mirror of
https://github.com/esphome/esphome.git
synced 2026-02-28 09:54:19 -07:00
[web_server_idf] Remove std::string temporaries from multipart header parsing (#13940)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user