diff options
author | Daniel Stenberg <daniel@haxx.se> | 2019-08-10 23:19:55 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2019-08-12 00:18:53 +0200 |
commit | d85a1cf11d31bbf7a91c406ba011e0235688c527 (patch) | |
tree | 509c1a70183bbb03b4134411247ed38c362f2a4f | |
parent | 17d1e27d309f16da960fd3b9933e6e2b1db22b17 (diff) |
nghttp3: required when ngtcp2 is used for QUIC
- checked for by configure
- updated docs/HTTP3.md
- shown in the version string
Closes #4210
-rwxr-xr-x | configure.ac | 93 | ||||
-rw-r--r-- | docs/HTTP3.md | 42 | ||||
-rw-r--r-- | lib/vquic/ngtcp2.c | 2 |
3 files changed, 128 insertions, 9 deletions
diff --git a/configure.ac b/configure.ac index 020a0e08c..32b25ac6e 100755 --- a/configure.ac +++ b/configure.ac @@ -3402,14 +3402,12 @@ if test X"$want_tcp2" != Xno; then AC_CHECK_LIB(ngtcp2, ngtcp2_conn_client_new, [ AC_CHECK_HEADERS(ngtcp2/ngtcp2.h, - curl_h3_msg="enabled (ngtcp2)" NGTCP2_ENABLED=1 AC_DEFINE(USE_NGTCP2, 1, [if ngtcp2 is in use]) AC_SUBST(USE_NGTCP2, [1]) CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$DIR_TCP2" export CURL_LIBRARY_PATH AC_MSG_NOTICE([Added $DIR_TCP2 to CURL_LIBRARY_PATH]) - experimental="$experimental HTTP3" ) ], dnl not found, revert back to clean variables @@ -3430,6 +3428,97 @@ if test X"$want_tcp2" != Xno; then fi dnl ********************************************************************** +dnl Check for nghttp3 (HTTP/3 with ngtcp2) +dnl ********************************************************************** + +OPT_NGHTTP3="yes" + +if test "x$NGTCP2_ENABLED" = "x"; then + # without ngtcp2, nghttp3 is of no use for us + OPT_NGHTTP3="no" +fi + +AC_ARG_WITH(nghttp3, +AC_HELP_STRING([--with-nghttp3=PATH],[Enable nghttp3 usage]) +AC_HELP_STRING([--without-nghttp3],[Disable nghttp3 usage]), + [OPT_NGHTTP3=$withval]) +case "$OPT_NGHTTP3" in + no) + dnl --without-nghttp3 option used + want_nghttp3="no" + ;; + yes) + dnl --with-nghttp3 option used without path + want_nghttp3="default" + want_nghttp3_path="" + ;; + *) + dnl --with-nghttp3 option used with path + want_nghttp3="yes" + want_nghttp3_path="$withval/lib/pkgconfig" + ;; +esac + +curl_http3_msg="disabled (--with-nghttp3)" +if test X"$want_nghttp3" != Xno; then + dnl backup the pre-nghttp3 variables + CLEANLDFLAGS="$LDFLAGS" + CLEANCPPFLAGS="$CPPFLAGS" + CLEANLIBS="$LIBS" + + CURL_CHECK_PKGCONFIG(libnghttp3, $want_nghttp3_path) + + if test "$PKGCONFIG" != "no" ; then + LIB_NGHTTP3=`CURL_EXPORT_PCDIR([$want_nghttp3_path]) + $PKGCONFIG --libs-only-l libnghttp3` + AC_MSG_NOTICE([-l is $LIB_NGHTTP3]) + + CPP_NGHTTP3=`CURL_EXPORT_PCDIR([$want_nghttp3_path]) dnl + $PKGCONFIG --cflags-only-I libnghttp3` + AC_MSG_NOTICE([-I is $CPP_NGHTTP3]) + + LD_NGHTTP3=`CURL_EXPORT_PCDIR([$want_nghttp3_path]) + $PKGCONFIG --libs-only-L libnghttp3` + AC_MSG_NOTICE([-L is $LD_NGHTTP3]) + + LDFLAGS="$LDFLAGS $LD_NGHTTP3" + CPPFLAGS="$CPPFLAGS $CPP_NGHTTP3" + LIBS="$LIB_NGHTTP3 $LIBS" + + if test "x$cross_compiling" != "xyes"; then + DIR_NGHTTP3=`echo $LD_NGHTTP3 | $SED -e 's/-L//'` + fi + AC_CHECK_LIB(nghttp3, nghttp3_conn_client_new, + [ + AC_CHECK_HEADERS(nghttp3/nghttp3.h, + curl_h3_msg="enabled (ngtcp2 + nghttp3)" + NGHTTP3_ENABLED=1 + AC_DEFINE(USE_NGHTTP3, 1, [if nghttp3 is in use]) + AC_SUBST(USE_NGHTTP3, [1]) + CURL_LIBRARY_PATH="$CURL_LIBRARY_PATH:$DIR_NGHTTP3" + export CURL_LIBRARY_PATH + AC_MSG_NOTICE([Added $DIR_NGHTTP3 to CURL_LIBRARY_PATH]) + experimental="$experimental HTTP3" + ) + ], + dnl not found, revert back to clean variables + LDFLAGS=$CLEANLDFLAGS + CPPFLAGS=$CLEANCPPFLAGS + LIBS=$CLEANLIBS + ) + + else + dnl no nghttp3 pkg-config found, deal with it + if test X"$want_nghttp3" != Xdefault; then + dnl To avoid link errors, we do not allow --with-nghttp3 without + dnl a pkgconfig file + AC_MSG_ERROR([--with-nghttp3 was specified but could not find nghttp3 pkg-config file.]) + fi + fi + +fi + +dnl ********************************************************************** dnl Check for quiche (QUIC) dnl ********************************************************************** diff --git a/docs/HTTP3.md b/docs/HTTP3.md index 98ffe2dcf..9e9b23c7d 100644 --- a/docs/HTTP3.md +++ b/docs/HTTP3.md @@ -31,12 +31,42 @@ in the master branch using pull-requests, just like ordinary changes. ## Build -1. clone ngtcp2 from git (the draft-22 branch) -2. build and install ngtcp2's custom OpenSSL version (the quic-draft-22 branch) -3. build and install nghttp3 -4. build and install ngtcp2 according to its instructions -5. configure curl with ngtcp2 support: `./configure --with-ngtcp2=<install prefix>` -6. build curl "normally" +Build (patched) OpenSSL + + % git clone --depth 1 -b quic-draft-22 https://github.com/tatsuhiro-t/openssl + % cd openssl + % ./config enable-tls1_3 --prefix=<somewhere1> + % make + % make install_sw + +Build nghttp3 + + % cd .. + % git clone https://github.com/ngtcp2/nghttp3 + % cd nghttp3 + % autoreconf -i + % ./configure --prefix=<somewhere2> --enable-lib-only + % make + % make install + +Build ngtcp2 + + % cd .. + % git clone -b draft-20 https://github.com/ngtcp2/ngtcp2 + % cd ngtcp2 + % autoreconf -i + % ./configure PKG_CONFIG_PATH=<somewhere1>/lib/pkgconfig:<somewhere2>/lib/pkgconfig LDFLAGS="-Wl,-rpath,<somehere1>/lib" --prefix==<somewhere3> + % make + % make install + +Build curl + + % cd .. + % git clone https://github.com/curl/curl + % cd curl + % ./buildconf + % LDFLAGS="-Wl,-rpath,<somewhere1>/lib" ./configure -with-ssl=<somewhere1> --with-nghttp3=<somewhere2> --with-ngtcp2=<somewhere3> + % make ## Running diff --git a/lib/vquic/ngtcp2.c b/lib/vquic/ngtcp2.c index c1aa00987..3669c714b 100644 --- a/lib/vquic/ngtcp2.c +++ b/lib/vquic/ngtcp2.c @@ -1055,7 +1055,7 @@ CURLcode Curl_quic_connect(struct connectdata *conn, */ int Curl_quic_ver(char *p, size_t len) { - return msnprintf(p, len, " ngtcp2/blabla"); + return msnprintf(p, len, " ngtcp2/blabla nghttp3/bloblo"); } CURLcode Curl_quic_is_connected(struct connectdata *conn, int sockindex, |