h2c
is a simple HTTP/2 command-line client, like curl
.
While curl
terminates after each request/response cycle, h2c
runs a background process to keep connections open.
That way, h2c
may receive asynchronous push messages from the server.
h2c
is currently in a very early stage. The best way to learn about it is to read the blog posts on unrestful.io.
h2c start &
h2c connect http2.akamai.com
h2c get /index.html
h2c stop
For a complete list of available commands, run h2c --help
.
h2c start [options]
Start the h2c process. The h2c process must be started before running any other command.h2c connect [options] <host>:<port>
Connect to a server using httpsh2c disconnect
Disconnect from serverh2c get [options] <path>
Perform a GET requesth2c post [options] <path>
Perform a POST requesth2c set <header-name> <header-value>
Set a header. The header will be valid for all subsequent requests.h2c unset <header-name> [<header-value>]
Undo 'h2c set'.h2c ping
Send a ping.h2c pid
Show the process id of the h2c process.h2c push-list
List responses that are available as push promises.h2c stream-info
List streams and their states.h2c stop
Stop the h2c processh2c wiretap <localhost:port> <remotehost:port>
Listen on localhost:port and forward all traffic to remotehost:port.
Binary releases are available on the GitHub Releases.
- Download the latest release ZIP file: h2c-v0.0.12.zip
- Extract the ZIP file
- Find the executable for your system in the
bin
folder:
- Linux:
h2c_linux_amd64
- OS X:
h2c_darwin_amd64
- Windows:
h2c_windows_amd64.exe
- Rename that executable to
h2c
, orh2c.exe
on Windows - Move the executable into a folder on your PATH.
h2c
is developed with Go 1.6. The external dependencies are located in the vendor/
directory.
In Go 1.6, the vendor/
directory will be used by default. In order to build h2c
with Go 1.5, you must enable the Go 1.5 vendor handling by setting the environment variable GO15VENDOREXPERIMENT
to 1
.
The following command will download, compile, and install h2c
:
go get github.com/fstab/h2c
h2c
uses parts of Brad Fitzpatrick's HTTP/2 support for Go. There is an HTTP/2 console debugger included in bradfitz/http2, but just like h2c
, it is currently only a quick few hour hack, so it is hard to tell if they aim at the same kind of tool.
h2c
is licensed under the Apache License, Version 2.0.
h2c
is implemented in Go and uses Go's standard library, which is licensed under Google's Go license, which is a variant of the BSD License.
The following 3rd party libraries are used:
golang.org/x/net/http2/hpack
implements the Header Compression for HTTP/2 (HPACK). The library is licensed under the terms of Go itself.github.com/fatih/color
implements the color output used inh2c start --dump
. The library is licensed under an MIT License.