Can I speak HTTP/2 over STDIN/STDOUT?

496 views Asked by At

Can I speak HTTP/2 over STDIN/STDOUT? If so, how could I do it, and what would be the limitations?

1

There are 1 answers

0
Michael Powers On BEST ANSWER

Strictly speaking HTTP/2 does by definition require a TCP connection:

An HTTP/2 connection is an application-layer protocol running on top of a TCP connection ([TCP]). The client is the TCP connection initiator.

HTTP/2 uses the same "http" and "https" URI schemes used by HTTP/1.1. HTTP/2 shares the same default port numbers: 80 for "http" URIs and 443 for "https" URIs. As a result, implementations processing requests for target resource URIs like http://example.org/foo or https://example.com/bar are required to first discover whether the upstream server (the immediate peer to which the client wishes to establish a connection) supports HTTP/2

That being said you probably could adapt the protocol to be used over any arbitrary transport (like pipes), but as far as I know there's no software that currently works that way. If libraries like that did exist I'd expect to see it in test suites for HTTP/2 libraries. Here's a site containing a list of HTTP/2 test applications. It's possible one of these may have a mode similar to what you're looking for.

As far as advantages and limitations go, since HTTP/2 wasn't designed to be used this way, I'm not sure there's much advantage in any case. The primary limitation is the same: that most software wouldn't be able to work with pipes.