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 6056 2026-09-20 05:09:33Z 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 "6057"
40#define BASLIB_VER_NO 6057
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#ifndef BA_STACKSZ
93#define BA_STACKSZ 24000
94#endif
95
96
97/* This ID must match the ID in LoginKey.java */
98#define BA_COOKIE_ID "z9ZAqJtI"
99
100#ifndef __DOXYGEN__
101struct HttpRequest;
102struct HttpResponse;
103struct HttpPage;
104struct HttpServer;
105struct HttpSession;
106struct HttpLinkCon;
107struct HttpDir;
108struct AuthenticatedUser;
109struct UserIntf;
110struct CspReader;
112struct AuthUserList;
113struct AuthorizerIntf;
114struct AuthenticatorIntf;
115struct LHttpCommand;
116#endif
117
118
119/* NonBlockingSendBuf is used when sending asynchronous, non-blocking
120 data. A pointer to this buffer is stored in SoDispCon.sslData for
121 HTTP connections; this pointer is not used for anything else for a
122 non-secure socket connection. */
123typedef struct
124{
125 int cursor;
126 int bufLen;
127 int maxBufLen;
128 char buf[1];
129} NonBlockingSendBuf;
130
131
132#ifdef __cplusplus
133extern "C" {
134#endif
136 struct HttpSession* session);
143BA_API void httpFmtDate(char* buf, U16 bufLen, BaTime t);
144
149#define httpUnescape(s) httpUnescapeInternal(s,FALSE)
150
155#define httpFormUnescape(s) httpUnescapeInternal(s,TRUE)
156
166BA_API char* httpUnescapeInternal(char* from, BaBool isForm);
167
175BA_API char* httpEscape(char* out, const char* in);
176#ifdef __cplusplus
177}
178#endif
179
180
181typedef void (*UserDefinedErrHandler)(BaFatalErrorCodes ecode1,
182 unsigned int ecode2,
183 const char* file,
184 int line);
185
186
212typedef void (*CspInit)(
213 struct HttpDir* cspRoot,struct CspReader* reader);
214 /* end of CSP */
216
217/* no longer used. included for compatibility.
218 */
219struct z_stream_s;
220typedef int (*ZlibInflateInit2)(struct z_stream_s* s, int windowBits,
221 const char *version, int stream_size);
222
223typedef int (*ZlibInflate)(struct z_stream_s* s, int flush);
224typedef int (*ZlibInflateEnd)(struct z_stream_s* s);
225
226
227#ifndef __DOXYGEN__
228
229typedef struct
230{
231 char* buf;
232 U16 size;
233 U16 index;
234} HttpAllocator;
235
236
239typedef struct HttpHeader
240{
241#ifdef __cplusplus
242 const char* name(HttpRequest* req);
243 const char* value(HttpRequest* req);
244#endif
245 U16 nameI;
246 U16 valueI;
247}HttpHeader;
248
249#ifdef __cplusplus
250extern "C" {
251#endif
252BA_API const char* HttpHeader_name(HttpHeader* o, struct HttpRequest* req);
253BA_API const char* HttpHeader_value(HttpHeader* o, struct HttpRequest* req);
254#ifdef __cplusplus
255}
256inline const char* HttpHeader::name(HttpRequest* req) {
257 return HttpHeader_name(this, req); }
258inline const char* HttpHeader::value(HttpRequest* req) {
259 return HttpHeader_value(this, req); }
260#endif
261
262#endif
263
264
265
266
267
268/*===========================================================================
269 *
270 * HttpInData
271 *---------------------------------------------------------------------------
272 * Description:
273 */
274
275#ifndef __DOXYGEN__
276
277typedef enum {
278 HttpInData_ParseHeader,
279 HttpInData_ReadBody,
280 HttpInData_ReadBodyAndParseUrlEncData
281} HttpInData_ParseState;
282#endif
283
284
287typedef struct HttpInData
288{
289#ifdef __cplusplus
292 const char* getBuf();
293
300 S32 getBufSize();
301#endif
302 HttpAllocator allocator;
303 struct HttpRequest* request;
304 U16 lineStartI;
305 U16 lineEndI;
306 S16 maxRequest;
307 U8 parseState; /* HttpInData_ParseState */
308 U8 overflow; /* Used for pipelined requests */
310
311#define HttpAllocator_2Ptr(o, index) ((&(o)->buf[index]))
312#define HttpInData_lineStartPtr(o) \
313 HttpAllocator_2Ptr(&(o)->allocator,(o)->lineStartI)
314
315#define HttpInData_getBufSize(o) \
316 ((o)->lineStartI < (o)->allocator.index ? \
317 (o)->allocator.index-(o)->lineStartI : 0)
318
319#define HttpInData_getBuf(o) HttpInData_lineStartPtr(o)
320BaBool HttpInData_hasMoreData(HttpInData* o);
321
322#ifdef __cplusplus
323inline const char* HttpInData::getBuf() {
324 return HttpInData_getBuf(this); }
326 return HttpInData_getBufSize(this); }
327#endif
328
329
330
388typedef struct HttpParameter
389{
390#ifdef __cplusplus
396 static U32 calculateSize(struct HttpRequest* req);
397
407 static HttpParameter* clone(void* buf, struct HttpRequest* req);
408
420 const char* getParameter(const char* paramName);
421
422 private:
423 HttpParameter() {}
424#endif
425 U16 formLen;
427
428
429#ifdef __cplusplus
430extern "C" {
431#endif
439BA_API HttpParameter* HttpParameter_clone(void* buf, struct HttpRequest* req);
443BA_API const char* HttpParameter_getParameter(
444 HttpParameter* o,const char* paramName);
445
446#ifdef __cplusplus
447}
449 return HttpParameter_calculateSize(req); }
450inline HttpParameter* HttpParameter::clone(void* buf, struct HttpRequest* req){
451 return HttpParameter_clone(buf, req); }
452inline const char* HttpParameter::getParameter(const char* paramName) {
453 return HttpParameter_getParameter(this, paramName); }
454#endif
455
456
485{
486#ifdef __cplusplus
491
498
501 void nextElement();
503 bool hasMoreElements();
505 const char* getName() const { return name; }
507 const char* getValue() const { return value; }
508 private:
509#endif
510 void* formElemBase;
511 U8* dataEntry;
512 U16 pos;
513 U16 formLen;
514 const char* name;
515 const char* value;
516
518
519#ifdef __cplusplus
520extern "C" {
521#endif
522
531 HttpParameterIterator* o, struct HttpRequest* req);
540 HttpParameter* param);
541BA_API void HttpParameterIterator_nextElement(HttpParameterIterator* o);
542#define HttpParameterIterator_hasMoreElements(o) ((o)->name != 0)
543#define HttpParameterIterator_getName(o) (o)->name
544#define HttpParameterIterator_getValue(o) (o)->value
545
546
547#ifdef __cplusplus
548}
549inline HttpParameterIterator::HttpParameterIterator(HttpRequest* req) {
551inline HttpParameterIterator::HttpParameterIterator(HttpParameter* param) {
554 HttpParameterIterator_nextElement(this); }
555#endif
556
557
588typedef struct HttpCookie
589{
590#ifdef __cplusplus
591 ~HttpCookie();
592
595 const char* getComment() const { return comment; }
596
598 const char* getDomain() const { return domain; }
599
603 BaTime getMaxAge() const { return maxAge; }
604
606 const char* getName() const { return name; }
607
610 const char* getPath() const { return path; }
611
615 bool getSecure() const { return secure ? true : false; }
616
620 bool getHttpOnly() const { return httpOnly ? true : false; }
621
623 const char* getValue() const { return value; }
624
629 int setComment(const char* purpose);
630
635 int setDomain(const char* pattern);
636
647 void setMaxAge(BaTime expiry);
656 void deleteCookie();
657
662 int setPath(const char* uri);
663
668 void setSecure(bool flag);
669
680 void setHttpOnly(bool flag);
681
686 int setValue(const char* newValue);
687
688#if 0
690 int getVersion() const { return version; }
691 /* Sets the version of the cookie protocol this cookie complies with. */
692 void setVersion(int v);
693#endif
694
700 void activate();
701 private:
702 HttpCookie();
703#endif
704 struct HttpCookie* next;
705 char* comment;
706 char* domain;
707 char* name;
708 char* path;
709 char* value;
710 BaTime maxAge;
711 int version;
712 BaBool secure;
713 BaBool httpOnly;
714 BaBool deleteCookieFlag;
715 BaBool activateFlag; /* The cookie will be sent to the client
716 * if this flag is true */
718
719#ifdef __cplusplus
720extern "C" {
721#endif
722BA_API void HttpCookie_destructor(HttpCookie* o);
726BA_API const char* HttpCookie_getComment(HttpCookie* o);
730BA_API const char* HttpCookie_getDomain(HttpCookie* o);
738BA_API const char* HttpCookie_getName(HttpCookie* o);
742BA_API const char* HttpCookie_getPath(HttpCookie* o);
754BA_API const char* HttpCookie_getValue(HttpCookie* o);
758BA_API int HttpCookie_setComment(HttpCookie* o, const char* purpose);
762BA_API int HttpCookie_setDomain(HttpCookie* o, const char* pattern);
766BA_API void HttpCookie_setMaxAge(HttpCookie* o, BaTime expiry);
767#define HttpCookie_deleteCookie(o) (o)->deleteCookieFlag = TRUE;
771BA_API int HttpCookie_setPath(HttpCookie* o, const char* uri);
783BA_API int HttpCookie_setValue(HttpCookie* o, const char* newValue);
784
785#if 0
786int HttpCookie_getVersion(HttpCookie* o);
787void HttpCookie_setVersion(HttpCookie* o, int v);
788#endif
789
794#ifdef __cplusplus
795}
796inline HttpCookie::HttpCookie() { baAssert(0); }
797inline HttpCookie::~HttpCookie() { HttpCookie_destructor(this); }
798inline int HttpCookie::setComment(const char* purpose) {
799 return HttpCookie_setComment(this, purpose); }
800inline int HttpCookie::setDomain(const char* pattern) {
801 return HttpCookie_setDomain(this, pattern); }
802inline void HttpCookie::setMaxAge(BaTime expiry) {
803 HttpCookie_setMaxAge(this, expiry); }
805 HttpCookie_deleteCookie(this); }
806inline int HttpCookie::setPath(const char* uri) {
807 return HttpCookie_setPath(this, uri); }
808inline void HttpCookie::setSecure(bool flag) {
809 HttpCookie_setSecure(this, flag ? TRUE : FALSE); }
810inline void HttpCookie::setHttpOnly(bool flag) {
811 HttpCookie_setHttpOnly(this, flag ? TRUE : FALSE); }
812inline int HttpCookie::setValue(const char* newValue) {
813 return HttpCookie_setValue(this, newValue); }
814#if 0
815inline void HttpCookie::setVersion(int v) {
816 HttpCookie_setVersion(this, v); }
817#endif
818inline void HttpCookie::activate() {
819 HttpCookie_activate(this); }
820#endif
821
822
826typedef struct HttpStdHeaders
827{
828#ifdef __cplusplus
832 const char* getConnection();
833
841 const char* getHost();
842
848 const char* getDomain();
849
853 const char* getContentType();
854
858#endif
859 HttpInData* inData;
860 char* domain;
861 BaFileSize contentLength;
862 U16 connectionHOffs;
863 U16 hostHOffs;
864 U16 contentTypeHOffs;
866
867#ifdef __cplusplus
868extern "C" {
869#endif
870BA_API const char* HttpStdHeaders_zzGetValFromOffs(
871 HttpStdHeaders* o, U16 offset);
872BA_API const char* HttpStdHeaders_getDomain(HttpStdHeaders* o);
873#define HttpStdHeaders_getConnection(o) \
874 HttpStdHeaders_zzGetValFromOffs(o,(o)->connectionHOffs)
875#define HttpStdHeaders_getHost(o) \
876 HttpStdHeaders_zzGetValFromOffs(o,(o)->hostHOffs)
877#define HttpStdHeaders_getContentType(o) \
878 HttpStdHeaders_zzGetValFromOffs(o,(o)->contentTypeHOffs)
879#define HttpStdHeaders_getContentLength(o) (o)->contentLength
880
881#ifdef __cplusplus
882}
883inline const char* HttpStdHeaders::getConnection() {
884 return HttpStdHeaders_getConnection(this); }
885inline const char* HttpStdHeaders::getHost() {
886 return HttpStdHeaders_getHost(this); }
887inline const char* HttpStdHeaders::getDomain() {
888 return HttpStdHeaders_getDomain(this); }
889inline const char* HttpStdHeaders::getContentType() {
890 return HttpStdHeaders_getContentType(this); }
892 return HttpStdHeaders_getContentLength(this); }
893
894#endif
895
896
897
898 /*Do not change the HttpMethod type without checking tables in Httpserver.c*/
899
910typedef enum {
911 HttpMethod_Connect =0x00001,
912 HttpMethod_Get =0x00002,
913 HttpMethod_Head =0x00004,
914 HttpMethod_Options =0x00008,
915
916 HttpMethod_Patch =0x00010,
917 HttpMethod_Post =0x00020,
918 HttpMethod_Put =0x00040,
919 HttpMethod_Trace =0x00080,
920
921 /* WebDAV */
922 HttpMethod_Copy =0x00100,
923 HttpMethod_Delete =0x00200,
924 HttpMethod_Lock =0x00400,
925 HttpMethod_Move =0x00800,
926
927 HttpMethod_Mkcol =0x01000,
928 HttpMethod_Propfind =0x02000,
929 HttpMethod_Proppatch =0x04000,
930 HttpMethod_Unlock =0x08000,
931
932 HttpMethod_Unknown =0x10000 /* Must be last */
933} HttpMethod;
934
935
936/* Convert an HTTP method from string value to the type HttpMethod */
937BA_API HttpMethod HttpMethod_a2m(const char* str);
938
939
940
949typedef struct HttpRequest
950{
951#ifdef __cplusplus
952
1004 int checkMethods(HttpResponse* resp, U32 methods, bool addDefault=TRUE);
1005
1021 BaBool checkTime(struct HttpResponse* resp, BaTime time);
1022
1026
1029 const char* getRequestURI();
1030
1047 const char* getRequestURL(bool forceHttps=false);
1048
1053
1055 const char* getVersion();
1056
1064 const char* getHeaderValue(const char* name);
1065
1069 HttpCookie* getCookie(const char* name);
1070
1077
1082 const char* getMethod();
1083
1087 static const char* getMethod(HttpMethod method);
1088
1101 const char* getParameter(const char* paramName);
1102
1115 int wsUpgrade();
1116
1135 HttpHeader* getHeaders(int* len);
1136
1137
1138
1177#ifndef NO_HTTP_SESSION
1178 HttpSession* getSession(BaBool create=true);
1179#endif
1183
1187
1191
1195
1198
1199
1200 int setUserObj(void* userObj, bool overwrite=false);
1201 void* getUserObj();
1202
1203#endif
1204 HttpStdHeaders stdH;
1205 HttpAllocator headerAlloc;
1206 HttpAllocator formAlloc;
1207 HttpInData inData;
1208 struct HttpServer* server;
1209 void* userObj;
1210 struct HttpSession* session;
1211 HttpMethod methodType;
1212 U16 pathI;
1213 U16 versionI;
1214 U16 headersI;
1215 U16 headerLen;
1216 U16 formsI;
1217 U16 formLen;
1218 BaBool postDataConsumed; /* Set by MultipartUpload and HttpRecData */
1219 BaBool expect100Continue; /* Validated expectation; cleared when handled. */
1220 BaBool chunkedBody; /* Set only after successful framing validation. */
1222
1223#ifdef __cplusplus
1224extern "C" {
1225#endif
1230 U32 methods, BaBool addDefault);
1231BA_API int HttpRequest_checkOptions(
1232 HttpRequest* o, struct HttpResponse* resp, int optLen, ...);
1233#define HttpRequest_getAuthenticatedUser(o) \
1234 AuthenticatedUser_get2(HttpRequest_getSession(o,FALSE))
1235#define HttpRequest_getConnection(o) HttpRequest_getCommand(o)->con
1236#define HttpRequest_getMethodType(o) (o)->methodType
1237#define HttpRequest_getMethod(o) HttpRequest_getMethod2((o)->methodType)
1238BA_API const char* HttpRequest_getMethod2(HttpMethod method);
1239#define HttpRequest_getServer(o) (o)->server
1240#define HttpRequest_getResponse(o) (&HttpRequest_getCommand(o)->response)
1241BA_API struct HttpCommand* HttpRequest_getCommand(HttpRequest*);
1246 HttpRequest* o, struct HttpResponse* resp, BaTime time);
1254BA_API const char* HttpRequest_getRequestURL(HttpRequest* o,BaBool forceHttps);
1255#define HttpRequest_getStdHeaders(o) (&(o)->stdH)
1263BA_API const char* HttpRequest_getHeaderValue(HttpRequest* o,const char* name);
1264#define HttpRequest_getNoOfParameters(o) (o)->formLen
1268BA_API HttpCookie* HttpRequest_getCookie(HttpRequest* o, const char* name);
1269#define HttpRequest_getUserObj(o) (o)->userObj
1270BA_API int HttpRequest_setUserObj(
1271 HttpRequest* o, void* userObj, BaBool overwrite);
1272#define HttpRequest_getBuffer(o) (&(o)->inData)
1276BA_API const char* HttpRequest_getParameter(
1277 HttpRequest* o, const char* paramName);
1281BA_API HttpHeader* HttpRequest_getHeaders(HttpRequest* o, int* len);
1286BA_API BaBool HttpRequest_enableKeepAlive(HttpRequest* o);
1287BA_API int HttpRequest_pushBackData(HttpRequest* o);
1288#ifndef NO_HTTP_SESSION
1293 HttpRequest* o, BaBool create);
1294BA_API struct HttpSession* HttpRequest_session(
1295 HttpRequest* o, const char* val, size_t len, int set);
1296#endif
1297#ifdef __cplusplus
1298}
1299
1301 U32 methods, bool addDefault){
1302 return HttpRequest_checkMethods(this,resp,
1303 methods, addDefault ? TRUE : FALSE);}
1304
1306 return HttpRequest_checkTime(this, resp, time); }
1308 return HttpRequest_getAuthenticatedUser(this); }
1310 return HttpRequest_getMethodType(this); }
1311inline const char* HttpRequest::getMethod() {
1312 return HttpRequest_getMethod(this); }
1313inline const char* HttpRequest::getMethod(HttpMethod method) {
1314 return HttpRequest_getMethod2(method); }
1316 return HttpRequest_getServer(this); }
1317inline const char* HttpRequest::getRequestURI() {
1318 return HttpRequest_getRequestURI(this); }
1319inline const char* HttpRequest::getRequestURL(bool forceHttps) {
1320 return HttpRequest_getRequestURL(this, forceHttps); }
1322 return HttpRequest_getStdHeaders(this); }
1323inline const char* HttpRequest::getVersion() {
1324 return HttpRequest_getVersion(this); }
1325inline const char* HttpRequest::getHeaderValue(const char* name) {
1326 return HttpRequest_getHeaderValue(this, name); }
1327inline HttpCookie* HttpRequest::getCookie(const char* name) {
1328 return HttpRequest_getCookie(this, name); }
1329inline const char* HttpRequest::getParameter(const char* paramName) {
1330 return HttpRequest_getParameter(this, paramName); }
1332 return HttpRequest_wsUpgrade(this);
1333}
1334inline HttpHeader* HttpRequest::getHeaders(int* len) {
1335 return HttpRequest_getHeaders(this, len); }
1336inline int HttpRequest::setUserObj(void* userObj, bool overwrite) {
1337 return HttpRequest_setUserObj(this, userObj, overwrite); }
1338inline void* HttpRequest::getUserObj() {
1339 return HttpRequest_getUserObj(this); }
1340#ifndef NO_HTTP_SESSION
1342 return HttpRequest_getSession(this, create); }
1343#endif
1345 return HttpParameterIterator_hasMoreElements(this); }
1347 return HttpRequest_getBuffer(this); }
1348#endif
1349
1350
1351#ifndef __DOXYGEN__
1352
1353typedef struct
1354{
1355 HttpAllocator data;
1356 U16 maxResponseHeader;
1357} NameValMM;
1358
1359
1360typedef struct
1361{
1362 U8 major;
1363 U8 minor;
1364} HttpProtocol;
1365
1366#endif
1367
1378typedef struct HttpResponse
1379{
1380#ifdef __cplusplus
1381
1384 U32 byteCount();
1385
1386
1392 HttpCookie* createCookie(const char* name);
1393
1404 const char* containsHeader(const char* name);
1405
1414 const char* encodeRedirectURL(const char* pathName);
1415
1425 const char* encodeRedirectURLWithParam(const char* pathName);
1426
1433 const char* encodeUrl(const char* path);
1434
1441 int flush();
1442
1467 int forward(const char* path);
1468
1488 int redirect(const char* path);
1489
1490
1494
1498
1499
1516 int include(const char* path);
1517
1522 bool committed() const;
1523
1527 bool isForward() const;
1528
1531 bool isInclude() const;
1532
1536 bool initial() const;
1537
1541 int resetHeaders();
1542
1547 int resetBuffer();
1548
1560 int sendError(int eCode);
1561
1575 int sendError(int eCode, const char* msg);
1576
1582 int sendBufAsError(int eCode);
1583
1589 int sendBufAsTxtError(int eCode);
1590
1591
1598 int fmtError(int eCode, const char* fmt, ...);
1599
1617 int sendRedirect(const char* url);
1618
1633 int redirect2TLS();
1634
1644
1652 int setContentType(const char* type);
1653
1663 int setDateHeader(const char* name, BaTime time);
1664
1691 int setHeader(const char* name, const char* value, bool replace=true);
1692
1701 int setMaxAge(BaTime seconds);
1702
1703
1740 char* fmtHeader(const char* name, int valueLen, bool replace=true);
1741
1742
1759 void setStatus(int statusCode);
1760
1766 int printf(const char* fmt, ...);
1767
1777
1791 int write(const void* data, int len, int useBuffering=TRUE);
1792
1800 int write(const char* data, int useBuffering=TRUE);
1801
1812 int send(const void* data, int len);
1813
1820 int setDefaultHeaders();
1821
1846 int setResponseBuf(BufPrint* buf, bool useDefBuffer=true);
1847
1854 int removeResponseBuf();
1855
1856
1857 int setUserObj(void* userObj, bool overwrite=false);
1858#endif
1859 NameValMM nameValMM;
1860 BufPrint headerPrint;
1861 BufPrint defaultBodyPrint;
1862 BufPrint* bodyPrint;
1863 struct HttpDir* currentDir;
1864 char* encodedURL;
1865 char* encodedRedirectURL;
1866 HttpCookie* cookieList;
1867 void* userObj;
1868 int statusCode;
1869 U32 msgLen; /* Used if request is of type HEAD, count total msg len */
1870 HttpProtocol protocol;
1871 U16 includeCounter;
1872 U16 forwardCounter;
1873 char headerSent;
1874 char printAndWriteInitialized;
1875 char useChunkTransfer;
1877
1878#ifdef __cplusplus
1879extern "C" {
1880#endif
1885 struct HttpResponse* o,const char* name);
1891 HttpResponse* o, const char* name);
1892BA_API int HttpResponse_dataAdded(HttpResponse* o, U32 size);
1893#define HttpResponse_byteCount(o) ((o)->msgLen + (o)->bodyPrint->cursor)
1898 HttpResponse* o, const char* pathName);
1899BA_API const char* HttpResponse_encodeRedirectURLWithParamOrSessionURL(
1900 HttpResponse* o,const char* path,BaBool setUrlCookie);
1901#define HttpResponse_encodeRedirectURLWithParam(o, path) \
1902 HttpResponse_encodeRedirectURLWithParamOrSessionURL(o, path, FALSE)
1903#define HttpResponse_encodeSessionURL(o, path) \
1904 HttpResponse_encodeRedirectURLWithParamOrSessionURL(o, path, TRUE)
1911BA_API const char* HttpResponse_encodeUrl(HttpResponse* o, const char* path);
1916#define HttpResponse_forward(o,path) HttpResponse_incOrForward(o,path,FALSE)
1917#define HttpResponse_getConnection(o) HttpResponse_getCommand(o)->con
1918#define HttpResponse_getRequest(o) (&HttpResponse_getCommand(o)->request)
1919BA_API struct HttpCommand* HttpResponse_getCommand(HttpResponse*);
1920#define HttpResponse_getBuf(o) (o)->bodyPrint->buf
1921#define HttpResponse_getBufSize(o) (o)->bodyPrint->bufSize
1922#define HttpResponse_getBufOffs(o) \
1923 ((o)->bodyPrint->buf + (o)->bodyPrint->cursor)
1924#define HttpResponse_getRemBufSize(o) \
1925 ((o)->bodyPrint->bufSize - (o)->bodyPrint->cursor)
1926#define HttpResponse_getUserObj(o) (o)->userObj
1927BA_API int HttpResponse_incOrForward(
1928 HttpResponse* o, const char* path, BaBool isInc);
1932BA_API int HttpResponse_redirect(HttpResponse* o, const char* path);
1933#define HttpResponse_include(o,path) HttpResponse_incOrForward(o,path,TRUE)
1934#define HttpResponse_isChunkTransfer(o) (o)->useChunkTransfer
1935#define HttpResponse_committed(o) (o)->headerSent
1936#define HttpResponse_isForward(o) ((o)->forwardCounter != 0)
1937#define HttpResponse_isInclude(o) ((o)->includeCounter != 0)
1938#define HttpResponse_initial(o) (!HttpResponse_isForward(o) && \
1939 !HttpResponse_isInclude(o))
1944 HttpResponse* o,BufPrint* buf,BaBool useDefBuffer);
1949
1958BA_API int HttpResponse_sendError1(HttpResponse* o, int eCode);
1959BA_API int HttpResponse_sendError2(HttpResponse* o,int eCode,const char* msg);
1968BA_API int HttpResponse_fmtVError(
1969 HttpResponse* response,
1970 int eCode,
1971 const char* fmt,
1972 va_list varg);
1973BA_API int HttpResponse_fmtError(
1974 HttpResponse* response,
1975 int eCode,
1976 const char* fmt, ...);
1980BA_API int HttpResponse_sendRedirect(HttpResponse* o, const char* url);
1981BA_API int HttpResponse_sendRedirectI(
1982 HttpResponse* o, const char* url, int status);
1987#define HttpResponse_forceHttps HttpResponse_redirect2TLS /* Backw. comp. */
1988
1989#define HttpResponse_setBufPos(o, pos) (o)->bodyPrint->cursor = pos
1997BA_API int HttpResponse_setContentType(HttpResponse* o, const char* type);
1998BA_API int HttpResponse_checkContentType(HttpResponse* o, const char* type);
2007 HttpResponse* o, const char* name, BaTime t);
2012 HttpResponse* o,const char* name,const char* value, BaBool replace);
2016BA_API int HttpResponse_setMaxAge(HttpResponse* response, BaTime seconds);
2021 HttpResponse* o, const char* name, int valueLen, BaBool replace);
2022BA_API int HttpResponse_setStatus(HttpResponse* o, int eCode);
2023BA_API int HttpResponse_vprintf(
2024 HttpResponse* o, const char* fmt, va_list argList);
2028BA_API int HttpResponse_printf(HttpResponse* o, const char* fmt, ...);
2032BA_API int HttpResponse_write(HttpResponse* o, const void* data, int len,
2033 int useBuffering);
2041BA_API int HttpResponse_send(HttpResponse* o, const void* data, int len);
2046BA_API int HttpResponse_downgrade(HttpResponse* o);
2047BA_API int HttpResponse_setUserObj(
2048 HttpResponse* o,void* userObj,BaBool overwrite);
2049BA_API int HttpResponse_printAndWriteInit(HttpResponse* o);
2050BA_API int HttpResponse_send100Continue(HttpResponse* o);
2051BA_API int HttpResponse_setChunkEncoding(HttpResponse* o);
2052BA_API const char* HttpResponse_getRespData(HttpResponse* o, int* len);
2053#define HttpResponse_getStatus(o) (o)->statusCode
2054#ifdef __cplusplus
2055}
2056inline HttpCookie* HttpResponse::createCookie(const char* name) {
2057 return HttpResponse_createCookie(this, name); }
2058inline const char* HttpResponse::containsHeader(const char* name) {
2059 return HttpResponse_containsHeader(this, name); }
2061 return HttpResponse_byteCount(this); }
2062inline const char* HttpResponse::encodeRedirectURL(const char* pathName) {
2063 return HttpResponse_encodeRedirectURL(this, pathName); }
2064inline const char* HttpResponse::encodeRedirectURLWithParam(const char* p) {
2065 return HttpResponse_encodeRedirectURLWithParam(this, p); }
2066inline const char* HttpResponse::encodeUrl(const char* path) {
2067 return HttpResponse_encodeUrl(this, path); }
2069 return HttpResponse_flush(this); }
2070inline int HttpResponse::forward(const char* path) {
2071 return HttpResponse_forward(this, path); }
2072inline int HttpResponse::redirect(const char* path) {
2073 return HttpResponse_redirect(this, path); }
2074inline int HttpResponse::include(const char* path) {
2075 return HttpResponse_include(this, path); }
2076inline bool HttpResponse::committed() const {
2077 return HttpResponse_committed(this) ? true : false; }
2078inline bool HttpResponse::isForward() const {
2079 return HttpResponse_isForward(this) ? true : false; }
2080inline bool HttpResponse::isInclude() const {
2081 return HttpResponse_isInclude(this) ? true : false; }
2082inline bool HttpResponse::initial() const {
2083 return HttpResponse_initial(this) ? true : false; }
2084inline int HttpResponse::setResponseBuf(BufPrint* buf, bool useDefBuffer) {
2085 return HttpResponse_setResponseBuf(this, buf, useDefBuffer?TRUE:FALSE); }
2087 return HttpResponse_removeResponseBuf(this); }
2089 return HttpResponse_resetHeaders(this); }
2091 return HttpResponse_resetBuffer(this); }
2092inline int HttpResponse::sendError(int eCode) {
2093 return HttpResponse_sendError1(this, eCode); }
2094inline int HttpResponse::sendError(int eCode, const char* msg) {
2095 return HttpResponse_sendError2(this, eCode, msg); }
2096inline int HttpResponse::sendBufAsError(int eCode) {
2097 return HttpResponse_sendBufAsError(this, eCode); }
2098inline int HttpResponse::sendBufAsTxtError(int eCode) {
2099 return HttpResponse_sendBufAsTxtError(this,eCode);}
2100inline int HttpResponse::fmtError(int eCode,const char* fmt,...) {
2101 int retv; va_list varg;
2102 va_start(varg, fmt);
2103 retv = HttpResponse_fmtVError(this, eCode, fmt, varg);
2104 va_end(varg);
2105 return retv; }
2106inline int HttpResponse::sendRedirect(const char* url) {
2107 return HttpResponse_sendRedirect(this, url); }
2109 return HttpResponse_redirect2TLS(this); }
2111 return HttpResponse_setContentLength(this, len); }
2112inline int HttpResponse::setContentType(const char* type) {
2113 return HttpResponse_setContentType(this, type); }
2114inline int HttpResponse::setDateHeader(const char* name, BaTime t) {
2115 return HttpResponse_setDateHeader(this, name, t); }
2117 const char* name, const char* value, bool replace) {
2118 return HttpResponse_setHeader(this,name, value, replace?TRUE:FALSE); }
2119inline int HttpResponse::setMaxAge(BaTime seconds) {
2120 return HttpResponse_setMaxAge(this, seconds); }
2122 const char* name, int valueLen, bool replace) {
2123 return HttpResponse_fmtHeader(this, name, valueLen, replace?TRUE:FALSE); }
2124inline void HttpResponse::setStatus(int eCode) {
2125 HttpResponse_setStatus(this, eCode);}
2126
2127inline int HttpResponse::printf(const char* fmt, ...) {
2128 int retv; va_list varg; va_start(varg, fmt);
2129 retv = HttpResponse_vprintf(this, fmt, varg); va_end(varg); return retv;}
2130inline int HttpResponse::write(const char* data, int useBuffering) {
2131 return HttpResponse_write(this, data, iStrlen(data), useBuffering); }
2133 return HttpResponse_getWriter(this); }
2134inline int HttpResponse::write(const void* data, int len, int useBuffering){
2135 return HttpResponse_write(this, data, len, useBuffering); }
2136inline int HttpResponse::send(const void* data, int len) {
2137 return HttpResponse_send(this, data, len); }
2139 return HttpResponse_setDefaultHeaders(this); }
2140inline int HttpResponse::setUserObj(void* userObj, bool overwrite) {
2141 return HttpResponse_setUserObj(this, userObj, overwrite); }
2142
2143#endif
2144
2150typedef struct HttpCommand
2151{
2152#ifdef __cplusplus
2153
2157
2161
2165 struct HttpConnection* getConnection();
2166
2168 struct HttpServer* getServer();
2169
2170 HttpCommand() {}
2171#endif
2172 DoubleLink super;
2173#ifdef __cplusplus
2174 public:
2175#endif
2176 HttpRequest request;
2177 HttpResponse response;
2178 struct HttpConnection* con;
2179 struct LHttpCommand* lcmd; /* Used by LSP plugin */
2180 BaTime requestTime;
2181 BaBool runningInThread;
2183
2184#define HttpCommand_getRequest(o) (&(o)->request)
2185#define HttpCommand_getResponse(o) (&(o)->response)
2186#define HttpCommand_getConnection(o) (o)->con
2187#define HttpCommand_getServer(o) HttpConnection_getServer((o)->con)
2188#ifdef __cplusplus
2190 return HttpCommand_getRequest(this); }
2192 return HttpCommand_getResponse(this); }
2194 return HttpCommand_getConnection(this); }
2196 return HttpCommand_getServer(this);
2197}
2198#endif
2199
2200
2201#ifndef NO_HTTP_SESSION
2202
2203#ifndef __DOXYGEN__
2206#endif
2207
2217 struct HttpSessionAttribute* o);
2218
2247{
2248#ifdef __cplusplus
2254 HttpSessionAttribute(const char* name,
2256
2260#endif
2261 struct HttpSessionAttribute* next;
2262 struct HttpSession* session;
2264 char* name;
2266
2267#ifdef __cplusplus
2268extern "C" {
2269#endif
2270
2280 const char* name,
2287#define HttpSessionAttribute_getSession(o) (o)->session
2288#ifdef __cplusplus
2289}
2291 const char* name,
2293 HttpSessionAttribute_constructor(this, name, d); }
2295 return HttpSessionAttribute_getSession(this); }
2296
2297#endif
2298
2304typedef struct HttpSession
2305{
2306#ifdef __cplusplus
2307
2308 void *operator new(size_t s) { return ::baMalloc(s); }
2309 void operator delete(void* d) { if(d) ::baFree(d); }
2310 void *operator new(size_t, void *place) { return place; }
2311 void operator delete(void*, void *) { }
2312
2327 void terminate();
2328
2335 HttpSessionAttribute* getAttribute(const char* name);
2336
2341
2347
2352
2355
2361 int removeAttribute(const char* name);
2362
2370
2376 void setMaxInactiveInterval(BaTime interval);
2377
2383 void incrRefCntr();
2384
2392 void decrRefCntr();
2393
2397 U32 getId();
2398
2402
2406
2407
2408 void incrementLock();
2409 void decrementLock();
2410
2411 HttpSession() {}
2412 private:
2413#endif
2414 SplayTreeNode super; /* inherits from SplayTreeNode */
2415 DoubleLink dlink;
2416 HttpSockaddr peer;
2417 HttpSessionAttribute* attrList;
2418 struct HttpSessionContainer* container;
2419 BaTime creationTime;
2420 BaTime lastAccessedTime;
2421 BaTime maxInactiveInterval;
2422 U32 sesrnd1; /* Session random number 1 & 2 */
2423 U32 sesrnd2; /* entropy id+sesrnd1+sesrnd2=96 bits */
2424 U32 useCounter;
2425 int refCounter;
2426 U16 lockCounter;
2427 U8 termPending; /* TRUE if in termination list */
2429
2430
2431#ifdef __cplusplus
2432extern "C" {
2433#endif
2438 const char* name);
2459BA_API BaBool HttpSession_isNew(HttpSession* o);
2463BA_API int HttpSession_removeAttribute(HttpSession* o, const char* name);
2468 HttpSessionAttribute* value);
2473#define HttpSession_incrRefCntr(o) (o)->refCounter++
2478#define HttpSession_incrementLock(o) (o)->lockCounter++
2479#define HttpSession_decrementLock(o) do {\
2480 baAssert((o)->lockCounter > 0);\
2481 (o)->lockCounter--; } while(0)
2488BA_API int HttpSession_fmtSessionId(HttpSession* o, U8* buf, size_t bufSize);
2489#define HttpSession_getId(o) \
2490 ((U32)((ptrdiff_t)SplayTreeNode_getKey((SplayTreeNode*)(o))))
2491#define HttpSession_getAuthenticatedUser(o) AuthenticatedUser_get2((o))
2492#define HttpSession_getUseCounter(o) (o)->useCounter
2493#define HttpSession_getPeerName(o) (&(o)->peer)
2494#ifdef __cplusplus
2495}
2497 return HttpSession_getAttribute(this, name); }
2499 return HttpSession_getCreationTime(this); }
2501 return HttpSession_getLastAccessedTime(this); }
2505 return HttpSession_getServer(this); }
2507 HttpSession_terminate(this); }
2508inline int HttpSession::removeAttribute(const char* name) {
2509 return HttpSession_removeAttribute(this, name); }
2511 return HttpSession_setAttribute(this, value); }
2513 HttpSession_setMaxInactiveInterval(this, interval); }
2515 HttpSession_incrRefCntr(this); }
2518inline U32 HttpSession::getId() { return HttpSession_getId(this); }
2520 return HttpSession_getUseCounter(this); }
2522 return HttpSession_getAuthenticatedUser(this); }
2523inline void HttpSession::incrementLock() {HttpSession_incrementLock(this);}
2524inline void HttpSession::decrementLock() {HttpSession_decrementLock(this);}
2525
2526#endif /* __cplusplus */
2527
2528typedef enum {
2529 HttpSessionContainer_OK = 0,
2530 HttpSessionContainer_NoMemory,
2531 HttpSessionContainer_TooManySessions,
2532 HttpSessionContainer_NoPeerAddress
2533} HttpSessionContainer_ECode;
2534
2535
2540{
2541#ifdef __cplusplus
2548 void setMaxSessions(int max);
2549 private:
2550#endif
2551 SplayTree sessionTree;
2552 DoubleList sessionList;
2553 DoubleList sessionTermList;
2554 DoubleLink* sessionLinkIter;
2555 struct HttpServer* server;
2556 int noOfSessions; /* Current number of active sessions */
2557 int maxSessions;
2558 HttpSessionContainer_ECode eCode;
2560
2561#ifdef __cplusplus
2562extern "C" {
2563#endif
2564void HttpSessionContainer_constructor(struct HttpSessionContainer* o,
2565 struct HttpServer* server,
2566 U16 maxSessions);
2567void HttpSessionContainer_destructor(struct HttpSessionContainer* o);
2568void HttpSessionContainer_sessionTimer(struct HttpSessionContainer* o);
2569#define HttpSessionContainer_setMaxSessions(o,max) (o)->maxSessions = max
2570#ifdef __cplusplus
2571}
2573 HttpSessionContainer_setMaxSessions(this, max); }
2574#endif
2575
2576#endif /* NO_HTTP_SESSION */
2577
2578
2589typedef void (*HttpPage_Service)(struct HttpPage* page,
2590 HttpRequest* request,
2591 HttpResponse* response);
2592
2593
2594#define HttpPageType_HttpPageSE 0x00020
2595
2596#ifndef __DOXYGEN__
2597typedef struct HttpPageNode
2598{
2599 struct HttpPageNode* next;
2600} HttpPageNode;
2601#endif
2602
2655typedef struct HttpPage
2656{
2657#ifdef __cplusplus
2658 void *operator new(size_t s) { return ::baMalloc(s); }
2659 void operator delete(void* d) { if(d) ::baFree(d); }
2660 void *operator new(size_t, void *place) { return place; }
2661 void operator delete(void*, void *) { }
2662 HttpPage() {}
2671 HttpPage(HttpPage_Service service, const char* name);
2672
2675 ~HttpPage();
2676
2679 const char* getName() const { return name; }
2680
2685 void service(HttpRequest* request, HttpResponse* response);
2686
2690 bool isLinked();
2691
2694 int unlink();
2695#endif
2696 HttpPageNode super; /* As if inherited */
2697 HttpPage_Service serviceCB;
2698 const char* name;
2700
2701#ifdef __cplusplus
2702extern "C" {
2703#endif
2704void
2709 HttpPage* o, HttpPage_Service service, const char* name);
2714#define HttpPage_getName(o) (o)->name
2715#define HttpPage_isLinked(o) ((HttpPageNode*)(o))->next
2720#define HttpPage_service(o, request, response) \
2721 (o)->serviceCB(o, request, response)
2722#ifdef __cplusplus
2723}
2724inline HttpPage::HttpPage(HttpPage_Service service, const char* name) {
2725 HttpPage_constructor(this, service, name); }
2727 HttpPage_destructor(this); }
2728inline bool HttpPage::isLinked() {
2729 return HttpPage_isLinked(this) ? true : false;
2730}
2731inline int HttpPage::unlink() {return HttpPage_unlink(this); }
2732inline void HttpPage::service(HttpRequest* request, HttpResponse* response) {
2733 HttpPage_service(this, request, response);
2734}
2735#endif
2736
2737
2747typedef int (*HttpDir_Service)(struct HttpDir* o,
2748 const char* relPath,
2749 HttpCommand* cmd);
2750
2751#define HttpDirType_EhDir 0x00001
2752#define HttpDirType_HttpResRdr 0x00002
2753#define HttpDirType_AuthenticateDir 0x00008
2754#define HttpDirType_AuthenticateDirWrapper 0x00010
2755
2756
2776typedef struct HttpDir
2777{
2778#ifdef __cplusplus
2779 void *operator new(size_t s) { return ::baMalloc(s); }
2780 void operator delete(void* d) { if(d) ::baFree(d); }
2781 void *operator new(size_t, void *place) { return place; }
2782 void operator delete(void*, void *) { }
2784 HttpDir();
2785
2804 HttpDir(const char* name, S8 priority=0);
2809 ~HttpDir();
2810
2818 int insertDir(HttpDir* dir);
2819
2826 int insertPage(HttpPage* page);
2827
2831
2835
2839 HttpDir* getDir(const char* name);
2840
2844 HttpPage* getPage(const char* name);
2845
2848 HttpDir* getNext();
2849
2862 HttpPage* findPage(HttpPage* iter, const char* name);
2863
2875 static HttpDir* findDir(HttpDir* iter, const char* name,
2876 unsigned int nameLen);
2877
2889 HttpDir* createOrGet(const char* name);
2890
2893 const char* getName() const { return name; }
2894
2897 HttpDir* getParent() const { return parent; }
2898
2923 char* makeAbsPath(const char* relPath, int relPathLen);
2924
2937 char* getRootPath();
2938
2939
2946
2958 void p403(const char* p403);
2959
2963 bool isLinked();
2964
2968 int unlink();
2969
2977 void setAuthenticator(
2978 struct AuthenticatorIntf* authenticator,
2979 struct AuthorizerIntf* authorizer=0);
2980
3002 bool authenticateAndAuthorize(HttpCommand* cmd,const char* path);
3003
3004
3005#endif
3006 HttpDir_Service service;
3007 struct HttpDir* parent; /* owner */
3008 struct HttpDir* next; /* next sibling */
3009 const char* name; /* e.g. /mydir/ */
3010 struct HttpDir* dirList; /* list of httpdirs (children) */
3011 struct AuthorizerIntf* realm; /* If we have authorization */
3012 struct AuthenticatorIntf* authenticator; /* If we have authentic. */
3013 char* _p403; /* If we have a 403 denied response page. */
3014 HttpPageNode pageList; /* pages for this dir */
3015 /* U8 type; */
3016 S8 priority;
3018
3019#ifdef __cplusplus
3020extern "C" {
3021#endif
3025BA_API void HttpDir_constructor(HttpDir* o, const char* name, S8 priority);
3034 HttpDir* o, const char* relPath, int relPathLen);
3035#define HttpDir_getRootPath(o) HttpDir_makeAbsPath(o,"",0)
3039BA_API int HttpDir_insertDir(HttpDir* o, HttpDir* dir);
3040#define HttpDir_getFirstPage(o) \
3041 (o)->pageList.next != &(o)->pageList ? ((HttpPage*)(o)->pageList.next) : 0
3042#define HttpDir_getFirstDir(o) (o)->dirList
3046BA_API HttpDir* HttpDir_getDir(HttpDir* o, const char* name);
3050BA_API HttpPage* HttpDir_getPage(HttpDir* o, const char* name);
3051#define HttpDir_getNext(o) (o)->next
3052#define HttpDir_getName(o) (o)->name
3053#define HttpDir_getParent(o) (o)->parent
3062 HttpDir* o, HttpPage* iter, const char* name);
3067 HttpDir* iter, const char* name,unsigned int nameLen);
3071BA_API HttpDir* HttpDir_createOrGet(HttpDir* o, const char* name);
3075BA_API void HttpDir_p403(HttpDir* o, const char* p403);
3076#define HttpDir_overloadService HttpDir_setService
3081#define HttpDir_isLinked(o) (o)->parent
3086#define HttpDir_setAuthenticator(o,authenticatorMA,authorizerMA) \
3087 (o)->authenticator = authenticatorMA,(o)->realm = authorizerMA
3092 HttpDir* o,HttpCommand* cmd,const char* path);
3093#define HttpDir_isAuthorized(o,user,method,path) \
3094 ((o)->realm ? \
3095 (user ? AuthorizerIntf_authorize((o)->realm,user,method,path) : FALSE) : \
3096 TRUE)
3097#ifdef __cplusplus
3098}
3100 HttpDir_constructor(this, 0, 0); }
3101inline HttpDir::HttpDir(const char* name, S8 priority) {
3102 HttpDir_constructor(this, name, priority); }
3104 HttpDir_destructor(this); }
3105inline char* HttpDir::makeAbsPath(const char* relPath, int relPathLen) {
3106 return HttpDir_makeAbsPath(this, relPath, relPathLen); }
3107inline char* HttpDir::getRootPath() {
3108 return HttpDir_getRootPath(this); }
3109inline int HttpDir::insertDir(HttpDir* dir) {
3110 return HttpDir_insertDir(this, dir); }
3112 return HttpDir_insertPage(this, page); }
3113inline HttpPage* HttpDir::getFirstPage() { return HttpDir_getFirstPage(this); }
3114inline HttpDir* HttpDir::getFirstDir() { return HttpDir_getFirstDir(this); }
3115inline HttpDir* HttpDir::getDir(const char* name) {
3116 return HttpDir_getDir(this,name); }
3117inline HttpPage* HttpDir::getPage(const char* name) {
3118 return HttpDir_getPage(this,name); }
3119inline HttpDir* HttpDir::getNext() { return HttpDir_getNext(this); }
3120inline HttpPage* HttpDir::findPage(HttpPage* iter, const char* name) {
3121 return HttpDir_findPage(this, iter, name); }
3122inline HttpDir* HttpDir::findDir(HttpDir* iter, const char* name,
3123 unsigned int nameLen) {
3124 return HttpDir_findDir(iter, name, nameLen); }
3125inline HttpDir* HttpDir::createOrGet(const char* name) {
3126 return HttpDir_createOrGet(this, name); }
3128 return HttpDir_setService(this, s); }
3129inline void HttpDir::p403(const char* p403) {
3130 HttpDir_p403(this, p403); }
3131inline int HttpDir::unlink() {return HttpDir_unlink(this); }
3132inline bool HttpDir::isLinked() {
3133 return HttpDir_isLinked(this) ? true : false; }
3134inline void HttpDir::setAuthenticator(struct AuthenticatorIntf* authenticator,
3135 struct AuthorizerIntf* authorizer){
3136 HttpDir_setAuthenticator(this,authenticator,authorizer);
3137}
3139 HttpCommand* cmd, const char* path) {
3140 return HttpDir_authenticateAndAuthorize(this,cmd,path) ? true : false; }
3141#endif
3142
3143#ifndef __DOXYGEN__
3144
3145typedef struct HttpLinkCon
3146{
3147 HttpConnection con; /* Inherits from HttpConnection */
3148 DoubleLink link;
3149} HttpLinkCon;
3150
3151
3152typedef struct
3153{
3154 HttpDir super; /* inherit */
3155 HttpDir_Service superServiceFunc;
3156 char* page404;
3157 BaBool page404InProgress;
3158} HttpRootDir;
3159
3160#endif
3161
3170typedef struct HttpServerConfig
3171{
3172#ifdef __cplusplus
3179
3212 int setRequest(S16 min, S16 max);
3213
3228 int setResponseHeader(U16 min, U16 max);
3229
3243 int setResponseData(U16 size);
3244
3260 int setCommit(U16 size);
3261
3277 int setNoOfHttpCommands(U16 size);
3278
3303 int setNoOfHttpConnections(U16 size);
3304
3313 int setMaxSessions(U16 size);
3314#endif
3315 S16 minRequest;
3316 S16 maxRequest;
3317 U16 minResponseHeader;
3318 U16 maxResponseHeader;
3319 U16 commit;
3320 U16 responseData;
3321 U16 noOfHttpCommands;
3322 U16 noOfHttpConnections;
3323 U16 maxSessions;
3325
3326#ifdef __cplusplus
3327extern "C" {
3328#endif
3341 HttpServerConfig* o, U16 min, U16 max);
3358 HttpServerConfig* o, U16 size);
3363#ifdef __cplusplus
3364}
3368 return HttpServerConfig_setRequest(this, min, max); }
3370 return HttpServerConfig_setResponseHeader(this, min, max); }
3372 return HttpServerConfig_setResponseData(this, size); }
3374 return HttpServerConfig_setCommit(this, size); }
3376 return HttpServerConfig_setNoOfHttpCommands(this, size); }
3378 return HttpServerConfig_setNoOfHttpConnections(this, size); }
3380 return HttpServerConfig_setMaxSessions(this, size); }
3381
3382#endif
3383
3384
3385typedef DoubleList HttpLinkConList;
3386
3387/* Used by LSP plugin */
3388typedef void (*LspOnTerminateRequest)(struct LHttpCommand* lcmd);
3389
3392typedef struct HttpServer
3393{
3394#ifdef __cplusplus
3395 void *operator new(size_t s) { return ::baMalloc(s); }
3396 void operator delete(void* d) { if(d) ::baFree(d); }
3397 void *operator new(size_t, void *place) { return place; }
3398 void operator delete(void*, void *) { }
3409 HttpServer(SoDisp* dispatcher, HttpServerConfig* cfg=0);
3410
3415 ~HttpServer();
3416
3430 int insertRootDir(HttpDir* dir);
3431
3457 int insertDir(const char* virtualDirRootPath, HttpDir* dir);
3458
3502 int insertCSP(CspInit cspInit,
3503 const char* virtualDirRootPath,
3504 struct CspReader* reader);
3505
3506 struct AuthUserList* getAuthUserList(const char* name);
3507
3510
3513
3519
3523
3524#ifndef NO_HTTP_SESSION
3535#endif
3536
3547 void set404Page(const char* page404);
3548
3550 const char* get404Page();
3551
3552 int setUserObj(void* userObj, bool overwrite=false);
3553
3559 static void initStatic(void);
3560
3571 static void setErrHnd(UserDefinedErrHandler e);
3572
3573 /* No longer used */
3574 static int setZlib(ZlibInflateInit2 init,
3575 ZlibInflate inflate,
3576 ZlibInflateEnd end){
3577 (void)init; (void)inflate; (void)end;
3578 return 0; }
3584 static const char* getStatusCode(int code);
3585
3586
3587#endif
3588 DoubleList commandPool;
3589 DoubleList cmdReqList;
3590 HttpConnection noOpCon;
3591 HttpLinkConList freeList;
3592 HttpLinkConList readyList;
3593 HttpLinkConList connectedList;
3594 HttpRootDir rootDirContainer;
3595 SplayTree authUserTree; /* Used by AuthenticatedUser.c */
3596 struct HttpCmdThreadPoolIntf* threadPoolIntf;
3597 HttpLinkCon* connections;
3598 SoDisp* dispatcher;
3599 void* userObj;
3600 SingleList waitForConClose; /* Bounded WaitForConClose list, oldest first. */
3601 LspOnTerminateRequest lspOnTerminateRequest;
3602 int commandPoolSize;
3603 U16 noOfConnections;
3604 S16 maxHttpRequestLen;
3605#ifndef NO_HTTP_SESSION
3606 HttpSessionContainer sessionContainer;
3607#endif
3609
3610
3611/* Used exclusively by HttpCmdThreadPool */
3612void HttpServer_AsynchProcessDir(HttpServer* o,
3613 HttpDir* dir,
3614 HttpCommand* cmd);
3615/* Used exclusively by HttpCmdThreadPool */
3616#define HttpServer_setThreadPoolIntf(o, intf) (o)->threadPoolIntf=intf
3617#define HttpServer_luaenv(o) (o)->luaenv
3618
3619#ifdef __cplusplus
3620extern "C" {
3621#endif
3641 const char* virtualDirRootPath,
3642 HttpDir* dir);
3647 CspInit cspInit,
3648 const char* virtualDirRootPath,
3649 struct CspReader* reader);
3650#define HttpServer_getAuthUserList(o, name) \
3651 (AuthUserList*)SplayTree_find(&(o)->authUserTree, name)
3652#define HttpServer_getDispatcher(o) (o)->dispatcher
3653#define HttpServer_getFirstRootDir(o) \
3654 HttpDir_getFirstDir((HttpDir*)&(o)->rootDirContainer)
3655#define HttpServer_getUserObj(o) (o)->userObj
3656#define HttpServer_getSessionContainer(o) (&(o)->sessionContainer)
3657#define HttpServer_getMutex(o) SoDisp_getMutex((o)->dispatcher)
3661BA_API const char* HttpServer_getStatusCode(int code);
3662void HttpServer_addCon2ConnectedList(HttpServer* o, HttpConnection* con);
3663void HttpServer_doLingeringClose(
3664 HttpServer* o, HttpConnection* con, BaFileSize contLen);
3665
3666#ifndef NO_HTTP_SESSION
3673#endif
3674BA_API HttpConnection* HttpServer_getFreeCon(HttpServer* o);
3675void HttpServer_returnFreeCon(HttpServer* o, HttpConnection* con);
3676BA_API void HttpServer_installNewCon(HttpServer* o, HttpConnection* con);
3677BA_API void HttpServer_setErrHnd(UserDefinedErrHandler e);
3678void HttpServer_initStatic(void);
3679int HttpServer_termOldestIdleCon(HttpServer* o);
3683BA_API void HttpServer_set404Page(HttpServer*o, const char* page404);
3684#define HttpServer_get404Page(o) (o)->rootDirContainer.page404
3685BA_API int HttpServer_setUserObj(
3686 HttpServer* o, void* userObj, BaBool overwrite);
3687#define HttpServer_termAllSessions(o) \
3688 HttpSessionContainer_destructor(&(o)->sessionContainer)
3689/* No longer used */
3690#define HttpServer_setZlib(init,inflate,end);
3691#ifdef __cplusplus
3692}
3694 HttpServer_constructor(this, disp, cfg); }
3696 HttpServer_destructor(this); }
3698 return HttpServer_insertRootDir(this, dir); }
3700 return HttpServer_getMutex(this);
3701}
3702inline int HttpServer::insertDir(const char* virtualDirRootPath,HttpDir* dir){
3703 return HttpServer_insertDir(this, virtualDirRootPath, dir); }
3705 const char* virtualDirRootPath,
3706 struct CspReader* reader) {
3707 return HttpServer_insertCSP(this, cspInit, virtualDirRootPath, reader); }
3708inline struct AuthUserList* HttpServer::getAuthUserList(const char* name) {
3709 return HttpServer_getAuthUserList(this,name); }
3711 return HttpServer_getDispatcher(this); }
3713 return HttpServer_getFirstRootDir(this); }
3715 return HttpServer_getSessionContainer(this); }
3716#ifndef NO_HTTP_SESSION
3718 return HttpServer_getSession(this, id); }
3719inline void HttpServer::initStatic(void) {
3720 HttpServer_initStatic(); }
3721inline void HttpServer::setErrHnd(UserDefinedErrHandler e) {
3722 HttpServer_setErrHnd(e); }
3723inline void HttpServer::set404Page(const char* page404) {
3724 HttpServer_set404Page(this, page404); }
3725inline const char* HttpServer::get404Page() {
3726 return HttpServer_get404Page(this); }
3727inline int HttpServer::setUserObj(void* userObj, bool overwrite) {
3728 return HttpServer_setUserObj(this, userObj, overwrite); }
3729inline const char* HttpServer::getStatusCode(int code) {
3730 return HttpServer_getStatusCode(code);
3731}
3732#endif
3733
3734
3736 return HttpRequest_getResponse(this); }
3738 return HttpRequest_getConnection(this); }
3740 return HttpResponse_getRequest(this); }
3742 return HttpResponse_getCommand(this); }
3744 return HttpRequest_getCommand(this); }
3746 return HttpConnection_getServer(this); }
3747
3748#endif /* __cplusplus */
3749 /* end of StdWebServer */
3751
3752/* Internal use */
3753#ifdef NO_SHARKSSL
3754
3755#define SHARKSSL_MD5_HASH_LEN 16
3756#define SHARKSSL_SHA1_HASH_LEN 20
3757
3758typedef struct SharkSslMd5Ctx
3759{
3760 U32 total[2];
3761 U32 state[4];
3762 U8 buffer[64];
3763} SharkSslMd5Ctx;
3764
3765SHARKSSL_API void SharkSslMd5Ctx_constructor(SharkSslMd5Ctx* ctx);
3766SHARKSSL_API void SharkSslMd5Ctx_append(SharkSslMd5Ctx* ctx, const U8* data, U32 len);
3767SHARKSSL_API void SharkSslMd5Ctx_finish(SharkSslMd5Ctx* ctx, U8 digest[]);
3768SHARKSSL_API int sharkssl_md5(const U8*, U16, U8*);
3769
3770typedef struct SharkSslSha1Ctx
3771{
3772 U32 total[2];
3773 U32 state[5];
3774 U8 buffer[64];
3775} SharkSslSha1Ctx;
3776
3777SHARKSSL_API void SharkSslSha1Ctx_constructor(SharkSslSha1Ctx* ctx);
3778SHARKSSL_API void SharkSslSha1Ctx_append(SharkSslSha1Ctx* ctx, const U8* data, U32 len);
3779SHARKSSL_API void SharkSslSha1Ctx_finish(SharkSslSha1Ctx*, U8 digest[]);
3780
3781typedef void SharkSsl;
3782
3783#endif
3784
3785#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:212
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:2500
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:804
HttpHeader * getHeaders(int *len)
Return an HTTP header iterator that can iterate and fetch all the HTTP headers.
Definition: HttpServer.h:1334
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:2074
BaTime getCreationTime()
Returns the time when this session was created, measured in seconds since midnight January 1,...
Definition: HttpServer.h:2498
int setMaxAge(BaTime seconds)
Sets header "Cache-Control: max-age=seconds".
Definition: HttpServer.h:2119
int setDateHeader(const char *name, BaTime time)
Sets a response header with the given name and date-value.
Definition: HttpServer.h:2114
HttpDir * getNext()
Returns the next dir in the parent list.
Definition: HttpServer.h:3119
const char * getRequestURI()
Returns the pathname.
Definition: HttpServer.h:1317
const char * containsHeader(const char *name)
Searches the internal response header database for a header with the specified name.
Definition: HttpServer.h:2058
const char * getContentType()
Returns the content type, for example: "application/x-www-form-urlencoded".
Definition: HttpServer.h:889
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()
Returns the host header.
Definition: HttpServer.h:885
BA_API BaTime HttpCookie_getMaxAge(HttpCookie *o)
Returns the maximum age of the cookie, specified in seconds; by default, 0 indicating the cookie will...
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:2068
void(* HttpSessionAttribute_Destructor)(struct HttpSessionAttribute *o)
HttpSessionAttribute termination callback function.
Definition: HttpServer.h:2216
int sendError(int eCode)
Sends an error response as a simple HTML page to the client using the specified status code.
Definition: HttpServer.h:2092
int forward(const char *path)
Forwards a request from a servlet to another resource (servlet, CSP file, or HTML file).
Definition: HttpServer.h:2070
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:810
int setContentLength(BaFileSize len)
Sets the "Content-Length" parameter value.
Definition: HttpServer.h:2110
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:808
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:3120
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:1315
int resetHeaders()
Removes all HTTP headers.
Definition: HttpServer.h:2088
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:2195
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:2189
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:3111
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:2510
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:1309
int send(const void *data, int len)
Used when sending raw data to the client.
Definition: HttpServer.h:2136
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:2191
int removeResponseBuf()
Remove buffer set by using setResponseBuf.
Definition: HttpServer.h:2086
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:910
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:3737
const char * getDomain()
Returns the host header without any port number.
Definition: HttpServer.h:887
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:3134
struct HttpConnection * getConnection()
Get the current connection object that the HttpCommand instance is bound with.
Definition: HttpServer.h:2193
int sendBufAsTxtError(int eCode)
Sends the data formatted into the HttpResponse buffer as an error message to the client.
Definition: HttpServer.h:2098
bool isForward() const
Returns true if this is a forward request from another servlet or CSP file.
Definition: HttpServer.h:2078
AuthenticatedUser * getAuthenticatedUser()
Returns the authenticated user or NULL if user is not authenticated.
Definition: HttpServer.h:1307
int unlink()
Unlinks/removes the page from the parent directory.
Definition: HttpServer.h:2731
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:2504
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:3367
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:1344
HttpStdHeaders * getStdHeaders()
Returns an object containing standard HTTP headers.
Definition: HttpServer.h:1321
const char * getHeaderValue(const char *name)
Returns the value of the specified request header.
Definition: HttpServer.h:1325
int setDefaultHeaders()
Sets the most common header values in servlet and CSP files.
Definition: HttpServer.h:2138
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:2090
int insertCSP(CspInit cspInit, const char *virtualDirRootPath, struct CspReader *reader)
Insert and initialize a CSP Virtual Directory.
Definition: HttpServer.h:3704
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:2062
bool initial() const
Returns true if this is the initial page.
Definition: HttpServer.h:2082
~HttpServer()
Stop using the server before destruction.
Definition: HttpServer.h:3695
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:3721
void terminate()
Unbinds any objects bound to this session object, runs the HttpSession destructor,...
Definition: HttpServer.h:2506
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:2726
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:553
SBaFileSize getContentLength()
Returns the content length if request contains a body.
Definition: HttpServer.h:891
U32 byteCount()
Returns number of bytes sent thus far.
Definition: HttpServer.h:2060
int setCommit(U16 size)
Set the size of the HTTP response commit buffer.
Definition: HttpServer.h:3373
BA_API BaBool HttpCookie_getSecure(HttpCookie *o)
Returns true if the browser is sending cookies only over a secure protocol, or false if the browser c...
HttpDir()
Constructor for creating a root dir, a root dir has no name.
Definition: HttpServer.h:3099
struct HttpServer HttpServer
The Web Server.
int setValue(const char *newValue)
Assigns a new value to a cookie after the cookie is created.
Definition: HttpServer.h:812
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:1327
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:3699
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:2732
void setMaxAge(BaTime expiry)
Sets the maximum age of the cookie in seconds.
Definition: HttpServer.h:802
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:2084
HttpSessionContainer * getSessionContainer()
Get the HttpSessionContainer.
Definition: HttpServer.h:3714
HttpDir * getFirstRootDir()
Returns the first root directory.
Definition: HttpServer.h:3712
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:2496
AuthenticatedUser * getAuthenticatedUser()
Returns the AuthenticatedUser if user is authenticated.
Definition: HttpServer.h:2521
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:2112
void(* HttpPage_Service)(struct HttpPage *page, HttpRequest *request, HttpResponse *response)
The HttpPage service function.
Definition: HttpServer.h:2589
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:2518
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:3369
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:3723
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:2064
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:3719
BA_API int HttpResponse_resetHeaders(HttpResponse *o)
Removes all HTTP headers.
struct HttpServer * getServer()
Definition: HttpServer.h:3745
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:2132
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:2134
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:3379
HttpInData * getBuffer()
Get the internal rec buffer.
Definition: HttpServer.h:1346
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)
Encodes an absolute or relative URL, or if encoding is not needed, returns the URL unchanged.
Definition: HttpServer.h:2066
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:3375
HttpDir * createOrGet(const char *name)
Returns a sub-directory with the given name.
Definition: HttpServer.h:3125
bool authenticateAndAuthorize(HttpCommand *cmd, const char *path)
Authenticate and authorize the user.
Definition: HttpServer.h:3138
int(* HttpDir_Service)(struct HttpDir *o, const char *relPath, HttpCommand *cmd)
The HttpDir service callback function.
Definition: HttpServer.h:2747
HttpServer(SoDisp *dispatcher, HttpServerConfig *cfg=0)
Create a Web Server object.
Definition: HttpServer.h:3693
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:2121
bool isInclude() const
Returns true if this is an include from another servlet or CSP file.
Definition: HttpServer.h:2080
int unlink()
Unlinks/removes the directory from the parent directory.
Definition: HttpServer.h:3131
char * getRootPath()
Calculates the root of where the HttpDir instance is installed in the virtual file system.
Definition: HttpServer.h:3107
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)
Checks the HTTP method type and sends a response message if condition met.
Definition: HttpServer.h:1300
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:1323
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:2127
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:2108
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)
Encodes an absolute or relative URL, or if encoding is not needed, returns the URL unchanged.
BA_API int HttpPage_unlink(HttpPage *o)
Unlinks/removes the page from the parent directory.
HttpPage * getFirstPage()
Returns the first page.
Definition: HttpServer.h:3113
SoDisp * getDispatcher()
Returns the dispatcher object.
Definition: HttpServer.h:3710
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:3115
int wsUpgrade()
Validate and send an HTTP/1.1 WebSocket version-13 handshake.
Definition: HttpServer.h:1331
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)
Checks the HTTP method type and sends a response message if condition met.
static const char * getStatusCode(int code)
Return a short description for common HTTP error codes.
Definition: HttpServer.h:3729
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:3105
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:3717
U32 getUseCounter()
Get the session usage counter.
Definition: HttpServer.h:2519
bool committed() const
Returns a boolean indicating if the response has been committed.
Definition: HttpServer.h:2076
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:2072
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:2514
const char * getConnection()
Returns the connection type for HTTP 1.1 connections, returns "Close" or "Keep-Alive.
Definition: HttpServer.h:883
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:1329
void decrRefCntr()
Decrements the session reference counter.
Definition: HttpServer.h:2516
const char * getRequestURL(bool forceHttps=false)
Reconstructs the URL the client used to make the request.
Definition: HttpServer.h:1319
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:3743
int insertDir(HttpDir *dir)
Insert a sub-directory.
Definition: HttpServer.h:3109
void setMaxInactiveInterval(BaTime interval)
Specifies the time, in seconds, between client requests before the session container will invalidate ...
Definition: HttpServer.h:2512
void setMaxSessions(int max)
Set the maximum number of session objects.
Definition: HttpServer.h:2572
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:2728
const char * get404Page()
Returns a pointer to the current 404 page, if any.
Definition: HttpServer.h:3725
HttpCommand * getCommand()
Get the HttpCommand object.
Definition: HttpServer.h:3741
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:3122
int setPath(const char *uri)
Set the cookie path.
Definition: HttpServer.h:806
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:1341
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:3365
const char * getMethod()
Returns a string representation of the value returned by HttpRequest::getMethodType.
Definition: HttpServer.h:1311
BaTime getMaxInactiveInterval()
Returns the maximum time interval, in seconds, that the session container will keep this session open...
Definition: HttpServer.h:2502
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:2056
HttpPage * getPage(const char *name)
Returns the page with the name given or NULL if not found.
Definition: HttpServer.h:3117
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:798
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:2100
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:3127
HttpDir * getFirstDir()
Returns the first sub-directory.
Definition: HttpServer.h:3114
int setDomain(const char *pattern)
Specifies the domain within which this cookie should be presented.
Definition: HttpServer.h:800
bool isLinked()
Returns true if this directory node is installed into a parent directory.
Definition: HttpServer.h:3132
HttpResponse * getResponse()
Returns the HttpResponse object.
Definition: HttpServer.h:3735
int insertDir(const char *virtualDirRootPath, HttpDir *dir)
Insert a directory node into the virtual file system.
Definition: HttpServer.h:3702
void setStatus(int statusCode)
Sets the status code for this response.
Definition: HttpServer.h:2124
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:3697
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:2116
HttpRequest * getRequest()
Get the HttpRequest object.
Definition: HttpServer.h:3739
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:3129
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:2294
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:1305
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:818
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:2106
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:3371
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:2508
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:3377
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:2096
HttpSessionAttribute(const char *name, HttpSessionAttribute_Destructor terminate)
Create a session attribute.
Definition: HttpServer.h:2290
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:3103
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:91
S32 SBaFileSize
Signed file-size value in bytes; 32 bits without BA_FILESIZE64.
Definition: GenPrimT.h:138
int32_t S32
Signed 32-bit integer.
Definition: GenPrimT.h:85
S64 BaTime
An arithmetic type representing calendar time with epoch of 1970-01-01 00:00:00 UTC,...
Definition: GenPrimT.h:103
uint32_t U32
Unsigned 32-bit integer.
Definition: GenPrimT.h:93
int16_t S16
Signed 16-bit integer.
Definition: GenPrimT.h:83
uint8_t U8
Unsigned 8-bit integer.
Definition: GenPrimT.h:89
U8 BaBool
Boolean stored in an unsigned byte; FALSE is zero and TRUE is one.
Definition: GenPrimT.h:118
int8_t S8
Signed 8-bit integer.
Definition: GenPrimT.h:81
U32 BaFileSize
Unsigned file size or position in bytes; 32 bits without BA_FILESIZE64.
Definition: GenPrimT.h:136
Abstract base class implemented by BasicAuthUser, FormAuthUser and DigestAuthUser.
Definition: AuthenticatedUser.h:272
Abstract interface class implemented by DigestAuthenticator, FormAuthenticator and BasicAuthenticator...
Definition: AuthenticatedUser.h:425
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:2151
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:589
const char * getComment() const
Returns the comment set for this cookie or null if the cookie comment is not set.
Definition: HttpServer.h:595
const char * getPath() const
Returns the path on the server to which the browser returns this cookie.
Definition: HttpServer.h:610
BaTime getMaxAge() const
Returns the maximum age of the cookie, specified in seconds; by default, 0 indicating the cookie will...
Definition: HttpServer.h:603
bool getSecure() const
Returns true if the browser is sending cookies only over a secure protocol, or false if the browser c...
Definition: HttpServer.h:615
const char * getDomain() const
Returns the domain name set for this cookie.
Definition: HttpServer.h:598
const char * getValue() const
Returns the value of the cookie.
Definition: HttpServer.h:623
bool getHttpOnly() const
Return the HttpOnly attribute.
Definition: HttpServer.h:620
const char * getName() const
Returns the name of the cookie.
Definition: HttpServer.h:606
An instance of the HttpDir class, which is a collection of zero or more resources,...
Definition: HttpServer.h:2777
HttpDir * getParent() const
Returns the parent directory or NULL if no parent.
Definition: HttpServer.h:2897
const char * getName() const
Returns the directory name.
Definition: HttpServer.h:2893
The web-server "Request Data" container.
Definition: HttpServer.h:288
const char * getBuf()
Get pointer to start of PUT/POST data.
Definition: HttpServer.h:323
S32 getBufSize()
Get size of internal buffer.
Definition: HttpServer.h:325
An HttpPage, which is typically created by the CSP compiler, is similar to a Java servlet.
Definition: HttpServer.h:2656
const char * getName() const
Returns the page name.
Definition: HttpServer.h:2679
The HttpParameterIterator is used for iterating through the form elements parsed by the HttpServer ob...
Definition: HttpServer.h:485
const char * getValue() const
Return the borrowed current value, or NULL at the end.
Definition: HttpServer.h:507
const char * getName() const
Return the borrowed current name, or NULL at the end.
Definition: HttpServer.h:505
A persistent container object for HTTP parameters.
Definition: HttpServer.h:389
static U32 calculateSize(struct HttpRequest *req)
Calculate the HttpParameter size.
Definition: HttpServer.h:448
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:452
static HttpParameter * clone(void *buf, struct HttpRequest *req)
Copy HTTP parameters to buf and return as a HttpParameter object.
Definition: HttpServer.h:450
The HttpServer creates an HttpRequest object when the HttpServer parses a client request.
Definition: HttpServer.h:950
This object is used when sending response messages back to the client.
Definition: HttpServer.h:1379
Use an instance of this class if you want to override the default web-server parameters.
Definition: HttpServer.h:3171
The Web Server.
Definition: HttpServer.h:3393
The interface to an HttpSession attribute.
Definition: HttpServer.h:2247
The HttpSession container class.
Definition: HttpServer.h:2540
Provides a way to identify a user across more than one page request or visit to a web site,...
Definition: HttpServer.h:2305
Standard HTTP header values.
Definition: HttpServer.h:827
The SoDisp dispatches any socket connection that contains data by calling the SoDispCon::execute memb...
Definition: SoDisp.h:91
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:195