Qore HttpServerUtil Module Reference 1.3.1
Loading...
Searching...
No Matches
HttpServerUtil Module

HttpServerUtil Introduction

The HttpServerUtil module provides a base code for the HttpServer module and code requiring HttpServer definitions but not the entire HttpServer module itself.

To use this module, use "%requires HttpServerUtil" in your code.

All the public symbols in the module are defined in the HttpServer namespace

The main classes are:

See also:

  • RestHandler: a module providing a handler framework for this module for implementing server-side REST services
  • WebSocketHandler: a module providing a handler framework for this module for implementing server-side WebSocket services
  • WebUtil: a module providing higher-level HTTP services using this module as a base as well as providing support for dynamic template-based HTML rendering (ie rendering qhtml files which are a mix of HTML and Qore code)
  • JsonRpcHandler: provides infrastructure for implementing JSON-RPC server-side services using the HttpServer module
  • YamlRpcHandler: provides infrastructure for implementing YAML-RPC server-side services using the HttpServer module
  • XmlRpcHandler: provides infrastructure for implementing XML-RPC server-side services using the HttpServer module
  • SoapHandler: provides infrastructure for implementing SOAP server-side services using the HttpServer module

HttpServerUtil Definitions

HttpServerUtil Request Context

The HTTP listener and server set the context hash as follows when handling HTTP requests

Key Type

Description

auth *string

the original Authorization header value, if any

char_encoding string

the character encoding of the Socket object handling the request

client-cert SSLCertificate

the client certificate if the server is configured to capture them and one is present in the request

close *bool

set to True if the connection should be closed after responding (as derived from request headers)

debug *bool

True if the debug flag is enabled on the HTTP server

handler_name string

the name of the handler serving the request

hdr hash

the header information as returned by Socket::readHTTPHeader()

id int

the ID for this socket connection; note that socket connections may be reused by proxies, so this ID cannot be used to identify the peer

handler_name string

the name of the handler serving the request

header-info hash

a hash of information as returned from the output info argument to Socket::readHTTPHeader()

listener-id int

a unique ID for the listener serving the request

listener-name string

a unique name for the listener serving the request

logger LoggerInterface

a LoggerInterface object for the HTTP server

masked_path string

the URI path after URL decoding and masking for sensitive information

orig_path string

the URI path in the request after URL decoding

peer-info hash

information about the remote socket as returned by Socket::getPeerInfo()

raw_path string

the raw URI request path in the request

response-encoding *string

any value given by any "Accept-Charset" in the request

root_path *string

the root URL path matched if the request was matched by a URL prefix

socket string

the bind address used to bind the listener ("socket-info" provides more detailed information)

socket-info hash

information about the listening socket as returned by Socket::getSocketInfo()

ssl *bool

True if the request was encrypted with HTTPS

url hash

a hash with a path key giving the URI path in the request

user *string

set by the authenticator if the request was authenticated to a specific user

uctx *hash

any user thread context for the listener (see HttpListenerInterface::addUserThreadContext())

HttpServerUtil Module Release Notes

HttpServerUtil 1.3.1

  • added Brotli (br) and Zstandard (zstd) Content-Encoding support in decodeBody() and encodeBody() (issue 5071)

HttpServerUtil 1.3

  • allow authentication methods to set the call context (issue 4970)
  • added utility functionality for cookies

HttpServerUtil 1.2

  • allow handlers to remove thread-local auth information after requests have been handled

HttpServerUtil 1.1

  • implemented support for reloading X.509 certificate information without manually restarting listeners (issue 4574)

HttpServerUtil 1.0.12

  • updated version to match Qore and server version

HttpServerUtil 1.0

HttpServerUtil 0.9.11

  • fixed a bug where it was not possible to include CORS headers or any context-sensitive information in a 401 response (issue 4136)
  • fixed a bug that left hanging threads in HTTP operations with I/O callbacks with HEAD requests and a Transfer-Encoding: chunked header in the response (issue 4109)

HttpServerUtil 0.9.5

  • aligned version with the HttpServer module version

HttpServerUtil 0.9.4

HttpServerUtil 0.3.12.1

  • improved sensitive data masking in log messages (issue 2621)

HttpServerUtil 0.3.12

HttpServerUtil 0.3.11.2

  • eliminated excess logging of each HTTP chunk sent or received

HttpServerUtil 0.3.11.1

HttpServerUtil 0.3.11

  • initial version of the module
  • implemented support for notifying persistent connections when the connection is terminated while a persistent connection is in place
  • removed unused AbstractStreamRequestHandler class
  • fixed HttpServer::parse_uri_query to always return params as a hash (issue 569)
  • added root_path to the context hash if the path was matched by a URL path prefix (issue 570)
  • implemented support for custom timeout values in stream handlers (issue 719)