httpie / httpie-http2

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

Missing reason in Status-Line #4

Open jkbrzt opened 9 years ago

jkbrzt commented 9 years ago

Should be HTTP/2 200 OK

image

https://github.com/jakubroztocil/httpie/blob/337c05f95cc3b5435f9a7718bbd62debbf282d31/httpie/models.py#L66

// cc @Lukasa

Lukasa commented 9 years ago

Note that the reason is missing because it isn't valid in HTTP/2. From the spec, section 8.1.2.4:

HTTP/2 does not define a way to carry the version or reason phrase that is included in an HTTP/1.1 status line.

A simple option is for HTTPie to add back in the reason phrase automatically if not present. Another option is for hyper to do that. Another another option is to do whatever cURL does. Another another another option is to come up with a new approach of rendering HTTP/2 requests.

jkbrzt commented 9 years ago

I see, It's a tricky one. I haven't finished reading the spec yet, but adopting a formatting similar to the one used in the examples section, where v1.1 vs. v2 messages are compared, might also be an option:


     GET /resource HTTP/1.1           HEADERS
     Host: example.org          ==>     + END_STREAM
     Accept: image/jpeg                 + END_HEADERS
                                          :method = GET
                                          :scheme = https
                                          :path = /resource
                                          host = example.org
                                          accept = image/jpeg

     HTTP/1.1 304 Not Modified        HEADERS
     ETag: "xyzzy"              ==>     + END_STREAM
     Expires: Thu, 23 Jan ...           + END_HEADERS
                                          :status = 304
                                          etag = "xyzzy"
                                          expires = Thu, 23 Jan ...

https://tools.ietf.org/html/draft-ietf-httpbis-http2-16#section-8.1.3