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

websocket, fix curl_ws_recv() #12945

Closed
wants to merge 3 commits into from
Closed

Conversation

icing
Copy link
Contributor

@icing icing commented Feb 15, 2024

  • when data arrived in several chunks, the collection into the passed buffer always started at offset 0, overwriting the data already there.

@icing icing marked this pull request as ready for review February 15, 2024 15:41
@calvin2021y
Copy link

maybe a unit tests can prevent this kind error.

@icing
Copy link
Contributor Author

icing commented Feb 16, 2024

maybe a unit tests can prevent this kind error.

It was triggered in pytest test_20_06, but it depended on how data arrived from the server. Any suggestion for a reliable test appreciated.

@calvin2021y
Copy link

maybe use netcat and pv to limit the send speed of a exists tcp stream

nc -l -p 8888 | pv -L 512  | nc example.com 80

in this example pv limit the stream speed at 512 byte per second.

@jay
Copy link
Member

jay commented Feb 16, 2024

It was triggered in pytest test_20_06, but it depended on how data arrived from the server.

Would CURL_DBG_SOCK_RMAX work for that

- when data arrived in several chunks, the collection into
  the passed buffer always started at offset 0, overwriting
  the data already there.
- debug environment var CURL_WS_CHUNK_SIZE can be used to
  influence the buffer chunk size used for en-/decoding.
@icing
Copy link
Contributor Author

icing commented Feb 20, 2024

It was triggered in pytest test_20_06, but it depended on how data arrived from the server.

Would CURL_DBG_SOCK_RMAX work for that

Added a new debug environment var CURL_WS_CHUNK_SIZE to influence the buffer dimensions used in en-/decoding for websockets. This exposes the bug in test_20-07 and verifies the fix.

@bagder bagder closed this in f0c446a Feb 20, 2024
@bagder
Copy link
Member

bagder commented Feb 20, 2024

Thanks!

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.

None yet

4 participants