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:
- 11:17d84c41a7b3
- Parent:
- 10:9c8d2c6a3469
- Child:
- 12:109bf1558300
--- a/SW_HTTPServer.cpp Sat Jul 27 23:47:31 2013 +0000 +++ b/SW_HTTPServer.cpp Sun Aug 04 21:34:44 2013 +0000 @@ -54,9 +54,19 @@ std::printf("[%04d] malloc(%d)\r\n", y, x); return malloc(x); } +static char toP(void * x) +{ + char * c = (char *) x; + if (*c >= ' ' && *c < 0x7F) + return *c; + else + return '.'; +} #define mymalloc(x) MyMalloc(x, __LINE__) #define myfree(x) \ - pc->printf("[%04d] free(%02x %02x %02x %02x ...\r\n", __LINE__, *x, *(x+1), *(x+2), *(x+3)); \ + pc->printf("[%4d] free(%02x %02x %02x %02x %02x ... %c%c%c%c%c)\r\n", __LINE__, \ + *x, *(x+1), *(x+2), *(x+3), *(x+4), \ + toP(x), toP(x+1), toP(x+2), toP(x+3), toP(x+4) ); \ free(x); #else #define mymalloc(x) malloc(x) @@ -173,7 +183,7 @@ case Idle: PerformanceTimer.reset(); bPtr = headerbuffer; - if (0 == server->accept(client)) { // client.receive(bPtr, 0)) { // server->accept(client) == 0) { + if (0 == server->accept(client)) { op = Receiving; t_ref = PerformanceTimer.read_us(); #ifdef DEBUG @@ -557,10 +567,6 @@ bool advanceState = false; int bytecount; - // Bad hack to have to do this here, but it isn't being set in the - // underlying layer, and this is what allows it to properly "close" - // when it is done. -// wifly->setConnectionState(true); // Buffer could have partial, but the double \r\n is the key // GET /QueryString HTTP/1.1\r\n // GET /QueryString HTTP/1.1\r\nHost: 192.168.1.140\r\nCache-Con