Simple HTTP Server with one page index.html stored inside MBED as char vector and javascript to update a table content
Fork of HTTP_SERVER by
Diff: HTTP_SERVER.cpp
- Revision:
- 6:4eb469f51570
- Parent:
- 5:dedbaa9c633b
- Child:
- 7:184c6f1ace94
diff -r dedbaa9c633b -r 4eb469f51570 HTTP_SERVER.cpp --- a/HTTP_SERVER.cpp Sat Nov 26 18:54:10 2016 +0000 +++ b/HTTP_SERVER.cpp Sat Nov 26 19:15:20 2016 +0000 @@ -91,7 +91,7 @@ case 0: printf("(HTTP_SERVER) recieved buffer is empty.\r\n"); msger.setStatusLine(400, "No Request"); - if(msger.setHeaderField("Connection", "close"))printf("(HTTP_SERVER)buffer over flow @ ResponseMessenger"); + if(msger.setHeaderField("Connection", "Close"))printf("(HTTP_SERVER)buffer over flow @ ResponseMessenger"); httpmethod = NULL; filepath = NULL; http_ver = NULL; @@ -99,7 +99,7 @@ case -1: printf("(HTTP_SERVER) failed to read data from client.\r\n"); msger.setStatusLine(500, "Internal Server Error"); - if(msger.setHeaderField("Connection", "close"))printf("(HTTP_SERVER)buffer over flow @ ResponseMessenger"); + if(msger.setHeaderField("Connection", "Close"))printf("(HTTP_SERVER)buffer over flow @ ResponseMessenger"); httpmethod = NULL; filepath = NULL; http_ver = NULL; @@ -242,6 +242,9 @@ msger.resetHeader(); printf("(HTTP_SERVER) echo back done.\r\n"); } + if (strcmp(httpmethod, NULL) == 0 ) { + msger.sendHTTPResponse(tcpcon); + } printf("(HTTP_SERVER) Response to Request has done\r\n"); } printf("(HTTP_SERVER) close connection.\r\ntcp server is listening...\r\n");