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

ws: handle reads before EAGAIN better #10856

Closed
wants to merge 2 commits into from
Closed

ws: handle reads before EAGAIN better #10856

wants to merge 2 commits into from

Conversation

bagder
Copy link
Member

@bagder bagder commented Mar 28, 2023

Reported-by: simplerobot on github
Fixes #10831

Reported-by: simplerobot on github
Fixes #10831
lib/ws.c Outdated Show resolved Hide resolved
@bagder bagder closed this in b19cbeb Mar 29, 2023
@bagder bagder deleted the bagder/ws-eagain branch March 29, 2023 08:24
@simplerobot
Copy link

I've found one more issue with this. The packet fragment may not be at the beginning of the buffer. We need to move it there before reading the rest of it. I updated the retry logic (https://github.com/curl/curl/blob/master/lib/ws.c#L451) to:

  if(result == CURLE_AGAIN) {
    /* a packet fragment only, loop and try reading more */
    memmove(data->state.buffer, wsp->stillb, wsp->stillblen);
    continue;
  }

I'd be happy to open a new defect if you want to track this separately.

Thanks,
John

@bagder
Copy link
Member Author

bagder commented Apr 13, 2023

I'd be happy to open a new defect if you want to track this separately.

Please do!

@simplerobot
Copy link

Done: #10962

bch pushed a commit to bch/curl that referenced this pull request Jul 19, 2023
Reported-by: simplerobot on github
Fixes curl#10831
Closes curl#10856
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.

WebSocket Intermittent Infinite Loop
2 participants