A stack which works with or without an Mbed os library. Provides IPv4 or IPv6 with a full 1500 byte buffer.
Dependents: oldheating gps motorhome heating
tcp/http/http.h@145:206bf0d073c7, 2019-05-14 (annotated)
- Committer:
- andrewboyson
- Date:
- Tue May 14 15:09:39 2019 +0000
- Revision:
- 145:206bf0d073c7
- Parent:
- 144:6bd5c54efc7d
- Child:
- 146:0fc66d610fd6
Added a shim module between the web server and TCP to switch between http (direct) and https (tls).
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
andrewboyson | 61:aad055f1b0d1 | 1 | #include <stdbool.h> |
andrewboyson | 61:aad055f1b0d1 | 2 | #include <stdarg.h> |
andrewboyson | 61:aad055f1b0d1 | 3 | #include <stdint.h> |
andrewboyson | 127:fcdfbfad8770 | 4 | #include <time.h> |
andrewboyson | 61:aad055f1b0d1 | 5 | |
andrewboyson | 96:43eb7a110f1a | 6 | extern void HttpAddChar (char c); |
andrewboyson | 96:43eb7a110f1a | 7 | extern void HttpFillChar (char c, int length); |
andrewboyson | 96:43eb7a110f1a | 8 | extern int HttpAddText (const char* text); |
andrewboyson | 96:43eb7a110f1a | 9 | extern int HttpAddV (char *fmt, va_list argptr); |
andrewboyson | 96:43eb7a110f1a | 10 | extern int HttpAddF (char *fmt, ...); |
andrewboyson | 96:43eb7a110f1a | 11 | extern void HttpAddData (const char* data, int length); |
andrewboyson | 96:43eb7a110f1a | 12 | extern void HttpAddStream (void (*startFunction)(void), int (*enumerateFunction)(void)); |
andrewboyson | 96:43eb7a110f1a | 13 | extern void HttpAddNibbleAsHex(int value); |
andrewboyson | 140:9000ea70b220 | 14 | extern void HttpAddByteAsHex (int value); |
andrewboyson | 96:43eb7a110f1a | 15 | extern void HttpAddInt12AsHex (int value); |
andrewboyson | 96:43eb7a110f1a | 16 | extern void HttpAddInt16AsHex (int value); |
andrewboyson | 135:a7f026a09543 | 17 | extern void HttpAddInt32AsHex (int value); |
andrewboyson | 140:9000ea70b220 | 18 | extern void HttpAddInt64AsHex (int64_t value); |
andrewboyson | 127:fcdfbfad8770 | 19 | extern void HttpAddTm (struct tm* ptm); |
andrewboyson | 145:206bf0d073c7 | 20 | extern bool HttpBufFilled (void); |
andrewboyson | 54:84ef2b29cf7e | 21 | |
andrewboyson | 141:25047f31dbab | 22 | extern void HttpOk(const char* contentType, const char* cacheControl, const char* lastModifiedDate, const char* lastModifiedTime); |
andrewboyson | 141:25047f31dbab | 23 | extern char* HttpOkCookieName; |
andrewboyson | 141:25047f31dbab | 24 | extern char* HttpOkCookieValue; |
andrewboyson | 141:25047f31dbab | 25 | extern int HttpOkCookieMaxAge; |
andrewboyson | 141:25047f31dbab | 26 | |
andrewboyson | 141:25047f31dbab | 27 | extern void HttpNotFound (void); |
andrewboyson | 141:25047f31dbab | 28 | extern void HttpNotModified (void); |
andrewboyson | 141:25047f31dbab | 29 | |
andrewboyson | 129:9c57197fb698 | 30 | extern int HttpRequestRead (char *p, int len, char** ppMethod, char** ppPath, char** ppQuery, char** ppLastModified, char** ppCookies, int* pContentLength); |
andrewboyson | 110:67c96c143c2a | 31 | |
andrewboyson | 129:9c57197fb698 | 32 | extern char* HttpCookiesSplit (char* pCookies, char** ppName, char** ppValue); |
andrewboyson | 129:9c57197fb698 | 33 | extern char* HttpQuerySplit (char* pQuery, char** ppName, char** ppValue); |
andrewboyson | 129:9c57197fb698 | 34 | extern int HttpQueryValueAsInt(char* pValue); |
andrewboyson | 129:9c57197fb698 | 35 | extern void HttpQueryUnencode (char* pValue); |
andrewboyson | 54:84ef2b29cf7e | 36 | |
andrewboyson | 54:84ef2b29cf7e | 37 | extern bool HttpTrace; |
andrewboyson | 145:206bf0d073c7 | 38 | extern bool HttpsTrace; |
andrewboyson | 54:84ef2b29cf7e | 39 | |
andrewboyson | 54:84ef2b29cf7e | 40 | extern void HttpDateFromDateTime(const char* date, const char *ptime, char* ptext); |
andrewboyson | 54:84ef2b29cf7e | 41 | extern void HttpDateFromNow(char* pText); |
andrewboyson | 54:84ef2b29cf7e | 42 | |
andrewboyson | 118:067cb5bce7e3 | 43 | extern bool HttpSameStr (const char* pa, const char* pb); |
andrewboyson | 118:067cb5bce7e3 | 44 | extern bool HttpSameStrCaseInsensitive(const char* pa, const char* pb); |
andrewboyson | 118:067cb5bce7e3 | 45 | extern bool HttpSameDate (const char* date, const char* time, const char* pOtherDate); |
andrewboyson | 109:bca6ebe63e32 | 46 | |
andrewboyson | 54:84ef2b29cf7e | 47 | #define HTTP_DATE_LENGTH 30 |
andrewboyson | 54:84ef2b29cf7e | 48 | |
andrewboyson | 145:206bf0d073c7 | 49 | extern void (*HttpRequestFunction)(int size, char* pRequestStream, uint32_t positionInRequestStream, char* pState); |
andrewboyson | 145:206bf0d073c7 | 50 | extern void HttpRequest (int size, char* pRequestStream, uint32_t positionInRequestStream, char* pState); |
andrewboyson | 145:206bf0d073c7 | 51 | extern void HttpsRequest (int size, char* pRequestStream, uint32_t positionInRequestStream, char* pState); |
andrewboyson | 145:206bf0d073c7 | 52 | extern bool (*HttpReplyPollFunction)(char* pState, bool clientFinished); |
andrewboyson | 145:206bf0d073c7 | 53 | extern bool HttpReplyPoll (char* pState, bool clientFinished); |
andrewboyson | 145:206bf0d073c7 | 54 | extern bool HttpsReplyPoll (char* pState, bool clientFinished); |
andrewboyson | 145:206bf0d073c7 | 55 |