feat(esp_http_client): Event to signal last header download

When parsing ND-JSON streams, this is needed to indicate the
point when the ND-JSON stream is considered open, which
occurs just after the last HTTP_EVENT_ON_HEADER.

ND-JSON stream clients cannot rely on the first HTTP_EVENT_ON_DATA,
since that is only triggered by an event, which are optional and
may never be sent, or only sent well after the last HTTP_EVENT_ON_HEADER.

Closes #15952
This commit is contained in:
Richard Allen
2025-05-16 12:54:15 -05:00
parent a74725a31b
commit 30758d9beb
9 changed files with 36 additions and 16 deletions

View File

@@ -74,6 +74,9 @@ esp_err_t _http_event_handler(esp_http_client_event_t *evt)
case HTTP_EVENT_ON_HEADER:
ESP_LOGD(TAG, "HTTP_EVENT_ON_HEADER, key=%s, value=%s", evt->header_key, evt->header_value);
break;
case HTTP_EVENT_ON_HEADERS_COMPLETE:
ESP_LOGD(TAG, "HTTP_EVENT_ON_HEADERS_COMPLETE");
break;
case HTTP_EVENT_ON_DATA:
ESP_LOGD(TAG, "HTTP_EVENT_ON_DATA, len=%d", evt->data_len);
/* Check if buffer is null, if yes, initialize it */