Skip to content

Commit fe1085e

Browse files
Webserver Ignore extra headers in multipart forms
From espressif/arduino-esp32#9253
1 parent 1f9350d commit fe1085e

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

libraries/WebServer/src/Parsing.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -448,11 +448,12 @@ bool HTTPServer::_parseForm(WiFiClient * client, String boundary, uint32_t len)
448448
argType = FPSTR(mimeTable[txt].mimeType);
449449
line = client->readStringUntil('\r');
450450
client->readStringUntil('\n');
451-
if (line.length() > 12 && line.substring(0, 12).equalsIgnoreCase(FPSTR(Content_Type))) {
452-
argType = line.substring(line.indexOf(':') + 2);
453-
//skip next line
454-
client->readStringUntil('\r');
455-
client->readStringUntil('\n');
451+
while (line.length() > 0) {
452+
if (line.length() > 12 && line.substring(0, 12).equalsIgnoreCase(FPSTR(Content_Type))) {
453+
argType = line.substring(line.indexOf(':') + 2);
454+
}
455+
//skip over any other headers
456+
line = client->readStringUntil('\r');
456457
}
457458
log_v("PostArg Type: %s", argType.c_str());
458459
if (!argIsFile) {

0 commit comments

Comments
 (0)