Skip to content

Add HTTP/1.x bidi streaming support#913

Open
emcfarlane wants to merge 3 commits intomainfrom
ed/http1BidiStream
Open

Add HTTP/1.x bidi streaming support#913
emcfarlane wants to merge 3 commits intomainfrom
ed/http1BidiStream

Conversation

@emcfarlane
Copy link
Contributor

This adds support for bidi streaming over HTTP/1 connections. It's an improvement over #796 adding support for full-duplex streams. It makes use of the new ResponseControler.EnableFullDuplex method to enable support. If disabled, this returns an error and we report the same error as previously. If enabled, the bidi connection is now allowed.

To test bidi streams over HTTP/1 memhttp is updated to use a buffered conn. Both sides of the net.Pipe are stuck writing, and neither can read because the write is synchronous and blocking. With real TCP sockets, the kernel buffers absorb these writes and there's no deadlock. For HTTP/2 we keep the zero buffer behaviour.

Closes #872

Signed-off-by: Edward McFarlane <emcfarlane@buf.build>
Signed-off-by: Edward McFarlane <emcfarlane@buf.build>
On an end of stream message, if the connection fails during drain but no
bytes were read, prefer the error from the envelope.

Signed-off-by: Edward McFarlane <emcfarlane@buf.build>
if connErr, ok := asError(err); ok {
return connErr
}
return errorf(CodeInternal, "corrupt response: I/O error after end-stream message: %w", err)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This reported the following error in the testcase TestClientBidiOverHTTP1/cumsum_error:

internal: corrupt response: I/O error after end-stream message: read tcp 127.0.0.1:61157->127.0.0.1:60942: wsarecv: An existing connection was forcibly closed by the remote host.

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