This commit is contained in:
Ethan Wilkes 2025-03-01 01:40:25 +00:00 committed by GitHub
commit 10af4d10a7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 12 additions and 1 deletions

View File

@ -124,6 +124,13 @@ reassemble the fragments to receive the complete message.
Only a single fragmented message can be transmitted at a time, but it may
be interrupted by CURLWS_CLOSE, CURLWS_PING or CURLWS_PONG frames.
## CURLWS_FIN
This flag is set when the FIN bit is present in the received WebSocket frame.
In WebSocket protocol, the FIN bit indicates that this frame is the final
frame of the message. When CURLWS_FIN is set, it means no further frames
follow for this message.
# %PROTOCOLS%
# EXAMPLE

View File

@ -1146,6 +1146,7 @@ CURLWARNING 7.66.0
CURLWS_BINARY 7.86.0
CURLWS_CLOSE 7.86.0
CURLWS_CONT 7.86.0
CURLWS_FIN 8.13.0
CURLWS_OFFSET 7.86.0
CURLWS_PING 7.86.0
CURLWS_PONG 7.86.0

View File

@ -43,6 +43,7 @@ struct curl_ws_frame {
#define CURLWS_CLOSE (1<<3)
#define CURLWS_PING (1<<4)
#define CURLWS_OFFSET (1<<5)
#define CURLWS_FIN (1<<6)
/*
* NAME curl_ws_recv()

View File

@ -195,6 +195,8 @@ static CURLcode ws_dec_read_head(struct ws_decoder *dec,
}
dec->frame_flags = ws_frame_op2flags(dec->head[0]);
dec->frame_flags = dec->frame_flags |
((dec->head[0] & WSBIT_FIN) ? CURLWS_FIN : 0);
if(!dec->frame_flags) {
failf(data, "WS: unknown opcode: %x",
dec->head[0] & WSBIT_OPCODE_MASK);

View File

@ -64,7 +64,7 @@ Sec-WebSocket-Key: NDMyMTUzMjE2MzIxNzMyMQ==
</protocol>
<stdout mode="text">
68 65 6c 6c 6f
RECFLAGS: 1
RECFLAGS: 41
</stdout>
</verify>
</testcase>