httpie / httpie-http2

(DEPRECATED) Experimental HTTP/2 plugin for HTTPie
https://httpie.org
Other
68 stars 4 forks source link

Request incorrectly shows HTTP/1.1 instead of HTTP/2 #2

Open jkbrzt opened 9 years ago

jkbrzt commented 9 years ago

It's hardcoded in HTTPie. Unclear how to obtain the actual version.

$ http -v  https://nghttp2.org/httpbin/get
GET /httpbin/get HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: nghttp2.org
User-Agent: HTTPie/0.9.1
HTTP/2 200
access-control-allow-credentials: true
access-control-allow-origin: *
content-length: 268
content-type: application/json
date: Sat, 07 Feb 2015 17:02:52 GMT
server: nghttpx nghttp2/0.7.4-DEV
strict-transport-security: max-age=31536000
via: 1.1 nghttpx
Lukasa commented 9 years ago

Arguably the more important fact is that the notion of a 'request line' doesn't exist in HTTP/2. Instead there are pseudo-headers: :method, :scheme, :authority, and :path.

Lukasa commented 9 years ago

I wonder what cURL does. That feels like the correct model to follow.

jinleileiking commented 7 years ago

I the same. return 1.1

jinleileiking commented 7 years ago
➜  tools git:(master) ✗ http https://nghttp2.org/httpbin/get
HTTP/1.1 200 OK
Access-Control-Allow-Credentials: true
Access-Control-Allow-Origin: *
Connection: close
Content-Length: 256
Content-Type: application/json
Date: Tue, 16 May 2017 08:41:55 GMT
Server: nghttpx
Strict-Transport-Security: max-age=31536000
Via: 1.1 nghttpx
X-Backend-Header-Rtt: 0.002316
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
x-xss-protection: 1; mode=block

{
    "args": {},
    "headers": {
        "Accept": "*/*",
        "Accept-Encoding": "gzip, deflate",
        "Host": "nghttp2.org",
        "User-Agent": "HTTPie/0.9.9",
        "Via": "1.1 nghttpx"
    },
    "origin": "120.92.8.170",
    "url": "https://nghttp2.org/httpbin/get"
}