251 class HttpServer::HandlerInfo {
268 bool matchContentType(
string ct);
272 int matchRequest(
hash hdr,
int score);
277 class HttpServer::HttpHandlerList {
288 static checkSpecialHeaders(reference sh);
297 *HandlerInfo findHandler(
hash hdr, reference score,
bool finalv =
False, *reference root_path);
308 class HttpServer::DynamicHandlerInfo :
public HttpServer::HandlerInfo {
321 class HttpServer::DynamicHandlerHelper {
333 constructor(Counter n_c);
341 class HttpServer::DynamicHttpHandlerList :
public HttpServer::HttpHandlerList {
354 removeHandler(
string name);
357 *DynamicHandlerInfo findHandler(
hash hdr, reference score, reference dhh, *reference root_path);
371 const PollTimeout = 5000;
381 const HttpMethods = (
396 const ContentEncodings = (
398 "deflate":
"deflate",
401 "x-deflate":
"deflate",
406 const DefaultIdleThreads = 10;
409 const CompressionThreshold = 1024;
420 const LLO_RECV_HEADERS = (1 << 0);
424 const LLO_RECV_BODY = (1 << 1);
427 const LLO_SEND_HEADERS = (1 << 2);
430 const LLO_SEND_BODY = (1 << 3);
446 Sequence seqSessions();
447 Sequence seqListeners();
449 bool stopped =
False;
452 HttpHandlerList handlers();
473 DynamicHttpHandlerList dhandlers();
476 ThreadPool threadPool(-1, DefaultIdleThreads);
482 *
string override_encoding;
484 string http_server_string;
506 static string getHttpServerVersionString();
508 setDefaultTextEncoding(
string enc);
511 string getDefaultTextEncoding();
572 final list addListeners(
string bind,
hash lp, *code logger, *code errorlogger, *code stopc, *
string name,
int family =
AF_UNSPEC);
592 hash addListener(softstring sock, *
string cert_path, *
string key_path, *
string name,
int family =
AF_UNSPEC, *
string pwd);
612 softlist addListeners(softstring sock, *
string cert_path, *
string key_path, *
string name,
int family =
AF_UNSPEC, *
string pwd);
631 list addINETListeners(*
string node, softstring service, *
string cert_path, *
string key_path, *
string name,
int family =
AF_UNSPEC, *
string pwd);
662 hash getListenerInfo(softint
id);
683 hash getListenerInfoName(
string name);
687 int getListenerCount();
706 listenerStarted(
int id,
hash sinfo);
720 stopListener(softstring bind);
724 stopListenerID(softint
id);
728 int getListenerTID(softint
id);
778 setListenerLogOptions(softstring bind, softint code);
792 setListenerLogOptionsID(softint
id, softint code);
799 int getListenerLogOptions(softstring bind);
806 int getListenerLogOptionsID(softint
id);
810 removeDynamicHandler(
string name);
818 logError(
string fmt);
822 sendHttpError(
HttpListener listener,
hash cx, Socket s,
int code,
string msg, *
hash extra_hdrs, *
string encoding);
831 static string getURLFromBind(softstring bind, *
string host);
834 setDebug(
bool dbg =
True);
841 startConnection(code c);
847 private int getListenerIdFromBindUnlocked(
string bind);
851 private setListenerLogOptionsUnlocked(softstring
id,
int code);
855 private int getListenerLogOptionsUnlocked(softstring
id);
859 static nothing setReplyHeaders(Socket s,
hash cx, reference rv);
867 static final private hash getSSLObjects(
string cert_path, *
string key_path, *
string pwd);
870 final private list addINETListenersIntern(*
string node, softstring service, *
hash sd, *
hash lp, *code logger, *code errorlogger, *code stopc, *
string name,
int family =
AF_UNSPEC);
874 final private hash noHandlerError(
hash cx,
hash hdr, any body);
879 final handleRequest(
HttpListener listener, Socket s, reference cx,
hash hdr,
hash hh, *data body,
bool head =
False, HttpPersistentHandlerInfo phi);
889 class HttpServer::HttpPersistentHandlerInfo {
893 *DynamicHandlerHelper dhh;
917 *SSLCertificate cert;
926 bool stopped =
False;
945 bool log_recv_headers =
False;
948 bool log_recv_body =
False;
951 bool log_send_headers =
False;
954 bool log_send_body =
False;
956 const PollInterval = 1s;
957 const ListenQueue = 100;
966 HttpHandlerList handlers();
969 *HandlerInfo defaultHandler;
974 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);
977 addHandlers(
hash hi);
980 setDefaultHandler(
string name);
989 logRecvHeaders(softbool flag =
True);
992 logRecvBody(softbool flag =
True);
995 logSendHeaders(softbool flag =
True);
998 logSendBody(softbool flag =
True);
1001 hash getLogOptions();
1019 any removeUserThreadContext(*
string k);
1022 addUserThreadContext(
hash uctx);
1031 logResponse(
hash cx,
int code, *data body, *
hash hdr);
1040 logError(
string fmt);
1043 private mainThread();
1047 private 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:369
nothing exit(softint rc=0)
The HttpServer class implements a multithreaded HTTP server.
Definition: HttpServer.qm.dox.h:362
the main namespace for the HttpServer module
this class implements the listeners for the HttpServer class
Definition: HttpServer.qm.dox.h:911
const HttpCodes
map of HTTP result codes and text messages
Definition: HttpServer.qm.dox.h:393