Skip to content

Allow configuring http_stream buffer_size and buffer_size_tx (AUD-7208)#1587

Open
stintel wants to merge 2 commits intoespressif:release/v2.xfrom
HeyWillow:feature/http_stream_buffer_size
Open

Allow configuring http_stream buffer_size and buffer_size_tx (AUD-7208)#1587
stintel wants to merge 2 commits intoespressif:release/v2.xfrom
HeyWillow:feature/http_stream_buffer_size

Conversation

@stintel
Copy link
Contributor

@stintel stintel commented Feb 12, 2026

Description

The http_stream component hardcodes buffer_size (2048) and buffer_size_tx (1024) when creating the internal esp_http_client. This makes it impossible for users to configure these values, thus there is no easy way to fix this error:

E (23:53:35.326) HTTP_CLIENT: Out of buffer

This PR adds both buffer_size and buffer_size_tx as fields in http_stream_cfg_t, with defaults matching the previous hardcoded values (HTTP_STREAM_BUFFER_SIZE = 2048, HTTP_STREAM_BUFFER_SIZE_TX = 1024). The _http_open() function now reads from the config struct instead of using hardcoded constants.

buffer_size_tx is guarded with #if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 1, 0) to match the upstream esp_http_client_config_t field availability.

This is a non-breaking change — existing code using HTTP_STREAM_CFG_DEFAULT() gets the same values as before.

Testing

Compile and runtime-tested in Willow.


Checklist

Before submitting a Pull Request, please ensure the following:

  • 🚨 This PR does not introduce breaking changes.
  • All CI checks (GH Actions) pass.
  • Documentation is updated as needed.
  • Tests are updated or added as necessary.
  • Code is well-commented, especially in complex areas.
  • Git history is clean — commits are squashed to the minimum necessary.

And move HTTP_STREAM_BUFFER_SIZE from http_stream.c to http_stream.h and
use it in the HTTP_STREAM_CFG_DEFAULT() macro.

This makes it possible to configure a different HTTP receive buffer
size.

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
And define the previous hardcoded default of 1024
HTTP_STREAM_BUFFER_SIZE_TX, and use it in the HTTP_STREAM_CFG_DEFAULT()
macro, for ESP-IDF 4.1 and higher.

This makes it possible to configure a different HTTP send buffer size.

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
@github-actions github-actions bot changed the title Allow configuring http_stream buffer_size and buffer_size_tx Allow configuring http_stream buffer_size and buffer_size_tx (AUD-7208) Feb 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant