Skip to content

veb: fix "error parsing request: io.Eof" error when a request body is expected, but the data is not ready yet - #23842

Merged
spytheman merged 3 commits into
vlang:masterfrom
Casper64:veb_dont_error_on_delayed_body_data
Mar 2, 2025
Merged

spytheman merged 3 commits into
vlang:masterfrom
Casper64:veb_dont_error_on_delayed_body_data

Conversation

@Casper64

@Casper64 Casper64 commented Mar 1, 2025 •

Copy link
Copy Markdown
Contributor

Possible fix for #22464

Currently, if a client sends request with the Content-Length > 0, veb expects some data of the body to be ready after the headers are parsed in the same picoev callback, else it shows an Eof error.

It is possible that a client sends the headers first and the body has not been received yet. In this case veb should wait for the connection to provide more data, but it errors. I believe this is what's causing the randomness in the error message.

This pr changes the behaviour to wait for the body data, if the headers are parsed in the same piceov callback (callback that the connection has data available).

@huly-for-github

Copy link
Copy Markdown

Connected to Huly®: V_0.6-22247

@spytheman spytheman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent work.

@spytheman
spytheman merged commit c37309f into vlang:master Mar 2, 2025
@medvednikov

Copy link
Copy Markdown
Member

Thank you so much for fixing this!

@syrmel

syrmel commented Mar 22, 2025

Copy link
Copy Markdown
Member

Great fix; I could finally convert my remaining vweb to veb. Thanks!

@Casper64
Casper64 deleted the veb_dont_error_on_delayed_body_data branch May 28, 2025 21:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants