108 "101":
"Switching Protocols",
117 "203":
"Non-Authoritative Information",
119 "205":
"Reset Content",
120 "206":
"Partial Content",
123 "207":
"Multi-Status",
126 "208":
"Already Reported",
132 "300":
"Multiple Choices",
133 "301":
"Moved Permanently",
136 "304":
"Not Modified",
139 "307":
"Temporary Redirect",
142 "400":
"Bad Request",
143 "401":
"Unauthorized",
144 "402":
"Payment Required",
147 "405":
"Method Not Allowed",
148 "406":
"Not Acceptable",
149 "407":
"Proxy Authentication Required",
150 "408":
"Request Timeout",
153 "411":
"Length Required",
154 "412":
"Precondition Failed",
155 "413":
"Request Entity Too Large",
156 "414":
"Request-URI Too Long",
157 "415":
"Unsupported Media Type",
158 "416":
"Requested Range Not Satisfiable",
159 "417":
"Expectation Failed",
162 "418":
"I'm a teapot",
165 "420":
"Enhance Yextern Calm",
168 "422":
"Unprocessable Entity",
174 "424":
"Failed Dependency",
177 "425":
"Unordered Collection",
180 "426":
"Upgrade Required",
183 "428":
"Precondition Required",
186 "429":
"Too Many Requests",
189 "431":
"Request Header Fields Too Large",
192 "500":
"Internal Server Error",
193 "501":
"Not Implemented",
194 "502":
"Bad Gateway",
195 "503":
"Service Unavailable",
196 "504":
"Gateway Timeout",
197 "505":
"HTTP Version Not Supported",
198 "509":
"Bandwidth Limit Exceeded",
201 "510":
"Not Extended",
204 "511":
"Network Authentication Required",
315 abstract log(
string fmt);
320 abstract logError(
string fmt);
325 logArgs(*softlist args);
331 logErrorArgs(*softlist args);
342 abstract addUserThreadContext(
hash uctx);
347 abstract auto removeUserThreadContext(*
string k);
359 bool requiresAuthentication();
375 authenticate(
string user,
string pass =
"");
385 authenticateByIP(
string ip, reference<string> user);
390 hash getAuthHeader();
397 hash<HttpResponseInfo> do401(
string msg =
"Authentication is required to access this server");
497 hash<HttpHandlerResponseInfo> handleRequest();
508 hash<HttpHandlerResponseInfo> sendResponse();
524 hash<HttpHandlerResponseInfo> getResponseHeaderMessage();
533 nothing recv(
hash v);
556 logChunk(
bool send,
int size);
574 hash<HttpResponseInfo> getResponseHeaderMessageImpl();
590 nothing recvImpl(
hash v);
624 bool decompress_to_string =
True;
633 const NotificationThreadKey =
"_AHRH_pc";
636 const PersistenceThreadKey =
"_AHRH_p";
652 setPersistent(
bool p =
True);
656 notifyClosed(*
code c);
664 string maskData(
string msg);
668 static staticNotificationCleanup();
671 static staticPersistenceCleanup();
674 nothing persistentClosed();
725 static data decodeBody(
string ce,
binary body, *
string enc);
728 static binary encodeBody(
string ce, data
body);
731 *data getMessageBody(Socket s,
hash hdr, *data
body,
bool decode =
True);
751 static *
string getLogMessage(
hash cx,
hash api, reference params, *reference<string> args);
756 *
hash saveThreadLocalData();
762 restoreThreadLocalData(*
hash data);
766 static hash<HttpResponseInfo> makeResponse(
int code,
string fmt);
769 static hash<HttpResponseInfo> makeResponse(
hash hdr,
int code,
string fmt);
772 static hash<HttpResponseInfo> makeResponse(
int code, *data
body, *
hash hdr);
775 static hash<HttpResponseInfo> make400(
string fmt);
778 static hash<HttpResponseInfo> make400(
hash hdr,
string fmt);
781 static hash<HttpResponseInfo> make501(
string fmt);
784 static hash<HttpResponseInfo> make501(
hash hdr,
string fmt);
787 static hash<HttpResponseInfo> redirect(
hash cx,
hash hdr,
string path);
808 string getRelativePath(
string path);
856 start(softstring lid,
hash cx,
hash hdr, Socket s);
864 stop(softstring lid);
923 abstract startImpl(softstring lid,
hash cx,
hash hdr, Socket s);
931 stopImpl(
string lid);
softbool close
set this key to True if the connection should be unconditionally closed when the handler returns ...
Definition: HttpServerUtil.qm.dox.h:226
bool reply_sent
this key can be set to True if the reply has already been sent (by a chunked callback for example) ...
Definition: HttpServerUtil.qm.dox.h:232
string sprintf(string fmt,...)
hash hdr
a hash of request headers
Definition: HttpServerUtil.qm.dox.h:474
const ReadTimeout
read timeout in ms
Definition: HttpServerUtil.qm.dox.h:102
const HttpCodes
map of HTTP result codes and text messages
Definition: HttpServerUtil.qm.dox.h:105
abstract class for streaming HTTP chunked requests/responses
Definition: HttpServerUtil.qm.dox.h:457
const LP_LOGPARAMS
bit for logging argument
Definition: HttpServerUtil.qm.dox.h:211
abstract class that all HTTP request handler objects must inherit from
Definition: HttpServerUtil.qm.dox.h:613
class providing automatic authentication for all requests
Definition: HttpServerUtil.qm.dox.h:425
*AbstractAuthenticator auth
the optional AbstractAuthenticator for requests to this handler
Definition: HttpServerUtil.qm.dox.h:618
hash lh
hash of listener references; this is to stop all connections associated with a particular listener ...
Definition: HttpServerUtil.qm.dox.h:823
*hash hdr
set this key to a hash of extra header information to be returned with the response ...
Definition: HttpServerUtil.qm.dox.h:229
this abstract class defines the public interface of the private HttpListener class defined in the Htt...
Definition: HttpServerUtil.qm.dox.h:336
string http_mask_data(string msg)
this function can be used to mask data in log messages
AbstractHttpRequestHandler handler
the request handler for the request
Definition: HttpServerUtil.qm.dox.h:468
string errlog
a string can be returned here which will be logged in the HTTP server's error log file (if any) ...
Definition: HttpServerUtil.qm.dox.h:238
bool stream
if the handler supports streaming requests/responses with chunked data
Definition: HttpServerUtil.qm.dox.h:627
string errlog
a string can be returned here which will be logged in the HTTP server's error log file (if any) ...
Definition: HttpServerUtil.qm.dox.h:262
string http_get_url_from_bind(softstring bind, *string host)
returns a complete URL from a bind address
abstract base class for external authentication
Definition: HttpServerUtil.qm.dox.h:353
hash cx
the call context variable
Definition: HttpServerUtil.qm.dox.h:472
Socket s
the Socket object for the response
Definition: HttpServerUtil.qm.dox.h:470
const HttpServerVersion
version of the HttpServer's implementation
Definition: HttpServerUtil.qm.dox.h:93
*data body
the message body to return in the response; if this key is returned, then the reply is sent immediate...
Definition: HttpServerUtil.qm.dox.h:223
*hash hdr
set this key to a hash of extra header information to be returned with the response ...
Definition: HttpServerUtil.qm.dox.h:253
HttpListenerInterface listener
an HttpListenerInterface object for the listener serving the request for logging purposes ...
Definition: HttpServerUtil.qm.dox.h:466
this abstract class defines the interface for classes that provide logging methods ...
Definition: HttpServerUtil.qm.dox.h:309
auto body
any message body given in a non-chunked request; could already be deserialized
Definition: HttpServerUtil.qm.dox.h:476
int code
the HTTP return code (see HttpServer::HttpCodes for possible values)
Definition: HttpServerUtil.qm.dox.h:244
const DefaultTimeout
default timeout in ms
Definition: HttpServerUtil.qm.dox.h:99
string log
a string can be returned here which will be logged in the HTTP server's log file (if any) ...
Definition: HttpServerUtil.qm.dox.h:259
int code
the HTTP return code (see HttpServer::HttpCodes for possible values)
Definition: HttpServerUtil.qm.dox.h:220
abstract class that all HTTP dedicated socket handler objects must inherit from
Definition: HttpServerUtil.qm.dox.h:815
abstract class for HTTP request handlers anchored at a specific URL
Definition: HttpServerUtil.qm.dox.h:791
the return value of HTTP handler methods with potentially unserialized message bodies ...
Definition: HttpServerUtil.qm.dox.h:242
hash< Util::UriQueryInfo > parse_uri_query(string path)
parses a URI path for a arguments and a method; where the method is the part of the path before the f...
const LP_LEVELMASK
mask for the log level
Definition: HttpServerUtil.qm.dox.h:214
const HttpServerString
default HTTP server string
Definition: HttpServerUtil.qm.dox.h:96
the main namespace for the HttpServer and HttpServerUtil modules
Definition: HttpServerUtil.qm.dox.h:91
the return value of HTTP handler methods where any message body has been serialized for sending over ...
Definition: HttpServerUtil.qm.dox.h:218
nothing http_set_reply_headers(Socket s, hash cx, reference rv, *string server_string)
helper function for setting HTTP response headers
string url_root
root part of URL for matching requests
Definition: HttpServerUtil.qm.dox.h:796
auto body
the message body to return in the response; for higher-level handlers this can be any data type that ...
Definition: HttpServerUtil.qm.dox.h:247
hash lsh
hash of listener stop flags
Definition: HttpServerUtil.qm.dox.h:826
string log
a string can be returned here which will be logged in the HTTP server's log file (if any) ...
Definition: HttpServerUtil.qm.dox.h:235