Added comments and todos linked to the web server

This commit is contained in:
Anatole SCHRAMM 2019-04-15 13:50:54 +02:00
parent 92ce0f0d6e
commit bce884ff57

View File

@ -138,7 +138,7 @@ boolean WEBServerManager::parseQuery(WiFiClient *wifiClient)
_httpParserState = ERROR;
break;
case HTTP_RESOURCE_SECTION:
if(_httpRequestData.HRM == POST)
if(_httpRequestData.HRM == POST)// Need to be changed, using Content-Length is more appropriate
activeTimeout = longTimeout;
if(readChar == '?' )
@ -170,31 +170,31 @@ boolean WEBServerManager::parseQuery(WiFiClient *wifiClient)
_httpParserState = HTTP_RESOURCE_SECTION;
}
break;
case HTTP_RESOURCE_PARAM_SECTION:
if(readChar == ' ')
{
_httpRequestData.getParams.add(parseKey,new DictionaryHelper::StringEntity(parseValue));
free(parseKey);free(parseValue);
parseKey = NULL;parseValue = NULL;
_httpParserState = HTTP_VER_SECTION;
}
else if( readChar == '=')
isKey = false;
else if(readChar == '&')
{
isKey = true;
_httpRequestData.getParams.add(parseKey, new DictionaryHelper::StringEntity(parseValue));
free(parseKey);free(parseValue);
parseKey = NULL;parseValue = NULL;
}
else
case HTTP_RESOURCE_PARAM_SECTION: //index.web?var1=1&var2=2...
if(readChar == ' ')
{
if(isKey)
parseKey = addChar(parseKey, readChar);
else
parseValue = addChar(parseValue, readChar);
_httpRequestData.getParams.add(parseKey,new DictionaryHelper::StringEntity(parseValue));
free(parseKey);free(parseValue);
parseKey = NULL;parseValue = NULL;
_httpParserState = HTTP_VER_SECTION;
}
break;
else if( readChar == '=')
isKey = false;
else if(readChar == '&')
{
isKey = true;
_httpRequestData.getParams.add(parseKey, new DictionaryHelper::StringEntity(parseValue));
free(parseKey);free(parseValue);
parseKey = NULL;parseValue = NULL;
}
else
{
if(isKey)
parseKey = addChar(parseKey, readChar);
else
parseValue = addChar(parseValue, readChar);
}
break;
case HTTP_VER_SECTION:
if((readChar >= 48 && readChar <= 57) || readChar == '.')
{
@ -211,12 +211,12 @@ boolean WEBServerManager::parseQuery(WiFiClient *wifiClient)
case BODY_SECTION:
//parseBuffer = addChar(parseBuffer, readChar);
break;
case PARAMETER_SECTION:
if(readChar == '\n')
{
_httpParserState = LINE_BREAK;
}
break;
case PARAMETER_SECTION: //Here are all the http header params
if(readChar == '\n')
{
_httpParserState = LINE_BREAK;
}
break;
case IGNORED:
break;
case ERROR: