The lib with which to make LPC1768 a simple HTTP server. This have not yet implemented. fopen() DOESN'T WORK after EthernetInterface::connect() is called as using mbed-os 5.4~. See also https://os.mbed.com/questions/80658/HardFault-occurs-when-fopen-is-called-af/ or https://github.com/ARMmbed/mbed-os/issues/6578 and https://github.com/ARMmbed/mbed-os/issues/6624
Fork of HTTP_SERVER by
Diff: handlers/ResponseMessenger.cpp
- Revision:
- 1:3a1fe94c6e42
- Parent:
- 0:cc483bea4fe3
- Child:
- 2:33714d7c0f45
--- a/handlers/ResponseMessenger.cpp Tue Feb 16 10:59:31 2016 +0000 +++ b/handlers/ResponseMessenger.cpp Sat Nov 26 16:49:04 2016 +0000 @@ -98,6 +98,28 @@ else return -1; } + +int ResponseMessenger::rmHeaderField( + const char* arg_field_name) +{ + char* removedLineHead; + char* removedLineEnd; + int buffer_size; + + // Look for the head of the line to want to remove + removedLineHead = strstr(header_field_buffer, arg_field_name); + if(removedLineHead = NULL) return -1; + // Look for the first "\r\n" which is the end of the line + removedLineEnd = strstr(removedLineHead, "\r\n"); + removedLineEnd += 3; //pointing next line head or '\0' if the line of the last one. + buffer_size = strlen(removedLineEnd); + + for(int i = 0; i < buffer_size + 1; i++) + removedLineHead[i] = removedLineEnd[i]; + + return 0; +} + int ResponseMessenger::getStatusCode() { return status_code; @@ -172,8 +194,7 @@ if (err_log < 0) err_code = ((err_code) | 2); if (!arg_file.hasError())err_code = ((err_code) | 1); - } - else{ + } else { printf("[No Body]\r\n"); } return (char)err_code;