Commit Graph
16 Commits
Author SHA1 Message Date
Richard Allen ec09815ed5 fix(transport_ws): Reject multiple Sec-WebSocket-Accept headers
Enforce RFC6455 requirement:
    The |Sec-WebSocket-Accept| header MUST NOT
    appear more than once in an HTTP response.
2025-09-12 10:03:42 -03:00
Richard Allen 58befcae26 feat(transport_ws): add header callback hook
Move to a line-by-line header parser.
Support a callback hook for each header-line.
Migrate "Location" and "Sec-WebSocket-Accept" parsing.

Part of https://github.com/espressif/esp-protocols/issues/715
2025-09-12 13:39:41 +08:00
Richard Allen cd4982a14f feat(transport_ws): buffer redir_host separately
Buffer separately to simplify future improvements.
2025-09-12 13:39:41 +08:00
Richard Allen 69404c8d83 docs(esp_http_client): document default timeout behaviour 2025-08-13 10:07:38 -05:00
Richard Allen 561b325a0d docs(esp_http_client): fix chunky function name 2025-06-27 14:55:55 -05:00
Richard Allen a8b6017ca5 docs(esp_transport_ws): fix parameter name documentation 2025-06-12 10:44:06 -05:00
Richard Allen 65a1d79af2 fix(esp_http_client): fix spurious async open error
Fix esp_http_client_open() often triggering a
spurious HTTP_EVENT_ERROR when is_async=true.

Fixes https://github.com/espressif/esp-idf/issues/16075
2025-06-05 17:54:05 -05:00
Richard Allen 30758d9beb 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
2025-05-28 08:50:28 -05:00
Richard Allen a0f085d012 docs(esp_http_client): update return codes for open & perform
Extend the return code section to include async return values.
2025-05-16 08:55:08 -05:00
Richard Allen 7f982fa09d fix(tcp_transport): Silence recoverable read failures
In some applications, ESP_TLS_ERR_SSL_WANT_READ and
ESP_TLS_ERR_SSL_TIMEOUT are common results which
need handled at the next layer. Downgrade these
to debug.
2025-05-16 08:37:19 -05:00
Richard Allen 5362a03eac feat(ws_transport): include error reason in failure log
When the underlying transport returns a failure,
add the failure result to the log.
2025-04-10 07:22:37 -03:00
Richard Allen 7f54410256 fix(ws_transport): Fix reading WS header bytes
Correct split header bytes

When the underlying transport returns header,
length, or mask bytes early, again call the
underlying transport.

This solves the WS parser getting offset when
the server sends a burst of frames where the
last WS header is split across packet boundaries,
so fewer than the needed bytes may be available.

Merges https://github.com/espressif/esp-idf/pull/14706
2024-11-12 17:06:31 +01:00
Richard Allen 0b51c24238 change(mbedtls/port): optimize gcm_mult()
1) pre-shift GCM last4 to use 32-bit shift

On 32-bit architectures like Aarch32, RV32, Xtensa,
shifting a 64-bit variable by 32-bits is free,
since it changes the register representing half of the 64-bit var.
Pre-shift the last4 array to take advantage of this.

2) unroll first GCM iteration

The first loop of gcm_mult() is different from
the others. By unrolling it separately from the
others, the other iterations may take advantage
of the zero-overhead loop construct, in addition
to saving a conditional branch in the loop.
2024-08-20 16:44:56 +08:00
Richard Allen bc56b4fc2e fix(mbedtls/port): fix codespell issues
Fix a few comments codespell identified.
2024-08-08 11:29:53 +08:00
Richard Allen 10a2c2ccc9 fix(ws_transport): fixed server-key corruption
When first fragment is sent over HTTP during websocket
connection, defer buffering of fragment until after the
websocket server-key is validated.

This order is required because the first fragment buffering
overwrites the memory holding the server-key headers.

Fixes 2267d4b
Fixes https://github.com/espressif/esp-protocols/issues/396
PR https://github.com/espressif/esp-idf/pull/13724
2024-05-20 16:25:53 +04:00
Richard Allen 4226d13b01 docs: clarify ESP_RETURN_ON_ERROR result 2024-04-22 09:56:58 -05:00