fixed with new libs
Dependents: SmartRemote WifiFlexManager SmartRemote E7
Fork of HTTPServer by
Diff: HTTPConnection.cpp
- Revision:
- 3:d6224049b3bf
- Parent:
- 2:8653bbcf7e58
- Child:
- 4:d065642c32cc
diff -r 8653bbcf7e58 -r d6224049b3bf HTTPConnection.cpp --- a/HTTPConnection.cpp Sun May 26 23:22:36 2013 +0000 +++ b/HTTPConnection.cpp Tue May 28 01:56:14 2013 +0000 @@ -178,24 +178,22 @@ } -int HTTPConnection::parseHeader(const char *buffer) +int HTTPConnection::parseHeader(char *buffer) { if ((strlen(buffer) <3) || (buffer == NULL)) return -1; // decompose string into a touple of <field name> : <field value> - static char fieldname[256] = {}; - static char fieldvalue[256] = {}; - for (int i = 0 ; i < strlen(buffer)+1 ; i++) { + int value_start = 0; + int buflen = strlen(buffer)+1; + for (int i = 0 ; i < buflen ; i++) { if (buffer[i] == ':') { // touple found - strncpy(fieldname, buffer, i); - fieldname[i] = 0; - strcpy(fieldvalue, &buffer[i+1]); - -// m_Msg.headers[fieldname] = fieldvalue; + buffer[i] = 0; + value_start = i+1; + m_Msg.headers[buffer] = &buffer[value_start]; - INFO("Header name=\"%s\" : value=\"%s\".", fieldname, fieldvalue); + INFO("Header name=\"%s\" : value=\"%s\".", buffer, &buffer[value_start]); return 0; } }