Files
esphome/esphome
J. Nick Koston f6bb54486d [web_server_idf] Remove std::string temporaries from multipart header parsing
Refactor multipart utility functions to work with const char* + length
instead of std::string to eliminate temporary heap allocations during
header parsing. The original implementations used std::string for
convenience when the OTA multipart support was first added, but these
can be avoided since the multipart parser already provides raw pointers
and lengths in its callbacks.

- extract_header_param: takes (const char*, size_t, const char*, std::string&)
  instead of (const std::string&, const std::string&) -> std::string.
  Assigns directly to destination, avoiding intermediate string construction.
- str_startswith_case_insensitive: takes (const char*, size_t, const char*)
  instead of (const std::string&, const std::string&)
- str_trim: takes (const char*, size_t, std::string&) instead of
  (const std::string&) -> std::string
- Rename stristr to strcasestr_n with explicit haystack length parameter
  to make the relationship to POSIX strcasestr clear and fix a latent
  buffer over-read risk (stristr relied on null-termination which the
  multipart parser does not guarantee for its callback data)
- process_header_ no longer creates a std::string copy of the raw
  parser buffer before calling utility functions

Saves ~350 bytes of flash.
2026-02-11 16:38:26 -06:00
..
2025-12-08 14:37:45 -05:00
2025-12-08 14:37:45 -05:00
2025-09-19 12:59:48 +00:00
2025-12-18 00:06:52 +00:00