Skip to content

Commit

Permalink
AP_Bootloader: make Content-Length handle case insensitive
Browse files Browse the repository at this point in the history
  • Loading branch information
bugobliterator authored and tridge committed Aug 28, 2024
1 parent 957e92a commit 8222d65
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Tools/AP_Bootloader/network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -484,10 +484,14 @@ void BL_Network::handle_request(SocketAPM *sock)
sock->send(header, strlen(header));

if (strncmp(headers, "POST / ", 7) == 0) {
const char *clen = "\r\nContent-Length:";
const char *p = strstr(headers, clen);
const char *clen1 = "\r\nContent-Length:";
const char *clen2 = "\r\ncontent-length:";
const char *p = strstr(headers, clen1);
if (p == nullptr) {
p = strstr(headers, clen2);
}
if (p != nullptr) {
p += strlen(clen);
p += strlen(clen1);
const uint32_t content_length = atoi(p);
handle_post(sock, content_length);
delete headers;
Expand Down

0 comments on commit 8222d65

Please sign in to comment.