From bfc19002f3027746322308dc8da79e198a2bf8bf Mon Sep 17 00:00:00 2001 From: Jason Harper Date: Mon, 26 Mar 2018 16:50:52 -0500 Subject: [PATCH] WebServer query arguments not containing an equals sign are now accepted, as a key with an empty value. Previous behavior was to completely ignore the argument, yet still include it in the argument count. (The use of "key=value" arguments is a convention, not an actual requirement in URLs.) Fixes bug #2611. --- libraries/ESP8266WebServer/src/Parsing.cpp | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/libraries/ESP8266WebServer/src/Parsing.cpp b/libraries/ESP8266WebServer/src/Parsing.cpp index 25bf6acec0..673f5610f8 100644 --- a/libraries/ESP8266WebServer/src/Parsing.cpp +++ b/libraries/ESP8266WebServer/src/Parsing.cpp @@ -311,19 +311,13 @@ void ESP8266WebServer::_parseArguments(String data) { DEBUG_OUTPUT.print(" &@ "); DEBUG_OUTPUT.println(next_arg_index); #endif + RequestArgument& arg = _currentArgs[iarg]; if ((equal_sign_index == -1) || ((equal_sign_index > next_arg_index) && (next_arg_index != -1))) { -#ifdef DEBUG_ESP_HTTP_SERVER - DEBUG_OUTPUT.print("arg missing value: "); - DEBUG_OUTPUT.println(iarg); -#endif - if (next_arg_index == -1) - break; - pos = next_arg_index + 1; - continue; + arg.key = urlDecode(data.substring(pos, next_arg_index)); + } else { + arg.key = urlDecode(data.substring(pos, equal_sign_index)); + arg.value = urlDecode(data.substring(equal_sign_index + 1, next_arg_index)); } - RequestArgument& arg = _currentArgs[iarg]; - arg.key = urlDecode(data.substring(pos, equal_sign_index)); - arg.value = urlDecode(data.substring(equal_sign_index + 1, next_arg_index)); #ifdef DEBUG_ESP_HTTP_SERVER DEBUG_OUTPUT.print("arg "); DEBUG_OUTPUT.print(iarg);