Skip to content

Switch a request to a bidirectional byte stream - #49

Merged
himura467 merged 1 commit into
mainfrom
tunnels
Oct 17, 2026
Merged

himura467 merged 1 commit into
mainfrom
tunnels

Conversation

@himura467

Copy link
Copy Markdown
Collaborator

Closes #31.

Lets a 101 to an HTTP/1.1 request carrying upgrade, or a 2xx to a CONNECT request on any version, switch the exchange to a tunnel. The host never hands over the connection: the new NsgiRequest::read_tunnel delivers the bytes the client sends after the request message, and the switching response's read_body supplies the bytes sent back. Each direction closes on its own, and the host defers nsgi_free_response until read_tunnel reports a terminal status. NsgiRequest::protocol carries the :protocol of an extended CONNECT request.

The request body keeps the request's own content, so an application that reads the whole body before responding does not block on a tunnel. NsgiInform rejects a 101, and the host answers 500 in place of a 101 that does not switch.

@himura467
himura467 merged commit 36e95bb into main Oct 17, 2026
1 check passed
@himura467
himura467 deleted the tunnels branch October 17, 2026 11:01
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.

Switch a request to a bidirectional byte stream

1 participant