Commit Graph

12 Commits

Author SHA1 Message Date
Daniel Stenberg
0554de58c6
ws: fix buffer pointer use in the callback loop
Closes #9678
2022-10-10 11:21:56 +02:00
Paul Seligman
b261389dba
ws: minor fixes for web sockets without the CONNECT_ONLY flag
- Fixed an issue where is_in_callback was getting cleared when using web
  sockets with debug logging enabled
- Ensure the handle is is_in_callback when calling out to fwrite_func
- Change the write vs. send_data decision to whether or not the handle
  is in CONNECT_ONLY mode.
- Account for buflen not including the header length in curl_ws_send

Closes #9665
2022-10-09 23:09:58 +02:00
Daniel Stenberg
c02291fd47
ws: fix Coverity complaints
Coverity pointed out several flaws where variables remained
uninitialized after forks.

Follow-up to e3f335148a

Closes #9666
2022-10-08 11:44:18 +02:00
Daniel Stenberg
e3f335148a
websockets: remodeled API to support 63 bit frame sizes
curl_ws_recv() now receives data to fill up the provided buffer, but can
return a partial fragment. The function now also get a pointer to a
curl_ws_frame struct with metadata that also mentions the offset and
total size of the fragment (of which you might be receiving a smaller
piece). This way, large incoming fragments will be "streamed" to the
application. When the curl_ws_frame struct field 'bytesleft' is 0, the
final fragment piece has been delivered.

curl_ws_recv() was also adjusted to work with a buffer size smaller than
the fragment size. (Possibly needless to say as the fragment size can
now be 63 bit large).

curl_ws_send() now supports sending a piece of a fragment, in a
streaming manner, in addition to sending the entire fragment in a single
call if it is small enough. To send a huge fragment, curl_ws_send() can
be used to send it in many small calls by first telling libcurl about
the total expected fragment size, and then send the payload in N number
of separate invokes and libcurl will stream those over the wire.

The struct curl_ws_meta() returns is now called 'curl_ws_frame' and it
has been extended with two new fields: *offset* and *bytesleft*. To help
describe the passed on data chunk when a fragment is delivered in many
smaller pieces.

The documentation has been updated accordingly.

Closes #9636
2022-10-07 12:50:58 +02:00
Daniel Stenberg
a2fa5f86d6
ws: fix a C89 compliance nit
Closes #9541
2022-09-21 09:19:42 +02:00
John Bampton
a46e412464
misc: fix spelling in two source files
Closes #9529
2022-09-19 08:47:55 +02:00
Daniel Stenberg
ec51f00480
ws: the infof() flags should be %zu
Follow-up to e5e9e0c5e4

Closes #9518
2022-09-16 21:35:15 +02:00
Marcel Raad
7740530ced
ws: fix build without USE_WEBSOCKETS
The curl.h include is required unconditionally.
2022-09-12 10:22:42 +02:00
Marcel Raad
a0ff4dba8b
ws: add missing curl.h include
A conflict between commits 664249d095 and e5839f4ee7 broke the build.
2022-09-12 10:12:32 +02:00
Daniel Stenberg
e5e9e0c5e4
ws: fix an infof() call to use %uz for size_t output
Detected by Coverity, CID 1514665.

Closes #9480
2022-09-12 10:02:38 +02:00
Daniel Stenberg
eebfa3279d
curl_ws_meta: initial implementation 2022-09-09 15:11:14 +02:00
Daniel Stenberg
664249d095
ws: initial websockets support
Closes #8995
2022-09-09 15:11:14 +02:00