I did this
I traced the blocking raw-send path in lib/ws.c and found that ws_send_raw_blocking() has no pnwritten output parameter, so the surrounding ws_send_raw() path can succeed without updating the caller's *sent value. In practice, callers using curl_ws_send() from inside a callback in raw mode can observe *sent == 0 even though the bytes were written.
It looks like an API-contract bug in the current lib/ws.c logic.
The call path is:
curl_ws_send() — zeroes *pnsent before dispatching
-> ws_send_raw()
-> ws_send_raw_blocking() — succeeds but never writes to pnwritten
Confirmed in current HEAD (lib/ws.c):
curl_ws_send() initialises *pnsent = 0 and delegates to ws_send_raw()
- In the blocking callback path,
ws_send_raw() calls ws_send_raw_blocking()
ws_send_raw_blocking() has no pnwritten output parameter and does not write back through the caller's pointer
- On return,
*pnsent remains 0 even though bytes were sent
I expected the following
On success, the blocking raw-send path should report the number of bytes written to the caller just like the non-blocking path does.
curl/libcurl version
curl 8.20.0-DEV (70281e3) in lib/ws.c
operating system
Linux x86_64
I did this
I traced the blocking raw-send path in
lib/ws.cand found thatws_send_raw_blocking()has nopnwrittenoutput parameter, so the surroundingws_send_raw()path can succeed without updating the caller's*sentvalue. In practice, callers usingcurl_ws_send()from inside a callback in raw mode can observe*sent == 0even though the bytes were written.It looks like an API-contract bug in the current
lib/ws.clogic.The call path is:
Confirmed in current HEAD (
lib/ws.c):curl_ws_send()initialises*pnsent = 0and delegates tows_send_raw()ws_send_raw()callsws_send_raw_blocking()ws_send_raw_blocking()has nopnwrittenoutput parameter and does not write back through the caller's pointer*pnsentremains 0 even though bytes were sentI expected the following
On success, the blocking raw-send path should report the number of bytes written to the caller just like the non-blocking path does.
curl/libcurl version
curl 8.20.0-DEV (
70281e3) inlib/ws.coperating system
Linux x86_64