4

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

Jonas
  • 121,568
  • 97
  • 310
  • 388
Demi
  • 3,535
  • 5
  • 29
  • 45
  • Why would you want to? – Barry Pollard Sep 25 '18 at 06:34
  • 1
    @BarryPollard To communicate using HTTP with a local program on Windows, which doesn't have Unix sockets until Windows 10 – Demi Sep 26 '18 at 18:05
  • Ok but curious as to why you think HTTP (and especially HTTP/2) would be the best protocol for this rather than something (anything?) else? – Barry Pollard Sep 26 '18 at 18:15
  • 1
    @BarryPollard Because I want to proxy a server over a single stream? There are many possibilities — a (hypothetical) idea for running web apps as desktop apps being just one of them. Another is proxying Docker’s control socket over qrexec. – Demi Sep 26 '18 at 20:08

1 Answers1

2

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.

Community
  • 1
  • 1
Michael Powers
  • 1,970
  • 1
  • 7
  • 12