[web_server_idf] Remove std::string temporaries from multipart header parsing (#13940)

This commit is contained in:
J. Nick Koston
2026-02-11 17:42:33 -06:00
committed by GitHub
parent fecb145a71
commit ae42bfa404
5 changed files with 67 additions and 49 deletions

View File

@@ -171,10 +171,11 @@ esp_err_t AsyncWebServer::request_post_handler(httpd_req_t *r) {
const char *content_type_char = content_type.value().c_str();
// Check most common case first
if (stristr(content_type_char, "application/x-www-form-urlencoded") != nullptr) {
size_t content_type_len = strlen(content_type_char);
if (strcasestr_n(content_type_char, content_type_len, "application/x-www-form-urlencoded") != nullptr) {
// Normal form data - proceed with regular handling
#ifdef USE_WEBSERVER_OTA
} else if (stristr(content_type_char, "multipart/form-data") != nullptr) {
} else if (strcasestr_n(content_type_char, content_type_len, "multipart/form-data") != nullptr) {
auto *server = static_cast<AsyncWebServer *>(r->user_ctx);
return server->handle_multipart_upload_(r, content_type_char);
#endif