Qore HttpServerUtil Module Reference 1.2
Loading...
Searching...
No Matches
HttpServerUtil.qm.dox.h
1// -*- mode: c++; indent-tabs-mode: nil -*-
3
4/* HttpServerUtil.qm Copyright (C) 2014 - 2024 Qore Technologies, s.r.o.
5
6 Permission is hereby granted, free of charge, to any person obtaining a
7 copy of this software and associated documentation files (the "Software"),
8 to deal in the Software without restriction, including without limitation
9 the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 and/or sell copies of the Software, and to permit persons to whom the
11 Software is furnished to do so, subject to the following conditions:
12
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 DEALINGS IN THE SOFTWARE.
23*/
24
25
26
27
147
151namespace HttpServer {
153const HttpServerVersion = "1.2";
154
156const HttpServerString = sprintf("Qore-HTTP-Server/%s", HttpServerVersion);
157
159const DefaultTimeout = 30s; # recvs timeout after 30 seconds
160
163
165
169const MaxSslFileLen = 1024 * 1024;
170
172const HttpCodes = ...;
173
174
179const LP_LOGPARAMS = 1 << 16;
180
184
186public hashdecl HttpResponseInfo {
188 int code;
189
191
196 *data body;
197
199
204 *InputStream chunked_body;
205
207 softbool close = False;
208
210 *hash<auto> hdr;
211
213 bool reply_sent = False;
214
216 string log;
217
219 string errlog;
220
222 *hash<auto> user_state;
223};
224
226public hashdecl HttpHandlerResponseInfo {
228 int code;
229
231
234 auto body;
235
237 softbool close = False;
238
240
243 *hash<auto> hdr;
244
246 bool reply_sent = False;
247
249 string log;
250
252 string errlog;
253
255 *hash<auto> user_state;
256};
257
258// hashdecl for SSL info
259public hashdecl HttpCertInfo {
261
263 *string cert_loc;
264
266
268 *string key_loc;
269
271
273 *string key_password;
274
276 *SSLCertificate cert;
278 *SSLPrivateKey key;
279};
280
282public hashdecl HttpListenerOptionInfo {
284 *string node;
285
287 *softstring service;
288
290 *string name;
291
293
295 *string cert_loc;
296
298
300 *string key_loc;
301
303
306
309
312
314 *hash<string, hash<HttpHandlerConfigInfo>> handler_info;
315
317 *LoggerInterface logger;
318
320 *code stopc;
321
323 int family = AF_UNSPEC;
324
326
329 bool get_remote_certs = False;
330
332
335
337
340
342 hash<auto> ext_info;
343};
344
346public hashdecl HttpHandlerConfigInfo {
348 string path = "/";
349
351 bool isregex = False;
352
354 softlist<softstring> content_types;
355
358
360 softlist<softstring> headers;
361};
362
364
368 string http_get_url_from_bind(softstring bind, *string host);
369
370
372
383 hash<Util::UriQueryInfo> parse_uri_query(string path);
384
385
387 nothing http_set_reply_headers(Socket s, hash<auto> cx, reference<auto> rv, *string server_string);
388
389
391
404 string http_mask_data(string msg);
405
406
408
419 hash<HttpListenerOptionInfo> http_get_listener_options(*string node, *softstring service, *string cert_loc, *string key_loc, *string key_password);
420
421
423
433 hash<HttpListenerOptionInfo> http_get_listener_options_from_bind(*softstring bind, *string cert_loc, *string key_loc, *string key_password);
434
435
437
443 hash<HttpListenerOptionInfo> http_get_listener_options_from_bind(*softstring bind, hash<auto> listener_params, hash<HttpListenerOptionInfo> opts = <HttpListenerOptionInfo>{});
444
445
447
457 hash<HttpCertInfo> http_get_ssl_objects(hash<auto> listener_params);
458
459
461
471 hash<HttpCertInfo> http_get_ssl_objects(string cert_loc, *string key_loc, *string pwd);
472
473
476
477public:
479
482 abstract log(string fmt, ...);
483
485
488 abstract logError(string fmt, ...);
489
491
493 logArgs(*softlist<auto> args);
494
495
497
499 logErrorArgs(*softlist<auto> args);
500
501};
502
505
506public:
508
511 logResponse(hash<auto> cx, hash<auto> rv);
512
513
516
517
519
522 abstract addUserThreadContext(hash<auto> uctx);
523
525
528 abstract auto removeUserThreadContext(*string k);
529};
530
532
535
536public:
538
542
543
545
547 string getRealm();
548
549
551
559 authenticate(string user, string pass = '');
560
561
563
572 authenticateByIP(string ip, reference<string> user);
573
574
576
578 hash<auto> getAuthHeader();
579
580
582
584 hash<auto> getAuthHeader(hash<auto> cx);
585
586
588
591 hash<HttpResponseInfo> do401(string msg = 'Authentication is required to access this server', *hash<auto> cx);
592
593
595
632 *hash<HttpResponseInfo> authenticateRequest(HttpListenerInterface listener, hash<auto> hdr, reference<hash<auto>> cx);
633
634
636
641
642};
643
646
647public:
649
681 *hash<HttpResponseInfo> authenticateRequest(HttpListenerInterface listener, hash<auto> hdr, reference<hash> cx);
682
683};
684
686
703
704public:
705
706
707protected:
713 Socket s;
715 hash<auto> cx;
717 hash<auto> hdr;
719 auto body;
722
723public:
724
726
738
739
741 hash<HttpHandlerResponseInfo> handleRequest();
742
743
745
753protected:
754 hash<HttpHandlerResponseInfo> sendResponse();
755public:
756
757
759
770protected:
771 hash<HttpHandlerResponseInfo> getResponseHeaderMessage();
772public:
773
774
776
778protected:
779 nothing recv(hash<auto> v);
780public:
781
782
784
787protected:
788 auto send();
789public:
790
791
793
802protected:
803 logChunk(bool send, int size);
804public:
805
806
808
823protected:
824 hash<HttpResponseInfo> getResponseHeaderMessageImpl();
825public:
826
827
829
846protected:
847 nothing recvImpl(hash<auto> v);
848public:
849
850
852
859protected:
860 auto sendImpl();
861public:
862
863};
864
866
874
875public:
878
880 bool decompress = True;
881
883
886
888 bool stream;
889
892
894 const NotificationThreadKey = "_AHRH_pc";
895
897 const PersistenceThreadKey = "_AHRH_p";
898
900
905 constructor(*AbstractAuthenticator n_auth, softbool n_stream = False);
906
907
910
911
913 setPersistent(bool p = True);
914
915
917 notifyClosed(*code c);
918
919
921
925 string maskData(string msg);
926
927
930
933
936
937
939protected:
940 nothing checkPersistent(hash<auto> cx, hash<auto> hdr);
941public:
942
943
945
990 hash<HttpResponseInfo> handleExpectHeader(hash<auto> cx, hash<auto> hdr);
991
992
994
1039 hash<HttpResponseInfo> handleRequest(hash<auto> cx, hash<auto> hdr, *data body);
1040
1041
1043 hash<HttpResponseInfo> handleRequest(HttpListenerInterface listener, Socket s, hash<auto> cx, hash<auto> hdr, *data body);
1044
1045
1047protected:
1048 AbstractStreamRequest getStreamRequestImpl(HttpListenerInterface listener, Socket s, hash<auto> cx, hash<auto> hdr, *data body);
1049public:
1050
1051
1053 static data decodeBody(string content_encoding, binary body, *string string_encoding);
1054
1056 static binary encodeBody(string content_encoding, data body);
1057
1059 *data getMessageBody(Socket s, hash<auto> hdr, *data body, bool decode = True);
1060
1061
1063
1096 static *string getLogMessage(hash<auto> cx, hash api, reference params, *reference<string> args);
1097
1099
1103 *hash<auto> saveThreadLocalData();
1104
1105
1107
1109 restoreThreadLocalData(*hash<auto> data);
1110
1111
1113 static hash<HttpResponseInfo> makeResponse(int code, string fmt, ...);
1114
1116 static hash<HttpResponseInfo> makeResponse(hash<auto> hdr, int code, string fmt, ...);
1117
1119 static hash<HttpResponseInfo> makeResponse(int code, binary body);
1120
1122 static hash<HttpResponseInfo> makeResponse(hash<auto> hdr, int code, binary body);
1123
1125 static hash<HttpResponseInfo> makeResponse(int code, *data body, *hash<auto> hdr);
1126
1128
1130 static hash<HttpResponseInfo> makeResponse(int code, *InputStream chunked_body, *hash<auto> hdr);
1131
1133 static hash<HttpResponseInfo> make200(string fmt, ...);
1134
1136 static hash<HttpResponseInfo> make200(hash<auto> hdr, string fmt, ...);
1137
1139 static hash<HttpResponseInfo> make200(hash<auto> hdr, InputStream chunked_body);
1140
1142 static hash<HttpResponseInfo> make200(InputStream chunked_body);
1143
1145 static hash<HttpResponseInfo> make400(string fmt, ...);
1146
1148 static hash<HttpResponseInfo> make400(hash<auto> hdr, string fmt, ...);
1149
1151 static hash<HttpResponseInfo> make500(string fmt, ...);
1152
1154 static hash<HttpResponseInfo> make500(hash<auto> hdr, string fmt, ...);
1155
1157 static hash<HttpResponseInfo> make501(string fmt, ...);
1158
1160 static hash<HttpResponseInfo> make501(hash<auto> hdr, string fmt, ...);
1161
1163 static hash<HttpResponseInfo> redirect(hash<auto> cx, hash<auto> request_hdr, string path, int status_code = 301, *hash<auto> response_hdr);
1164};
1165
1168
1169public:
1171 string url_root;
1172
1174
1179
1180
1182
1185 string getRelativePath(string path);
1186
1187};
1188
1190
1208
1209public:
1210protected:
1212 bool stop = False;
1213
1215 hash<string, int> lh;
1216
1218 hash<string, bool> lsh;
1219
1221 Mutex m();
1222
1223public:
1224
1226 code setExternallyManaged(softstring lid, hash<auto> cx, Socket s);
1227
1228
1230
1264 bool start(softstring lid, hash<auto> cx, hash<auto> hdr, Socket s);
1265
1266
1268
1276 stop(softstring lid);
1277
1278
1280
1286
1287
1289protected:
1290 handlerStopped(softstring lid);
1291public:
1292
1293
1295
1316protected:
1317 abstract bool startImpl(softstring lid, hash<auto> cx, hash<auto> hdr, Socket s);
1318public:
1319
1321
1326protected:
1327 stopImpl(string lid);
1328public:
1329
1330
1332
1334protected:
1336public:
1337
1338};
1339
1341
1353};
abstract base class for external authentication
Definition HttpServerUtil.qm.dox.h:534
hash< HttpResponseInfo > do401(string msg='Authentication is required to access this server', *hash< auto > cx)
returns a 401 repsonse with the given string argument as the message body
authenticateByIP(string ip, reference< string > user)
called when the connection requires authentication, but no authentication credentials were supplied,...
hash< auto > getAuthHeader()
returns a hash with one item - WWW-Authenticate header set to correct realm
bool requiresAuthentication()
called to check if the connection requires authentication
*hash< HttpResponseInfo > authenticateRequest(HttpListenerInterface listener, hash< auto > hdr, reference< hash< auto > > cx)
primary method called to authenticate each request
string getRealm()
returns the authentication realm as a string
hash< auto > getAuthHeader(hash< auto > cx)
returns a hash with one item - WWW-Authenticate header set to correct realm
authenticate(string user, string pass='')
called to authenticate a user for a connection
endRequest()
Called after a request has been handled to allow the authenticator to remove any thread-local auth in...
abstract class that all HTTP request handler objects must inherit from
Definition HttpServerUtil.qm.dox.h:873
hash< HttpResponseInfo > handleRequest(HttpListenerInterface listener, Socket s, hash< auto > cx, hash< auto > hdr, *data body)
top-level request handling method
hash< HttpResponseInfo > handleRequest(hash< auto > cx, hash< auto > hdr, *data body)
will be called when a request is received that should be directed to the handler
bool stream
if the handler supports streaming requests/responses with chunked data
Definition HttpServerUtil.qm.dox.h:888
static hash< HttpResponseInfo > make400(hash< auto > hdr, string fmt,...)
creates a hash for an HTTP 400 error response with the response message body as a string
notifyClosed(*code c)
calls the argument when the persistent connection is closed
restoreThreadLocalData(*hash< auto > data)
called after handleRequest() with any data returned from saveThreadData()
static hash< HttpResponseInfo > makeResponse(hash< auto > hdr, int code, string fmt,...)
creates a hash for an HTTP response with the response code and the response message body as a formatt...
timeout timeout_ms
send and receive socket timeout in milliseconds
Definition HttpServerUtil.qm.dox.h:891
static hash< HttpResponseInfo > make501(hash< auto > hdr, string fmt,...)
creates a hash for an HTTP 501 error response with the response message body as a string
static hash< HttpResponseInfo > make500(string fmt,...)
creates a hash for an HTTP 500 error response with the response message body as a string
const NotificationThreadKey
thread-local key string for notification callbacks
Definition HttpServerUtil.qm.dox.h:894
bool decompress_to_string
if automatically decompressed POSTed data should be converted to a string
Definition HttpServerUtil.qm.dox.h:885
static hash< HttpResponseInfo > make200(hash< auto > hdr, string fmt,...)
creates a hash for an HTTP 200 OK error response with the response message body as a string
static hash< HttpResponseInfo > make200(string fmt,...)
creates a hash for an HTTP 200 OK error response with the response message body as a string
static data decodeBody(string content_encoding, binary body, *string string_encoding)
decodes a message body with content-encoding
static hash< HttpResponseInfo > makeResponse(int code, *data body, *hash< auto > hdr)
creates a hash for an HTTP response with the response code and a literal response message body
const PersistenceThreadKey
thread-local key string for the persistent flag
Definition HttpServerUtil.qm.dox.h:897
AbstractStreamRequest getStreamRequestImpl(HttpListenerInterface listener, Socket s, hash< auto > cx, hash< auto > hdr, *data body)
returns the AbstractStreamRequest object for handling chunked requests
static hash< HttpResponseInfo > make200(InputStream chunked_body)
creates a hash for an HTTP 200 OK error response with the response message body from an input stream
static hash< HttpResponseInfo > make400(string fmt,...)
creates a hash for an HTTP 400 error response with the response message body as a string
*AbstractAuthenticator auth
the optional AbstractAuthenticator for requests to this handler
Definition HttpServerUtil.qm.dox.h:877
static hash< HttpResponseInfo > makeResponse(int code, *InputStream chunked_body, *hash< auto > hdr)
creates a hash for an HTTP response with the response code and a response message body from an input ...
bool isPersistent()
returns True if the current connection is persistent, False if not
static staticPersistenceCleanup()
removes the thread-local data key in case the object is destroyed in another thread
static hash< HttpResponseInfo > makeResponse(hash< auto > hdr, int code, binary body)
creates a hash for an HTTP response with the response code and the response message body as binary da...
*data getMessageBody(Socket s, hash< auto > hdr, *data body, bool decode=True)
optionally retrieves and post-processes any message body
static binary encodeBody(string content_encoding, data body)
encodes a message body with content-encoding
nothing persistentClosed()
called externally when a persistent connection is closed
constructor(*AbstractAuthenticator n_auth, softbool n_stream=False)
create the object optionally with the given AbstractAuthenticator
static hash< HttpResponseInfo > make500(hash< auto > hdr, string fmt,...)
creates a hash for an HTTP 500 error response with the response message body as a string
nothing checkPersistent(hash< auto > cx, hash< auto > hdr)
this method will throw an exception if a persistent connection cannot be granted
bool decompress
if POSTed data should be decompressed automatically if there is content-encoding
Definition HttpServerUtil.qm.dox.h:880
static *string getLogMessage(hash< auto > cx, hash api, reference params, *reference< string > args)
helper method for handling log messages
*hash< auto > saveThreadLocalData()
called before handleRequest()
static hash< HttpResponseInfo > makeResponse(int code, string fmt,...)
creates a hash for an HTTP response with the response code and the response message body as a formatt...
static hash< HttpResponseInfo > make501(string fmt,...)
creates a hash for an HTTP 501 error response with the response message body as a string
string maskData(string msg)
this method can be used to mask data in debug messages
static hash< HttpResponseInfo > make200(hash< auto > hdr, InputStream chunked_body)
creates a hash for an HTTP 200 OK error response with the response message body from an input stream
hash< HttpResponseInfo > handleExpectHeader(hash< auto > cx, hash< auto > hdr)
Called if the request contains an "Expect: 100-continue" header.
static staticNotificationCleanup()
removes the thread-local data key in case the object is destroyed in another thread
static hash< HttpResponseInfo > makeResponse(int code, binary body)
creates a hash for an HTTP response with the response code and the response message body as binary da...
static hash< HttpResponseInfo > redirect(hash< auto > cx, hash< auto > request_hdr, string path, int status_code=301, *hash< auto > response_hdr)
generates a redirect hash for the given path
setPersistent(bool p=True)
called externally to notify the handler that the connection will be persistent
abstract class that all HTTP dedicated socket handler objects must inherit from
Definition HttpServerUtil.qm.dox.h:1343
constructor(*AbstractAuthenticator auth)
create the object optionally with the given AbstractAuthenticator
Abstract class for HTTP handlers for handling protocol switching.
Definition HttpServerUtil.qm.dox.h:1207
stop(softstring lid)
called from the HTTP server when the socket should be closed due to an HTTP listener being stopped
stopImpl()
called from the HTTP server when the socket should be closed due to an external request
abstract bool startImpl(softstring lid, hash< auto > cx, hash< auto > hdr, Socket s)
called from the HTTP server after the handleRequest() method indicates that a dedicated connection sh...
Mutex m()
listener reference hash mutex
hash< string, int > lh
hash of listener references; this is to stop all connections associated with a particular listener
Definition HttpServerUtil.qm.dox.h:1215
handlerStopped(softstring lid)
Called when the handler stops.
code setExternallyManaged(softstring lid, hash< auto > cx, Socket s)
Returns a closure that can be used to confirm that the connection has been closed.
hash< string, bool > lsh
hash of listener stop flags
Definition HttpServerUtil.qm.dox.h:1218
bool stop
stop listener flag
Definition HttpServerUtil.qm.dox.h:1212
bool start(softstring lid, hash< auto > cx, hash< auto > hdr, Socket s)
called from the HTTP server after the handleRequest() method indicates that a dedicated connection sh...
stop()
called from the HTTP server when the socket should be closed due to an external request
stopImpl(string lid)
called from the HTTP server when the socket should be closed because the listener is stopping
this abstract class defines the interface for classes that provide logging methods
Definition HttpServerUtil.qm.dox.h:475
logArgs(*softlist< auto > args)
calls log() with the given args
abstract logError(string fmt,...)
called to log error information to the registered error log code
logErrorArgs(*softlist< auto > args)
calls logError() with the given args
abstract log(string fmt,...)
called to log information to the registered log code
abstract class for streaming HTTP chunked requests/responses
Definition HttpServerUtil.qm.dox.h:702
auto sendImpl()
callback method for sending chunked data
hash< auto > cx
the call context variable
Definition HttpServerUtil.qm.dox.h:715
hash< auto > hdr
a hash of request headers
Definition HttpServerUtil.qm.dox.h:717
constructor(HttpListenerInterface listener, AbstractHttpRequestHandler handler, Socket s, hash< auto > cx, hash< auto > hdr, auto body)
creates the object with the given attributes
auto send()
this is the primary callback for sending chunked responses
logChunk(bool send, int size)
this method can be overridden in base classes to log each HTTP chunk sent
AbstractHttpRequestHandler handler
the request handler for the request
Definition HttpServerUtil.qm.dox.h:711
nothing recvImpl(hash< auto > v)
callback method for receiving chunked data; the default implementation in this base class does nothin...
Socket s
the Socket object for the response
Definition HttpServerUtil.qm.dox.h:713
hash< HttpHandlerResponseInfo > handleRequest()
handles the request
HttpListenerInterface listener
an HttpListenerInterface object for the listener serving the request for logging purposes
Definition HttpServerUtil.qm.dox.h:709
timeout timeout_ms
send and receive timeout
Definition HttpServerUtil.qm.dox.h:721
hash< HttpHandlerResponseInfo > getResponseHeaderMessage()
this method returns the response message description hash by calling getResponseHeaderMessageImpl()
auto body
any message body given in a non-chunked request; could already be deserialized
Definition HttpServerUtil.qm.dox.h:719
nothing recv(hash< auto > v)
this is the primary callback for receiving chunked data; data will be logged, and then recvImpl() is ...
hash< HttpResponseInfo > getResponseHeaderMessageImpl()
this method should return the response message description hash
hash< HttpHandlerResponseInfo > sendResponse()
called to either create the response hash or send a chunked response directly
abstract class for HTTP request handlers anchored at a specific URL
Definition HttpServerUtil.qm.dox.h:1167
string url_root
root part of URL for matching requests
Definition HttpServerUtil.qm.dox.h:1171
constructor(string url_root, *AbstractAuthenticator auth)
creates the object based on the URL root and optional authenticator
string getRelativePath(string path)
returns the relative path anchored from the url_root if possible
this abstract class defines the public interface of the private HttpListener class defined in the Htt...
Definition HttpServerUtil.qm.dox.h:504
abstract addUserThreadContext(hash< auto > uctx)
adds user-defined data to be returned in the "uctx" context key when serving requests from this liste...
abstract auto removeUserThreadContext(*string k)
removes the given key from the "uctx" context key
removeExternalDedicatedSocket(softstring id)
Removes a dedicated socket handler from the listener.
logResponse(hash< auto > cx, hash< auto > rv)
method to log a response message
class providing automatic authentication for all requests
Definition HttpServerUtil.qm.dox.h:645
*hash< HttpResponseInfo > authenticateRequest(HttpListenerInterface listener, hash< auto > hdr, reference< hash > cx)
primary method called to authenticate each request
const LP_LEVELMASK
mask for the log level
Definition HttpServerUtil.qm.dox.h:182
const LP_LOGPARAMS
Definition HttpServerUtil.qm.dox.h:179
the main namespace for the HttpServer and HttpServerUtil modules
Definition HttpServerUtil.qm.dox.h:151
const HttpCodes
map of HTTP result codes and text messages
Definition HttpServerUtil.qm.dox.h:172
const DefaultTimeout
default timeout in ms
Definition HttpServerUtil.qm.dox.h:159
hash< HttpCertInfo > http_get_ssl_objects(hash< auto > listener_params)
converts a hash to HTTP certificate info if possible
const HttpServerVersion
version of the HttpServer's implementation
Definition HttpServerUtil.qm.dox.h:153
const ReadTimeout
read timeout in ms
Definition HttpServerUtil.qm.dox.h:162
nothing http_set_reply_headers(Socket s, hash< auto > cx, reference< auto > rv, *string server_string)
helper function for setting HTTP response headers
string http_get_url_from_bind(softstring bind, *string host)
returns a complete URL from a bind address
hash< HttpListenerOptionInfo > http_get_listener_options(*string node, *softstring service, *string cert_loc, *string key_loc, *string key_password)
returns a listener option info hash from flat arguments
const MaxSslFileLen
maximum X.509 and private key file length
Definition HttpServerUtil.qm.dox.h:169
hash< HttpListenerOptionInfo > http_get_listener_options_from_bind(*softstring bind, *string cert_loc, *string key_loc, *string key_password)
returns a listener option info hash from flat arguments
string http_mask_data(string msg)
this function can be used to mask data in log messages
hash< Util::UriQueryInfo > parse_uri_query(string path)
parses a URI path for a arguments and a method
const HttpServerString
default HTTP server string
Definition HttpServerUtil.qm.dox.h:156
hash providing HTTP handler configuration info
Definition HttpServerUtil.qm.dox.h:346
string path
the URI path for the handler
Definition HttpServerUtil.qm.dox.h:348
softlist< softstring > headers
a list of headers that indicate that a request should be handled by the handler (optional)
Definition HttpServerUtil.qm.dox.h:360
AbstractHttpRequestHandler handler
the handler itself (required)
Definition HttpServerUtil.qm.dox.h:357
softlist< softstring > content_types
the Content-Type that the handler handles (optional)
Definition HttpServerUtil.qm.dox.h:354
bool isregex
if the URI path is a regular expression pattern
Definition HttpServerUtil.qm.dox.h:351
the return value of HTTP handler methods with potentially unserialized message bodies
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:246
*hash< auto > user_state
additional info to be added to the context (cx) variable's user_state key if the connection is not cl...
Definition HttpServerUtil.qm.dox.h:255
*hash< auto > hdr
set this key to a hash of extra header information to be returned with the response
Definition HttpServerUtil.qm.dox.h:243
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:249
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:252
int code
the HTTP return code (see HttpServer::HttpCodes for possible values)
Definition HttpServerUtil.qm.dox.h:228
softbool close
set this key to True if the connection should be unconditionally closed when the handler returns
Definition HttpServerUtil.qm.dox.h:237
auto body
the message body to return in the response
Definition HttpServerUtil.qm.dox.h:234
options for new listeners
Definition HttpServerUtil.qm.dox.h:282
*string cert_loc
The X.509 certificate file location.
Definition HttpServerUtil.qm.dox.h:295
*string node
the node value for the bind
Definition HttpServerUtil.qm.dox.h:284
int family
network family
Definition HttpServerUtil.qm.dox.h:323
bool ssl_accept_all_certs
set to False to use openssl CA validation for client certificates
Definition HttpServerUtil.qm.dox.h:339
*Qore::SSLPrivateKey key
SSL key.
Definition HttpServerUtil.qm.dox.h:311
*Qore::SSLCertificate cert
SSL cert.
Definition HttpServerUtil.qm.dox.h:308
hash< auto > ext_info
Additional info added to the notification callback when listeners are started.
Definition HttpServerUtil.qm.dox.h:342
*LoggerInterface logger
logger interface
Definition HttpServerUtil.qm.dox.h:317
*hash< string, hash< HttpHandlerConfigInfo > > handler_info
handler info
Definition HttpServerUtil.qm.dox.h:314
*string key_loc
The private key file location for the X.509 certificate.
Definition HttpServerUtil.qm.dox.h:300
*string name
the name of the listener
Definition HttpServerUtil.qm.dox.h:290
bool get_remote_certs
ask for remote client certificates (causes browsers to prompt for a client cert on new connections)
Definition HttpServerUtil.qm.dox.h:329
*softstring service
the service value for the bind
Definition HttpServerUtil.qm.dox.h:287
*string key_password
The private key password, if any.
Definition HttpServerUtil.qm.dox.h:305
*code stopc
stopc stop notification closure
Definition HttpServerUtil.qm.dox.h:320
int ssl_verify_flags
SSL certificate verification constants; see SSL Verification Mode Constants.
Definition HttpServerUtil.qm.dox.h:334
the return value of HTTP handler methods where any message body has been serialized for sending over ...
Definition HttpServerUtil.qm.dox.h:186
softbool close
set this key to True if the connection should be unconditionally closed when the handler returns
Definition HttpServerUtil.qm.dox.h:207
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:213
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:216
*data body
the message body to return in the response
Definition HttpServerUtil.qm.dox.h:196
int code
the HTTP return code (see HttpServer::HttpCodes for possible values)
Definition HttpServerUtil.qm.dox.h:188
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:219
*InputStream chunked_body
the message body to return in the response as a chunked response
Definition HttpServerUtil.qm.dox.h:204
*hash< auto > user_state
additional info to be added to the context (cx) variable's user_state key if the connection is not cl...
Definition HttpServerUtil.qm.dox.h:222
*hash< auto > hdr
set this key to a hash of extra header information to be returned with the response
Definition HttpServerUtil.qm.dox.h:210