ws: fix and extend CURLWS_CONT handling

Follow-up to fa3d1e7d43

Add test 2311 to verify

Closes #16687
This commit is contained in:
Calvin Ruocco 2025-03-10 17:19:58 +01:00 committed by Daniel Stenberg
parent c799f608f2
commit 3588df9478
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
6 changed files with 197 additions and 122 deletions

View file

@ -52,9 +52,13 @@ pointer is permitted in this case. Note that frames without payload are consumed
by this action.
If the received message consists of multiple fragments, the *CURLWS_CONT* bit
is set in all frames except the final one. The application is responsible for
reassembling fragmented messages. See curl_ws_meta(3) for more details on
*CURLWS_CONT*.
is set in all frames except the final one. The appropriate *CURLWS_TEXT* or
*CURLWS_BINARY* flag is set in every frame, regardless whether it is the first
fragment, an intermediate fragment or the final fragment. The application is
responsible for reassembling fragmented messages. Special care must be taken
to correctly handle control frames (i.e. CLOSE, PING and PONG) arriving in
between consecutive fragments of a fragmented TEXT or BINARY message. See
curl_ws_meta(3) for more details on *CURLWS_CONT*.
# %PROTOCOLS%

View file

@ -49,7 +49,10 @@ in the section on *CURLWS_OFFSET* below.
*flags* must contain at least one flag indicating the type of the message.
To send a fragmented message consisting of multiple frames, additionally set
the *CURLWS_CONT* bit in all frames except the final one.
the *CURLWS_CONT* bit in all frames except the final one. The appropriate
message type bit should be set in every frame of a fragmented message without
exemption. Omitting the message type for continuation frames of a fragmented
message is only supported for backwards compatibility and highly discouraged.
For more details on the supported flags see below and in curl_ws_meta(3).