websocket: add option to disable auto-pong reply

This adds another bitflag on CURLOPT_WS_OPTIONS (CURLWS_NOAUTOPONG) that
disables the default and automatic PONG reply in the WebSocket layer.

Assisted-by: Calvin Ruocco

Closes #16744
This commit is contained in:
Brian Chrzanowski 2024-07-23 22:15:23 -04:00 committed by Daniel Stenberg
parent 21fd64645b
commit c0df01fd94
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
15 changed files with 204 additions and 9 deletions

View file

@ -259,7 +259,7 @@ test2100 test2101 test2102 \
test2200 test2201 test2202 test2203 test2204 test2205 \
\
test2300 test2301 test2302 test2303 test2304 test2305 test2306 test2307 \
test2308 test2309 test2310 test2311 \
test2308 test2309 test2310 test2311 test2312 \
\
test2400 test2401 test2402 test2403 test2404 test2405 test2406 \
\

66
tests/data/test2312 Normal file
View file

@ -0,0 +1,66 @@
<testcase>
<info>
<keywords>
WebSockets
</keywords>
</info>
#
# Server-side
<reply>
<data nocheck="yes" nonewline="yes">
HTTP/1.1 101 Switching to WebSockets swsclose
Server: test-server/fake
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Accept: HkPsVga7+8LuxM4RGQ5p9tZHeYs=
%hex[%89%00]hex%
</data>
# allow upgrade
<servercmd>
upgrade
</servercmd>
</reply>
#
# Client-side
<client>
# for the forced CURL_ENTROPY
<features>
debug
ws
</features>
<server>
http
</server>
<name>
WebSockets no auto ping
</name>
<tool>
lib%TESTNUMBER
</tool>
<command>
ws://%HOSTIP:%HTTPPORT/%TESTNUMBER
</command>
</client>
#
# Verify data after the test has been "shot"
<verify>
<protocol nocheck="yes">
GET /%TESTNUMBER HTTP/1.1
Host: %HOSTIP:%HTTPPORT
User-Agent: webbie-sox/3
Accept: */*
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Version: 13
Sec-WebSocket-Key: NDMyMTUzMjE2MzIxNzMyMQ==
</protocol>
<errorcode>
0
</errorcode>
</verify>
</testcase>