Skip to content

Inconsistent response header representation for HTTP/1.1 vs HTTP/2 #797

@Lukasa

Description

@Lukasa

Summary

When asking curl to print the HTTP headers (either by using -v or -I), the representation of the response headers is different for HTTP/1.1 responses and for HTTP/2 responses. In particular, the HTTP/2 representation would not be parsed by a very strict HTTP/1.1 header block parser.

I did this

curl --http1.1 -I https://http2bin.org/get

and

curl --http2 -I https://http2bin.org/get

(The only difference is --http1.1 vs --http2.)

I expected the following

The same representation of the output from both commands.

I got

From HTTP/1.1:

HTTP/1.1 200 OK
Date: Wed, 11 May 2016 10:51:41 GMT
Server: h2o/1.7.0
Connection: keep-alive
Content-Length: 253
content-type: application/json
access-control-allow-origin: *
access-control-allow-credentials: true
x-clacks-overhead: GNU Terry Pratchett

From HTTP/2:

HTTP/2.0 200
server:h2o/1.7.0
date:Wed, 11 May 2016 10:51:37 GMT
content-type:application/json
access-control-allow-origin:*
access-control-allow-credentials:true
x-clacks-overhead:GNU Terry Pratchett
content-length:251

(Note the lack of spaces after the colons in the HTTP/2 representation.)

curl/libcurl version

curl 7.48.0 (x86_64-apple-darwin15.4.0) libcurl/7.48.0 OpenSSL/1.0.2g zlib/1.2.5 nghttp2/1.9.2
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP HTTP2 UnixSockets

operating system

Mac OS X El Capitan 10.11.5 Beta (15F31a)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions