Skip to content

Instantly share code, notes, and snippets.

@feuyeux
Last active August 28, 2016 19:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save feuyeux/55f9217bf229838a9487 to your computer and use it in GitHub Desktop.
Save feuyeux/55f9217bf229838a9487 to your computer and use it in GitHub Desktop.
HTTP2 learning

HTTP2

golang/caddy

echo "limit maxfiles 1024 unlimited" | sudo tee -a /etc/launchd.conf

git clone https://github.com/mholt/caddy.git
cd caddy
echo "test" > test.html
go run main.go

curl

👎

curl -v :2015/test.html

*   Trying ::1...
* Connected to  (::1) port 2015 (#0)
> GET /test.html HTTP/1.1
> Host: :2015
> User-Agent: curl/7.43.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Accept-Ranges: bytes
< Content-Length: 5
< Content-Type: text/html; charset=utf-8
< Last-Modified: Thu, 03 Sep 2015 16:48:52 GMT
< Server: Caddy
< Date: Thu, 03 Sep 2015 16:49:04 GMT
<
test
* Connection #0 to host  left intact

curl --http2 -v :2015/test.html

curl: (1) Unsupported protocol

🆘

brew install curl --with-nghttp2

👍

curl --http2 -v :2015/test.html                                                                   [2:01:54]
*   Trying ::1...
* Connected to  (::1) port 2015 (#0)
> GET /test.html HTTP/1.1
> Host: :2015
> User-Agent: curl/7.44.0
> Accept: */*
> Connection: Upgrade, HTTP2-Settings
> Upgrade: h2c
> HTTP2-Settings: AAMAAABkAAQAAP__
>
< HTTP/1.1 200 OK
< Accept-Ranges: bytes
< Content-Length: 5
< Content-Type: text/html; charset=utf-8
< Last-Modified: Thu, 03 Sep 2015 16:48:52 GMT
< Server: Caddy
< Date: Thu, 03 Sep 2015 18:02:05 GMT
<
test
* Connection #0 to host  left intact
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment