Single instance HTTP Server using new Ethernet Interface. Blocking mode only; this improved stability, but the HTTP server must be started from a separate thread.
Fork of HTTPServer by
Diff: HTTPConnection.cpp
- Revision:
- 11:3943841e1798
- Parent:
- 9:c2a1462b9b71
- Child:
- 13:aa5338a5e452
--- a/HTTPConnection.cpp Sun Jun 02 00:37:38 2013 +0000 +++ b/HTTPConnection.cpp Sun Jun 02 22:59:51 2013 +0000 @@ -73,7 +73,7 @@ if (rcvd == -1) { // Invalid content received, so close the connection INFO("Invalid message received, so sending negative response and closing connection !"); - sprintf(buffer,"HTTP/1.0 400 BadRequest\n\rContent-Length: %d\n\rContent-Type: text\n\rConnection: Close\n\r\n\r",0); + sprintf(buffer,"HTTP/1.1 400 BadRequest\n\rContent-Length: %d\n\rContent-Type: text\n\r\n\r\n\r",0); m_Tcp.set_blocking(true, 1500); m_Tcp.send(buffer,strlen(buffer)); close(); @@ -116,7 +116,7 @@ // Try to receive up to the max number of characters for (i = 0 ; i < nMaxLen-1 ; i++) { int c; - c = m_Tcp.receive_all( szLine + i, 1 ); + c = m_Tcp.receive( szLine + i, 1 ); // Check that - if no character was currently received - the timeout period is reached. if ((c == 0) || (c==-1)) { // no character was read, so check if operation timed out