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: http.cpp
- Revision:
- 1:5f70c361db20
- Child:
- 2:849103b5a16d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/http.cpp Thu Jan 19 23:03:26 2017 +0000 @@ -0,0 +1,25 @@ +#include "mbed.h" + +void HttpRequest(int position, int len, char *pData) +{ +} +int HttpResponse(int position, char *pData) +{ + char *pHtml = "HTTP/1.1 200 OK\r\n" + "Content-Type: text/html; charset=UTF-8\r\n" + "Connection: close\r\n" + "\r\n" + "<html>\r\n" + "<head>\r\n" + " <title>GPS Clock</title>\r\n" + "</head>\r\n" + "<body>\r\n" + " Hello World, this is the GPS Clock.\r\n" + "</body>\r\n" + "</html>\r\n"; + int len = strlen(pHtml) - position; + if (len <= 0) return 0; + strcpy(pData, pHtml); + return strlen(pHtml); + +}