Skip to content

Conversation

@mrstux
Copy link

@mrstux mrstux commented Nov 8, 2022

A sufficiently complex body-writer may not be able to complete writing the body, and the only practical approach is to throw an exception.

Exceptions are normally thrown from body-writers when the socket is closed by the remote peer.

If a Raw response body-writer throws an exception before completing the body the http session will be left out of sync and will hang indefinitely waiting to read the next request. The fix results in the socket being closed and not attempting to read the next request when an error occurs. If a content-length is provided then the network error can be detected by the remote peer, otherwise a truncated body is returned to the client.

@mrstux mrstux force-pushed the fix-body-writer-exception-handling branch 2 times, most recently from 8c9387b to ab8b51a Compare November 8, 2022 04:45
A sufficiently complex body-writer may not be able to complete writing
the body, and the only practical approach is to throw an exception.

Exceptions are normally thrown from body-writers when the socket is
closed by the remote peer.

If a Raw response body-writer throws an exception before completing the
body the http session will be left out of sync and will hang
indefinitely waiting to read the next request. The fix results in the
socket being closed and not attempting to read the next request when an
error occurs. If a content-length is provided then the network error
can be detected by the remote peer, otherwise a truncated body is
returned to the client.
@mrstux mrstux force-pushed the fix-body-writer-exception-handling branch from ab8b51a to 9ad8a89 Compare November 8, 2022 04:46
@mrstux
Copy link
Author

mrstux commented Nov 8, 2022

branched from 1.5.0. Simply merging stable will resolve above conflicts.

@mrstux mrstux force-pushed the fix-body-writer-exception-handling branch 2 times, most recently from 21ebb16 to 9ad8a89 Compare November 8, 2022 04:59
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.

1 participant