我可以说 HTTP/2 超过 STDIN/STDOUT 吗?

Can I speak HTTP/2 over STDIN/STDOUT?

我可以在 STDIN/STDOUT 上讲 HTTP/2 吗?如果可以,我该怎么做,有什么限制?

严格来说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

话虽这么说,您可能可以调整协议以在任意传输(如管道)上使用,但据我所知,目前还没有以这种方式工作的软件。如果确实存在这样的库,我希望在 HTTP/2 库的测试套件中看到它。这是一个网站 containing a list of HTTP/2 test applications。可能其中之一的模式与您正在寻找的模式相似。

就优势和局限性而言,由于 HTTP/2 并非旨在以这种方式使用,所以我不确定在任何情况下都有多少优势。主要限制是相同的:大多数软件无法使用管道。