J. Nick Koston
8307eadda2
[http_request] Lowercase collect headers at config time, eliminate per-request overhead
...
Move header lowercasing from the per-request start() path to config time:
- Python codegen now lowercases collect_headers values before passing to C++
- add_collect_header() stores values as-is (already lowered by Python)
- start() with std::vector is now a direct passthrough to perform()
- Deprecated std::set overload still lowercases for external callers
Rename collect_headers_ to lower_case_collect_headers_ and update all
parameter names throughout the chain to make the lowercase invariant
explicit in the API contract.
This eliminates per-request allocation of a temporary vector and
str_lower_case() calls on every HTTP request, reducing stack usage
in the perform() call chain where stack space is critical for HTTPS
TLS handshakes.
2026-02-18 14:21:17 -06:00
J. Nick Koston
8120bd373c
[http_request] Replace std::map/std::set/std::list with std::vector for response headers
...
Replace heavy STL containers with simple std::vector and linear scan
for response header collection. This eliminates red-black tree (_Rb_tree)
and hash table template instantiations that are unnecessary for the small
number of headers typically collected (1-5 elements).
Changes:
- response_headers_: std::map<string, list<string>> -> std::vector<Header>
- collect_headers_: std::set<string> -> std::vector<string>
- perform() signature: std::set -> std::vector
- Add should_collect_header() inline helper for linear scan
- Lowercase collect_headers at config/insertion time instead of per-request
- IDF UserData now holds references to container's vector instead of
owning a separate map that gets moved after the request
- Reuse existing Header struct instead of std::pair
Reduces stack usage in perform() and eliminates STL container overhead
on memory-constrained ESP devices.
2026-02-16 18:11:58 -06:00
J. Nick Koston
d4ccc64dc0
[http_request] Fix IDF chunked response completion detection ( #13886 )
2026-02-10 08:55:59 -06:00
J. Nick Koston
ae71f07abb
[http_request] Fix requests taking full timeout when response is already complete ( #13649 )
2026-02-03 03:19:38 +01:00
J. Nick Koston
455ade0dca
[http_request] Fix empty body for chunked transfer encoding responses ( #13599 )
2026-01-28 09:41:42 -10:00
Jonathan Swoboda
0cc8055757
[http_request] Add custom CA certificate support for ESP32 ( #13552 )
...
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com >
2026-01-26 22:07:27 -05:00
J. Nick Koston
5bbf9153ca
[http_request] Fix OTA failures on ESP8266/Arduino by making read semantics consistent ( #13435 )
...
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com >
2026-01-21 19:48:32 -10:00
Jonathan Swoboda
5345c96ff3
[http_request] Fix verify_ssl: false not working on ESP32 ( #13422 )
...
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com >
2026-01-21 13:18:37 -05:00
Mike Ford
1f4221abfa
[http_request] Unable to handle chunked responses ( #7884 )
...
Co-authored-by: J. Nick Koston <nick@koston.org >
2026-01-16 22:18:48 -05:00
Jonathan Swoboda
18814f12dc
[http_request] Use ESP-IDF for ESP32 Arduino ( #12428 )
...
Co-authored-by: Claude <noreply@anthropic.com >
2025-12-16 19:44:14 -05:00
J. Nick Koston
2c85ba037e
[http_request] Pass collect_headers by const reference instead of by value ( #11494 )
2025-10-23 20:01:48 -07:00
J. Nick Koston
6372099df3
[http_request] Pass parameters by const reference to reduce flash usage ( #11184 )
2025-10-14 09:53:11 +13:00
Stas
1a7757e7ca
[http_request] set correct duration_ms for failed requests ( #9789 )
2025-07-22 11:39:03 -10:00
Craig Andrews
5fa9d22c5d
[http_request] allow retrieval of more than just the first header ( #9242 )
2025-07-02 14:17:34 +12:00
J. Nick Koston
c0b05ada1a
Reduce ESP_LOGCONFIG calls ( #9026 )
2025-06-09 00:02:30 +00:00
Craig Andrews
991f3d3a10
[http_request] Ability to get response headers ( #8224 )
...
Co-authored-by: guillempages <guillempages@users.noreply.github.com >
Co-authored-by: Clyde Stubbs <2366188+clydebarrow@users.noreply.github.com >
2025-04-23 14:30:50 +10:00
guillempages
8b7aa4c110
[http_request]Use std::string for headers ( #8225 )
2025-02-11 11:39:03 +11:00
Kevin Ahrendt
8c6c45e6c1
[http_request] Bugfix: run update function in a task ( #8018 )
2025-01-17 10:43:41 +13:00
Jesse Hills
49e9c43339
[http_request] Feed watchdog timeout around http request functions ( #7786 )
2024-11-19 18:54:19 -06:00
Clyde Stubbs
df750d0d11
[http_request] Add enum for status codes ( #7690 )
2024-10-29 16:05:58 +13:00
Clyde Stubbs
88627095fb
[http_request] Always return defined server response status ( #7689 )
2024-10-29 11:12:32 +11:00
Olivier ARCHER
caa2ea64e3
http_request watchdog as a component ( #7161 )
2024-07-30 13:45:19 +12:00
dentra
1f3754684a
[http_request] Allow configure buffer size on ESP-IDF ( #7125 )
...
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com >
2024-07-24 15:50:59 +12:00
dentra
39de179e21
[http_request] Fix ESP-IDF follow redirect ( #7101 )
2024-07-24 12:12:59 +12:00
Olivier ARCHER
1f4829598a
[http_request] allow basic auth for idf ( #7086 )
2024-07-22 11:29:09 +12:00
Kevin P. Fleming
67bd5db6d6
Fix infinite loop in http_request for ESP-IDF. ( #6963 )
2024-06-22 09:18:43 +12:00
Jesse Hills
7b45498de6
[http_request] Add esp-idf and rp2040 support ( #3256 )
...
* Implement http_request component for esp-idf
* Fix ifdefs
* Lint
* clang
* Set else to fail with error message
* Use unique_ptr
* Fix
* Tidy up casting, explicit HttpResponse lifetime (#3265 )
Co-authored-by: Daniel Cousens <dcousens@users.noreply.github.com >
* Remove unique_ptr wrapper
* Fix
* Use reference
* Add duration code into new split files
* Add config for tx/rx buffer on idf
* Fix
* Try reserve response data with rx buffer size
* Update http_request.h
* Move client cleanup to be earlier
* Move capture_response to bool on struct and remove global
* Fix returns
* Change quotes to brackets
* Rework http request
* Remove http request from old test yamls
* Update component tests
* Validate md5 length when hardcoded string
* Linting
* Add duration_ms to container
* More lint
* const
* Remove default arguments and add helper functions for get and post
* Add virtual destructor to HttpContainer
* Undo const HEADER_KEYS
* 🤦
* Update esphome/components/http_request/ota/ota_http_request.cpp
Co-authored-by: Keith Burzinski <kbx81x@gmail.com >
* Update esphome/components/http_request/ota/ota_http_request.cpp
Co-authored-by: Keith Burzinski <kbx81x@gmail.com >
* lint
* Move header keys inline
* Add missing WatchdogManagers
* CAPS
* Fix "follow redirects" string in config dump
* IDF 5+ fix
---------
Co-authored-by: Daniel Cousens <413395+dcousens@users.noreply.github.com >
Co-authored-by: Daniel Cousens <dcousens@users.noreply.github.com >
Co-authored-by: Keith Burzinski <kbx81x@gmail.com >
2024-06-09 15:15:29 -05:00