Barracuda Application Server C/C++ Reference
Native APIs, integration guides, and platform interfaces
HttpServer.h
Go to the documentation of this file.
1/*
2 * ____ _________ __ _
3 * / __ \___ ____ _/ /_ __(_)___ ___ ___ / / ____ ____ _(_)____
4 * / /_/ / _ \/ __ `/ / / / / / __ `__ \/ _ \/ / / __ \/ __ `/ / ___/
5 * / _, _/ __/ /_/ / / / / / / / / / / / __/ /___/ /_/ / /_/ / / /__
6 * /_/ |_|\___/\__,_/_/ /_/ /_/_/ /_/ /_/\___/_____/\____/\__, /_/\___/
7 * /____/
8 *
9 * Barracuda Embedded Web-Server
10 *
11 ****************************************************************************
12 * HEADER
13 *
14 * $Id: HttpServer.h 6657 2026-10-28 18:19:39Z wini $
15 *
16 * COPYRIGHT: Real Time Logic LLC, 2003 - 2026
17 *
18 * This software is copyrighted by and is the sole property of Real
19 * Time Logic LLC. All rights, title, ownership, or other interests in
20 * the software remain the property of Real Time Logic LLC. This
21 * software may only be used in accordance with the terms and
22 * conditions stipulated in the corresponding license agreement under
23 * which the software has been supplied. Any unauthorized use,
24 * duplication, transmission, distribution, or disclosure of this
25 * software is expressly forbidden.
26 *
27 * This Copyright notice may not be removed or modified without prior
28 * written consent of Real Time Logic LLC.
29 *
30 * Real Time Logic LLC. reserves the right to modify this software
31 * without notice.
32 *
33 * http://www.realtimelogic.com
34 ****************************************************************************
35 *
36 *
37 */
38
39#define BASLIB_VER "6692"
40#define BASLIB_VER_NO 6692
41
76#ifndef __HttpServer_h
77#define __HttpServer_h
78#include "TargConfig.h"
79#include "HttpConnection.h"
80#include "DoubleList.h"
81#include "SingleList.h"
82#include "SoDisp.h"
83#include "SplayTree.h"
84#include "BaErrorCodes.h"
85#include "SplayTree.h"
86#include "BufPrint.h"
87#include "IoIntf.h"
88#include <string.h>
89#include <stddef.h>
90
91/* Used by examples */
92
93
94/* This ID must match the ID in LoginKey.java */
95#define BA_COOKIE_ID "z9ZAqJtI"
96
97#ifndef __DOXYGEN__
98struct HttpRequest;
99struct HttpResponse;
100struct HttpPage;
101struct HttpServer;
102struct HttpSession;
103struct HttpLinkCon;
104struct HttpDir;
105struct AuthenticatedUser;
106struct UserIntf;
107struct CspReader;
109struct AuthUserList;
110struct AuthorizerIntf;
111struct AuthenticatorIntf;
112struct LHttpCommand;
113#endif
114
115
116/* NonBlockingSendBuf is used when sending asynchronous, non-blocking
117 data. A pointer to this buffer is stored in SoDispCon.sslData for
118 HTTP connections; this pointer is not used for anything else for a
119 non-secure socket connection. */
120typedef struct
121{
122 int cursor;
123 int bufLen;
124 int maxBufLen;
125 char buf[1];
126} NonBlockingSendBuf;
127
128
129#ifdef __cplusplus
130extern "C" {
131#endif
133 struct HttpSession* session);
140BA_API void httpFmtDate(char* buf, U16 bufLen, BaTime t);
141
146#define httpUnescape(s) httpUnescapeInternal(s,FALSE)
147
152#define httpFormUnescape(s) httpUnescapeInternal(s,TRUE)
153
163BA_API char* httpUnescapeInternal(char* from, BaBool isForm);
164
172BA_API char* httpEscape(char* out, const char* in);
173#ifdef __cplusplus
174}
175#endif
176
177
178typedef void (*UserDefinedErrHandler)(BaFatalErrorCodes ecode1,
179 unsigned int ecode2,
180 const char* file,
181 int line);
182
183
209typedef void (*CspInit)(
210 struct HttpDir* cspRoot,struct CspReader* reader);
211 /* end of CSP */
213
214/* no longer used. included for compatibility.
215 */
216struct z_stream_s;
217typedef int (*ZlibInflateInit2)(struct z_stream_s* s, int windowBits,
218 const char *version, int stream_size);
219
220typedef int (*ZlibInflate)(struct z_stream_s* s, int flush);
221typedef int (*ZlibInflateEnd)(struct z_stream_s* s);
222
223
224#ifndef __DOXYGEN__
225
226typedef struct
227{
228 char* buf;
229 U16 size;
230 U16 index;
231} HttpAllocator;
232
233
236typedef struct HttpHeader
237{
238#ifdef __cplusplus
239 const char* name(HttpRequest* req);
240 const char* value(HttpRequest* req);
241#endif
242 U16 nameI;
243 U16 valueI;
244}HttpHeader;
245
246#ifdef __cplusplus
247extern "C" {
248#endif
249BA_API const char* HttpHeader_name(HttpHeader* o, struct HttpRequest* req);
250BA_API const char* HttpHeader_value(HttpHeader* o, struct HttpRequest* req);
251#ifdef __cplusplus
252}
253inline const char* HttpHeader::name(HttpRequest* req) {
254 return HttpHeader_name(this, req); }
255inline const char* HttpHeader::value(HttpRequest* req) {
256 return HttpHeader_value(this, req); }
257#endif
258
259#endif
260
261
262
263
264
265/*===========================================================================
266 *
267 * HttpInData
268 *---------------------------------------------------------------------------
269 * Description:
270 */
271
272#ifndef __DOXYGEN__
273
274typedef enum {
275 HttpInData_ParseHeader,
276 HttpInData_ReadBody,
277 HttpInData_ReadBodyAndParseUrlEncData
278} HttpInData_ParseState;
279#endif
280
281
284typedef struct HttpInData
285{
286#ifdef __cplusplus
290 const char* getBuf();
291
298 S32 getBufSize();
299#endif
300 HttpAllocator allocator;
301 struct HttpRequest* request;
302 U16 lineStartI;
303 U16 lineEndI;
304 S16 maxRequest;
305 U8 parseState; /* HttpInData_ParseState */
306 U8 overflow; /* Used for pipelined requests */
308
309#define HttpAllocator_2Ptr(o, index) ((&(o)->buf[index]))
310#define HttpInData_lineStartPtr(o) \
311 HttpAllocator_2Ptr(&(o)->allocator,(o)->lineStartI)
312
313#define HttpInData_getBufSize(o) \
314 ((o)->lineStartI < (o)->allocator.index ? \
315 (o)->allocator.index-(o)->lineStartI : 0)
316
317#define HttpInData_getBuf(o) HttpInData_lineStartPtr(o)
318BaBool HttpInData_hasMoreData(HttpInData* o);
319
320#ifdef __cplusplus
321inline const char* HttpInData::getBuf() {
322 return HttpInData_getBuf(this); }
324 return HttpInData_getBufSize(this); }
325#endif
326
327
328
386typedef struct HttpParameter
387{
388#ifdef __cplusplus
394 static U32 calculateSize(struct HttpRequest* req);
395
405 static HttpParameter* clone(void* buf, struct HttpRequest* req);
406
418 const char* getParameter(const char* paramName);
419
420 private:
421 HttpParameter() {}
422#endif
423 U16 formLen;
425
426
427#ifdef __cplusplus
428extern "C" {
429#endif
437BA_API HttpParameter* HttpParameter_clone(void* buf, struct HttpRequest* req);
441BA_API const char* HttpParameter_getParameter(
442 HttpParameter* o,const char* paramName);
443
444#ifdef __cplusplus
445}
447 return HttpParameter_calculateSize(req); }
448inline HttpParameter* HttpParameter::clone(void* buf, struct HttpRequest* req){
449 return HttpParameter_clone(buf, req); }
450inline const char* HttpParameter::getParameter(const char* paramName) {
451 return HttpParameter_getParameter(this, paramName); }
452#endif
453
454
484{
485#ifdef __cplusplus
492
500
503 void nextElement();
507 bool hasMoreElements();
511 const char* getName() const { return name; }
515 const char* getValue() const { return value; }
516 private:
517#endif
518 void* formElemBase;
519 U8* dataEntry;
520 U16 pos;
521 U16 formLen;
522 const char* name;
523 const char* value;
524
526
527#ifdef __cplusplus
528extern "C" {
529#endif
530
539 HttpParameterIterator* o, struct HttpRequest* req);
548 HttpParameter* param);
549BA_API void HttpParameterIterator_nextElement(HttpParameterIterator* o);
550#define HttpParameterIterator_hasMoreElements(o) ((o)->name != 0)
551#define HttpParameterIterator_getName(o) (o)->name
552#define HttpParameterIterator_getValue(o) (o)->value
553
554
555#ifdef __cplusplus
556}
557inline HttpParameterIterator::HttpParameterIterator(HttpRequest* req) {
559inline HttpParameterIterator::HttpParameterIterator(HttpParameter* param) {
562 HttpParameterIterator_nextElement(this); }
563#endif
564
565
596typedef struct HttpCookie
597{
598#ifdef __cplusplus
599 ~HttpCookie();
600
605 const char* getComment() const { return comment; }
606
610 const char* getDomain() const { return domain; }
611
618 BaTime getMaxAge() const { return maxAge; }
619
623 const char* getName() const { return name; }
624
629 const char* getPath() const { return path; }
630
635 bool getSecure() const { return secure ? true : false; }
636
641 bool getHttpOnly() const { return httpOnly ? true : false; }
642
646 const char* getValue() const { return value; }
647
653 int setComment(const char* purpose);
654
660 int setDomain(const char* pattern);
661
672 void setMaxAge(BaTime expiry);
681 void deleteCookie();
682
688 int setPath(const char* uri);
689
694 void setSecure(bool flag);
695
706 void setHttpOnly(bool flag);
707
713 int setValue(const char* newValue);
714
715#if 0
717 int getVersion() const { return version; }
718 /* Sets the version of the cookie protocol this cookie complies with. */
719 void setVersion(int v);
720#endif
721
727 void activate();
728 private:
729 HttpCookie();
730#endif
731 struct HttpCookie* next;
732 char* comment;
733 char* domain;
734 char* name;
735 char* path;
736 char* value;
737 BaTime maxAge;
738 int version;
739 BaBool secure;
740 BaBool httpOnly;
741 BaBool deleteCookieFlag;
742 BaBool activateFlag; /* The cookie will be sent to the client
743 * if this flag is true */
745
746#ifdef __cplusplus
747extern "C" {
748#endif
749BA_API void HttpCookie_destructor(HttpCookie* o);
753BA_API const char* HttpCookie_getComment(HttpCookie* o);
757BA_API const char* HttpCookie_getDomain(HttpCookie* o);
765BA_API const char* HttpCookie_getName(HttpCookie* o);
769BA_API const char* HttpCookie_getPath(HttpCookie* o);
781BA_API const char* HttpCookie_getValue(HttpCookie* o);
785BA_API int HttpCookie_setComment(HttpCookie* o, const char* purpose);
789BA_API int HttpCookie_setDomain(HttpCookie* o, const char* pattern);
793BA_API void HttpCookie_setMaxAge(HttpCookie* o, BaTime expiry);
794#define HttpCookie_deleteCookie(o) (o)->deleteCookieFlag = TRUE;
798BA_API int HttpCookie_setPath(HttpCookie* o, const char* uri);
810BA_API int HttpCookie_setValue(HttpCookie* o, const char* newValue);
811
812#if 0
813int HttpCookie_getVersion(HttpCookie* o);
814void HttpCookie_setVersion(HttpCookie* o, int v);
815#endif
816
821#ifdef __cplusplus
822}
823inline HttpCookie::HttpCookie() { baAssert(0); }
824inline HttpCookie::~HttpCookie() { HttpCookie_destructor(this); }
825inline int HttpCookie::setComment(const char* purpose) {
826 return HttpCookie_setComment(this, purpose); }
827inline int HttpCookie::setDomain(const char* pattern) {
828 return HttpCookie_setDomain(this, pattern); }
829inline void HttpCookie::setMaxAge(BaTime expiry) {
830 HttpCookie_setMaxAge(this, expiry); }
832 HttpCookie_deleteCookie(this); }
833inline int HttpCookie::setPath(const char* uri) {
834 return HttpCookie_setPath(this, uri); }
835inline void HttpCookie::setSecure(bool flag) {
836 HttpCookie_setSecure(this, flag ? TRUE : FALSE); }
837inline void HttpCookie::setHttpOnly(bool flag) {
838 HttpCookie_setHttpOnly(this, flag ? TRUE : FALSE); }
839inline int HttpCookie::setValue(const char* newValue) {
840 return HttpCookie_setValue(this, newValue); }
841#if 0
842inline void HttpCookie::setVersion(int v) {
843 HttpCookie_setVersion(this, v); }
844#endif
845inline void HttpCookie::activate() {
846 HttpCookie_activate(this); }
847#endif
848
849
853typedef struct HttpStdHeaders
854{
855#ifdef __cplusplus
861 const char* getConnection();
862
868 const char* getHost();
869
875 const char* getDomain();
876
881 const char* getContentType();
882
889#endif
890 HttpInData* inData;
891 char* domain;
892 BaFileSize contentLength;
893 U16 connectionHOffs;
894 U16 hostHOffs;
895 U16 contentTypeHOffs;
897
898#ifdef __cplusplus
899extern "C" {
900#endif
901BA_API const char* HttpStdHeaders_zzGetValFromOffs(
902 HttpStdHeaders* o, U16 offset);
903BA_API const char* HttpStdHeaders_getDomain(HttpStdHeaders* o);
904#define HttpStdHeaders_getConnection(o) \
905 HttpStdHeaders_zzGetValFromOffs(o,(o)->connectionHOffs)
906#define HttpStdHeaders_getHost(o) \
907 HttpStdHeaders_zzGetValFromOffs(o,(o)->hostHOffs)
908#define HttpStdHeaders_getContentType(o) \
909 HttpStdHeaders_zzGetValFromOffs(o,(o)->contentTypeHOffs)
910#define HttpStdHeaders_getContentLength(o) (o)->contentLength
911
912#ifdef __cplusplus
913}
914inline const char* HttpStdHeaders::getConnection() {
915 return HttpStdHeaders_getConnection(this); }
916inline const char* HttpStdHeaders::getHost() {
917 return HttpStdHeaders_getHost(this); }
918inline const char* HttpStdHeaders::getDomain() {
919 return HttpStdHeaders_getDomain(this); }
920inline const char* HttpStdHeaders::getContentType() {
921 return HttpStdHeaders_getContentType(this); }
923 return HttpStdHeaders_getContentLength(this); }
924
925#endif
926
927
928
929 /*Do not change the HttpMethod type without checking tables in Httpserver.c*/
930
941typedef enum {
942 HttpMethod_Connect =0x00001,
943 HttpMethod_Get =0x00002,
944 HttpMethod_Head =0x00004,
945 HttpMethod_Options =0x00008,
946
947 HttpMethod_Patch =0x00010,
948 HttpMethod_Post =0x00020,
949 HttpMethod_Put =0x00040,
950 HttpMethod_Trace =0x00080,
951
952 /* WebDAV */
953 HttpMethod_Copy =0x00100,
954 HttpMethod_Delete =0x00200,
955 HttpMethod_Lock =0x00400,
956 HttpMethod_Move =0x00800,
957
958 HttpMethod_Mkcol =0x01000,
959 HttpMethod_Propfind =0x02000,
960 HttpMethod_Proppatch =0x04000,
961 HttpMethod_Unlock =0x08000,
962
963 HttpMethod_Unknown =0x10000 /* Must be last */
964} HttpMethod;
965
966
967/* Convert an HTTP method from string value to the type HttpMethod */
968BA_API HttpMethod HttpMethod_a2m(const char* str);
969
970
971
980typedef struct HttpRequest
981{
982#ifdef __cplusplus
983
999 int checkMethods(HttpResponse* resp, U32 methods, bool addDefault=TRUE);
1000
1016 BaBool checkTime(struct HttpResponse* resp, BaTime time);
1017
1022
1027 const char* getRequestURI();
1028
1045 const char* getRequestURL(bool forceHttps=false);
1046
1052
1056 const char* getVersion();
1057
1066 const char* getHeaderValue(const char* name);
1067
1072 HttpCookie* getCookie(const char* name);
1073
1081
1087 const char* getMethod();
1088
1094 static const char* getMethod(HttpMethod method);
1095
1109 const char* getParameter(const char* paramName);
1110
1123 int wsUpgrade();
1124
1143 HttpHeader* getHeaders(int* len);
1144
1145
1146
1185 HttpSession* getSession(BaBool create=true);
1190
1195
1200
1205
1210
1211
1212 int setUserObj(void* userObj, bool overwrite=false);
1213 void* getUserObj();
1214
1215#endif
1216 HttpStdHeaders stdH;
1217 HttpAllocator headerAlloc;
1218 HttpAllocator formAlloc;
1219 HttpInData inData;
1220 struct HttpServer* server;
1221 void* userObj;
1222 struct HttpSession* session;
1223 HttpMethod methodType;
1224 U16 pathI;
1225 U16 versionI;
1226 U16 headersI;
1227 U16 headerLen;
1228 U16 formsI;
1229 U16 formLen;
1230 BaBool postDataConsumed; /* Set by MultipartUpload and HttpRecData */
1231 BaBool expect100Continue; /* Validated expectation; cleared when handled. */
1232 BaBool chunkedBody; /* Set only after successful framing validation. */
1234
1235#ifdef __cplusplus
1236extern "C" {
1237#endif
1242 U32 methods, BaBool addDefault);
1243BA_API int HttpRequest_checkOptions(
1244 HttpRequest* o, struct HttpResponse* resp, int optLen, ...);
1245#define HttpRequest_getAuthenticatedUser(o) \
1246 AuthenticatedUser_get2(HttpRequest_getSession(o,FALSE))
1247#define HttpRequest_getConnection(o) HttpRequest_getCommand(o)->con
1248#define HttpRequest_getMethodType(o) (o)->methodType
1249#define HttpRequest_getMethod(o) HttpRequest_getMethod2((o)->methodType)
1250BA_API const char* HttpRequest_getMethod2(HttpMethod method);
1251#define HttpRequest_getServer(o) (o)->server
1252#define HttpRequest_getResponse(o) (&HttpRequest_getCommand(o)->response)
1253BA_API struct HttpCommand* HttpRequest_getCommand(HttpRequest*);
1258 HttpRequest* o, struct HttpResponse* resp, BaTime time);
1266BA_API const char* HttpRequest_getRequestURL(HttpRequest* o,BaBool forceHttps);
1267#define HttpRequest_getStdHeaders(o) (&(o)->stdH)
1275BA_API const char* HttpRequest_getHeaderValue(HttpRequest* o,const char* name);
1276#define HttpRequest_getNoOfParameters(o) (o)->formLen
1280BA_API HttpCookie* HttpRequest_getCookie(HttpRequest* o, const char* name);
1281#define HttpRequest_getUserObj(o) (o)->userObj
1282BA_API int HttpRequest_setUserObj(
1283 HttpRequest* o, void* userObj, BaBool overwrite);
1284#define HttpRequest_getBuffer(o) (&(o)->inData)
1288BA_API const char* HttpRequest_getParameter(
1289 HttpRequest* o, const char* paramName);
1293BA_API HttpHeader* HttpRequest_getHeaders(HttpRequest* o, int* len);
1298BA_API BaBool HttpRequest_enableKeepAlive(HttpRequest* o);
1299BA_API int HttpRequest_pushBackData(HttpRequest* o);
1304 HttpRequest* o, BaBool create);
1305BA_API struct HttpSession* HttpRequest_session(
1306 HttpRequest* o, const char* val, size_t len, int set);
1307#ifdef __cplusplus
1308}
1309
1311 U32 methods, bool addDefault){
1312 return HttpRequest_checkMethods(this,resp,
1313 methods, addDefault ? TRUE : FALSE);}
1314
1316 return HttpRequest_checkTime(this, resp, time); }
1318 return HttpRequest_getAuthenticatedUser(this); }
1320 return HttpRequest_getMethodType(this); }
1321inline const char* HttpRequest::getMethod() {
1322 return HttpRequest_getMethod(this); }
1323inline const char* HttpRequest::getMethod(HttpMethod method) {
1324 return HttpRequest_getMethod2(method); }
1326 return HttpRequest_getServer(this); }
1327inline const char* HttpRequest::getRequestURI() {
1328 return HttpRequest_getRequestURI(this); }
1329inline const char* HttpRequest::getRequestURL(bool forceHttps) {
1330 return HttpRequest_getRequestURL(this, forceHttps); }
1332 return HttpRequest_getStdHeaders(this); }
1333inline const char* HttpRequest::getVersion() {
1334 return HttpRequest_getVersion(this); }
1335inline const char* HttpRequest::getHeaderValue(const char* name) {
1336 return HttpRequest_getHeaderValue(this, name); }
1337inline HttpCookie* HttpRequest::getCookie(const char* name) {
1338 return HttpRequest_getCookie(this, name); }
1339inline const char* HttpRequest::getParameter(const char* paramName) {
1340 return HttpRequest_getParameter(this, paramName); }
1342 return HttpRequest_wsUpgrade(this);
1343}
1344inline HttpHeader* HttpRequest::getHeaders(int* len) {
1345 return HttpRequest_getHeaders(this, len); }
1346inline int HttpRequest::setUserObj(void* userObj, bool overwrite) {
1347 return HttpRequest_setUserObj(this, userObj, overwrite); }
1348inline void* HttpRequest::getUserObj() {
1349 return HttpRequest_getUserObj(this); }
1351 return HttpRequest_getSession(this, create); }
1353 return HttpParameterIterator_hasMoreElements(this); }
1355 return HttpRequest_getBuffer(this); }
1356#endif
1357
1358
1359#ifndef __DOXYGEN__
1360
1361typedef struct
1362{
1363 HttpAllocator data;
1364 U16 maxResponseHeader;
1365} NameValMM;
1366
1367
1368typedef struct
1369{
1370 U8 major;
1371 U8 minor;
1372} HttpProtocol;
1373
1374#endif
1375
1386typedef struct HttpResponse
1387{
1388#ifdef __cplusplus
1389
1393 U32 byteCount();
1394
1395
1402 HttpCookie* createCookie(const char* name);
1403
1416 const char* containsHeader(const char* name);
1417
1426 const char* encodeRedirectURL(const char* pathName);
1427
1437 const char* encodeRedirectURLWithParam(const char* pathName);
1438
1448 const char* encodeUrl(const char* path);
1449
1456 int flush();
1457
1482 int forward(const char* path);
1483
1503 int redirect(const char* path);
1504
1505
1510
1515
1516
1534 int include(const char* path);
1535
1541 bool committed() const;
1542
1547 bool isForward() const;
1548
1552 bool isInclude() const;
1553
1557 bool initial() const;
1558
1563 int resetHeaders();
1564
1570 int resetBuffer();
1571
1584 int sendError(int eCode);
1585
1600 int sendError(int eCode, const char* msg);
1601
1608 int sendBufAsError(int eCode);
1609
1616 int sendBufAsTxtError(int eCode);
1617
1618
1626 int fmtError(int eCode, const char* fmt, ...);
1627
1645 int sendRedirect(const char* url);
1646
1661 int redirect2TLS();
1662
1672
1680 int setContentType(const char* type);
1681
1692 int setDateHeader(const char* name, BaTime time);
1693
1721 int setHeader(const char* name, const char* value, bool replace=true);
1722
1731 int setMaxAge(BaTime seconds);
1732
1733
1770 char* fmtHeader(const char* name, int valueLen, bool replace=true);
1771
1772
1789 void setStatus(int statusCode);
1790
1796 int printf(const char* fmt, ...);
1797
1807
1821 int write(const void* data, int len, int useBuffering=TRUE);
1822
1831 int write(const char* data, int useBuffering=TRUE);
1832
1843 int send(const void* data, int len);
1844
1852 int setDefaultHeaders();
1853
1878 int setResponseBuf(BufPrint* buf, bool useDefBuffer=true);
1879
1886 int removeResponseBuf();
1887
1888
1889 int setUserObj(void* userObj, bool overwrite=false);
1890#endif
1891 NameValMM nameValMM;
1892 BufPrint headerPrint;
1893 BufPrint defaultBodyPrint;
1894 BufPrint* bodyPrint;
1895 struct HttpDir* currentDir;
1896 char* encodedURL;
1897 char* encodedRedirectURL;
1898 HttpCookie* cookieList;
1899 void* userObj;
1900 int statusCode;
1901 U32 msgLen; /* Used if request is of type HEAD, count total msg len */
1902 HttpProtocol protocol;
1903 U16 includeCounter;
1904 U16 forwardCounter;
1905 char headerSent;
1906 char printAndWriteInitialized;
1907 char useChunkTransfer;
1909
1910#ifdef __cplusplus
1911extern "C" {
1912#endif
1917 struct HttpResponse* o,const char* name);
1922 HttpResponse* o, const char* name);
1923BA_API int HttpResponse_dataAdded(HttpResponse* o, U32 size);
1924#define HttpResponse_byteCount(o) ((o)->msgLen + (o)->bodyPrint->cursor)
1929 HttpResponse* o, const char* pathName);
1930BA_API const char* HttpResponse_encodeRedirectURLWithParamOrSessionURL(
1931 HttpResponse* o,const char* path,BaBool setUrlCookie);
1932#define HttpResponse_encodeRedirectURLWithParam(o, path) \
1933 HttpResponse_encodeRedirectURLWithParamOrSessionURL(o, path, FALSE)
1934#define HttpResponse_encodeSessionURL(o, path) \
1935 HttpResponse_encodeRedirectURLWithParamOrSessionURL(o, path, TRUE)
1939BA_API const char* HttpResponse_encodeUrl(HttpResponse* o, const char* path);
1944#define HttpResponse_forward(o,path) HttpResponse_incOrForward(o,path,FALSE)
1945#define HttpResponse_getConnection(o) HttpResponse_getCommand(o)->con
1946#define HttpResponse_getRequest(o) (&HttpResponse_getCommand(o)->request)
1947BA_API struct HttpCommand* HttpResponse_getCommand(HttpResponse*);
1948#define HttpResponse_getBuf(o) (o)->bodyPrint->buf
1949#define HttpResponse_getBufSize(o) (o)->bodyPrint->bufSize
1950#define HttpResponse_getBufOffs(o) \
1951 ((o)->bodyPrint->buf + (o)->bodyPrint->cursor)
1952#define HttpResponse_getRemBufSize(o) \
1953 ((o)->bodyPrint->bufSize - (o)->bodyPrint->cursor)
1954#define HttpResponse_getUserObj(o) (o)->userObj
1955BA_API int HttpResponse_incOrForward(
1956 HttpResponse* o, const char* path, BaBool isInc);
1960BA_API int HttpResponse_redirect(HttpResponse* o, const char* path);
1961#define HttpResponse_include(o,path) HttpResponse_incOrForward(o,path,TRUE)
1962#define HttpResponse_isChunkTransfer(o) (o)->useChunkTransfer
1963#define HttpResponse_committed(o) (o)->headerSent
1964#define HttpResponse_isForward(o) ((o)->forwardCounter != 0)
1965#define HttpResponse_isInclude(o) ((o)->includeCounter != 0)
1966#define HttpResponse_initial(o) (!HttpResponse_isForward(o) && \
1967 !HttpResponse_isInclude(o))
1972 HttpResponse* o,BufPrint* buf,BaBool useDefBuffer);
1977
1986BA_API int HttpResponse_sendError1(HttpResponse* o, int eCode);
1987BA_API int HttpResponse_sendError2(HttpResponse* o,int eCode,const char* msg);
1996BA_API int HttpResponse_fmtVError(
1997 HttpResponse* response,
1998 int eCode,
1999 const char* fmt,
2000 va_list varg);
2001BA_API int HttpResponse_fmtError(
2002 HttpResponse* response,
2003 int eCode,
2004 const char* fmt, ...);
2008BA_API int HttpResponse_sendRedirect(HttpResponse* o, const char* url);
2009BA_API int HttpResponse_sendRedirectI(
2010 HttpResponse* o, const char* url, int status);
2015#define HttpResponse_forceHttps HttpResponse_redirect2TLS /* Backw. comp. */
2016
2017#define HttpResponse_setBufPos(o, pos) (o)->bodyPrint->cursor = pos
2025BA_API int HttpResponse_setContentType(HttpResponse* o, const char* type);
2026BA_API int HttpResponse_checkContentType(HttpResponse* o, const char* type);
2035 HttpResponse* o, const char* name, BaTime t);
2040 HttpResponse* o,const char* name,const char* value, BaBool replace);
2044BA_API int HttpResponse_setMaxAge(HttpResponse* response, BaTime seconds);
2049 HttpResponse* o, const char* name, int valueLen, BaBool replace);
2050BA_API int HttpResponse_setStatus(HttpResponse* o, int eCode);
2051BA_API int HttpResponse_vprintf(
2052 HttpResponse* o, const char* fmt, va_list argList);
2056BA_API int HttpResponse_printf(HttpResponse* o, const char* fmt, ...);
2060BA_API int HttpResponse_write(HttpResponse* o, const void* data, int len,
2061 int useBuffering);
2069BA_API int HttpResponse_send(HttpResponse* o, const void* data, int len);
2074BA_API int HttpResponse_downgrade(HttpResponse* o);
2075BA_API int HttpResponse_setUserObj(
2076 HttpResponse* o,void* userObj,BaBool overwrite);
2077BA_API int HttpResponse_printAndWriteInit(HttpResponse* o);
2078BA_API int HttpResponse_send100Continue(HttpResponse* o);
2079BA_API int HttpResponse_setChunkEncoding(HttpResponse* o);
2080BA_API const char* HttpResponse_getRespData(HttpResponse* o, int* len);
2081#define HttpResponse_getStatus(o) (o)->statusCode
2082#ifdef __cplusplus
2083}
2084inline HttpCookie* HttpResponse::createCookie(const char* name) {
2085 return HttpResponse_createCookie(this, name); }
2086inline const char* HttpResponse::containsHeader(const char* name) {
2087 return HttpResponse_containsHeader(this, name); }
2089 return HttpResponse_byteCount(this); }
2090inline const char* HttpResponse::encodeRedirectURL(const char* pathName) {
2091 return HttpResponse_encodeRedirectURL(this, pathName); }
2092inline const char* HttpResponse::encodeRedirectURLWithParam(const char* p) {
2093 return HttpResponse_encodeRedirectURLWithParam(this, p); }
2094inline const char* HttpResponse::encodeUrl(const char* path) {
2095 return HttpResponse_encodeUrl(this, path); }
2097 return HttpResponse_flush(this); }
2098inline int HttpResponse::forward(const char* path) {
2099 return HttpResponse_forward(this, path); }
2100inline int HttpResponse::redirect(const char* path) {
2101 return HttpResponse_redirect(this, path); }
2102inline int HttpResponse::include(const char* path) {
2103 return HttpResponse_include(this, path); }
2104inline bool HttpResponse::committed() const {
2105 return HttpResponse_committed(this) ? true : false; }
2106inline bool HttpResponse::isForward() const {
2107 return HttpResponse_isForward(this) ? true : false; }
2108inline bool HttpResponse::isInclude() const {
2109 return HttpResponse_isInclude(this) ? true : false; }
2110inline bool HttpResponse::initial() const {
2111 return HttpResponse_initial(this) ? true : false; }
2112inline int HttpResponse::setResponseBuf(BufPrint* buf, bool useDefBuffer) {
2113 return HttpResponse_setResponseBuf(this, buf, useDefBuffer?TRUE:FALSE); }
2115 return HttpResponse_removeResponseBuf(this); }
2117 return HttpResponse_resetHeaders(this); }
2119 return HttpResponse_resetBuffer(this); }
2120inline int HttpResponse::sendError(int eCode) {
2121 return HttpResponse_sendError1(this, eCode); }
2122inline int HttpResponse::sendError(int eCode, const char* msg) {
2123 return HttpResponse_sendError2(this, eCode, msg); }
2124inline int HttpResponse::sendBufAsError(int eCode) {
2125 return HttpResponse_sendBufAsError(this, eCode); }
2126inline int HttpResponse::sendBufAsTxtError(int eCode) {
2127 return HttpResponse_sendBufAsTxtError(this,eCode);}
2128inline int HttpResponse::fmtError(int eCode,const char* fmt,...) {
2129 int retv; va_list varg;
2130 va_start(varg, fmt);
2131 retv = HttpResponse_fmtVError(this, eCode, fmt, varg);
2132 va_end(varg);
2133 return retv; }
2134inline int HttpResponse::sendRedirect(const char* url) {
2135 return HttpResponse_sendRedirect(this, url); }
2137 return HttpResponse_redirect2TLS(this); }
2139 return HttpResponse_setContentLength(this, len); }
2140inline int HttpResponse::setContentType(const char* type) {
2141 return HttpResponse_setContentType(this, type); }
2142inline int HttpResponse::setDateHeader(const char* name, BaTime t) {
2143 return HttpResponse_setDateHeader(this, name, t); }
2145 const char* name, const char* value, bool replace) {
2146 return HttpResponse_setHeader(this,name, value, replace?TRUE:FALSE); }
2147inline int HttpResponse::setMaxAge(BaTime seconds) {
2148 return HttpResponse_setMaxAge(this, seconds); }
2150 const char* name, int valueLen, bool replace) {
2151 return HttpResponse_fmtHeader(this, name, valueLen, replace?TRUE:FALSE); }
2152inline void HttpResponse::setStatus(int eCode) {
2153 HttpResponse_setStatus(this, eCode);}
2154
2155inline int HttpResponse::printf(const char* fmt, ...) {
2156 int retv; va_list varg; va_start(varg, fmt);
2157 retv = HttpResponse_vprintf(this, fmt, varg); va_end(varg); return retv;}
2158inline int HttpResponse::write(const char* data, int useBuffering) {
2159 return HttpResponse_write(this, data, iStrlen(data), useBuffering); }
2161 return HttpResponse_getWriter(this); }
2162inline int HttpResponse::write(const void* data, int len, int useBuffering){
2163 return HttpResponse_write(this, data, len, useBuffering); }
2164inline int HttpResponse::send(const void* data, int len) {
2165 return HttpResponse_send(this, data, len); }
2167 return HttpResponse_setDefaultHeaders(this); }
2168inline int HttpResponse::setUserObj(void* userObj, bool overwrite) {
2169 return HttpResponse_setUserObj(this, userObj, overwrite); }
2170
2171#endif
2172
2178typedef struct HttpCommand
2179{
2180#ifdef __cplusplus
2181
2186
2191
2196 struct HttpConnection* getConnection();
2197
2201 struct HttpServer* getServer();
2202
2203 HttpCommand() {}
2204#endif
2205 DoubleLink super;
2206#ifdef __cplusplus
2207 public:
2208#endif
2209 HttpRequest request;
2210 HttpResponse response;
2211 struct HttpConnection* con;
2212 struct LHttpCommand* lcmd; /* Used by LSP plugin */
2213 BaTime requestTime;
2214 BaBool runningInThread;
2216
2217#define HttpCommand_getRequest(o) (&(o)->request)
2218#define HttpCommand_getResponse(o) (&(o)->response)
2219#define HttpCommand_getConnection(o) (o)->con
2220#define HttpCommand_getServer(o) HttpConnection_getServer((o)->con)
2221#ifdef __cplusplus
2223 return HttpCommand_getRequest(this); }
2225 return HttpCommand_getResponse(this); }
2227 return HttpCommand_getConnection(this); }
2229 return HttpCommand_getServer(this);
2230}
2231#endif
2232
2233
2234
2235#ifndef __DOXYGEN__
2238#endif
2239
2249 struct HttpSessionAttribute* o);
2250
2279{
2280#ifdef __cplusplus
2286 HttpSessionAttribute(const char* name,
2288
2293#endif
2294 struct HttpSessionAttribute* next;
2295 struct HttpSession* session;
2297 char* name;
2299
2300#ifdef __cplusplus
2301extern "C" {
2302#endif
2303
2313 const char* name,
2320#define HttpSessionAttribute_getSession(o) (o)->session
2321#ifdef __cplusplus
2322}
2324 const char* name,
2326 HttpSessionAttribute_constructor(this, name, d); }
2328 return HttpSessionAttribute_getSession(this); }
2329
2330#endif
2331
2337typedef struct HttpSession
2338{
2339#ifdef __cplusplus
2340
2341 void *operator new(size_t s) { return ::baMalloc(s); }
2342 void operator delete(void* d) { if(d) ::baFree(d); }
2343 void *operator new(size_t, void *place) { return place; }
2344 void operator delete(void*, void *) { }
2345
2360 void terminate();
2361
2368 HttpSessionAttribute* getAttribute(const char* name);
2369
2375
2382
2388
2393
2399 int removeAttribute(const char* name);
2400
2408
2414 void setMaxInactiveInterval(BaTime interval);
2415
2421 void incrRefCntr();
2422
2430 void decrRefCntr();
2431
2436 U32 getId();
2437
2442
2447
2448
2449 void incrementLock();
2450 void decrementLock();
2451
2452 HttpSession() {}
2453 private:
2454#endif
2455 SplayTreeNode super; /* inherits from SplayTreeNode */
2456 DoubleLink dlink;
2457 HttpSockaddr peer;
2458 HttpSessionAttribute* attrList;
2459 struct HttpSessionContainer* container;
2460 BaTime creationTime;
2461 BaTime lastAccessedTime;
2462 BaTime maxInactiveInterval;
2463 U32 sesrnd1; /* Session random number 1 & 2 */
2464 U32 sesrnd2; /* entropy id+sesrnd1+sesrnd2=96 bits */
2465 U32 useCounter;
2466 int refCounter;
2467 U16 lockCounter;
2468 U8 termPending; /* TRUE if in termination list */
2470
2471
2472#ifdef __cplusplus
2473extern "C" {
2474#endif
2479 const char* name);
2500BA_API BaBool HttpSession_isNew(HttpSession* o);
2504BA_API int HttpSession_removeAttribute(HttpSession* o, const char* name);
2509 HttpSessionAttribute* value);
2514#define HttpSession_incrRefCntr(o) (o)->refCounter++
2519#define HttpSession_incrementLock(o) (o)->lockCounter++
2520#define HttpSession_decrementLock(o) do {\
2521 baAssert((o)->lockCounter > 0);\
2522 (o)->lockCounter--; } while(0)
2529BA_API int HttpSession_fmtSessionId(HttpSession* o, U8* buf, size_t bufSize);
2530#define HttpSession_getId(o) \
2531 ((U32)((ptrdiff_t)SplayTreeNode_getKey((SplayTreeNode*)(o))))
2532#define HttpSession_getAuthenticatedUser(o) AuthenticatedUser_get2((o))
2533#define HttpSession_getUseCounter(o) (o)->useCounter
2534#define HttpSession_getPeerName(o) (&(o)->peer)
2535#ifdef __cplusplus
2536}
2538 return HttpSession_getAttribute(this, name); }
2540 return HttpSession_getCreationTime(this); }
2542 return HttpSession_getLastAccessedTime(this); }
2546 return HttpSession_getServer(this); }
2548 HttpSession_terminate(this); }
2549inline int HttpSession::removeAttribute(const char* name) {
2550 return HttpSession_removeAttribute(this, name); }
2552 return HttpSession_setAttribute(this, value); }
2554 HttpSession_setMaxInactiveInterval(this, interval); }
2556 HttpSession_incrRefCntr(this); }
2559inline U32 HttpSession::getId() { return HttpSession_getId(this); }
2561 return HttpSession_getUseCounter(this); }
2563 return HttpSession_getAuthenticatedUser(this); }
2564inline void HttpSession::incrementLock() {HttpSession_incrementLock(this);}
2565inline void HttpSession::decrementLock() {HttpSession_decrementLock(this);}
2566
2567#endif /* __cplusplus */
2568
2569typedef enum {
2570 HttpSessionContainer_OK = 0,
2571 HttpSessionContainer_NoMemory,
2572 HttpSessionContainer_TooManySessions,
2573 HttpSessionContainer_NoPeerAddress
2574} HttpSessionContainer_ECode;
2575
2576
2581{
2582#ifdef __cplusplus
2590 void setMaxSessions(int max);
2591 private:
2592#endif
2593 SplayTree sessionTree;
2594 DoubleList sessionList;
2595 DoubleList sessionTermList;
2596 DoubleLink* sessionLinkIter;
2597 struct HttpServer* server;
2598 int noOfSessions; /* Current number of active sessions */
2599 int maxSessions;
2600 HttpSessionContainer_ECode eCode;
2602
2603#ifdef __cplusplus
2604extern "C" {
2605#endif
2606void HttpSessionContainer_constructor(struct HttpSessionContainer* o,
2607 struct HttpServer* server,
2608 U16 maxSessions);
2609void HttpSessionContainer_destructor(struct HttpSessionContainer* o);
2610void HttpSessionContainer_sessionTimer(struct HttpSessionContainer* o);
2611#define HttpSessionContainer_setMaxSessions(o,max) (o)->maxSessions = max
2612#ifdef __cplusplus
2613}
2615 HttpSessionContainer_setMaxSessions(this, max); }
2616#endif
2617
2618
2619
2630typedef void (*HttpPage_Service)(struct HttpPage* page,
2631 HttpRequest* request,
2632 HttpResponse* response);
2633
2634
2635#define HttpPageType_HttpPageSE 0x00020
2636
2637#ifndef __DOXYGEN__
2638typedef struct HttpPageNode
2639{
2640 struct HttpPageNode* next;
2641} HttpPageNode;
2642#endif
2643
2696typedef struct HttpPage
2697{
2698#ifdef __cplusplus
2699 void *operator new(size_t s) { return ::baMalloc(s); }
2700 void operator delete(void* d) { if(d) ::baFree(d); }
2701 void *operator new(size_t, void *place) { return place; }
2702 void operator delete(void*, void *) { }
2703 HttpPage() {}
2712 HttpPage(HttpPage_Service service, const char* name);
2713
2716 ~HttpPage();
2717
2721 const char* getName() const { return name; }
2722
2729 void service(HttpRequest* request, HttpResponse* response);
2730
2735 bool isLinked();
2736
2740 int unlink();
2741#endif
2742 HttpPageNode super; /* As if inherited */
2743 HttpPage_Service serviceCB;
2744 const char* name;
2746
2747#ifdef __cplusplus
2748extern "C" {
2749#endif
2750void
2756 HttpPage* o, HttpPage_Service service, const char* name);
2761#define HttpPage_getName(o) (o)->name
2762#define HttpPage_isLinked(o) ((HttpPageNode*)(o))->next
2767#define HttpPage_service(o, request, response) \
2768 (o)->serviceCB(o, request, response)
2769#ifdef __cplusplus
2770}
2771inline HttpPage::HttpPage(HttpPage_Service service, const char* name) {
2772 HttpPage_constructor(this, service, name); }
2774 HttpPage_destructor(this); }
2775inline bool HttpPage::isLinked() {
2776 return HttpPage_isLinked(this) ? true : false;
2777}
2778inline int HttpPage::unlink() {return HttpPage_unlink(this); }
2779inline void HttpPage::service(HttpRequest* request, HttpResponse* response) {
2780 HttpPage_service(this, request, response);
2781}
2782#endif
2783
2784
2794typedef int (*HttpDir_Service)(struct HttpDir* o,
2795 const char* relPath,
2796 HttpCommand* cmd);
2797
2798#define HttpDirType_EhDir 0x00001
2799#define HttpDirType_HttpResRdr 0x00002
2800#define HttpDirType_AuthenticateDir 0x00008
2801#define HttpDirType_AuthenticateDirWrapper 0x00010
2802
2803
2823typedef struct HttpDir
2824{
2825#ifdef __cplusplus
2826 void *operator new(size_t s) { return ::baMalloc(s); }
2827 void operator delete(void* d) { if(d) ::baFree(d); }
2828 void *operator new(size_t, void *place) { return place; }
2829 void operator delete(void*, void *) { }
2831 HttpDir();
2832
2851 HttpDir(const char* name, S8 priority=0);
2856 ~HttpDir();
2857
2865 int insertDir(HttpDir* dir);
2866
2873 int insertPage(HttpPage* page);
2874
2879
2884
2889 HttpDir* getDir(const char* name);
2890
2895 HttpPage* getPage(const char* name);
2896
2900 HttpDir* getNext();
2901
2914 HttpPage* findPage(HttpPage* iter, const char* name);
2915
2927 static HttpDir* findDir(HttpDir* iter, const char* name,
2928 unsigned int nameLen);
2929
2941 HttpDir* createOrGet(const char* name);
2942
2946 const char* getName() const { return name; }
2947
2951 HttpDir* getParent() const { return parent; }
2952
2977 char* makeAbsPath(const char* relPath, int relPathLen);
2978
2991 char* getRootPath();
2992
2993
3000
3012 void p403(const char* p403);
3013
3018 bool isLinked();
3019
3024 int unlink();
3025
3033 void setAuthenticator(
3034 struct AuthenticatorIntf* authenticator,
3035 struct AuthorizerIntf* authorizer=0);
3036
3058 bool authenticateAndAuthorize(HttpCommand* cmd,const char* path);
3059
3060
3061#endif
3062 HttpDir_Service service;
3063 struct HttpDir* parent; /* owner */
3064 struct HttpDir* next; /* next sibling */
3065 const char* name; /* e.g. /mydir/ */
3066 struct HttpDir* dirList; /* list of httpdirs (children) */
3067 struct AuthorizerIntf* realm; /* If we have authorization */
3068 struct AuthenticatorIntf* authenticator; /* If we have authentic. */
3069 char* _p403; /* If we have a 403 denied response page. */
3070 HttpPageNode pageList; /* pages for this dir */
3071 /* U8 type; */
3072 S8 priority;
3074
3075#ifdef __cplusplus
3076extern "C" {
3077#endif
3081BA_API void HttpDir_constructor(HttpDir* o, const char* name, S8 priority);
3090 HttpDir* o, const char* relPath, int relPathLen);
3091#define HttpDir_getRootPath(o) HttpDir_makeAbsPath(o,"",0)
3095BA_API int HttpDir_insertDir(HttpDir* o, HttpDir* dir);
3096#define HttpDir_getFirstPage(o) \
3097 (o)->pageList.next != &(o)->pageList ? ((HttpPage*)(o)->pageList.next) : 0
3098#define HttpDir_getFirstDir(o) (o)->dirList
3102BA_API HttpDir* HttpDir_getDir(HttpDir* o, const char* name);
3106BA_API HttpPage* HttpDir_getPage(HttpDir* o, const char* name);
3107#define HttpDir_getNext(o) (o)->next
3108#define HttpDir_getName(o) (o)->name
3109#define HttpDir_getParent(o) (o)->parent
3118 HttpDir* o, HttpPage* iter, const char* name);
3123 HttpDir* iter, const char* name,unsigned int nameLen);
3127BA_API HttpDir* HttpDir_createOrGet(HttpDir* o, const char* name);
3131BA_API void HttpDir_p403(HttpDir* o, const char* p403);
3132#define HttpDir_overloadService HttpDir_setService
3137#define HttpDir_isLinked(o) (o)->parent
3142#define HttpDir_setAuthenticator(o,authenticatorMA,authorizerMA) \
3143 (o)->authenticator = authenticatorMA,(o)->realm = authorizerMA
3148 HttpDir* o,HttpCommand* cmd,const char* path);
3149#define HttpDir_isAuthorized(o,user,method,path) \
3150 ((o)->realm ? \
3151 (user ? AuthorizerIntf_authorize((o)->realm,user,method,path) : FALSE) : \
3152 TRUE)
3153#ifdef __cplusplus
3154}
3156 HttpDir_constructor(this, 0, 0); }
3157inline HttpDir::HttpDir(const char* name, S8 priority) {
3158 HttpDir_constructor(this, name, priority); }
3160 HttpDir_destructor(this); }
3161inline char* HttpDir::makeAbsPath(const char* relPath, int relPathLen) {
3162 return HttpDir_makeAbsPath(this, relPath, relPathLen); }
3163inline char* HttpDir::getRootPath() {
3164 return HttpDir_getRootPath(this); }
3165inline int HttpDir::insertDir(HttpDir* dir) {
3166 return HttpDir_insertDir(this, dir); }
3168 return HttpDir_insertPage(this, page); }
3169inline HttpPage* HttpDir::getFirstPage() { return HttpDir_getFirstPage(this); }
3170inline HttpDir* HttpDir::getFirstDir() { return HttpDir_getFirstDir(this); }
3171inline HttpDir* HttpDir::getDir(const char* name) {
3172 return HttpDir_getDir(this,name); }
3173inline HttpPage* HttpDir::getPage(const char* name) {
3174 return HttpDir_getPage(this,name); }
3175inline HttpDir* HttpDir::getNext() { return HttpDir_getNext(this); }
3176inline HttpPage* HttpDir::findPage(HttpPage* iter, const char* name) {
3177 return HttpDir_findPage(this, iter, name); }
3178inline HttpDir* HttpDir::findDir(HttpDir* iter, const char* name,
3179 unsigned int nameLen) {
3180 return HttpDir_findDir(iter, name, nameLen); }
3181inline HttpDir* HttpDir::createOrGet(const char* name) {
3182 return HttpDir_createOrGet(this, name); }
3184 return HttpDir_setService(this, s); }
3185inline void HttpDir::p403(const char* p403) {
3186 HttpDir_p403(this, p403); }
3187inline int HttpDir::unlink() {return HttpDir_unlink(this); }
3188inline bool HttpDir::isLinked() {
3189 return HttpDir_isLinked(this) ? true : false; }
3190inline void HttpDir::setAuthenticator(struct AuthenticatorIntf* authenticator,
3191 struct AuthorizerIntf* authorizer){
3192 HttpDir_setAuthenticator(this,authenticator,authorizer);
3193}
3195 HttpCommand* cmd, const char* path) {
3196 return HttpDir_authenticateAndAuthorize(this,cmd,path) ? true : false; }
3197#endif
3198
3199#ifndef __DOXYGEN__
3200
3201typedef struct HttpLinkCon
3202{
3203 HttpConnection con; /* Inherits from HttpConnection */
3204 DoubleLink link;
3205} HttpLinkCon;
3206
3207
3208typedef struct
3209{
3210 HttpDir super; /* inherit */
3211 HttpDir_Service superServiceFunc;
3212 char* page404;
3213 BaBool page404InProgress;
3214} HttpRootDir;
3215
3216#endif
3217
3226typedef struct HttpServerConfig
3227{
3228#ifdef __cplusplus
3235
3268 int setRequest(S16 min, S16 max);
3269
3284 int setResponseHeader(U16 min, U16 max);
3285
3299 int setResponseData(U16 size);
3300
3316 int setCommit(U16 size);
3317
3333 int setNoOfHttpCommands(U16 size);
3334
3359 int setNoOfHttpConnections(U16 size);
3360
3369 int setMaxSessions(U16 size);
3370#endif
3371 S16 minRequest;
3372 S16 maxRequest;
3373 U16 minResponseHeader;
3374 U16 maxResponseHeader;
3375 U16 commit;
3376 U16 responseData;
3377 U16 noOfHttpCommands;
3378 U16 noOfHttpConnections;
3379 U16 maxSessions;
3381
3382#ifdef __cplusplus
3383extern "C" {
3384#endif
3397 HttpServerConfig* o, U16 min, U16 max);
3414 HttpServerConfig* o, U16 size);
3419#ifdef __cplusplus
3420}
3424 return HttpServerConfig_setRequest(this, min, max); }
3426 return HttpServerConfig_setResponseHeader(this, min, max); }
3428 return HttpServerConfig_setResponseData(this, size); }
3430 return HttpServerConfig_setCommit(this, size); }
3432 return HttpServerConfig_setNoOfHttpCommands(this, size); }
3434 return HttpServerConfig_setNoOfHttpConnections(this, size); }
3436 return HttpServerConfig_setMaxSessions(this, size); }
3437
3438#endif
3439
3440
3441typedef DoubleList HttpLinkConList;
3442
3443/* Used by LSP plugin */
3444typedef void (*LspOnTerminateRequest)(struct LHttpCommand* lcmd);
3445
3462typedef struct HttpServer
3463{
3464#ifdef __cplusplus
3465 void *operator new(size_t s) { return ::baMalloc(s); }
3466 void operator delete(void* d) { if(d) ::baFree(d); }
3467 void *operator new(size_t, void *place) { return place; }
3468 void operator delete(void*, void *) { }
3479 HttpServer(SoDisp* dispatcher, HttpServerConfig* cfg=0);
3480
3485 ~HttpServer();
3486
3500 int insertRootDir(HttpDir* dir);
3501
3526 int insertDir(const char* virtualDirRootPath, HttpDir* dir);
3527
3571 int insertCSP(CspInit cspInit,
3572 const char* virtualDirRootPath,
3573 struct CspReader* reader);
3574
3575 struct AuthUserList* getAuthUserList(const char* name);
3576
3581
3586
3593
3598
3612
3623 void set404Page(const char* page404);
3624
3628 const char* get404Page();
3629
3630 int setUserObj(void* userObj, bool overwrite=false);
3631
3637 static void initStatic(void);
3638
3649 static void setErrHnd(UserDefinedErrHandler e);
3650
3651 /* No longer used */
3652 static int setZlib(ZlibInflateInit2 init,
3653 ZlibInflate inflate,
3654 ZlibInflateEnd end){
3655 (void)init; (void)inflate; (void)end;
3656 return 0; }
3662 static const char* getStatusCode(int code);
3663
3664
3665#endif
3666 DoubleList commandPool;
3667 DoubleList cmdReqList;
3668 HttpConnection noOpCon;
3669 HttpLinkConList freeList;
3670 HttpLinkConList readyList;
3671 HttpLinkConList connectedList;
3672 HttpRootDir rootDirContainer;
3673 SplayTree authUserTree; /* Used by AuthenticatedUser.c */
3674 struct HttpCmdThreadPoolIntf* threadPoolIntf;
3675 HttpLinkCon* connections;
3676 SoDisp* dispatcher;
3677 void* userObj;
3678 SingleList waitForConClose; /* Bounded WaitForConClose list, oldest first. */
3679 LspOnTerminateRequest lspOnTerminateRequest;
3680 int commandPoolSize;
3681 U16 noOfConnections;
3682 S16 maxHttpRequestLen;
3683 HttpSessionContainer sessionContainer;
3685
3686
3687/* Used exclusively by HttpCmdThreadPool */
3688void HttpServer_AsynchProcessDir(HttpServer* o,
3689 HttpDir* dir,
3690 HttpCommand* cmd);
3691/* Used exclusively by HttpCmdThreadPool */
3692#define HttpServer_setThreadPoolIntf(o, intf) (o)->threadPoolIntf=intf
3693#define HttpServer_luaenv(o) (o)->luaenv
3694
3695#ifdef __cplusplus
3696extern "C" {
3697#endif
3715 const char* virtualDirRootPath,
3716 HttpDir* dir);
3721 CspInit cspInit,
3722 const char* virtualDirRootPath,
3723 struct CspReader* reader);
3724#define HttpServer_getAuthUserList(o, name) \
3725 (AuthUserList*)SplayTree_find(&(o)->authUserTree, name)
3726#define HttpServer_getDispatcher(o) (o)->dispatcher
3727#define HttpServer_getFirstRootDir(o) \
3728 HttpDir_getFirstDir((HttpDir*)&(o)->rootDirContainer)
3729#define HttpServer_getUserObj(o) (o)->userObj
3730#define HttpServer_getSessionContainer(o) (&(o)->sessionContainer)
3731#define HttpServer_getMutex(o) SoDisp_getMutex((o)->dispatcher)
3735BA_API const char* HttpServer_getStatusCode(int code);
3736void HttpServer_addCon2ConnectedList(HttpServer* o, HttpConnection* con);
3737void HttpServer_doLingeringClose(
3738 HttpServer* o, HttpConnection* con, BaFileSize contLen);
3739
3744BA_API HttpConnection* HttpServer_getFreeCon(HttpServer* o);
3745void HttpServer_returnFreeCon(HttpServer* o, HttpConnection* con);
3746BA_API void HttpServer_installNewCon(HttpServer* o, HttpConnection* con);
3747BA_API void HttpServer_setErrHnd(UserDefinedErrHandler e);
3748void HttpServer_initStatic(void);
3749int HttpServer_termOldestIdleCon(HttpServer* o);
3753BA_API void HttpServer_set404Page(HttpServer*o, const char* page404);
3754#define HttpServer_get404Page(o) (o)->rootDirContainer.page404
3755BA_API int HttpServer_setUserObj(
3756 HttpServer* o, void* userObj, BaBool overwrite);
3757#define HttpServer_termAllSessions(o) \
3758 HttpSessionContainer_destructor(&(o)->sessionContainer)
3759/* No longer used */
3760#define HttpServer_setZlib(init,inflate,end);
3761#ifdef __cplusplus
3762}
3764 HttpServer_constructor(this, disp, cfg); }
3766 HttpServer_destructor(this); }
3768 return HttpServer_insertRootDir(this, dir); }
3770 return HttpServer_getMutex(this);
3771}
3772inline int HttpServer::insertDir(const char* virtualDirRootPath,HttpDir* dir){
3773 return HttpServer_insertDir(this, virtualDirRootPath, dir); }
3775 const char* virtualDirRootPath,
3776 struct CspReader* reader) {
3777 return HttpServer_insertCSP(this, cspInit, virtualDirRootPath, reader); }
3778inline struct AuthUserList* HttpServer::getAuthUserList(const char* name) {
3779 return HttpServer_getAuthUserList(this,name); }
3781 return HttpServer_getDispatcher(this); }
3783 return HttpServer_getFirstRootDir(this); }
3785 return HttpServer_getSessionContainer(this); }
3787 return HttpServer_getSession(this, id); }
3788inline void HttpServer::initStatic(void) {
3789 HttpServer_initStatic(); }
3790inline void HttpServer::setErrHnd(UserDefinedErrHandler e) {
3791 HttpServer_setErrHnd(e); }
3792inline void HttpServer::set404Page(const char* page404) {
3793 HttpServer_set404Page(this, page404); }
3794inline const char* HttpServer::get404Page() {
3795 return HttpServer_get404Page(this); }
3796inline int HttpServer::setUserObj(void* userObj, bool overwrite) {
3797 return HttpServer_setUserObj(this, userObj, overwrite); }
3798inline const char* HttpServer::getStatusCode(int code) {
3799 return HttpServer_getStatusCode(code);
3800}
3801
3802
3804 return HttpRequest_getResponse(this); }
3806 return HttpRequest_getConnection(this); }
3808 return HttpResponse_getRequest(this); }
3810 return HttpResponse_getCommand(this); }
3812 return HttpRequest_getCommand(this); }
3814 return HttpConnection_getServer(this); }
3815
3816#endif /* __cplusplus */
3817 /* end of StdWebServer */
3819
3820/* Internal use */
3821#if !BA_ENABLE_SHARKSSL || SHARKSSL_PSA_CONSUMER
3822
3823#define SHARKSSL_MD5_HASH_LEN 16
3824
3825typedef struct SharkSslMd5Ctx
3826{
3827 U32 total[2];
3828 U32 state[4];
3829 U8 buffer[64];
3830} SharkSslMd5Ctx;
3831
3832SHARKSSL_API void SharkSslMd5Ctx_constructor(SharkSslMd5Ctx* ctx);
3833SHARKSSL_API void SharkSslMd5Ctx_append(SharkSslMd5Ctx* ctx, const U8* data, U32 len);
3834SHARKSSL_API void SharkSslMd5Ctx_finish(SharkSslMd5Ctx* ctx, U8 digest[SHARKSSL_MD5_HASH_LEN]);
3835SHARKSSL_API int sharkssl_md5(const U8*, U16, U8*);
3836#endif
3837
3838#if !BA_ENABLE_SHARKSSL || SHARKSSL_PSA_CONSUMER
3839#define SHARKSSL_SHA1_HASH_LEN 20
3840
3841typedef struct SharkSslSha1Ctx
3842{
3843 U32 total[2];
3844 U32 state[5];
3845 U8 buffer[64];
3846} SharkSslSha1Ctx;
3847
3848SHARKSSL_API void SharkSslSha1Ctx_constructor(SharkSslSha1Ctx* ctx);
3849SHARKSSL_API void SharkSslSha1Ctx_append(SharkSslSha1Ctx* ctx, const U8* data, U32 len);
3850SHARKSSL_API void SharkSslSha1Ctx_finish(SharkSslSha1Ctx*, U8 digest[SHARKSSL_SHA1_HASH_LEN]);
3851#if SHARKSSL_PSA_CONSUMER
3852SHARKSSL_API int sharkssl_sha1(const U8* data, U32 len, U8* digest);
3853#endif
3854#if !BA_ENABLE_SHARKSSL
3855typedef void SharkSsl;
3856#endif
3857#endif
3858
3859#endif /* __httpServer_h */
BAS status codes and fatal-error reporting.
BaFatalErrorCodes
Fatal conditions reported to UserDefinedErrHandler, not ordinary returns.
Definition: BaErrorCodes.h:49
#define HttpConnection_getServer(o)
Definition: HttpConnection.h:127
struct HttpParameter HttpParameter
A persistent container object for HTTP parameters.
BA_API void httpFmtDate(char *buf, U16 bufLen, BaTime t)
Format an HTTP date in GMT.
BA_API char * httpEscape(char *out, const char *in)
Encodes characters that cannot be in a http URL.
BA_API HttpParameter * HttpParameter_clone(void *buf, struct HttpRequest *req)
Copy HTTP parameters to buf and return as a HttpParameter object.
BA_API char * httpUnescapeInternal(char *from, BaBool isForm)
Decode percent followed by two hex digits in place.
struct HttpInData HttpInData
The web-server "Request Data" container.
BA_API const char * HttpParameter_getParameter(HttpParameter *o, const char *paramName)
Returns the value of a request parameter as a const char*, or null if the parameter does not exist.
BA_API U32 HttpParameter_calculateSize(struct HttpRequest *req)
Calculate the HttpParameter size.
BA_API AuthenticatedUser * AuthenticatedUser_get2(HttpSession *session)
Find the authenticated-user session attribute.
void(* CspInit)(struct HttpDir *cspRoot, struct CspReader *reader)
Function prototype for the "initialize function" generated by CspLink.
Definition: HttpServer.h:209
void * baMalloc(size_t size)
Allocate uninitialized storage using the target's configured allocator.
void baFree(void *p)
Release storage using the target's configured allocator.
BaTime getLastAccessedTime()
Returns the last time the client sent a request associated with this session, as the number of second...
Definition: HttpServer.h:2541
BA_API BaTime HttpSession_getLastAccessedTime(HttpSession *o)
Returns the last time the client sent a request associated with this session, as the number of second...
void deleteCookie()
Specifies a path for the cookie to which the client should return the cookie.
Definition: HttpServer.h:831
HttpHeader * getHeaders(int *len)
Return an HTTP header iterator that can iterate and fetch all the HTTP headers.
Definition: HttpServer.h:1344
BA_API int HttpResponse_flush(HttpResponse *o)
Forces any content in the buffer to be written to the client.
int include(const char *path)
Includes the content of a resource (servlet, CSP page, HTML file) in the response.
Definition: HttpServer.h:2102
BaTime getCreationTime()
Returns the time when this session was created, measured in seconds since midnight January 1,...
Definition: HttpServer.h:2539
int setMaxAge(BaTime seconds)
Sets header "Cache-Control: max-age=seconds".
Definition: HttpServer.h:2147
int setDateHeader(const char *name, BaTime time)
Sets a response header with the given name and date-value.
Definition: HttpServer.h:2142
HttpDir * getNext()
Returns the next dir in the parent list.
Definition: HttpServer.h:3175
const char * getRequestURI()
Returns the pathname.
Definition: HttpServer.h:1327
const char * containsHeader(const char *name)
Searches the internal response header database for a header with the specified name.
Definition: HttpServer.h:2086
const char * getContentType()
Read the request's Content-Type header.
Definition: HttpServer.h:920
BA_API int HttpCookie_setDomain(HttpCookie *o, const char *pattern)
Specifies the domain within which this cookie should be presented.
BA_API int HttpResponse_setContentLength(HttpResponse *o, BaFileSize len)
Sets the "Content-Length" parameter value.
BA_API int HttpServer_insertCSP(HttpServer *o, CspInit cspInit, const char *virtualDirRootPath, struct CspReader *reader)
Insert and initialize a CSP Virtual Directory.
BA_API int HttpResponse_redirect2TLS(HttpResponse *o)
Prepares an HTTPS redirect (301) for a non-secure connection.
const char * getHost()
Read the request's Host header.
Definition: HttpServer.h:916
BA_API BaTime HttpCookie_getMaxAge(HttpCookie *o)
Read the stored cookie lifetime in seconds.
BA_API int HttpResponse_setResponseBuf(HttpResponse *o, BufPrint *buf, BaBool useDefBuffer)
This is an advanced function that makes it possible to redirect the output, which is normally sent to...
BA_API int HttpServerConfig_setRequest(HttpServerConfig *o, S16 min, S16 max)
Set the size of the HTTP request buffer.
int flush()
Forces any content in the buffer to be written to the client.
Definition: HttpServer.h:2096
void(* HttpSessionAttribute_Destructor)(struct HttpSessionAttribute *o)
HttpSessionAttribute termination callback function.
Definition: HttpServer.h:2248
int sendError(int eCode)
Sends an error response as a simple HTML page to the client using the specified status code.
Definition: HttpServer.h:2120
int forward(const char *path)
Forwards a request from a servlet to another resource (servlet, CSP file, or HTML file).
Definition: HttpServer.h:2098
BA_API BufPrint * HttpResponse_getWriter(HttpResponse *o)
Returns a BufPrint object that can send any type of data to the client.
void setHttpOnly(bool flag)
Marks or unmarks this Cookie as HttpOnly.
Definition: HttpServer.h:837
int setContentLength(BaFileSize len)
Sets the "Content-Length" parameter value.
Definition: HttpServer.h:2138
BA_API HttpHeader * HttpRequest_getHeaders(HttpRequest *o, int *len)
Return an HTTP header iterator that can iterate and fetch all the HTTP headers.
BA_API HttpDir_Service HttpDir_setService(HttpDir *o, HttpDir_Service s)
Replace the original service function in HttpDir with your own.
void setSecure(bool flag)
Inform the browser whether the cookie should be sent only using a secure protocol such as HTTPS – i....
Definition: HttpServer.h:835
BA_API void HttpCookie_setHttpOnly(HttpCookie *o, BaBool flag)
Marks or unmarks this Cookie as HttpOnly.
BA_API const char * HttpCookie_getComment(HttpCookie *o)
Returns the comment set for this cookie or null if the cookie comment is not set.
BA_API void HttpSession_terminate(HttpSession *o)
Unbinds any objects bound to this session object, runs the HttpSession destructor,...
HttpPage * findPage(HttpPage *iter, const char *name)
Searches for a page in this directory node.
Definition: HttpServer.h:3176
BA_API int HttpResponse_resetBuffer(HttpResponse *o)
Clears the content of the underlying buffer in the response without clearing headers or status code.
HttpServer * getServer()
Returns the web server object.
Definition: HttpServer.h:1325
int resetHeaders()
Removes all HTTP headers.
Definition: HttpServer.h:2116
BA_API HttpSessionAttribute * HttpSession_getAttribute(HttpSession *o, const char *name)
Returns the object bound with the specified name in this session, or null if no object is bound under...
struct HttpServer * getServer()
Get the web-server object.
Definition: HttpServer.h:2228
BA_API int HttpParameterIterator_constructor2(HttpParameterIterator *o, HttpParameter *param)
Initialize an iterator and select its first element.
BA_API const char * HttpCookie_getValue(HttpCookie *o)
Returns the value of the cookie.
HttpRequest * getRequest()
Get the request object.
Definition: HttpServer.h:2222
BA_API void HttpCookie_setMaxAge(HttpCookie *o, BaTime expiry)
Sets the maximum age of the cookie in seconds.
int insertPage(HttpPage *page)
Insert a page in the directory.
Definition: HttpServer.h:3167
BA_API HttpPage * HttpDir_getPage(HttpDir *o, const char *name)
Returns the page with the name given or NULL if not found.
int setAttribute(HttpSessionAttribute *value)
Binds an object to this session, using the name specified.
Definition: HttpServer.h:2551
BA_API int HttpResponse_redirect(HttpResponse *o, const char *path)
Internally redirects the request to another resource.
HttpMethod getMethodType()
Returns the method type.
Definition: HttpServer.h:1319
int send(const void *data, int len)
Used when sending raw data to the client.
Definition: HttpServer.h:2164
BA_API int HttpServerConfig_setNoOfHttpCommands(HttpServerConfig *o, U16 size)
The number of HttpCommand instances created by the web-server.
HttpResponse * getResponse()
Get the response object.
Definition: HttpServer.h:2224
int removeResponseBuf()
Remove buffer set by using setResponseBuf.
Definition: HttpServer.h:2114
BA_API const char * HttpResponse_containsHeader(HttpResponse *o, const char *name)
Searches the internal response header database for a header with the specified name.
BA_API int HttpResponse_send(HttpResponse *o, const void *data, int len)
Used when sending raw data to the client.
BA_API const char * HttpRequest_getHeaderValue(HttpRequest *o, const char *name)
Returns the value of the specified request header.
BA_API HttpPage * HttpDir_findPage(HttpDir *o, HttpPage *iter, const char *name)
Searches for a page in this directory node.
HttpMethod
HTTP method types.
Definition: HttpServer.h:941
BA_API int HttpRequest_wsUpgrade(HttpRequest *o)
Validate and send an HTTP/1.1 WebSocket version-13 handshake.
HttpConnection * getConnection()
Returns the connection object associated with this request.
Definition: HttpServer.h:3805
const char * getDomain()
Read the lower-case Host value without its port.
Definition: HttpServer.h:918
struct HttpRequest HttpRequest
The HttpServer creates an HttpRequest object when the HttpServer parses a client request.
void setAuthenticator(struct AuthenticatorIntf *authenticator, struct AuthorizerIntf *authorizer=0)
Set the optional authenticator and optional AuthorizerIntf.
Definition: HttpServer.h:3190
struct HttpConnection * getConnection()
Get the current connection object that the HttpCommand instance is bound with.
Definition: HttpServer.h:2226
int sendBufAsTxtError(int eCode)
Sends the data formatted into the HttpResponse buffer as an error message to the client.
Definition: HttpServer.h:2126
bool isForward() const
Returns true if this is a forward request from another servlet or CSP file.
Definition: HttpServer.h:2106
AuthenticatedUser * getAuthenticatedUser()
Returns the authenticated user or NULL if user is not authenticated.
Definition: HttpServer.h:1317
int unlink()
Unlinks/removes the page from the parent directory.
Definition: HttpServer.h:2778
BA_API int HttpResponse_setMaxAge(HttpResponse *response, BaTime seconds)
Sets header "Cache-Control: max-age=seconds".
HttpServer * getServer()
Get the server object.
Definition: HttpServer.h:2545
struct HttpSessionAttribute HttpSessionAttribute
The interface to an HttpSession attribute.
int setRequest(S16 min, S16 max)
Set the size of the HTTP request buffer.
Definition: HttpServer.h:3423
BA_API BaTime HttpSession_getCreationTime(HttpSession *o)
Returns the time when this session was created, measured in seconds since midnight January 1,...
bool hasMoreElements()
Returns true if more elements.
Definition: HttpServer.h:1352
HttpStdHeaders * getStdHeaders()
Returns an object containing standard HTTP headers.
Definition: HttpServer.h:1331
const char * getHeaderValue(const char *name)
Returns the value of the specified request header.
Definition: HttpServer.h:1335
int setDefaultHeaders()
Sets the most common header values in servlet and CSP files.
Definition: HttpServer.h:2166
BA_API int HttpServer_insertDir(HttpServer *o, const char *virtualDirRootPath, HttpDir *dir)
Insert a directory node into the virtual file system.
BA_API int HttpResponse_setHeader(HttpResponse *o, const char *name, const char *value, BaBool replace)
Sets a HTTP response header with the given name and value.
int resetBuffer()
Clears the content of the underlying buffer in the response without clearing headers or status code.
Definition: HttpServer.h:2118
int insertCSP(CspInit cspInit, const char *virtualDirRootPath, struct CspReader *reader)
Insert and initialize a CSP Virtual Directory.
Definition: HttpServer.h:3774
struct HttpServerConfig HttpServerConfig
Use an instance of this class if you want to override the default web-server parameters.
const char * encodeRedirectURL(const char *pathName)
Encodes the specified URL into an absolute URL, or if encoding is not needed, returns the URL unchang...
Definition: HttpServer.h:2090
bool initial() const
Returns true if this is the initial page.
Definition: HttpServer.h:2110
~HttpServer()
Stop using the server before destruction.
Definition: HttpServer.h:3765
struct HttpStdHeaders HttpStdHeaders
Standard HTTP header values.
static void setErrHnd(UserDefinedErrHandler e)
You can set your own user defined error handler for the web-server.
Definition: HttpServer.h:3790
void terminate()
Unbinds any objects bound to this session object, runs the HttpSession destructor,...
Definition: HttpServer.h:2547
struct HttpResponse HttpResponse
This object is used when sending response messages back to the client.
~HttpPage()
The HttpPage destructor unlinks the page from the parent directory.
Definition: HttpServer.h:2773
BA_API void HttpDir_constructor(HttpDir *o, const char *name, S8 priority)
Constructor for creating a sub-directory.
void nextElement()
Advance to the next element.
Definition: HttpServer.h:561
SBaFileSize getContentLength()
Read the request's declared Content-Length in bytes.
Definition: HttpServer.h:922
U32 byteCount()
Returns number of bytes sent thus far.
Definition: HttpServer.h:2088
int setCommit(U16 size)
Set the size of the HTTP response commit buffer.
Definition: HttpServer.h:3429
BA_API BaBool HttpCookie_getSecure(HttpCookie *o)
Read the cookie's Secure flag.
HttpDir()
Constructor for creating a root dir, a root dir has no name.
Definition: HttpServer.h:3155
struct HttpServer HttpServer
Route and process HTTP requests using a borrowed dispatcher.
int setValue(const char *newValue)
Assigns a new value to a cookie after the cookie is created.
Definition: HttpServer.h:839
BA_API HttpDir * HttpDir_getDir(HttpDir *o, const char *name)
Returns the first directory with the name given or NULL if not found.
HttpCookie * getCookie(const char *name)
Returns the requested cookie or NULL if no cookie matches the name.
Definition: HttpServer.h:1337
BA_API const char * HttpCookie_getDomain(HttpCookie *o)
Returns the domain name set for this cookie.
ThreadMutex * getMutex()
Get the dispatcher mutex.
Definition: HttpServer.h:3769
BA_API struct HttpSession * HttpRequest_getSession(HttpRequest *o, BaBool create)
Returns the current HttpSession associated with this request, or if there is no current session and c...
void service(HttpRequest *request, HttpResponse *response)
The virtual service function (C callback function) is normally run by the parent directory when deleg...
Definition: HttpServer.h:2779
void setMaxAge(BaTime expiry)
Sets the maximum age of the cookie in seconds.
Definition: HttpServer.h:829
int setResponseBuf(BufPrint *buf, bool useDefBuffer=true)
This is an advanced function that makes it possible to redirect the output, which is normally sent to...
Definition: HttpServer.h:2112
HttpSessionContainer * getSessionContainer()
Get the HttpSessionContainer.
Definition: HttpServer.h:3784
HttpDir * getFirstRootDir()
Returns the first root directory.
Definition: HttpServer.h:3782
HttpSessionAttribute * getAttribute(const char *name)
Returns the object bound with the specified name in this session, or null if no object is bound under...
Definition: HttpServer.h:2537
AuthenticatedUser * getAuthenticatedUser()
Returns the AuthenticatedUser if user is authenticated.
Definition: HttpServer.h:2562
BA_API BaTime HttpSession_getMaxInactiveInterval(HttpSession *o)
Returns the maximum time interval, in seconds, that the session container will keep this session open...
BA_API int HttpResponse_setDefaultHeaders(HttpResponse *o)
Sets the most common header values in servlet and CSP files.
int setContentType(const char *type)
Sets the "Content-Type" parameter value.
Definition: HttpServer.h:2140
void(* HttpPage_Service)(struct HttpPage *page, HttpRequest *request, HttpResponse *response)
The HttpPage service function.
Definition: HttpServer.h:2630
struct HttpCookie HttpCookie
A cookie is used for exchanging a small amount of information between a HttpPage and a web browser.
BA_API const char * HttpRequest_getRequestURI(HttpRequest *o)
Returns the pathname.
U32 getId()
Returns a unique identifier assigned to this session.
Definition: HttpServer.h:2559
BA_API int HttpResponse_sendBufAsError(HttpResponse *o, int eCode)
Sends the data formatted into the HttpResponse buffer as an error message to the client.
BA_API int HttpServer_insertRootDir(HttpServer *o, HttpDir *dir)
Insert a root directory node.
BA_API const char * HttpRequest_getRequestURL(HttpRequest *o, BaBool forceHttps)
Reconstructs the URL the client used to make the request.
BA_API BaBool HttpRequest_checkTime(HttpRequest *o, struct HttpResponse *resp, BaTime time)
Parses and checks if the "If-Modified-Since" time is equal or greater than "time".
int setResponseHeader(U16 min, U16 max)
Set the size of the HTTP response header buffer.
Definition: HttpServer.h:3425
BA_API int HttpServerConfig_setCommit(HttpServerConfig *o, U16 size)
Set the size of the HTTP response commit buffer.
void set404Page(const char *page404)
Set a more user friendly 404 page.
Definition: HttpServer.h:3792
BA_API void HttpServer_set404Page(HttpServer *o, const char *page404)
Set a more user friendly 404 page.
const char * encodeRedirectURLWithParam(const char *pathName)
This method is similar to HttpResponse::encodeRedirectURL, but this method also includes all URL-enco...
Definition: HttpServer.h:2092
BA_API void HttpPage_destructor(HttpPage *o)
The HttpPage destructor unlinks the page from the parent directory.
BA_API int HttpResponse_removeResponseBuf(HttpResponse *o)
Remove buffer set by using setResponseBuf.
static void initStatic(void)
The only purpose with this function is to clean all static variables that are in the BSS section; i....
Definition: HttpServer.h:3788
BA_API int HttpResponse_resetHeaders(HttpResponse *o)
Removes all HTTP headers.
struct HttpServer * getServer()
Definition: HttpServer.h:3813
BA_API struct HttpServer * HttpSession_getServer(HttpSession *o)
Get the server object.
BufPrint * getWriter()
Returns a BufPrint object that can send any type of data to the client.
Definition: HttpServer.h:2160
BA_API const char * HttpRequest_getParameter(HttpRequest *o, const char *paramName)
Returns the value of a request parameter as a const char* or null if the parameter does not exist.
BA_API int HttpCookie_setValue(HttpCookie *o, const char *newValue)
Assigns a new value to a cookie after the cookie is created.
int write(const void *data, int len, int useBuffering=TRUE)
Used for sending pre-formatted data to the client.
Definition: HttpServer.h:2162
BA_API const char * HttpResponse_encodeRedirectURL(HttpResponse *o, const char *pathName)
Encodes the specified URL into an absolute URL, or if encoding is not needed, returns the URL unchang...
int setMaxSessions(U16 size)
Maximum allowed active HttpSession objects.
Definition: HttpServer.h:3435
HttpInData * getBuffer()
Get the internal rec buffer.
Definition: HttpServer.h:1354
BA_API int HttpCookie_setComment(HttpCookie *o, const char *purpose)
Specifies a comment that describes a cookie's purpose.
BA_API int HttpServerConfig_setResponseData(HttpServerConfig *o, U16 size)
The HttpResponse object stores formatted data in the response data buffer.
const char * encodeUrl(const char *path)
Escape a URL path into a response-owned buffer.
Definition: HttpServer.h:2094
BA_API int HttpResponse_setContentType(HttpResponse *o, const char *type)
Sets the "Content-Type" parameter value.
int setNoOfHttpCommands(U16 size)
The number of HttpCommand instances created by the web-server.
Definition: HttpServer.h:3431
HttpDir * createOrGet(const char *name)
Returns a sub-directory with the given name.
Definition: HttpServer.h:3181
bool authenticateAndAuthorize(HttpCommand *cmd, const char *path)
Authenticate and authorize the user.
Definition: HttpServer.h:3194
int(* HttpDir_Service)(struct HttpDir *o, const char *relPath, HttpCommand *cmd)
The HttpDir service callback function.
Definition: HttpServer.h:2794
HttpServer(SoDisp *dispatcher, HttpServerConfig *cfg=0)
Create a Web Server object.
Definition: HttpServer.h:3763
struct HttpCommand HttpCommand
The HttpCommand class is a container class for the HttpRequest and HttpResponse command pair.
BA_API void HttpServer_destructor(HttpServer *o)
Stop using the server before destruction.
BA_API void HttpSession_decrRefCntr(HttpSession *o)
Decrements the session reference counter.
BA_API int HttpCookie_setPath(HttpCookie *o, const char *uri)
Set the cookie path.
char * fmtHeader(const char *name, int valueLen, bool replace=true)
Pre-allocate memory for a {name, value} pair in the response header database.
Definition: HttpServer.h:2149
bool isInclude() const
Returns true if this is an include from another servlet or CSP file.
Definition: HttpServer.h:2108
int unlink()
Unlinks/removes the directory from the parent directory.
Definition: HttpServer.h:3187
char * getRootPath()
Calculates the root of where the HttpDir instance is installed in the virtual file system.
Definition: HttpServer.h:3163
BA_API HttpDir * HttpDir_findDir(HttpDir *iter, const char *name, unsigned int nameLen)
Searches for a sub-directory in this directory node.
int checkMethods(HttpResponse *resp, U32 methods, bool addDefault=TRUE)
Check allowed HTTP methods on the original request.
Definition: HttpServer.h:1310
BA_API int HttpParameterIterator_constructor(HttpParameterIterator *o, struct HttpRequest *req)
Initialize an iterator and select its first element.
const char * getVersion()
Returns the HTTP version as a string, normally "1.1".
Definition: HttpServer.h:1333
void BA_API HttpPage_constructor(HttpPage *o, HttpPage_Service service, const char *name)
The HttpPage constructor.
BA_API HttpDir * HttpDir_createOrGet(HttpDir *o, const char *name)
Returns a sub-directory with the given name.
int printf(const char *fmt,...)
printf is used for sending formatted data to the client.
Definition: HttpServer.h:2155
BA_API BaBool HttpCookie_getHttpOnly(HttpCookie *o)
Return the HttpOnly attribute.
int redirect2TLS()
Prepares an HTTPS redirect (301) for a non-secure connection.
Definition: HttpServer.h:2136
BA_API int HttpSession_removeAttribute(HttpSession *o, const char *name)
Removes the object bound with the specified name from this session.
BA_API const char * HttpCookie_getPath(HttpCookie *o)
Returns the path on the server to which the browser returns this cookie.
BA_API const char * HttpResponse_encodeUrl(HttpResponse *o, const char *path)
Escape a URL path into a response-owned buffer.
BA_API int HttpPage_unlink(HttpPage *o)
Unlinks/removes the page from the parent directory.
HttpPage * getFirstPage()
Returns the first page.
Definition: HttpServer.h:3169
SoDisp * getDispatcher()
Returns the dispatcher object.
Definition: HttpServer.h:3780
BA_API char * HttpResponse_fmtHeader(HttpResponse *o, const char *name, int valueLen, BaBool replace)
Pre-allocate memory for a {name, value} pair in the response header database.
BA_API int HttpServerConfig_setResponseHeader(HttpServerConfig *o, U16 min, U16 max)
Set the size of the HTTP response header buffer.
HttpDir * getDir(const char *name)
Returns the first directory with the name given or NULL if not found.
Definition: HttpServer.h:3171
int wsUpgrade()
Validate and send an HTTP/1.1 WebSocket version-13 handshake.
Definition: HttpServer.h:1341
BA_API int HttpDir_unlink(HttpDir *o)
Unlinks/removes the directory from the parent directory.
BA_API int HttpRequest_checkMethods(HttpRequest *o, struct HttpResponse *resp, U32 methods, BaBool addDefault)
Check allowed HTTP methods on the original request.
static const char * getStatusCode(int code)
Return a short description for common HTTP error codes.
Definition: HttpServer.h:3798
BA_API int HttpServerConfig_setMaxSessions(HttpServerConfig *o, U16 size)
Maximum allowed active HttpSession objects.
char * makeAbsPath(const char *relPath, int relPathLen)
Makes an absolute path based on where the HttpDir instance is installed in the virtual file system an...
Definition: HttpServer.h:3161
struct HttpSessionContainer HttpSessionContainer
The HttpSession container class.
HttpSession * getSession(U32 id)
Returns the HttpSession associated with id or NULL if not found.
Definition: HttpServer.h:3786
U32 getUseCounter()
Get the session usage counter.
Definition: HttpServer.h:2560
bool committed() const
Returns a boolean indicating if the response has been committed.
Definition: HttpServer.h:2104
BA_API int HttpResponse_write(HttpResponse *o, const void *data, int len, int useBuffering)
Used for sending pre-formatted data to the client.
BA_API int HttpDir_authenticateAndAuthorize(HttpDir *o, HttpCommand *cmd, const char *path)
Authenticate and authorize the user.
int redirect(const char *path)
Internally redirects the request to another resource.
Definition: HttpServer.h:2100
BA_API void HttpSession_setMaxInactiveInterval(HttpSession *o, BaTime interval)
Specifies the time, in seconds, between client requests before the session container will invalidate ...
void incrRefCntr()
Increments the session reference counter.
Definition: HttpServer.h:2555
const char * getConnection()
Read the request's Connection header.
Definition: HttpServer.h:914
const char * getParameter(const char *paramName)
Returns the value of a request parameter as a const char* or null if the parameter does not exist.
Definition: HttpServer.h:1339
void decrRefCntr()
Decrements the session reference counter.
Definition: HttpServer.h:2557
const char * getRequestURL(bool forceHttps=false)
Reconstructs the URL the client used to make the request.
Definition: HttpServer.h:1329
BA_API int HttpServerConfig_setNoOfHttpConnections(HttpServerConfig *o, U16 size)
Number of HttpConnection instances.
BA_API HttpCookie * HttpResponse_createCookie(struct HttpResponse *o, const char *name)
Create a cookie.
BA_API void HttpDir_destructor(HttpDir *o)
Unlink this directory and notify all child pages/directories through their service callbacks with NUL...
HttpCommand * getCommand()
Get the HttpCommand object.
Definition: HttpServer.h:3811
int insertDir(HttpDir *dir)
Insert a sub-directory.
Definition: HttpServer.h:3165
void setMaxInactiveInterval(BaTime interval)
Specifies the time, in seconds, between client requests before the session container will invalidate ...
Definition: HttpServer.h:2553
void setMaxSessions(int max)
Set the maximum number of session objects.
Definition: HttpServer.h:2614
struct HttpSession HttpSession
Provides a way to identify a user across more than one page request or visit to a web site,...
bool isLinked()
Returns true if this page node is installed into a parent directory.
Definition: HttpServer.h:2775
const char * get404Page()
Returns a pointer to the current 404 page, if any.
Definition: HttpServer.h:3794
HttpCommand * getCommand()
Get the HttpCommand object.
Definition: HttpServer.h:3809
BA_API HttpSession * HttpServer_getSession(HttpServer *o, U32 id)
Returns the HttpSession associated with id or NULL if not found.
static HttpDir * findDir(HttpDir *iter, const char *name, unsigned int nameLen)
Searches for a sub-directory in this directory node.
Definition: HttpServer.h:3178
int setPath(const char *uri)
Set the cookie path.
Definition: HttpServer.h:833
HttpSession * getSession(BaBool create=true)
Returns the current HttpSession associated with this request, or if there is no current session and c...
Definition: HttpServer.h:1350
BA_API void HttpSessionAttribute_constructor(HttpSessionAttribute *o, const char *name, HttpSessionAttribute_Destructor d)
Initialize a session attribute.
HttpServerConfig()
The constructor sets up the default parameters.
Definition: HttpServer.h:3421
const char * getMethod()
Returns a string representation of the value returned by HttpRequest::getMethodType.
Definition: HttpServer.h:1321
BaTime getMaxInactiveInterval()
Returns the maximum time interval, in seconds, that the session container will keep this session open...
Definition: HttpServer.h:2543
BA_API const char * HttpServer_getStatusCode(int code)
Return a short description for common HTTP error codes.
BA_API void HttpSessionAttribute_destructor(HttpSessionAttribute *o)
Terminate an unattached attribute and release its copied name.
HttpCookie * createCookie(const char *name)
Create a cookie.
Definition: HttpServer.h:2084
HttpPage * getPage(const char *name)
Returns the page with the name given or NULL if not found.
Definition: HttpServer.h:3173
BA_API const char * HttpCookie_getName(HttpCookie *o)
Returns the name of the cookie.
int setComment(const char *purpose)
Specifies a comment that describes a cookie's purpose.
Definition: HttpServer.h:825
BA_API int HttpDir_insertDir(HttpDir *o, HttpDir *dir)
Insert a sub-directory.
int fmtError(int eCode, const char *fmt,...)
This method implements a printf like implementation for formatting and sending an error message.
Definition: HttpServer.h:2128
BA_API const char * HttpRequest_getVersion(HttpRequest *o)
Returns the HTTP version as a string, normally "1.1".
struct HttpPage HttpPage
An HttpPage, which is typically created by the CSP compiler, is similar to a Java servlet.
BA_API int HttpResponse_sendRedirect(HttpResponse *o, const char *url)
Sends a temporary redirect (302) response to the client using the specified redirect location URL.
HttpDir_Service setService(HttpDir_Service s)
Replace the original service function in HttpDir with your own.
Definition: HttpServer.h:3183
HttpDir * getFirstDir()
Returns the first sub-directory.
Definition: HttpServer.h:3170
int setDomain(const char *pattern)
Specifies the domain within which this cookie should be presented.
Definition: HttpServer.h:827
bool isLinked()
Returns true if this directory node is installed into a parent directory.
Definition: HttpServer.h:3188
HttpResponse * getResponse()
Returns the HttpResponse object.
Definition: HttpServer.h:3803
int insertDir(const char *virtualDirRootPath, HttpDir *dir)
Insert a directory node into the virtual file system.
Definition: HttpServer.h:3772
void setStatus(int statusCode)
Sets the status code for this response.
Definition: HttpServer.h:2152
BA_API void HttpDir_p403(HttpDir *o, const char *p403)
Set a 403 denied request handler.
int insertRootDir(HttpDir *dir)
Insert a root directory node.
Definition: HttpServer.h:3767
int setHeader(const char *name, const char *value, bool replace=true)
Sets a HTTP response header with the given name and value.
Definition: HttpServer.h:2144
HttpRequest * getRequest()
Get the HttpRequest object.
Definition: HttpServer.h:3807
BA_API void HttpCookie_setSecure(HttpCookie *o, BaBool flag)
Inform the browser whether the cookie should be sent only using a secure protocol such as HTTPS – i....
BA_API void HttpServer_constructor(HttpServer *, SoDisp *, HttpServerConfig *)
Initialize a server in caller-provided storage (first argument), using a required borrowed dispatcher...
void p403(const char *p403)
Set a 403 denied request handler.
Definition: HttpServer.h:3185
BA_API void HttpCookie_activate(HttpCookie *o)
Activates the cookie.
BA_API int HttpResponse_setDateHeader(HttpResponse *o, const char *name, BaTime t)
Set a copied date header; call before response commitment.
HttpSession * getSession()
Get the session object.
Definition: HttpServer.h:2327
BaBool checkTime(struct HttpResponse *resp, BaTime time)
Parses and checks if the "If-Modified-Since" time is equal or greater than "time".
Definition: HttpServer.h:1315
BA_API int HttpResponse_sendBufAsTxtError(HttpResponse *o, int eCode)
Sends the data formatted into the HttpResponse buffer as an error message to the client.
void activate()
Activates the cookie.
Definition: HttpServer.h:845
BA_API HttpCookie * HttpRequest_getCookie(HttpRequest *o, const char *name)
Returns the requested cookie or NULL if no cookie matches the name.
int sendRedirect(const char *url)
Sends a temporary redirect (302) response to the client using the specified redirect location URL.
Definition: HttpServer.h:2134
BA_API int HttpSession_setAttribute(HttpSession *o, HttpSessionAttribute *value)
Binds an object to this session, using the name specified.
int setResponseData(U16 size)
The HttpResponse object stores formatted data in the response data buffer.
Definition: HttpServer.h:3427
BA_API int HttpSession_fmtSessionId(HttpSession *o, U8 *buf, size_t bufSize)
Format the full session token as hexadecimal text.
int removeAttribute(const char *name)
Removes the object bound with the specified name from this session.
Definition: HttpServer.h:2549
BA_API int HttpDir_insertPage(HttpDir *o, HttpPage *page)
Insert a page in the directory.
int setNoOfHttpConnections(U16 size)
Number of HttpConnection instances.
Definition: HttpServer.h:3433
BA_API int HttpResponse_printf(HttpResponse *o, const char *fmt,...)
printf is used for sending formatted data to the client.
BA_API char * HttpDir_makeAbsPath(HttpDir *o, const char *relPath, int relPathLen)
Makes an absolute path based on where the HttpDir instance is installed in the virtual file system an...
int sendBufAsError(int eCode)
Sends the data formatted into the HttpResponse buffer as an error message to the client.
Definition: HttpServer.h:2124
HttpSessionAttribute(const char *name, HttpSessionAttribute_Destructor terminate)
Create a session attribute.
Definition: HttpServer.h:2323
struct HttpDir HttpDir
An instance of the HttpDir class, which is a collection of zero or more resources,...
~HttpDir()
Unlink this directory and notify all child pages/directories through their service callbacks with NUL...
Definition: HttpServer.h:3159
struct HttpParameterIterator HttpParameterIterator
The HttpParameterIterator is used for iterating through the form elements parsed by the HttpServer ob...
BA_API void HttpServerConfig_constructor(HttpServerConfig *o)
The constructor sets up the default parameters.
uint16_t U16
Unsigned 16-bit integer.
Definition: GenPrimT.h:94
S32 SBaFileSize
Signed file-size value in bytes; 32 bits with BA_FILE_OFFSET_BITS=32.
Definition: GenPrimT.h:141
int32_t S32
Signed 32-bit integer.
Definition: GenPrimT.h:88
S64 BaTime
An arithmetic type representing calendar time with epoch of 1970-01-01 00:00:00 UTC,...
Definition: GenPrimT.h:106
uint32_t U32
Unsigned 32-bit integer.
Definition: GenPrimT.h:96
int16_t S16
Signed 16-bit integer.
Definition: GenPrimT.h:86
uint8_t U8
Unsigned 8-bit integer.
Definition: GenPrimT.h:92
U8 BaBool
Boolean stored in an unsigned byte; FALSE is zero and TRUE is one.
Definition: GenPrimT.h:121
int8_t S8
Signed 8-bit integer.
Definition: GenPrimT.h:84
U32 BaFileSize
Unsigned file size or position in bytes; 32 bits with BA_FILE_OFFSET_BITS=32.
Definition: GenPrimT.h:139
Abstract base class implemented by BasicAuthUser, FormAuthUser and DigestAuthUser.
Definition: AuthenticatedUser.h:273
Abstract interface class implemented by DigestAuthenticator, FormAuthenticator and BasicAuthenticator...
Definition: AuthenticatedUser.h:426
An abstract class, which you must implement, provides a method of authorizing an authenticated user.
Definition: AuthenticatedUser.h:115
The BufPrint class, which implements a compact printf-style formatter, is a base class used by severa...
Definition: BufPrint.h:132
Abstract interface class for reading the "dat" file generated by HttpLink.
Definition: CspRunTm.h:126
Worker-pool dispatch interface borrowed by HttpServer.
Definition: HttpCmdThreadPoolIntf.h:63
The HttpCommand class is a container class for the HttpRequest and HttpResponse command pair.
Definition: HttpServer.h:2179
Contains information about the physical socket connection.
Definition: HttpConnection.h:80
A cookie is used for exchanging a small amount of information between a HttpPage and a web browser.
Definition: HttpServer.h:597
const char * getComment() const
Returns the comment set for this cookie or null if the cookie comment is not set.
Definition: HttpServer.h:605
const char * getPath() const
Returns the path on the server to which the browser returns this cookie.
Definition: HttpServer.h:629
BaTime getMaxAge() const
Read the stored cookie lifetime in seconds.
Definition: HttpServer.h:618
bool getSecure() const
Read the cookie's Secure flag.
Definition: HttpServer.h:635
const char * getDomain() const
Returns the domain name set for this cookie.
Definition: HttpServer.h:610
const char * getValue() const
Returns the value of the cookie.
Definition: HttpServer.h:646
bool getHttpOnly() const
Return the HttpOnly attribute.
Definition: HttpServer.h:641
const char * getName() const
Returns the name of the cookie.
Definition: HttpServer.h:623
An instance of the HttpDir class, which is a collection of zero or more resources,...
Definition: HttpServer.h:2824
HttpDir * getParent() const
Returns the parent directory or NULL if no parent.
Definition: HttpServer.h:2951
const char * getName() const
Returns the directory name.
Definition: HttpServer.h:2946
The web-server "Request Data" container.
Definition: HttpServer.h:285
const char * getBuf()
Get pointer to start of PUT/POST data.
Definition: HttpServer.h:321
S32 getBufSize()
Get the number of bytes currently available from getBuf().
Definition: HttpServer.h:323
An HttpPage, which is typically created by the CSP compiler, is similar to a Java servlet.
Definition: HttpServer.h:2697
const char * getName() const
Returns the page name.
Definition: HttpServer.h:2721
The HttpParameterIterator is used for iterating through the form elements parsed by the HttpServer ob...
Definition: HttpServer.h:484
const char * getValue() const
Return the borrowed current value, or NULL at the end.
Definition: HttpServer.h:515
const char * getName() const
Return the borrowed current name, or NULL at the end.
Definition: HttpServer.h:511
A persistent container object for HTTP parameters.
Definition: HttpServer.h:387
static U32 calculateSize(struct HttpRequest *req)
Calculate the HttpParameter size.
Definition: HttpServer.h:446
const char * getParameter(const char *paramName)
Returns the value of a request parameter as a const char*, or null if the parameter does not exist.
Definition: HttpServer.h:450
static HttpParameter * clone(void *buf, struct HttpRequest *req)
Copy HTTP parameters to buf and return as a HttpParameter object.
Definition: HttpServer.h:448
The HttpServer creates an HttpRequest object when the HttpServer parses a client request.
Definition: HttpServer.h:981
This object is used when sending response messages back to the client.
Definition: HttpServer.h:1387
Use an instance of this class if you want to override the default web-server parameters.
Definition: HttpServer.h:3227
Route and process HTTP requests using a borrowed dispatcher.
Definition: HttpServer.h:3463
The interface to an HttpSession attribute.
Definition: HttpServer.h:2279
The HttpSession container class.
Definition: HttpServer.h:2581
Provides a way to identify a user across more than one page request or visit to a web site,...
Definition: HttpServer.h:2338
Standard HTTP header values.
Definition: HttpServer.h:854
The SoDisp dispatches any socket connection that contains data by calling the SoDispCon::execute memb...
Definition: SoDisp.h:97
Intrusive tree node.
Definition: SplayTree.h:52
Self-adjusting tree of caller-owned nodes, with unique keys.
Definition: SplayTree.h:109
A mutual exclusion class.
Definition: ThreadLib.h:196
User database interface used by the authentication classes.
Definition: AuthenticatedUser.h:196