How to Enable cURL with HTTP/3 on Ubuntu 24.04

1 min read

Enable HTTP3 QUIC in cURL command.

What’s cURL

cURL is a powerful command-line tool that enables data transfer over various network protocols. By enabling HTTP/3 and QUIC support, you can take advantage of modern web protocols that provide faster, more reliable connectivity.

Prerequisites

  • Ubuntu 24.04 or newest
  • Basic knowledge of terminal commands.

How to compile cURL with HTTP3 support

Update and Upgrade Your System

First, ensure your system is up to date:

apt update && apt upgrade -y

Install Dependencies

Install necessary dependencies for building cURL with HTTP/3 and QUIC support:

apt install -y build-essential git curl libssl-dev \
  libnghttp2-dev libbrotli-dev python3 python3-pip cmake

Install and Configure Cloudflare Quiche

We use Cloudflare Quiche to support QUIC in cURL, and here to build the package:

cd ~
git clone --recursive https://github.com/cloudflare/quiche
cd quiche
cargo build --package quiche --release --features ffi,pkg-config-meta,qlog
ln -s libquiche.so target/release/libquiche.so.0
mkdir quiche/deps/boringssl/src/lib
ln -vnf $(find target/release -name libcrypto.a -o -name libssl.a) quiche/deps/boringssl/src/lib/

Download and Compile cURL with HTTP/3 and QUIC support

Download the cURL source code and compile it with HTTP/3 support:

cd ~
git clone https://github.com/curl/curl
cd curl
autoreconf -fi
./configure LDFLAGS="-Wl,-rpath,$PWD/../quiche/target/release" \
  --with-openssl=$PWD/../quiche/quiche/deps/boringssl/src \
  --with-quiche=$PWD/../quiche/target/release 
make
make install
ldconfig

Verify Installation

Verify that cURL has been compiled with HTTP/3 support:

which curl
/usr/local/bin/curl

curl --version  | grep HTTP3
Features: alt-svc AsynchDNS brotli HSTS HTTP2 HTTP3 HTTPS-proxy IPv6 Largefile libz NTLM SSL threadsafe UnixSockets

Testing cURL with HTTP/3

To test if cURL is working with HTTP/3, you can use a website that supports HTTP/3. For example:

curl -I --http3 https://blackonsole.org
HTTP/3 200

Reference

Leave a Reply

Your email address will not be published. Required fields are marked *