mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 03:00:34 +03:00
feat(esp_http_client): detect oversized headers in tx buffer while sending request
When CONFIG_ESP_HTTP_CLIENT_STRICT_HEADER_BUFFER is enabled, esp_http_client_request_send() fails fast when a single request header is larger than buffer_size_tx, instead of silently emitting a truncated request. The condition is reported with a dedicated ESP_ERR_HTTP_HEADER_TOO_LONG error code rather than overloading ESP_ERR_HTTP_WRITE_DATA, so callers can tell a permanent header-sizing failure apart from a transient write error. errno is cleared on this path so the async caller (which maps errno == EAGAIN to "retry later") does not spin retrying a request that can never succeed. Closes https://github.com/espressif/esp-idf/issues/18639 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
c2e931b1b1
commit
8c181842f1
@@ -187,7 +187,7 @@ int http_header_generate_string(http_header_handle_t header, int index, char *bu
|
||||
if (size + 1 > *buffer_len - 2) {
|
||||
// if this item would not fit to the buffer, return the index of the last fitting one
|
||||
ret_idx = idx - 1;
|
||||
ESP_LOGE(TAG, "Buffer length is small to fit all the headers");
|
||||
ESP_LOGE(TAG, "Buffer length is small to fit all the headers, required %d bytes, buffer size %d", size + 1, *buffer_len - 2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user