Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Fork of webserverBlinky by
Diff: main.cpp
- Revision:
- 74:7409fbeabb2e
- Parent:
- 73:2f56ec87dbe9
- Child:
- 75:0d513869231f
diff -r 2f56ec87dbe9 -r 7409fbeabb2e main.cpp --- a/main.cpp Mon Jun 26 17:41:47 2017 +0000 +++ b/main.cpp Wed Jun 28 18:36:05 2017 +0000 @@ -523,6 +523,7 @@ n=n+sprintf(n+dataStart,"Content-Length: "); // http header int contentLengthStart = n; // remember where Content-Length is in buffer n=n+sprintf(n+dataStart,"?????\r\n"); // leave five spaces for content length - will be updated later + n=n+sprintf(n+dataStart,"Connection: close\r\n"); // close connection immediately n=n+sprintf(n+dataStart,"Content-Type: text/html; charset=us-ascii\r\n\r\n"); // http header must end with empty line (\r\n) int nHeader=n; // byte size of the HTTP header. Note - seems like this must be 1+(multiple of four) @@ -537,16 +538,17 @@ if (v0) { debug("HTTP GET BufferSize %d*32=%d Header %d Content-Length %d Total %d Available %d\n",dataLen/32,dataLen,nHeader,contentLength,n,dataLen-n); } - } else { // all remaining requests get 404 Not Found response + } else { // all remaining requests get 404 Not Found response and heap size n=n+sprintf(n+dataStart,"HTTP/1.1 404 Not Found\r\nServer: PPP-Blinky\r\n"); // http header n=n+sprintf(n+dataStart,"Content-Length: "); // http header int contentLengthStart = n; // remember where Content-Length is in buffer n=n+sprintf(n+dataStart,"?????\r\n"); // leave five spaces for content length - will be updated later - n=n+sprintf(n+dataStart,"Content-Type: text/html; charset=us-ascii\r\n\r\n"); // http header must end with empty line (\r\n) + n=n+sprintf(n+dataStart,"Connection: close\r\n"); // close connection immediately + n=n+sprintf(n+dataStart,"Content-Type: text/html; charset=us-ascii\r\n\r\n"); // http header must end with empty line (\r\n) int nHeader=n; // byte total of all headers. Note - seems like this must be 1+(multiple of four) n=n+sprintf(n+dataStart,"<!DOCTYPE html><html><head></head>"); // html start - n=n+sprintf(n+dataStart,"<body><h1>File Not Found</h1></body>"); + n=n+sprintf(n+dataStart,"<body><h1>File Not Found. Stack=0x%08x</h1></body>",&nHeader); n=n+sprintf(n+dataStart,"</html>\r\n"); // html end char contentLengthString[CONTENTLENGTHSIZE+1]; // temporary buffer to create Content-Length string