Skip to content

Commit bfc1900

Browse files
committed
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 esp8266#2611.
1 parent e1ca870 commit bfc1900

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

libraries/ESP8266WebServer/src/Parsing.cpp

+5-11
Original file line numberDiff line numberDiff line change
@@ -311,19 +311,13 @@ void ESP8266WebServer::_parseArguments(String data) {
311311
DEBUG_OUTPUT.print(" &@ ");
312312
DEBUG_OUTPUT.println(next_arg_index);
313313
#endif
314+
RequestArgument& arg = _currentArgs[iarg];
314315
if ((equal_sign_index == -1) || ((equal_sign_index > next_arg_index) && (next_arg_index != -1))) {
315-
#ifdef DEBUG_ESP_HTTP_SERVER
316-
DEBUG_OUTPUT.print("arg missing value: ");
317-
DEBUG_OUTPUT.println(iarg);
318-
#endif
319-
if (next_arg_index == -1)
320-
break;
321-
pos = next_arg_index + 1;
322-
continue;
316+
arg.key = urlDecode(data.substring(pos, next_arg_index));
317+
} else {
318+
arg.key = urlDecode(data.substring(pos, equal_sign_index));
319+
arg.value = urlDecode(data.substring(equal_sign_index + 1, next_arg_index));
323320
}
324-
RequestArgument& arg = _currentArgs[iarg];
325-
arg.key = urlDecode(data.substring(pos, equal_sign_index));
326-
arg.value = urlDecode(data.substring(equal_sign_index + 1, next_arg_index));
327321
#ifdef DEBUG_ESP_HTTP_SERVER
328322
DEBUG_OUTPUT.print("arg ");
329323
DEBUG_OUTPUT.print(iarg);

0 commit comments

Comments
 (0)