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

http.cpp

Committer:
andrewboyson
Date:
2017-01-19
Revision:
1:5f70c361db20
Child:
2:849103b5a16d

File content as of revision 1:5f70c361db20:

#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);
    
}