Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

websockets: remodeled API to support 63 bit frame sizes #9636

Closed
wants to merge 4 commits into from

Conversation

bagder
Copy link
Member

@bagder bagder commented Oct 3, 2022

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.

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
@bagder bagder force-pushed the bagder/websocket-huge-fragments branch from b760909 to 85d05a1 Compare October 4, 2022 11:29
@bagder
Copy link
Member Author

bagder commented Oct 6, 2022

Any objections to me merging this soon?

@jay
Copy link
Member

jay commented Oct 6, 2022

Any objections to me merging this soon?

I haven't been following this but if you are changing the API I would wait until the next feature window.

@bagder
Copy link
Member Author

bagder commented Oct 6, 2022

I haven't been following this but if you are changing the API I would wait until the next feature window.

Really? That just delays things more, as then people will get the old API in the next release when that is already history.

We do have it experimental to be able to change things (including the API), and I've been informed in clear terms that the limitations of the current API makes it hard to use.

@jay
Copy link
Member

jay commented Oct 7, 2022

Ok. Those are all good points.

@bagder
Copy link
Member Author

bagder commented Oct 7, 2022

Thanks for keeping things in check!

@bagder bagder closed this in e3f3351 Oct 7, 2022
@bagder bagder deleted the bagder/websocket-huge-fragments branch October 7, 2022 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants