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
Diff: tcp/http/httpadd.c
- Revision:
- 152:80a3840fc9f8
- Parent:
- 146:0fc66d610fd6
- Child:
- 156:be12b8fd5b21
--- a/tcp/http/httpadd.c Fri Jul 19 17:48:06 2019 +0000 +++ b/tcp/http/httpadd.c Thu Jul 25 21:11:37 2019 +0000 @@ -122,6 +122,30 @@ HttpAddNibbleAsHex(value >> 4); HttpAddNibbleAsHex(value >> 0); } +void HttpAddBytesAsHex(const char* value, int size) +{ + int i = 0; + while(true) + { + HttpAddByteAsHex(value[i]); + i++; + if (i >= size) break; + if (i % 16 == 0) HttpAddText("\r\n"); + else HttpAddChar(' '); + } +} +void HttpAddBytesAsHexRev(const char* value, int size) +{ + int i = 0; + while(true) + { + HttpAddByteAsHex(value[size - i - 1]); + i++; + if (i >= size) break; + if (i % 16 == 0) HttpAddText("\r\n"); + else HttpAddChar(' '); + } +} void HttpAddTm(struct tm* ptm) { HttpAddF("%d-%02d-%02d ", ptm->tm_year + 1900, ptm->tm_mon + 1, ptm->tm_mday);