Repository navigation
Websockets - #8995
Websockets#8995bagder wants to merge 11 commits into
Conversation
7a66eeb to
8364ca8
Compare
9376d25 to
93e9419
Compare
4f782d9 to
9e015a3
Compare
|
Hi @bagder, thanks for the great work. I plan to use libcurl with event loop to replace libwebsockets. The new implement will support non-blocked frame recv ? I guess call curl_ws_recv will blocked, so some thing like CURLOPT_WS_RECVFUNCTION, CURLOPT_WS_RECVDATA should exists to handle the callback inside a event loop. (each call should return a full frame with type: ping, pong, binary, text) |
|
I think maybe it might be better to take this to the discussions rather than to have this "side conversation" here in the PR.
I'm not sure what that means. The proposed API is documented in the wiki and in somewhat more detail in the docs section in the files in this PR.
It will return a full frame is there is one, I think it might not return anything if there isn't a complete frame to return.
This has been discussed at length and I am currently providing the websockets data using the "regular" write callback |
696b9c5 to
ff3c4ec
Compare
d4268de to
098cdc3
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
- add websockets support to sws - 2300: first very basic websockets test - 2301: first libcurl test for ws (not working yet) - 2302: use the ws callback - 2303: test refused upgrade
|
I intend to merge this soon. |
…ol type Setting the `CURLWS_NOAUTOPONG` flag via the `CURLOPT_WS_OPTIONS` `curl_easy_setopt()` API failed to enable this flag in libcurl builds using a compiler without a native C99 bool type. This in turn caused 2700, 2709, 2711, 2712 WebSocket tests to fail. The initial WebSocket code assigned `arg & CURLWS_RAW_MODE` to a bit-field, after casting the expression to `bool`. This worked because `CURLWS_RAW_MODE` equals 1. Later this line was cloned when adding support for `CURLWS_NOAUTOPONG`, but this new bit flag's value was 2. Casting it to `bool` and then assigning it to a bit-field worked as expected, as long as the bool type was the C99 one. On compilers without the C99 bool type, the interim cast did not work, and when assigning the value 2 to the bit-field, it ended up storing zero/false unconditionally. Such compilers are VS2012 and VS2010. For them, another trigger was a subsequent update that enabled bit-field support for MSVC compilers. Fix by replacing the `(bool)` cast with `!!`. Also for `CURLWS_RAW_MODE`, to not rely on the literal value of this macro, and to avoid reusing this pattern in future code. There were no other places in the codebase with this pattern. The rest use either `!!` or ternary expression for this type of conversion. Discovered while trying to enable tests for MSVC builds in AppVeyor CI, causing test failures with VS2012 and VS2010. Refs: https://en.cppreference.com/c/language/arithmetic_types#Boolean_type https://en.cppreference.com/c/language/conversion https://godbolt.org/z/3h5zMfePq Bug: #23306 (comment) Bug: #23306 (comment) Follow-up to 85c841c #20142 Follow-up to c0df01f #16744 Follow-up to 664249d #8995 Cherry-picked from #23306 Closes #23428
Warning: regular rebase + force-pushes are still performed on this branch.
Initial design thoughts
Left for follow-up work
curl_ws_poll()CURLWS_COMPRESS