Skip to content
Merged
Changes from all commits
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
7 changes: 7 additions & 0 deletions src/AsyncWebHeader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ AsyncWebHeader::AsyncWebHeader(const String &data) {
if (index < 0) {
return;
}
if (data.indexOf('\r') >= 0 || data.indexOf('\n') >= 0) {
// Note: do not log as info, warn or error because this could flood the logs without being able to filter this out
#ifdef ESP32
log_v("Invalid character in HTTP header");
#endif
return; // Invalid header format
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@me-no-dev : the current code is weird IMO. If the header line cannot be parsed in anyway, we should not have created a AsyncWebHeader instance from start. This parsing logic should be extracted in a static method which is returning an AsyncWebHeader pointer or null maybe.

WDYT ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could rethink the logic, agreed

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. Let's merge that, cut a release, then do the change

_name = data.substring(0, index);
_value = data.substring(index + 2);
}
Expand Down