For HTTP/0.9:
GET /
For HTTP/1.0:
GET / HTTP/1.0
For HTTP/1.1:
GET / HTTP/1.1
Host: example.com
What is the request line for HTTP/2? Is it something like:
GET / HTTP/2.0
Or HTTP/2?
For HTTP/0.9:
GET /
For HTTP/1.0:
GET / HTTP/1.0
For HTTP/1.1:
GET / HTTP/1.1
Host: example.com
What is the request line for HTTP/2? Is it something like:
GET / HTTP/2.0
Or HTTP/2?
Neither; there is not such request line, because HTTP/2 (RFC 7540) does not use lines but frames (section 4) for communication. Inside those frames, headers are exchanged using HTTP header fields (section 8.1.2).
The client must first know whether the server supports HTTP/2.
For HTTP (section 3.2), this is done with
Upgrade: h2c
headers:For HTTPS (section 3.3),
h2
protocol identifier in TLS-ALPN (RFC 7301) is used.Immediately start with HTTP/2 connection preface, because of prior knowledge (section 3.4).
Now, the HTTP/2 client connection preface (section 3.5) might be the equivalent you are looking for, as the communication always begins with a sequence of 24 octets:
0x505249202a20485454502f322e300d0a0d0a534d0d0a0d0a
i.e.
PRI *m HTTP/2.0\r\n\r\nSM\r\n\r\n
After that, the header fields are exchanged in the frames, using header compression (section 4.3):
The HTTP/2 equivalents for several HTTP/1.1 requests and responses are illustrated in the examples on section 8.1.3, e.g.