diff options
author | Stefan Eissing <stefan@eissing.org> | 2023-04-18 15:02:34 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2023-04-25 23:16:51 +0200 |
commit | 930c00c25988a65882fb9b120af66f08cb93e78b (patch) | |
tree | 9bdf200c91288eee8f6a00e48927b552e84c72fc /tests | |
parent | 3f0b81c112ebfe826ed702a2987cc5e32082a7a6 (diff) | |
download | curl-930c00c25988a65882fb9b120af66f08cb93e78b.tar.gz |
Websocket en-/decoding
- state is fully kept at connection, since curl_ws_send() and
curl_ws_rec() have lifetime beyond usual transfers
- no more limit on frame sizes
Reported-by: simplerobot on github
Fixes #10962
Closes #10999
Diffstat (limited to 'tests')
-rw-r--r-- | tests/libtest/lib2304.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/libtest/lib2304.c b/tests/libtest/lib2304.c index 83027029b..58cafe0bc 100644 --- a/tests/libtest/lib2304.c +++ b/tests/libtest/lib2304.c @@ -67,6 +67,20 @@ static int recv_pong(CURL *curl, const char *exected_payload) return (int)result; } +static int recv_any(CURL *curl) +{ + size_t rlen; + struct curl_ws_frame *meta; + char buffer[256]; + CURLcode result = curl_ws_recv(curl, buffer, sizeof(buffer), &rlen, &meta); + if(result) + return result; + + fprintf(stderr, "recv_any: got %u bytes rflags %x\n", (int)rlen, + meta->flags); + return 0; +} + /* just close the connection */ static void websocket_close(CURL *curl) { @@ -82,6 +96,7 @@ static void websocket(CURL *curl) int i = 0; fprintf(stderr, "ws: websocket() starts\n"); do { + recv_any(curl); fprintf(stderr, "Send ping\n"); if(ping(curl, "foobar")) return; |