A simple web server that can be bound to either the EthernetInterface or the WiflyInterface.
Dependents: Smart-WiFly-WebServer WattEye X10Svr SSDP_Server
Diff: SW_HTTPServer.cpp
- Revision:
- 28:f93ef41b78e1
- Parent:
- 27:90a1f5a5392f
- Child:
- 29:00116fc9da74
--- a/SW_HTTPServer.cpp Thu Oct 10 20:38:12 2013 +0000 +++ b/SW_HTTPServer.cpp Fri Oct 11 02:33:46 2013 +0000 @@ -622,7 +622,7 @@ // Should we check the 'Content-Type' to see if it is // 'application/x-www-form-urlencoded'? int postBytes = atoi(GetHeaderValue("Content-Length")); - bool acceptIt = false; + CallBackResults acceptIt = ACCEPT_ERROR; if (strcmp(queryType, "POST") == 0 && postBytes > 0 ) { if (postBytes) { int ndxHandler = 0; @@ -637,7 +637,7 @@ } } - if (regHandled && acceptIt) { + if (regHandled && acceptIt != ACCEPT_ERROR) { // @todo need to refactor - if the thing is bigger than the buffer, // then we can receive it a chunk at a time, and hand off // the chunks to the callback. May need callbacks that @@ -647,10 +647,12 @@ // // If so, we'll make space for it postQueryString = (char *)mymalloc(postBytes + 1); + INFO("Free space %d", Free()); if (postQueryString) { char * offset; int len; + INFO("Processing"); dblCR += 4; // If we slurped up any of the POST, while (*dblCR && *dblCR <= ' ') dblCR++; @@ -661,9 +663,9 @@ n = client.receive(offset, postBytes - len); if (n >=0) { offset[n] = '\0'; - //printf("HTTPd: %d of %d: [%s]\r\n", len, postBytes, offset); + INFO("HTTPd: %d of %d: [%s]", len, postBytes, offset); } else if (n < 0) { - //printf("HTTPd: n=%d\r\n", n); + INFO("HTTPd; n=%d", n); break; // no more data, before the plan } } @@ -671,6 +673,7 @@ // UnescapeString(postQueryString); // ParseParameters(postQueryString); // use the same handler as for the length check + INFO("calling user code"); acceptIt = (*handlers[ndxHandler].callback)(this, DATA_TRANSFER, postQueryString, NULL, 0); } else { ERR("HTTPd: len error.");