![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Upper Version Add PUT method Delete POST method
Dependencies: Adafruit_GFX MbedJSONValue_v102 WIZnetInterface mbed
Fork of WIZwiki-REST-io_v102 by
Diff: HTTPServer.cpp
- Revision:
- 8:60d99da6eeb2
- Parent:
- 4:0b5a199e91f3
diff -r 64db444b21f4 -r 60d99da6eeb2 HTTPServer.cpp --- a/HTTPServer.cpp Fri Jul 29 08:15:34 2016 +0000 +++ b/HTTPServer.cpp Mon Sep 05 06:29:55 2016 +0000 @@ -93,33 +93,33 @@ if(buffer) { #ifdef DEBUG_HTTP - // buffer check - printf("*******************************************************\r\n"); - printf("buffer=%s\r\n",buffer); - printf("*******************************************************\r\n"); + // buffer check + printf("***********************\r\n"); + printf(" buffer=%s \r\n",buffer); + printf("***********************\r\n"); #endif - // type parsing - request_type = strtok(buffer," \r\n"); + // type parsing + request_type = strtok(buffer," \r\n"); #ifdef DEBUG_HTTP printf("Type = %s\r\n", request_type); #endif if(request_type) { - request = strtok(NULL, " \r\n"); // corrested " " -> " /" : /Name -> Name + request = strtok(NULL, " \r\n"); // corrested " " -> " /" : /Name -> Name if(request) { #ifdef DEBUG_HTTP - printf("URI = %s\r\n", request); + printf("URI = %s\r\n", request); #endif } else { - strcpy(rest_result, "Invaild URI"); + strcpy(rest_result, "Invaild URI"); #ifdef DEBUG_HTTP - printf("%s\r\n",rest_result); + printf("%s\r\n",rest_result); #endif - return HTTP_INVALID_URI; + return HTTP_INVALID_URI; } } } @@ -135,6 +135,7 @@ if(itor->second != NULL) { char* request_data = 0; +#ifdef HTTP_POST if(!strcmp(request_type,"POST")) { request_data = strstr(request+strlen(request)+1, "\r\n\r\n"); @@ -142,6 +143,14 @@ printf("POST:request_data=%s\r\n",request_data+4); #endif } +#endif + if(!strcmp(request_type,"PUT")) + { + request_data = strstr(request+strlen(request)+1, "\r\n\r\n"); +#ifdef DEBUG_HTTP + printf("PUT:request_data=%s\r\n",request_data+4); +#endif + } itor->second->handle(request, request_data, rest_result); } else