8000 fix parseArgument #2 by d-a-v · Pull Request #5252 · esp8266/Arduino · GitHub
[go: up one dir, main page]

Skip to content

fix parseArgument #2 #5252

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Oct 17, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
alexa invite: add workaround for malformed x-www-form-urlencoded
  • Loading branch information
d-a-v committed Oct 13, 2018
commit 0d62a41bec6cb40c99331db5b060ae075295835d
17 changes: 7 additions & 10 deletions libraries/ESP8266WebServer/src/Parsing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,15 @@ bool ESP8266WebServer::_parseRequest(WiFiClient& client) {
if (contentLength > 0) {
if(isEncoded){
//url encoded form
if (searchStr != "") searchStr += '&';
if (searchStr.length())
searchStr += '&';
else
// workaround: x-www-form-urlencoded without data
searchStr = F("plain=");
searchStr += plainBuf;
}
_parseArguments(searchStr);
if ( !isEncoded
|| (hasSearch == -1) // Alexa fix (malformed header with form content)
) {
if (!isEncoded) {
//plain post json or other data
RequestArgument& arg = _currentArgs[_currentArgCount++];
arg.key = F("plain");
Expand Down Expand Up @@ -328,12 +330,7 @@ int ESP8266WebServer::_parseArgumentsPrivate(const String& data, int counted) {
if ((equal_index != -1) && ((equal_index < next_index - 1) || (next_index == -1)))
arg.value = urlDecode(data.substring(equal_index + 1, next_index - 1));
#ifdef DEBUG_ESP_HTTP_SERVER
DEBUG_OUTPUT.print("arg ");
DEBUG_OUTPUT.print(arg_total);
DEBUG_OUTPUT.print(" key: ");
DEBUG_OUTPUT.print(arg.key);
DEBUG_OUTPUT.print(" value: ");
DEBUG_OUTPUT.println(arg.value);
DEBUG_OUTPUT.printf("arg %d key: '%s' value: '%s'\r\n", arg_total, arg.key.c_str(), arg.value.c_str());
#endif
}

Expand Down
0