1# HTTP3 (and QUIC) 2 3## Resources 4 5[HTTP/3 Explained](https://daniel.haxx.se/http3-explained/) - the online free 6book describing the protocols involved. 7 8[QUIC implementation](https://github.com/curl/curl/wiki/QUIC-implementation) - 9the wiki page describing the plan for how to support QUIC and HTTP/3 in curl 10and libcurl. 11 12[quicwg.org](https://quicwg.org/) - home of the official protocol drafts 13 14## QUIC libraries 15 16QUIC 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 24HTTP/3 and QUIC support in curl is considered **EXPERIMENTAL** until further 25notice. It needs to be enabled at build-time. 26 27Further development and tweaking of the HTTP/3 support in curl will happen in 28in the master branch using pull-requests, just like ordinary changes. 29 30# ngtcp2 version 31 32## Build with OpenSSL 33 34Build (patched) OpenSSL 35 36 % git clone --depth 1 -b OpenSSL_1_1_1g-quic-draft-29 https://github.com/tatsuhiro-t/openssl 37 % cd openssl 38 % ./config enable-tls1_3 --prefix=<somewhere1> 39 % make 40 % make install_sw 41 42Build 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 52Build 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 62Build 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## Build with GnuTLS 72 73Build (patched) GnuTLS 74 75 % git clone --depth 1 -b tmp-quic https://gitlab.com/gnutls/gnutls.git 76 % cd gnutls 77 % ./bootstrap 78 % ./configure --disable-doc --prefix=<somewhere1> 79 % make 80 % make install 81 82Build nghttp3 83 84 % cd .. 85 % git clone https://github.com/ngtcp2/nghttp3 86 % cd nghttp3 87 % autoreconf -i 88 % ./configure --prefix=<somewhere2> --enable-lib-only 89 % make 90 % make install 91 92Build ngtcp2 93 94 % cd .. 95 % git clone https://github.com/ngtcp2/ngtcp2 96 % cd ngtcp2 97 % autoreconf -i 98 % ./configure PKG_CONFIG_PATH=<somewhere1>/lib/pkgconfig:<somewhere2>/lib/pkgconfig LDFLAGS="-Wl,-rpath,<somewhere1>/lib" --prefix=<somewhere3> 99 % make 100 % make install 101 102Build curl 103 104 % cd .. 105 % git clone https://github.com/curl/curl 106 % cd curl 107 % ./buildconf 108 % ./configure --without-ssl --with-gnutls=<somewhere1> --with-nghttp3=<somewhere2> --with-ngtcp2=<somewhere3> --enable-alt-svc 109 % make 110 111# quiche version 112 113## build 114 115Build quiche and BoringSSL: 116 117 % git clone --recursive https://github.com/cloudflare/quiche 118 % cd quiche 119 % cargo build --release --features pkg-config-meta,qlog 120 % mkdir deps/boringssl/src/lib 121 % ln -vnf $(find target/release -name libcrypto.a -o -name libssl.a) deps/boringssl/src/lib/ 122 123Build curl: 124 125 % cd .. 126 % git clone https://github.com/curl/curl 127 % cd curl 128 % ./buildconf 129 % ./configure LDFLAGS="-Wl,-rpath,$PWD/../quiche/target/release" --with-ssl=$PWD/../quiche/deps/boringssl/src --with-quiche=$PWD/../quiche/target/release --enable-alt-svc 130 % make 131 132## Run 133 134Use HTTP/3 directly: 135 136 curl --http3 https://nghttp2.org:8443/ 137 138Upgrade via Alt-Svc: 139 140 curl --alt-svc altsvc.cache https://quic.aiortc.org/ 141 142See this [list of public HTTP/3 servers](https://bagder.github.io/HTTP3-test/) 143