259 class HttpServer::HandlerInfo {
276 bool matchContentType(
string ct);
280 int matchRequest(
hash hdr,
int score);
285 class HttpServer::HttpHandlerList {
310 *HandlerInfo findHandler(
hash hdr, reference<int> score,
bool finalv =
False, *reference<string> root_path);
321 class HttpServer::DynamicHandlerInfo :
public HttpServer::HandlerInfo {
334 class HttpServer::DynamicHandlerHelper {
346 constructor(Counter n_c);
354 class HttpServer::DynamicHttpHandlerList :
public HttpServer::HttpHandlerList {
367 removeHandler(
string name);
370 *DynamicHandlerInfo findHandler(
hash hdr, reference<int> score, reference<DynamicHandlerHelper> dhh, *reference<string> root_path);
384 const PollTimeout = 5000;
394 const HttpMethods = (
410 const ContentEncodings = (
412 "deflate":
"deflate",
415 "x-deflate":
"deflate",
420 const DefaultIdleThreads = 10;
423 const CompressionThreshold = 1024;
434 const LLO_RECV_HEADERS = (1 << 0);
438 const LLO_RECV_BODY = (1 << 1);
441 const LLO_SEND_HEADERS = (1 << 2);
444 const LLO_SEND_BODY = (1 << 3);
463 Sequence seqSessions();
464 Sequence seqListeners();
466 bool stopped =
False;
469 HttpHandlerList handlers();
490 DynamicHttpHandlerList dhandlers();
493 ThreadPool threadPool(-1, DefaultIdleThreads);
499 *
string override_encoding;
501 string http_server_string;
523 static string getHttpServerVersionString();
525 setDefaultTextEncoding(
string enc);
528 string getDefaultTextEncoding();
589 final list addListeners(
string bind,
hash lp, *code logger, *code errorlogger, *code stopc, *
string name,
int family =
AF_UNSPEC);
609 hash addListener(softstring sock, *
string cert_path, *
string key_path, *
string name,
int family =
AF_UNSPEC, *
string pwd);
629 softlist addListeners(softstring sock, *
string cert_path, *
string key_path, *
string name,
int family =
AF_UNSPEC, *
string pwd);
648 list addINETListeners(*
string node, softstring service, *
string cert_path, *
string key_path, *
string name,
int family =
AF_UNSPEC, *
string pwd);
679 hash getListenerInfo(softint
id);
700 hash getListenerInfoName(
string name);
704 int getListenerCount();
723 listenerStarted(
int id,
hash sinfo);
737 stopListener(softstring bind);
741 stopListenerID(softint
id);
745 int getListenerTID(softint
id);
795 setListenerLogOptions(softstring bind, softint code);
809 setListenerLogOptionsID(softint
id, softint code);
816 int getListenerLogOptions(softstring bind);
823 int getListenerLogOptionsID(softint
id);
827 removeDynamicHandler(
string name);
835 logError(
string fmt);
839 sendHttpError(
HttpListener listener,
hash cx, Socket s,
int code,
string msg, *
hash extra_hdrs, *
string encoding);
847 string maskData(
string msg);
862 setMaskCode(code maskfunc);
871 static string getURLFromBind(softstring bind, *
string host);
874 setDebug(
bool dbg =
True);
881 startConnection(code c);
889 int getListenerIdFromBindUnlocked(
string bind);
896 setListenerLogOptionsUnlocked(softstring
id,
int code);
903 int getListenerLogOptionsUnlocked(softstring
id);
908 static nothing setReplyHeaders(Socket s,
hash cx, reference<hash> rv);
921 static final hash getSSLObjects(
string cert_path, *
string key_path, *
string pwd);
928 final list addINETListenersIntern(*
string node, softstring service, *
hash sd, *
hash lp, *code logger, *code errorlogger, *code stopc, *
string name,
int family =
AF_UNSPEC);
935 final hash<HttpResponseInfo> noHandlerError(
hash cx,
hash hdr,
auto body);
941 final handleRequest(
HttpListener listener, Socket s, reference<hash> cx,
hash hdr,
hash hh, *data body,
bool head =
False, HttpPersistentHandlerInfo phi);
951 class HttpServer::HttpPersistentHandlerInfo {
955 *DynamicHandlerHelper dhh;
979 *SSLCertificate cert;
988 bool stopped =
False;
1007 bool log_recv_headers =
False;
1010 bool log_recv_body =
False;
1013 bool log_send_headers =
False;
1016 bool log_send_body =
False;
1018 const PollInterval = 1s;
1019 const ListenQueue = 100;
1020 const BodyLogLimit = 40;
1029 HttpHandlerList handlers();
1032 *HandlerInfo defaultHandler;
1037 constructor(
HttpServer n_server,
int n_id, Sequence n_ss, *
string n_node, *softstring n_service, *
Qore::SSLCertificate n_cert, *
Qore::SSLPrivateKey n_key, *
hash n_hi, *code n_logger, *code n_errorlogger, *code n_stopc,
string n_name,
int n_family =
AF_UNSPEC);
1040 addHandlers(
hash hi);
1043 setDefaultHandler(
string name);
1052 logRecvHeaders(softbool flag =
True);
1055 logRecvBody(softbool flag =
True);
1058 logSendHeaders(softbool flag =
True);
1061 logSendBody(softbool flag =
True);
1064 hash getLogOptions();
1082 auto removeUserThreadContext(*
string k);
1085 addUserThreadContext(
hash uctx);
1094 logResponse(
hash cx,
int code, *data body, *
hash hdr);
1103 logError(
string fmt);
1115 connectionThread(Socket s);
string get_exception_string(hash ex)
returns a multi-line string from the exception hash argument suitable for logging or output on the co...
const ReadTimeout
default read timeout in ms
Definition: HttpServer.qm.dox.h:382
nothing exit(softint rc=0)
The HttpServer class implements a multithreaded HTTP server.
Definition: HttpServer.qm.dox.h:375
the main namespace for the HttpServer module
this class implements the listeners for the HttpServer class
Definition: HttpServer.qm.dox.h:973
const HttpCodes
map of HTTP result codes and text messages
Definition: HttpServer.qm.dox.h:407