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:
- 23:6963f45e950a
- Parent:
- 22:55974de690c1
diff -r 55974de690c1 -r 6963f45e950a SW_HTTPServer.cpp --- a/SW_HTTPServer.cpp Thu Oct 10 13:44:07 2013 +0000 +++ b/SW_HTTPServer.cpp Thu Oct 10 16:00:23 2013 +0000 @@ -14,7 +14,8 @@ #include "SW_HTTPServer.h" #include "Utility.h" -//#define DEBUG +#define DEBUG "HTTPd" // Debug aids report this +#include "DebugAid.h" const char * DEFAULT_FILENAME = "index.htm"; @@ -51,7 +52,7 @@ // search the web for embedded system malloc alternates. static void * MyMalloc(int x, int y) { - std::printf("[%04d] malloc(%d)\r\n", y, x); + std::printf("[DBG %s%4d] malloc(%d)\r\n", DEBUG, y, x); return malloc(x); } static char toP(void * x) @@ -64,7 +65,7 @@ } #define mymalloc(x) MyMalloc(x, __LINE__) #define myfree(x) \ - pc->printf("[%4d] free(%02x %02x %02x %02x %02x ... %c%c%c%c%c)\r\n", __LINE__, \ + pc->printf("[DBG %s%4d] free(%02x %02x %02x %02x %02x ... %c%c%c%c%c)\r\n", DEBUG, __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); @@ -268,6 +269,7 @@ char *fbuffer = (char *)mymalloc(FILESEND_BUF_SIZE); int bytes; + INFO("SendFile"); if (fbuffer) { header(200, "OK", filetype); bytes = fread(fbuffer,sizeof(char),FILESEND_BUF_SIZE,fp); @@ -380,6 +382,7 @@ char http[100]; sprintf(http, "%s %i %s\r\n", hdr_httpver, code, code_text); + INFO("header(%s)", http); send(http); send(hdr_age); send(hdr_server);