1# HTTP3 (and QUIC) 2 3## Resources 4 5[HTTP/3 Explained](https://http3-explained.haxx.se/en/) - 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 are 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-3.0.0+quic https://github.com/quictls/openssl 37 % cd openssl 38 % ./config enable-tls1_3 --prefix=<somewhere1> 39 % make 40 % make install 41 42Build nghttp3 43 44 % cd .. 45 % git clone https://github.com/ngtcp2/nghttp3 46 % cd nghttp3 47 % autoreconf -fi 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 -fi 58 % ./configure PKG_CONFIG_PATH=<somewhere1>/lib/pkgconfig:<somewhere2>/lib/pkgconfig LDFLAGS="-Wl,-rpath,<somewhere1>/lib" --prefix=<somewhere3> --enable-lib-only 59 % make 60 % make install 61 62Build curl 63 64 % cd .. 65 % git clone https://github.com/curl/curl 66 % cd curl 67 % autoreconf -fi 68 % LDFLAGS="-Wl,-rpath,<somewhere1>/lib" ./configure --with-openssl=<somewhere1> --with-nghttp3=<somewhere2> --with-ngtcp2=<somewhere3> 69 % make 70 % make install 71 72For OpenSSL 3.0.0 or later builds on Linux for x86_64 architecture, substitute all occurances of "/lib" with "/lib64" 73 74## Build with GnuTLS 75 76Build GnuTLS 77 78 % git clone --depth 1 https://gitlab.com/gnutls/gnutls.git 79 % cd gnutls 80 % ./bootstrap 81 % ./configure --prefix=<somewhere1> 82 % make 83 % make install 84 85Build nghttp3 86 87 % cd .. 88 % git clone https://github.com/ngtcp2/nghttp3 89 % cd nghttp3 90 % autoreconf -fi 91 % ./configure --prefix=<somewhere2> --enable-lib-only 92 % make 93 % make install 94 95Build ngtcp2 96 97 % cd .. 98 % git clone https://github.com/ngtcp2/ngtcp2 99 % cd ngtcp2 100 % autoreconf -fi 101 % ./configure PKG_CONFIG_PATH=<somewhere1>/lib/pkgconfig:<somewhere2>/lib/pkgconfig LDFLAGS="-Wl,-rpath,<somewhere1>/lib" --prefix=<somewhere3> --enable-lib-only --with-gnutls 102 % make 103 % make install 104 105Build curl 106 107 % cd .. 108 % git clone https://github.com/curl/curl 109 % cd curl 110 % autoreconf -fi 111 % ./configure --without-openssl --with-gnutls=<somewhere1> --with-nghttp3=<somewhere2> --with-ngtcp2=<somewhere3> 112 % make 113 % make install 114 115# quiche version 116 117## build 118 119Build quiche and BoringSSL: 120 121 % git clone --recursive https://github.com/cloudflare/quiche 122 % cd quiche 123 % cargo build --release --features ffi,pkg-config-meta,qlog 124 % mkdir deps/boringssl/src/lib 125 % ln -vnf $(find target/release -name libcrypto.a -o -name libssl.a) deps/boringssl/src/lib/ 126 127Build curl: 128 129 % cd .. 130 % git clone https://github.com/curl/curl 131 % cd curl 132 % autoreconf -fi 133 % ./configure LDFLAGS="-Wl,-rpath,$PWD/../quiche/target/release" --with-openssl=$PWD/../quiche/deps/boringssl/src --with-quiche=$PWD/../quiche/target/release 134 % make 135 % make install 136 137 If `make install` results in `Permission denied` error, you will need to prepend it with `sudo`. 138 139## Run 140 141Use HTTP/3 directly: 142 143 curl --http3 https://nghttp2.org:4433/ 144 145Upgrade via Alt-Svc: 146 147 curl --alt-svc altsvc.cache https://quic.aiortc.org/ 148 149See this [list of public HTTP/3 servers](https://bagder.github.io/HTTP3-test/) 150