| 1 |
# HTTP3 (and QUIC) |
| 2 |
|
| 3 |
## Resources |
| 4 |
|
| 5 |
[HTTP/3 Explained](https://daniel.haxx.se/http3-explained/) - the online free |
| 6 |
book describing the protocols involved. |
| 7 |
|
| 8 |
[QUIC implementation](https://github.com/curl/curl/wiki/QUIC-implementation) - |
| 9 |
the wiki page describing the plan for how to support QUIC and HTTP/3 in curl |
| 10 |
and libcurl. |
| 11 |
|
| 12 |
[quicwg.org](https://quicwg.org/) - home of the official protocol drafts |
| 13 |
|
| 14 |
## QUIC libraries |
| 15 |
|
| 16 |
QUIC libraries we're experimenting with: |
| 17 |
|
| 18 |
[ngtcp2](https://github.com/ngtcp2/ngtcp2) |
| 19 |
|
| 20 |
[quiche](https://github.com/cloudflare/quiche) |
| 21 |
|
| 22 |
## Experimental! |
| 23 |
|
| 24 |
HTTP/3 and QUIC support in curl is considered **EXPERIMENTAL** until further |
| 25 |
notice. It needs to be enabled at build-time. |
| 26 |
|
| 27 |
Further development and tweaking of the HTTP/3 support in curl will happen in |
| 28 |
in the master branch using pull-requests, just like ordinary changes. |
| 29 |
|
| 30 |
# ngtcp2 version |
| 31 |
|
| 32 |
## Build |
| 33 |
|
| 34 |
Build (patched) OpenSSL |
| 35 |
|
| 36 |
% git clone --depth 1 -b OpenSSL_1_1_1d-quic-draft-27 https://github.com/tatsuhiro-t/openssl |
| 37 |
% cd openssl |
| 38 |
% ./config enable-tls1_3 --prefix=<somewhere1> |
| 39 |
% make |
| 40 |
% make install_sw |
| 41 |
|
| 42 |
Build nghttp3 |
| 43 |
|
| 44 |
% cd .. |
| 45 |
% git clone https://github.com/ngtcp2/nghttp3 |
| 46 |
% cd nghttp3 |
| 47 |
% autoreconf -i |
| 48 |
% ./configure --prefix=<somewhere2> --enable-lib-only |
| 49 |
% make |
| 50 |
% make install |
| 51 |
|
| 52 |
Build ngtcp2 |
| 53 |
|
| 54 |
% cd .. |
| 55 |
% git clone https://github.com/ngtcp2/ngtcp2 |
| 56 |
% cd ngtcp2 |
| 57 |
% autoreconf -i |
| 58 |
% ./configure PKG_CONFIG_PATH=<somewhere1>/lib/pkgconfig:<somewhere2>/lib/pkgconfig LDFLAGS="-Wl,-rpath,<somewhere1>/lib" --prefix=<somewhere3> |
| 59 |
% make |
| 60 |
% make install |
| 61 |
|
| 62 |
Build curl |
| 63 |
|
| 64 |
% cd .. |
| 65 |
% git clone https://github.com/curl/curl |
| 66 |
% cd curl |
| 67 |
% ./buildconf |
| 68 |
% LDFLAGS="-Wl,-rpath,<somewhere1>/lib" ./configure --with-ssl=<somewhere1> --with-nghttp3=<somewhere2> --with-ngtcp2=<somewhere3> --enable-alt-svc |
| 69 |
% make |
| 70 |
|
| 71 |
# quiche version |
| 72 |
|
| 73 |
## build |
| 74 |
|
| 75 |
Clone quiche and BoringSSL: |
| 76 |
|
| 77 |
% git clone --recursive https://github.com/cloudflare/quiche |
| 78 |
|
| 79 |
Build BoringSSL (it needs to be built manually so it can be reused with curl): |
| 80 |
|
| 81 |
% cd quiche/deps/boringssl |
| 82 |
% mkdir build |
| 83 |
% cd build |
| 84 |
% cmake -DCMAKE_POSITION_INDEPENDENT_CODE=on .. |
| 85 |
% make |
| 86 |
% cd .. |
| 87 |
% mkdir -p .openssl/lib |
| 88 |
% cp build/crypto/libcrypto.a build/ssl/libssl.a .openssl/lib |
| 89 |
% ln -s $PWD/include .openssl |
| 90 |
|
| 91 |
Build quiche: |
| 92 |
|
| 93 |
% cd ../.. |
| 94 |
% QUICHE_BSSL_PATH=$PWD/deps/boringssl cargo build --release --features pkg-config-meta |
| 95 |
|
| 96 |
Build curl: |
| 97 |
|
| 98 |
% cd .. |
| 99 |
% git clone https://github.com/curl/curl |
| 100 |
% cd curl |
| 101 |
% ./buildconf |
| 102 |
% ./configure LDFLAGS="-Wl,-rpath,$PWD/../quiche/target/release" --with-ssl=$PWD/../quiche/deps/boringssl/.openssl --with-quiche=$PWD/../quiche/target/release --enable-alt-svc |
| 103 |
% make |
| 104 |
|
| 105 |
## Run |
| 106 |
|
| 107 |
Use HTTP/3 directly: |
| 108 |
|
| 109 |
curl --http3 https://nghttp2.org:8443/ |
| 110 |
|
| 111 |
Upgrade via Alt-Svc: |
| 112 |
|
| 113 |
curl --alt-svc altsvc.cache https://quic.aiortc.org/ |
| 114 |
|
| 115 |
See this [list of public HTTP/3 servers](https://bagder.github.io/HTTP3-test/) |