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

fix(http): fix HttpTooLagreError on TCP close #454

Closed

Conversation

hoxnox
Copy link

@hoxnox hoxnox commented Apr 15, 2015

When TCP connection finished, NetworkStream::read returns Ok(0), so
buffer::read_info_buf() also returns Ok(0), but parse function treats
it as the HttpTooLargeError and we have annoying errors in debug mode.
We should return some kind of Err() in read_info_buf and check this
error in parse function instead of treating Ok(0) as error.

When TCP connection finished, NetworkStream::read returns Ok(0), so
buffer::read_info_buf() also returns Ok(0), but parse function treats
it as the HttpTooLargeError and we have annoying errors in debug mode.
We should return some kind of Err() in read_info_buf and check this
error in parse function instead of treating Ok(0) as error.
When NetworkStream reads zero-length data, it treats as TCP FIN.
HttpError::HttpClosed is passed through the stack and is terminated in
handle_connection function.
@hoxnox hoxnox force-pushed the bugfix_HttpTooLargeError_on_tcp_close branch from e944f8d to e00cd19 Compare April 15, 2015 11:20
@seanmonstar
Copy link
Member

Ohh! Thank you for this, now I see the issue.

@seanmonstar
Copy link
Member

I handled this a little differently, by using an io::ErrorKind::ConnectionAborted error, and just checking for that in handle_connection. I wasn't sure yet about adding a HttpClosed variant. Still, thank you for filing this, as I was having trouble seeing where the actual error was.

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.

2 participants