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.cpp@21:02c82594c8c0, 2017-06-29 (annotated)
- Committer:
- andrewboyson
- Date:
- Thu Jun 29 19:42:28 2017 +0000
- Revision:
- 21:02c82594c8c0
- Parent:
- 10:f0854784e960
- Child:
- 22:914b970356f0
Added http reply routines
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
andrewboyson | 21:02c82594c8c0 | 1 | #include "mbed.h" |
andrewboyson | 21:02c82594c8c0 | 2 | #include "time.h" |
andrewboyson | 21:02c82594c8c0 | 3 | #include "http.h" |
andrewboyson | 4:31fa7d50722c | 4 | |
andrewboyson | 21:02c82594c8c0 | 5 | static void dateFromTm(struct tm* ptm, char* ptext) |
andrewboyson | 2:849103b5a16d | 6 | { |
andrewboyson | 2:849103b5a16d | 7 | size_t size = strftime(ptext, HTTP_DATE_LENGTH, "%a, %d %b %Y %H:%M:%S GMT", ptm);//Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123 |
andrewboyson | 2:849103b5a16d | 8 | } |
andrewboyson | 21:02c82594c8c0 | 9 | void HttpDateFromNow(char* pText) |
andrewboyson | 2:849103b5a16d | 10 | { |
andrewboyson | 2:849103b5a16d | 11 | struct tm tm; |
andrewboyson | 2:849103b5a16d | 12 | TimeToTmUtc(time(NULL), &tm); |
andrewboyson | 21:02c82594c8c0 | 13 | dateFromTm(&tm, pText); |
andrewboyson | 2:849103b5a16d | 14 | } |
andrewboyson | 21:02c82594c8c0 | 15 | void HttpDateFromDateTime(const char* date, const char *ptime, char* ptext) |
andrewboyson | 2:849103b5a16d | 16 | { |
andrewboyson | 2:849103b5a16d | 17 | struct tm tm; |
andrewboyson | 2:849103b5a16d | 18 | TimeAsciiDateTimeToTm(date, ptime, &tm); |
andrewboyson | 21:02c82594c8c0 | 19 | dateFromTm(&tm, ptext); |
andrewboyson | 3:ab6fd66d172c | 20 | } |