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.
Fork of SW_HTTPServer by
Diff: SW_HTTPServer.cpp
- Revision:
- 10:9c8d2c6a3469
- Parent:
- 9:2ea342765c9d
- Child:
- 11:17d84c41a7b3
diff -r 2ea342765c9d -r 9c8d2c6a3469 SW_HTTPServer.cpp --- a/SW_HTTPServer.cpp Thu Jul 04 01:58:13 2013 +0000 +++ b/SW_HTTPServer.cpp Sat Jul 27 23:47:31 2013 +0000 @@ -99,7 +99,7 @@ // client.set_blocking(false, 0); // server->accept(client); ResetPerformanceData(); - timer.start(); + PerformanceTimer.start(); } HTTPServer::~HTTPServer() @@ -155,7 +155,7 @@ static state op = Idle; static char * bPtr = headerbuffer; int n; - static int t_ref; // reference point for the timer + static int t_ref; // reference point for the PerformanceTimer #ifdef DEBUG static state lastOp = Reset; @@ -171,11 +171,11 @@ break; case Idle: - timer.reset(); + PerformanceTimer.reset(); bPtr = headerbuffer; if (0 == server->accept(client)) { // client.receive(bPtr, 0)) { // server->accept(client) == 0) { op = Receiving; - t_ref = timer.read_us(); + t_ref = PerformanceTimer.read_us(); #ifdef DEBUG pc->printf("Accept at %d\r\n", t_ref); #endif @@ -402,7 +402,7 @@ { bool res; - res = wifly->close(); + res = server->close(); //wifly->close(); #ifdef DEBUG pc->printf("close connection returned %d\r\n", res); #endif @@ -560,7 +560,7 @@ // 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); +// 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 @@ -591,13 +591,15 @@ queryType = (char *)mymalloc(strlen("GET")+1); strcpy(queryType, "GET"); } + //printf("GET: %s\r\n", queryString); } else if (strstr(soRec, "POST ") == soRec) { Extract(soRec, "POST", &queryString); if (queryString) { queryType = (char *)mymalloc(strlen("POST")+1); strcpy(queryType, "POST"); } - } + //printf("POST: %s\r\n", queryString); + } Extract(soRec, "Host: ", &hostString); Extract(soRec, "Content-Length: ", &contentLength); Extract(soRec, "Content-Type: ", &contentType); @@ -622,7 +624,7 @@ //for (int i=0; i<paramcount; i++) // pc->printf("param %d '%s'='%s'\r\n", i, params[i].name, params[i].value); } else { - pc->printf("ERROR: queryString not found\r\n"); + pc->printf("ERROR: queryString not found in (%s)\r\n", soRec); } advanceState = true; buffer[0] = 0; @@ -702,7 +704,7 @@ int HTTPServer::RecordPerformanceData(SW_PerformanceParam * param, int refTime) { - int t_now = timer.read_us(); + int t_now = PerformanceTimer.read_us(); param->TotalTime_us += (t_now - refTime); param->Samples++; if ((t_now - refTime) > param->MaxTime_us)