Compare commits

..

21 Commits

Author SHA1 Message Date
Tatsuhiro Tsujikawa
989d69be01 Update manual pages 2023-07-12 17:20:52 +09:00
Tatsuhiro Tsujikawa
2143f46f45 Bump package version 2023-07-12 17:14:02 +09:00
Tatsuhiro Tsujikawa
5bbe86a713 Merge pull request #1927 from nghttp2/bump-macos
Bump macos to 12
2023-07-11 22:54:06 +09:00
Tatsuhiro Tsujikawa
3cc152a9a5 Bump macos to 12 2023-07-11 22:24:19 +09:00
Tatsuhiro Tsujikawa
693372b695 Merge pull request #1926 from nghttp2/bump-llhttp
Bump llhttp to a0e744f850d8101a51284868ffdf745bcfe4fbcc
2023-07-11 22:13:31 +09:00
Tatsuhiro Tsujikawa
43e6a01189 Bump llhttp to a0e744f850d8101a51284868ffdf745bcfe4fbcc 2023-07-11 21:24:11 +09:00
Tatsuhiro Tsujikawa
9dc39859fc Merge pull request #1925 from nghttp2/nghttpx-randomize-initial-quic-pkt-num
nghttpx: Randomize initial QUIC packet number
2023-07-11 21:04:47 +09:00
Tatsuhiro Tsujikawa
5b350acc4c nghttpx: Randomize initial QUIC packet number 2023-07-11 20:47:30 +09:00
Tatsuhiro Tsujikawa
42140d3ade Merge pull request #1923 from nghttp2/bump-ngtcp2
Bump ngtcp2
2023-07-09 22:23:31 +09:00
Tatsuhiro Tsujikawa
dfa2a59f99 Bump ngtcp2 2023-07-09 21:09:43 +09:00
Tatsuhiro Tsujikawa
5c11ad80c0 Merge pull request #1920 from nghttp2/gro
h2load, nghttpx: Add UDP_GRO support
2023-06-25 19:35:13 +09:00
Tatsuhiro Tsujikawa
ee4de34a42 h2load, nghttpx: Add UDP_GRO support 2023-06-25 18:51:57 +09:00
Tatsuhiro Tsujikawa
892a6162ab Merge pull request #1918 from nghttp2/mruby-cross
mruby: Support cross build for autotools
2023-06-24 16:32:40 +09:00
Tatsuhiro Tsujikawa
811b3554a7 mruby: Support cross build for autotools
Support mruby cross build, but now we are unable to specify host C/C++
compiler on cross build.

Do not pass compiler and linker flags because mruby does its own.

Cross build only works with autotools.  It does not work with cmake.
2023-06-11 20:06:06 +09:00
Tatsuhiro Tsujikawa
e7f5940655 Merge pull request #1917 from nghttp2/bump-go-dep
Bump go package dependencies
2023-06-11 13:27:44 +09:00
Tatsuhiro Tsujikawa
e4ad2921e5 Bump go package dependencies 2023-06-11 13:03:34 +09:00
Tatsuhiro Tsujikawa
7872401f73 Merge pull request #1916 from nghttp2/bump-go
Bump go to 1.20
2023-06-11 13:02:50 +09:00
Tatsuhiro Tsujikawa
2277f7cc68 Bump go to 1.20 2023-06-11 12:05:55 +09:00
Tatsuhiro Tsujikawa
2c955ab76b Merge pull request #1915 from nghttp2/fix-build-without-libev
Fix build error without libev
2023-06-08 20:31:41 +09:00
Tatsuhiro Tsujikawa
9fc1f85102 Fix build error without libev
Check libev availability, and guard the usage of libev in util.h.
2023-06-08 19:33:23 +09:00
Tatsuhiro Tsujikawa
2571f78ce7 Bump package version 2023-06-07 19:01:48 +09:00
32 changed files with 973 additions and 741 deletions

View File

@@ -8,15 +8,15 @@ env:
LIBBPF_VERSION: v1.2.0 LIBBPF_VERSION: v1.2.0
OPENSSL1_VERSION: 1_1_1u+quic OPENSSL1_VERSION: 1_1_1u+quic
OPENSSL3_VERSION: 3.1.0+quic OPENSSL3_VERSION: 3.1.0+quic
BORINGSSL_VERSION: b0341041b03ea71d8371a9692aedae263fc06ee9 BORINGSSL_VERSION: 80dcb67d4481fb1194b9669917e35580c32dc388
NGHTTP3_VERSION: v0.12.0 NGHTTP3_VERSION: v0.13.0
NGTCP2_VERSION: v0.16.0 NGTCP2_VERSION: v0.17.0
jobs: jobs:
build-cache: build-cache:
strategy: strategy:
matrix: matrix:
os: [ubuntu-22.04, macos-11] os: [ubuntu-22.04, macos-12]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
@@ -175,22 +175,22 @@ jobs:
strategy: strategy:
matrix: matrix:
os: [ubuntu-22.04, macos-11] os: [ubuntu-22.04, macos-12]
compiler: [gcc, clang] compiler: [gcc, clang]
buildtool: [autotools, cmake] buildtool: [autotools, cmake]
http3: [http3, no-http3] http3: [http3, no-http3]
openssl: [openssl1, openssl3, boringssl] openssl: [openssl1, openssl3, boringssl]
exclude: exclude:
- os: macos-11 - os: macos-12
openssl: openssl3 openssl: openssl3
- http3: no-http3 - http3: no-http3
openssl: openssl3 openssl: openssl3
- os: macos-11 - os: macos-12
compiler: gcc compiler: gcc
- # disable macos cmake because of include path issue - # disable macos cmake because of include path issue
os: macos-11 os: macos-12
buildtool: cmake buildtool: cmake
- os: macos-11 - os: macos-12
openssl: boringssl openssl: boringssl
- openssl: boringssl - openssl: boringssl
buildtool: cmake buildtool: cmake
@@ -397,7 +397,7 @@ jobs:
- uses: actions/setup-go@v3 - uses: actions/setup-go@v3
if: matrix.buildtool == 'cmake' if: matrix.buildtool == 'cmake'
with: with:
go-version: '1.19' go-version-file: go.mod
- name: Integration test - name: Integration test
# Integration tests for nghttpx; autotools erases build # Integration tests for nghttpx; autotools erases build
# artifacts. # artifacts.

View File

@@ -24,7 +24,7 @@
cmake_minimum_required(VERSION 3.0) cmake_minimum_required(VERSION 3.0)
# XXX using 1.8.90 instead of 1.9.0-DEV # XXX using 1.8.90 instead of 1.9.0-DEV
project(nghttp2 VERSION 1.54.0) project(nghttp2 VERSION 1.55.0)
# See versioning rule: # See versioning rule:
# https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html # https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
@@ -61,9 +61,9 @@ find_package(Libev 4.11)
find_package(Libcares 1.7.5) find_package(Libcares 1.7.5)
find_package(ZLIB 1.2.3) find_package(ZLIB 1.2.3)
find_package(Libngtcp2 0.0.0) find_package(Libngtcp2 0.0.0)
find_package(Libngtcp2_crypto_openssl 0.0.0) find_package(Libngtcp2_crypto_quictls 0.0.0)
if(LIBNGTCP2_CRYPTO_OPENSSL_FOUND) if(LIBNGTCP2_CRYPTO_QUICTLS_FOUND)
set(HAVE_LIBNGTCP2_CRYPTO_OPENSSL 1) set(HAVE_LIBNGTCP2_CRYPTO_QUICTLS 1)
endif() endif()
find_package(Libnghttp3 0.0.0) find_package(Libnghttp3 0.0.0)
if(WITH_LIBBPF) if(WITH_LIBBPF)
@@ -238,9 +238,9 @@ if(ENABLE_APP AND NOT (ZLIB_FOUND AND OPENSSL_FOUND AND LIBEV_FOUND))
message(FATAL_ERROR "Applications were requested (ENABLE_APP=1) but dependencies are not met.") message(FATAL_ERROR "Applications were requested (ENABLE_APP=1) but dependencies are not met.")
endif() endif()
# HTTP/3 requires quictls/openssl, libngtcp2, libngtcp2_crypto_openssl # HTTP/3 requires quictls/openssl, libngtcp2, libngtcp2_crypto_quictls
# and libnghttp3. # and libnghttp3.
if(ENABLE_HTTP3 AND NOT (HAVE_SSL_IS_QUIC AND LIBNGTCP2_FOUND AND LIBNGTCP2_CRYPTO_OPENSSL_FOUND AND LIBNGHTTP3_FOUND)) if(ENABLE_HTTP3 AND NOT (HAVE_SSL_IS_QUIC AND LIBNGTCP2_FOUND AND LIBNGTCP2_CRYPTO_QUICTLS_FOUND AND LIBNGHTTP3_FOUND))
message(FATAL_ERROR "HTTP/3 was requested (ENABLE_HTTP3=1) but dependencies are not met.") message(FATAL_ERROR "HTTP/3 was requested (ENABLE_HTTP3=1) but dependencies are not met.")
endif() endif()
@@ -513,7 +513,7 @@ message(STATUS "summary of build options:
Libev: ${HAVE_LIBEV} (LIBS='${LIBEV_LIBRARIES}') Libev: ${HAVE_LIBEV} (LIBS='${LIBEV_LIBRARIES}')
Libc-ares: ${HAVE_LIBCARES} (LIBS='${LIBCARES_LIBRARIES}') Libc-ares: ${HAVE_LIBCARES} (LIBS='${LIBCARES_LIBRARIES}')
Libngtcp2: ${HAVE_LIBNGTCP2} (LIBS='${LIBNGTCP2_LIBRARIES}') Libngtcp2: ${HAVE_LIBNGTCP2} (LIBS='${LIBNGTCP2_LIBRARIES}')
Libngtcp2_crypto_openssl: ${HAVE_LIBNGTCP2_CRYPTO_OPENSSL} (LIBS='${LIBNGTCP2_CRYPTO_OPENSSL_LIBRARIES}') Libngtcp2_crypto_quictls: ${HAVE_LIBNGTCP2_CRYPTO_QUICTLS} (LIBS='${LIBNGTCP2_CRYPTO_QUICTLS_LIBRARIES}')
Libnghttp3: ${HAVE_LIBNGHTTP3} (LIBS='${LIBNGHTTP3_LIBRARIES}') Libnghttp3: ${HAVE_LIBNGHTTP3} (LIBS='${LIBNGHTTP3_LIBRARIES}')
Libbpf: ${HAVE_LIBBPF} (LIBS='${LIBBPF_LIBRARIES}') Libbpf: ${HAVE_LIBBPF} (LIBS='${LIBBPF_LIBRARIES}')
Libevent(SSL): ${HAVE_LIBEVENT_OPENSSL} (LIBS='${LIBEVENT_OPENSSL_LIBRARIES}') Libevent(SSL): ${HAVE_LIBEVENT_OPENSSL} (LIBS='${LIBEVENT_OPENSSL_LIBRARIES}')

View File

@@ -44,7 +44,7 @@ EXTRA_DIST = nghttpx.conf.sample proxy.pac.sample android-config android-env \
cmake/FindLibbpf.cmake \ cmake/FindLibbpf.cmake \
cmake/FindLibnghttp3.cmake \ cmake/FindLibnghttp3.cmake \
cmake/FindLibngtcp2.cmake \ cmake/FindLibngtcp2.cmake \
cmake/FindLibngtcp2_crypto_openssl.cmake cmake/FindLibngtcp2_crypto_quictls.cmake
.PHONY: clang-format .PHONY: clang-format

View File

@@ -130,8 +130,8 @@ following libraries are required:
<https://github.com/quictls/openssl/tree/OpenSSL_1_1_1u+quic>`_; or <https://github.com/quictls/openssl/tree/OpenSSL_1_1_1u+quic>`_; or
`BoringSSL <https://boringssl.googlesource.com/boringssl/>`_ (commit `BoringSSL <https://boringssl.googlesource.com/boringssl/>`_ (commit
b0341041b03ea71d8371a9692aedae263fc06ee9) b0341041b03ea71d8371a9692aedae263fc06ee9)
* `ngtcp2 <https://github.com/ngtcp2/ngtcp2>`_ 0.16.x * `ngtcp2 <https://github.com/ngtcp2/ngtcp2>`_ 0.17.x
* `nghttp3 <https://github.com/ngtcp2/nghttp3>`_ 0.12.x * `nghttp3 <https://github.com/ngtcp2/nghttp3>`_ 0.13.x
Use ``--enable-http3`` configure option to enable HTTP/3 feature for Use ``--enable-http3`` configure option to enable HTTP/3 feature for
h2load and nghttpx. h2load and nghttpx.
@@ -354,7 +354,7 @@ Build nghttp3:
.. code-block:: text .. code-block:: text
$ git clone --depth 1 -b v0.12.0 https://github.com/ngtcp2/nghttp3 $ git clone --depth 1 -b v0.13.0 https://github.com/ngtcp2/nghttp3
$ cd nghttp3 $ cd nghttp3
$ autoreconf -i $ autoreconf -i
$ ./configure --prefix=$PWD/build --enable-lib-only $ ./configure --prefix=$PWD/build --enable-lib-only
@@ -366,7 +366,7 @@ Build ngtcp2:
.. code-block:: text .. code-block:: text
$ git clone --depth 1 -b v0.16.0 https://github.com/ngtcp2/ngtcp2 $ git clone --depth 1 -b v0.17.0 https://github.com/ngtcp2/ngtcp2
$ cd ngtcp2 $ cd ngtcp2
$ autoreconf -i $ autoreconf -i
$ ./configure --prefix=$PWD/build --enable-lib-only \ $ ./configure --prefix=$PWD/build --enable-lib-only \

View File

@@ -1,43 +0,0 @@
# - Try to find libngtcp2_crypto_openssl
# Once done this will define
# LIBNGTCP2_CRYPTO_OPENSSL_FOUND - System has libngtcp2_crypto_openssl
# LIBNGTCP2_CRYPTO_OPENSSL_INCLUDE_DIRS - The libngtcp2_crypto_openssl include directories
# LIBNGTCP2_CRYPTO_OPENSSL_LIBRARIES - The libraries needed to use libngtcp2_crypto_openssl
find_package(PkgConfig QUIET)
pkg_check_modules(PC_LIBNGTCP2_CRYPTO_OPENSSL QUIET libngtcp2_crypto_openssl)
find_path(LIBNGTCP2_CRYPTO_OPENSSL_INCLUDE_DIR
NAMES ngtcp2/ngtcp2_crypto_openssl.h
HINTS ${PC_LIBNGTCP2_CRYPTO_OPENSSL_INCLUDE_DIRS}
)
find_library(LIBNGTCP2_CRYPTO_OPENSSL_LIBRARY
NAMES ngtcp2_crypto_openssl
HINTS ${PC_LIBNGTCP2_CRYPTO_OPENSSL_LIBRARY_DIRS}
)
if(LIBNGTCP2_CRYPTO_OPENSSL_INCLUDE_DIR)
set(_version_regex "^#define[ \t]+NGTCP2_VERSION[ \t]+\"([^\"]+)\".*")
file(STRINGS "${LIBNGTCP2_CRYPTO_OPENSSL_INCLUDE_DIR}/ngtcp2/version.h"
LIBNGTCP2_CRYPTO_OPENSSL_VERSION REGEX "${_version_regex}")
string(REGEX REPLACE "${_version_regex}" "\\1"
LIBNGTCP2_CRYPTO_OPENSSL_VERSION "${LIBNGTCP2_CRYPTO_OPENSSL_VERSION}")
unset(_version_regex)
endif()
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set
# LIBNGTCP2_CRYPTO_OPENSSL_FOUND to TRUE if all listed variables are
# TRUE and the requested version matches.
find_package_handle_standard_args(Libngtcp2_crypto_openssl REQUIRED_VARS
LIBNGTCP2_CRYPTO_OPENSSL_LIBRARY
LIBNGTCP2_CRYPTO_OPENSSL_INCLUDE_DIR
VERSION_VAR LIBNGTCP2_CRYPTO_OPENSSL_VERSION)
if(LIBNGTCP2_CRYPTO_OPENSSL_FOUND)
set(LIBNGTCP2_CRYPTO_OPENSSL_LIBRARIES ${LIBNGTCP2_CRYPTO_OPENSSL_LIBRARY})
set(LIBNGTCP2_CRYPTO_OPENSSL_INCLUDE_DIRS ${LIBNGTCP2_CRYPTO_OPENSSL_INCLUDE_DIR})
endif()
mark_as_advanced(LIBNGTCP2_CRYPTO_OPENSSL_INCLUDE_DIR
LIBNGTCP2_CRYPTO_OPENSSL_LIBRARY)

View File

@@ -0,0 +1,43 @@
# - Try to find libngtcp2_crypto_quictls
# Once done this will define
# LIBNGTCP2_CRYPTO_QUICTLS_FOUND - System has libngtcp2_crypto_quictls
# LIBNGTCP2_CRYPTO_QUICTLS_INCLUDE_DIRS - The libngtcp2_crypto_quictls include directories
# LIBNGTCP2_CRYPTO_QUICTLS_LIBRARIES - The libraries needed to use libngtcp2_crypto_quictls
find_package(PkgConfig QUIET)
pkg_check_modules(PC_LIBNGTCP2_CRYPTO_QUICTLS QUIET libngtcp2_crypto_quictls)
find_path(LIBNGTCP2_CRYPTO_QUICTLS_INCLUDE_DIR
NAMES ngtcp2/ngtcp2_crypto_quictls.h
HINTS ${PC_LIBNGTCP2_CRYPTO_QUICTLS_INCLUDE_DIRS}
)
find_library(LIBNGTCP2_CRYPTO_QUICTLS_LIBRARY
NAMES ngtcp2_crypto_quictls
HINTS ${PC_LIBNGTCP2_CRYPTO_QUICTLS_LIBRARY_DIRS}
)
if(LIBNGTCP2_CRYPTO_QUICTLS_INCLUDE_DIR)
set(_version_regex "^#define[ \t]+NGTCP2_VERSION[ \t]+\"([^\"]+)\".*")
file(STRINGS "${LIBNGTCP2_CRYPTO_QUICTLS_INCLUDE_DIR}/ngtcp2/version.h"
LIBNGTCP2_CRYPTO_QUICTLS_VERSION REGEX "${_version_regex}")
string(REGEX REPLACE "${_version_regex}" "\\1"
LIBNGTCP2_CRYPTO_QUICTLS_VERSION "${LIBNGTCP2_CRYPTO_QUICTLS_VERSION}")
unset(_version_regex)
endif()
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set
# LIBNGTCP2_CRYPTO_QUICTLS_FOUND to TRUE if all listed variables are
# TRUE and the requested version matches.
find_package_handle_standard_args(Libngtcp2_crypto_quictls REQUIRED_VARS
LIBNGTCP2_CRYPTO_QUICTLS_LIBRARY
LIBNGTCP2_CRYPTO_QUICTLS_INCLUDE_DIR
VERSION_VAR LIBNGTCP2_CRYPTO_QUICTLS_VERSION)
if(LIBNGTCP2_CRYPTO_QUICTLS_FOUND)
set(LIBNGTCP2_CRYPTO_QUICTLS_LIBRARIES ${LIBNGTCP2_CRYPTO_QUICTLS_LIBRARY})
set(LIBNGTCP2_CRYPTO_QUICTLS_INCLUDE_DIRS ${LIBNGTCP2_CRYPTO_QUICTLS_INCLUDE_DIR})
endif()
mark_as_advanced(LIBNGTCP2_CRYPTO_QUICTLS_INCLUDE_DIR
LIBNGTCP2_CRYPTO_QUICTLS_LIBRARY)

View File

@@ -88,5 +88,8 @@
/* Define to 1 if you have enum bpf_stats_type in linux/bpf.h. */ /* Define to 1 if you have enum bpf_stats_type in linux/bpf.h. */
#cmakedefine HAVE_BPF_STATS_TYPE 1 #cmakedefine HAVE_BPF_STATS_TYPE 1
/* Define to 1 if you have `libngtcp2_crypto_openssl` library. */ /* Define to 1 if you have `libngtcp2_crypto_quictls` library. */
#cmakedefine HAVE_LIBNGTCP2_CRYPTO_OPENSSL #cmakedefine HAVE_LIBNGTCP2_CRYPTO_QUICTLS
/* Define to 1 if you have `libev` library. */
#cmakedefine HAVE_LIBEV 1

View File

@@ -25,7 +25,7 @@ dnl Do not change user variables!
dnl https://www.gnu.org/software/automake/manual/html_node/Flag-Variables-Ordering.html dnl https://www.gnu.org/software/automake/manual/html_node/Flag-Variables-Ordering.html
AC_PREREQ(2.61) AC_PREREQ(2.61)
AC_INIT([nghttp2], [1.54.0], [t-tujikawa@users.sourceforge.net]) AC_INIT([nghttp2], [1.55.0], [t-tujikawa@users.sourceforge.net])
AC_CONFIG_AUX_DIR([.]) AC_CONFIG_AUX_DIR([.])
AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([config.h]) AC_CONFIG_HEADERS([config.h])
@@ -433,6 +433,10 @@ if test "x${request_libev}" != "xno"; then
else else
have_libev=yes have_libev=yes
fi fi
if test "x${have_libev}" = "xyes"; then
AC_DEFINE([HAVE_LIBEV], [1], [Define to 1 if you have `libev` library.])
fi
fi fi
if test "x${request_libev}" = "xyes" && if test "x${request_libev}" = "xyes" &&
@@ -504,7 +508,7 @@ fi
# ngtcp2 (for src) # ngtcp2 (for src)
have_libngtcp2=no have_libngtcp2=no
if test "x${request_libngtcp2}" != "xno"; then if test "x${request_libngtcp2}" != "xno"; then
PKG_CHECK_MODULES([LIBNGTCP2], [libngtcp2 >= 0.16.0], [have_libngtcp2=yes], PKG_CHECK_MODULES([LIBNGTCP2], [libngtcp2 >= 0.17.0], [have_libngtcp2=yes],
[have_libngtcp2=no]) [have_libngtcp2=no])
if test "x${have_libngtcp2}" = "xno"; then if test "x${have_libngtcp2}" = "xno"; then
AC_MSG_NOTICE($LIBNGTCP2_PKG_ERRORS) AC_MSG_NOTICE($LIBNGTCP2_PKG_ERRORS)
@@ -516,26 +520,26 @@ if test "x${request_libngtcp2}" = "xyes" &&
AC_MSG_ERROR([libngtcp2 was requested (--with-libngtcp2) but not found]) AC_MSG_ERROR([libngtcp2 was requested (--with-libngtcp2) but not found])
fi fi
# ngtcp2_crypto_openssl (for src) # ngtcp2_crypto_quictls (for src)
have_libngtcp2_crypto_openssl=no have_libngtcp2_crypto_quictls=no
if test "x${have_ssl_is_quic}" = "xyes" && if test "x${have_ssl_is_quic}" = "xyes" &&
test "x${request_libngtcp2}" != "xno"; then test "x${request_libngtcp2}" != "xno"; then
PKG_CHECK_MODULES([LIBNGTCP2_CRYPTO_OPENSSL], PKG_CHECK_MODULES([LIBNGTCP2_CRYPTO_QUICTLS],
[libngtcp2_crypto_openssl >= 0.16.0], [libngtcp2_crypto_quictls >= 0.17.0],
[have_libngtcp2_crypto_openssl=yes], [have_libngtcp2_crypto_quictls=yes],
[have_libngtcp2_crypto_openssl=no]) [have_libngtcp2_crypto_quictls=no])
if test "x${have_libngtcp2_crypto_openssl}" = "xno"; then if test "x${have_libngtcp2_crypto_quictls}" = "xno"; then
AC_MSG_NOTICE($LIBNGTCP2_CRYPTO_OPENSSL_PKG_ERRORS) AC_MSG_NOTICE($LIBNGTCP2_CRYPTO_QUICTLS_PKG_ERRORS)
else else
AC_DEFINE([HAVE_LIBNGTCP2_CRYPTO_OPENSSL], [1], AC_DEFINE([HAVE_LIBNGTCP2_CRYPTO_QUICTLS], [1],
[Define to 1 if you have `libngtcp2_crypto_openssl` library.]) [Define to 1 if you have `libngtcp2_crypto_quictls` library.])
fi fi
fi fi
if test "x${have_ssl_is_quic}" = "xyes" && if test "x${have_ssl_is_quic}" = "xyes" &&
test "x${request_libngtcp2}" = "xyes" && test "x${request_libngtcp2}" = "xyes" &&
test "x${have_libngtcp2_crypto_openssl}" != "xyes"; then test "x${have_libngtcp2_crypto_quictls}" != "xyes"; then
AC_MSG_ERROR([libngtcp2_crypto_openssl was requested (--with-libngtcp2) but not found]) AC_MSG_ERROR([libngtcp2_crypto_quictls was requested (--with-libngtcp2) but not found])
fi fi
# ngtcp2_crypto_boringssl (for src) # ngtcp2_crypto_boringssl (for src)
@@ -563,7 +567,7 @@ fi
# nghttp3 (for src) # nghttp3 (for src)
have_libnghttp3=no have_libnghttp3=no
if test "x${request_libnghttp3}" != "xno"; then if test "x${request_libnghttp3}" != "xno"; then
PKG_CHECK_MODULES([LIBNGHTTP3], [libnghttp3 >= 0.12.0], [have_libnghttp3=yes], PKG_CHECK_MODULES([LIBNGHTTP3], [libnghttp3 >= 0.13.0], [have_libnghttp3=yes],
[have_libnghttp3=no]) [have_libnghttp3=no])
if test "x${have_libnghttp3}" = "xno"; then if test "x${have_libnghttp3}" = "xno"; then
AC_MSG_NOTICE($LIBNGHTTP3_PKG_ERRORS) AC_MSG_NOTICE($LIBNGHTTP3_PKG_ERRORS)
@@ -751,7 +755,7 @@ if test "x${request_http3}" != "xno" &&
(test "x${have_ssl_is_quic}" = "xyes" || (test "x${have_ssl_is_quic}" = "xyes" ||
test "x${have_boringssl_quic}" = "xyes") && test "x${have_boringssl_quic}" = "xyes") &&
test "x${have_libngtcp2}" = "xyes" && test "x${have_libngtcp2}" = "xyes" &&
(test "x${have_libngtcp2_crypto_openssl}" = "xyes" || (test "x${have_libngtcp2_crypto_quictls}" = "xyes" ||
test "x${have_libngtcp2_crypto_boringssl}" = "xyes") && test "x${have_libngtcp2_crypto_boringssl}" = "xyes") &&
test "x${have_libnghttp3}" = "xyes"; then test "x${have_libnghttp3}" = "xyes"; then
enable_http3=yes enable_http3=yes
@@ -1140,7 +1144,7 @@ AC_MSG_NOTICE([summary of build options:
Libev: ${have_libev} (CFLAGS='${LIBEV_CFLAGS}' LIBS='${LIBEV_LIBS}') Libev: ${have_libev} (CFLAGS='${LIBEV_CFLAGS}' LIBS='${LIBEV_LIBS}')
Libc-ares: ${have_libcares} (CFLAGS='${LIBCARES_CFLAGS}' LIBS='${LIBCARES_LIBS}') Libc-ares: ${have_libcares} (CFLAGS='${LIBCARES_CFLAGS}' LIBS='${LIBCARES_LIBS}')
libngtcp2: ${have_libngtcp2} (CFLAGS='${LIBNGTCP2_CFLAGS}' LIBS='${LIBNGTCP2_LIBS}') libngtcp2: ${have_libngtcp2} (CFLAGS='${LIBNGTCP2_CFLAGS}' LIBS='${LIBNGTCP2_LIBS}')
libngtcp2_crypto_openssl: ${have_libngtcp2_crypto_openssl} (CFLAGS='${LIBNGTCP2_CRYPTO_OPENSSL_CFLAGS}' LIBS='${LIBNGTCP2_CRYPTO_OPENSSL_LIBS}') libngtcp2_crypto_quictls: ${have_libngtcp2_crypto_quictls} (CFLAGS='${LIBNGTCP2_CRYPTO_QUICTLS_CFLAGS}' LIBS='${LIBNGTCP2_CRYPTO_QUICTLS_LIBS}')
libngtcp2_crypto_boringssl: ${have_libngtcp2_crypto_boringssl} (CFLAGS='${LIBNGTCP2_CRYPTO_BORINGSSL_CFLAGS}' LIBS='${LIBNGTCP2_CRYPTO_BORINGSSL_LIBS}') libngtcp2_crypto_boringssl: ${have_libngtcp2_crypto_boringssl} (CFLAGS='${LIBNGTCP2_CRYPTO_BORINGSSL_CFLAGS}' LIBS='${LIBNGTCP2_CRYPTO_BORINGSSL_LIBS}')
libnghttp3: ${have_libnghttp3} (CFLAGS='${LIBNGHTTP3_CFLAGS}' LIBS='${LIBNGHTTP3_LIBS}') libnghttp3: ${have_libnghttp3} (CFLAGS='${LIBNGHTTP3_CFLAGS}' LIBS='${LIBNGHTTP3_LIBS}')
libbpf: ${have_libbpf} (CFLAGS='${LIBBPF_CFLAGS}' LIBS='${LIBBPF_LIBS}') libbpf: ${have_libbpf} (CFLAGS='${LIBBPF_CFLAGS}' LIBS='${LIBBPF_LIBS}')

View File

@@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u .in \\n[rst2man-indent\\n[rst2man-indent-level]]u
.. ..
.TH "H2LOAD" "1" "Jun 07, 2023" "1.54.0" "nghttp2" .TH "H2LOAD" "1" "Jul 12, 2023" "1.55.0" "nghttp2"
.SH NAME .SH NAME
h2load \- HTTP/2 benchmarking tool h2load \- HTTP/2 benchmarking tool
.SH SYNOPSIS .SH SYNOPSIS

View File

@@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u .in \\n[rst2man-indent\\n[rst2man-indent-level]]u
.. ..
.TH "NGHTTP" "1" "Jun 07, 2023" "1.54.0" "nghttp2" .TH "NGHTTP" "1" "Jul 12, 2023" "1.55.0" "nghttp2"
.SH NAME .SH NAME
nghttp \- HTTP/2 client nghttp \- HTTP/2 client
.SH SYNOPSIS .SH SYNOPSIS

View File

@@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u .in \\n[rst2man-indent\\n[rst2man-indent-level]]u
.. ..
.TH "NGHTTPD" "1" "Jun 07, 2023" "1.54.0" "nghttp2" .TH "NGHTTPD" "1" "Jul 12, 2023" "1.55.0" "nghttp2"
.SH NAME .SH NAME
nghttpd \- HTTP/2 server nghttpd \- HTTP/2 server
.SH SYNOPSIS .SH SYNOPSIS

View File

@@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u .in \\n[rst2man-indent\\n[rst2man-indent-level]]u
.. ..
.TH "NGHTTPX" "1" "Jun 07, 2023" "1.54.0" "nghttp2" .TH "NGHTTPX" "1" "Jul 12, 2023" "1.55.0" "nghttp2"
.SH NAME .SH NAME
nghttpx \- HTTP/2 proxy nghttpx \- HTTP/2 proxy
.SH SYNOPSIS .SH SYNOPSIS

View File

@@ -15,7 +15,7 @@ RUN git clone --depth 1 -b OpenSSL_1_1_1u+quic https://github.com/quictls/openss
cd .. && \ cd .. && \
rm -rf openssl rm -rf openssl
RUN git clone --depth 1 -b v0.12.0 https://github.com/ngtcp2/nghttp3 && \ RUN git clone --depth 1 -b v0.13.0 https://github.com/ngtcp2/nghttp3 && \
cd nghttp3 && \ cd nghttp3 && \
autoreconf -i && \ autoreconf -i && \
./configure --enable-lib-only && \ ./configure --enable-lib-only && \
@@ -24,7 +24,7 @@ RUN git clone --depth 1 -b v0.12.0 https://github.com/ngtcp2/nghttp3 && \
cd .. && \ cd .. && \
rm -rf nghttp3 rm -rf nghttp3
RUN git clone --depth 1 -b v0.16.0 https://github.com/ngtcp2/ngtcp2 && \ RUN git clone --depth 1 -b v0.17.0 https://github.com/ngtcp2/ngtcp2 && \
cd ngtcp2 && \ cd ngtcp2 && \
autoreconf -i && \ autoreconf -i && \
./configure --enable-lib-only \ ./configure --enable-lib-only \

18
go.mod
View File

@@ -1,12 +1,12 @@
module github.com/nghttp2/nghttp2 module github.com/nghttp2/nghttp2
go 1.19 go 1.20
require ( require (
github.com/bradfitz/gomemcache v0.0.0-20230124162541-5f7a7d875746 github.com/bradfitz/gomemcache v0.0.0-20230124162541-5f7a7d875746
github.com/quic-go/quic-go v0.33.0 github.com/quic-go/quic-go v0.35.1
github.com/tatsuhiro-t/go-nghttp2 v0.0.0-20150408091349-4742878d9c90 github.com/tatsuhiro-t/go-nghttp2 v0.0.0-20150408091349-4742878d9c90
golang.org/x/net v0.7.0 golang.org/x/net v0.10.0
) )
require ( require (
@@ -15,12 +15,12 @@ require (
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 // indirect github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 // indirect
github.com/onsi/ginkgo/v2 v2.2.0 // indirect github.com/onsi/ginkgo/v2 v2.2.0 // indirect
github.com/quic-go/qpack v0.4.0 // indirect github.com/quic-go/qpack v0.4.0 // indirect
github.com/quic-go/qtls-go1-19 v0.2.1 // indirect github.com/quic-go/qtls-go1-19 v0.3.2 // indirect
github.com/quic-go/qtls-go1-20 v0.1.1 // indirect github.com/quic-go/qtls-go1-20 v0.2.2 // indirect
golang.org/x/crypto v0.4.0 // indirect golang.org/x/crypto v0.4.0 // indirect
golang.org/x/exp v0.0.0-20221205204356-47842c84f3db // indirect golang.org/x/exp v0.0.0-20221205204356-47842c84f3db // indirect
golang.org/x/mod v0.6.0 // indirect golang.org/x/mod v0.8.0 // indirect
golang.org/x/sys v0.5.0 // indirect golang.org/x/sys v0.8.0 // indirect
golang.org/x/text v0.7.0 // indirect golang.org/x/text v0.9.0 // indirect
golang.org/x/tools v0.2.0 // indirect golang.org/x/tools v0.6.0 // indirect
) )

32
go.sum
View File

@@ -22,12 +22,12 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/quic-go/qpack v0.4.0 h1:Cr9BXA1sQS2SmDUWjSofMPNKmvF6IiIfDRmgU0w1ZCo= github.com/quic-go/qpack v0.4.0 h1:Cr9BXA1sQS2SmDUWjSofMPNKmvF6IiIfDRmgU0w1ZCo=
github.com/quic-go/qpack v0.4.0/go.mod h1:UZVnYIfi5GRk+zI9UMaCPsmZ2xKJP7XBUvVyT1Knj9A= github.com/quic-go/qpack v0.4.0/go.mod h1:UZVnYIfi5GRk+zI9UMaCPsmZ2xKJP7XBUvVyT1Knj9A=
github.com/quic-go/qtls-go1-19 v0.2.1 h1:aJcKNMkH5ASEJB9FXNeZCyTEIHU1J7MmHyz1Q1TSG1A= github.com/quic-go/qtls-go1-19 v0.3.2 h1:tFxjCFcTQzK+oMxG6Zcvp4Dq8dx4yD3dDiIiyc86Z5U=
github.com/quic-go/qtls-go1-19 v0.2.1/go.mod h1:ySOI96ew8lnoKPtSqx2BlI5wCpUVPT05RMAlajtnyOI= github.com/quic-go/qtls-go1-19 v0.3.2/go.mod h1:ySOI96ew8lnoKPtSqx2BlI5wCpUVPT05RMAlajtnyOI=
github.com/quic-go/qtls-go1-20 v0.1.1 h1:KbChDlg82d3IHqaj2bn6GfKRj84Per2VGf5XV3wSwQk= github.com/quic-go/qtls-go1-20 v0.2.2 h1:WLOPx6OY/hxtTxKV1Zrq20FtXtDEkeY00CGQm8GEa3E=
github.com/quic-go/qtls-go1-20 v0.1.1/go.mod h1:JKtK6mjbAVcUTN/9jZpvLbGxvdWIKS8uT7EiStoU1SM= github.com/quic-go/qtls-go1-20 v0.2.2/go.mod h1:JKtK6mjbAVcUTN/9jZpvLbGxvdWIKS8uT7EiStoU1SM=
github.com/quic-go/quic-go v0.33.0 h1:ItNoTDN/Fm/zBlq769lLJc8ECe9gYaW40veHCCco7y0= github.com/quic-go/quic-go v0.35.1 h1:b0kzj6b/cQAf05cT0CkQubHM31wiA+xH3IBkxP62poo=
github.com/quic-go/quic-go v0.33.0/go.mod h1:YMuhaAV9/jIu0XclDXwZPAsP/2Kgr5yMYhe9oxhhOFA= github.com/quic-go/quic-go v0.35.1/go.mod h1:+4CVgVppm0FNjpG3UcX8Joi/frKOH7/ciD5yGcwOO1g=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
@@ -41,13 +41,13 @@ golang.org/x/crypto v0.4.0/go.mod h1:3quD/ATkf6oY+rnes5c3ExXTbLc8mueNue5/DoinL80
golang.org/x/exp v0.0.0-20221205204356-47842c84f3db h1:D/cFflL63o2KSLJIwjlcIt8PR064j/xsmdEJL/YvY/o= golang.org/x/exp v0.0.0-20221205204356-47842c84f3db h1:D/cFflL63o2KSLJIwjlcIt8PR064j/xsmdEJL/YvY/o=
golang.org/x/exp v0.0.0-20221205204356-47842c84f3db/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= golang.org/x/exp v0.0.0-20221205204356-47842c84f3db/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.6.0 h1:b9gGHsz9/HhJ3HF5DHQytPpuwocVTChQJK3AvoLRD5I= golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8=
golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M=
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@@ -56,18 +56,18 @@ golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.2.0 h1:G6AHpWxTMGY1KyEYoAQ5WTtIekUUvDNjan3ugu60JvE= golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM=
golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

View File

@@ -15,7 +15,7 @@ include_directories(
${LIBEV_INCLUDE_DIRS} ${LIBEV_INCLUDE_DIRS}
${LIBNGHTTP3_INCLUDE_DIRS} ${LIBNGHTTP3_INCLUDE_DIRS}
${LIBNGTCP2_INCLUDE_DIRS} ${LIBNGTCP2_INCLUDE_DIRS}
${LIBNGTCP2_CRYPTO_OPENSSL_INCLUDE_DIRS} ${LIBNGTCP2_CRYPTO_QUICTLS_INCLUDE_DIRS}
${OPENSSL_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIRS}
${LIBCARES_INCLUDE_DIRS} ${LIBCARES_INCLUDE_DIRS}
${JANSSON_INCLUDE_DIRS} ${JANSSON_INCLUDE_DIRS}
@@ -31,7 +31,7 @@ link_libraries(
${LIBEV_LIBRARIES} ${LIBEV_LIBRARIES}
${LIBNGHTTP3_LIBRARIES} ${LIBNGHTTP3_LIBRARIES}
${LIBNGTCP2_LIBRARIES} ${LIBNGTCP2_LIBRARIES}
${LIBNGTCP2_CRYPTO_OPENSSL_LIBRARIES} ${LIBNGTCP2_CRYPTO_QUICTLS_LIBRARIES}
${OPENSSL_LIBRARIES} ${OPENSSL_LIBRARIES}
${LIBCARES_LIBRARIES} ${LIBCARES_LIBRARIES}
${JANSSON_LIBRARIES} ${JANSSON_LIBRARIES}

View File

@@ -45,7 +45,7 @@ AM_CPPFLAGS = \
@LIBXML2_CFLAGS@ \ @LIBXML2_CFLAGS@ \
@LIBEV_CFLAGS@ \ @LIBEV_CFLAGS@ \
@LIBNGHTTP3_CFLAGS@ \ @LIBNGHTTP3_CFLAGS@ \
@LIBNGTCP2_CRYPTO_OPENSSL_CFLAGS@ \ @LIBNGTCP2_CRYPTO_QUICTLS_CFLAGS@ \
@LIBNGTCP2_CRYPTO_BORINGSSL_CFLAGS@ \ @LIBNGTCP2_CRYPTO_BORINGSSL_CFLAGS@ \
@LIBNGTCP2_CFLAGS@ \ @LIBNGTCP2_CFLAGS@ \
@OPENSSL_CFLAGS@ \ @OPENSSL_CFLAGS@ \
@@ -64,7 +64,7 @@ LDADD = $(top_builddir)/lib/libnghttp2.la \
@LIBXML2_LIBS@ \ @LIBXML2_LIBS@ \
@LIBEV_LIBS@ \ @LIBEV_LIBS@ \
@LIBNGHTTP3_LIBS@ \ @LIBNGHTTP3_LIBS@ \
@LIBNGTCP2_CRYPTO_OPENSSL_LIBS@ \ @LIBNGTCP2_CRYPTO_QUICTLS_LIBS@ \
@LIBNGTCP2_CRYPTO_BORINGSSL_LIBS@ \ @LIBNGTCP2_CRYPTO_BORINGSSL_LIBS@ \
@LIBNGTCP2_LIBS@ \ @LIBNGTCP2_LIBS@ \
@OPENSSL_LIBS@ \ @OPENSSL_LIBS@ \

View File

@@ -51,9 +51,9 @@
#include <openssl/err.h> #include <openssl/err.h>
#ifdef ENABLE_HTTP3 #ifdef ENABLE_HTTP3
# ifdef HAVE_LIBNGTCP2_CRYPTO_OPENSSL # ifdef HAVE_LIBNGTCP2_CRYPTO_QUICTLS
# include <ngtcp2/ngtcp2_crypto_openssl.h> # include <ngtcp2/ngtcp2_crypto_quictls.h>
# endif // HAVE_LIBNGTCP2_CRYPTO_OPENSSL # endif // HAVE_LIBNGTCP2_CRYPTO_QUICTLS
# ifdef HAVE_LIBNGTCP2_CRYPTO_BORINGSSL # ifdef HAVE_LIBNGTCP2_CRYPTO_BORINGSSL
# include <ngtcp2/ngtcp2_crypto_boringssl.h> # include <ngtcp2/ngtcp2_crypto_boringssl.h>
# endif // HAVE_LIBNGTCP2_CRYPTO_BORINGSSL # endif // HAVE_LIBNGTCP2_CRYPTO_BORINGSSL
@@ -541,6 +541,14 @@ int Client::make_socket(addrinfo *addr) {
return -1; return -1;
} }
# ifdef UDP_GRO
int val = 1;
if (setsockopt(fd, IPPROTO_UDP, UDP_GRO, &val, sizeof(val)) != 0) {
std::cerr << "setsockopt UDP_GRO failed" << std::endl;
return -1;
}
# endif // UDP_GRO
rv = util::bind_any_addr_udp(fd, addr->ai_family); rv = util::bind_any_addr_udp(fd, addr->ai_family);
if (rv != 0) { if (rv != 0) {
close(fd); close(fd);
@@ -2919,13 +2927,13 @@ int main(int argc, char **argv) {
if (config.is_quic()) { if (config.is_quic()) {
#ifdef ENABLE_HTTP3 #ifdef ENABLE_HTTP3
# ifdef HAVE_LIBNGTCP2_CRYPTO_OPENSSL # ifdef HAVE_LIBNGTCP2_CRYPTO_QUICTLS
if (ngtcp2_crypto_openssl_configure_client_context(ssl_ctx) != 0) { if (ngtcp2_crypto_quictls_configure_client_context(ssl_ctx) != 0) {
std::cerr << "ngtcp2_crypto_openssl_configure_client_context failed" std::cerr << "ngtcp2_crypto_quictls_configure_client_context failed"
<< std::endl; << std::endl;
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
# endif // HAVE_LIBNGTCP2_CRYPTO_OPENSSL # endif // HAVE_LIBNGTCP2_CRYPTO_QUICTLS
# ifdef HAVE_LIBNGTCP2_CRYPTO_BORINGSSL # ifdef HAVE_LIBNGTCP2_CRYPTO_BORINGSSL
if (ngtcp2_crypto_boringssl_configure_client_context(ssl_ctx) != 0) { if (ngtcp2_crypto_boringssl_configure_client_context(ssl_ctx) != 0) {
std::cerr << "ngtcp2_crypto_boringssl_configure_client_context failed" std::cerr << "ngtcp2_crypto_boringssl_configure_client_context failed"

View File

@@ -28,9 +28,9 @@
#include <iostream> #include <iostream>
#ifdef HAVE_LIBNGTCP2_CRYPTO_OPENSSL #ifdef HAVE_LIBNGTCP2_CRYPTO_QUICTLS
# include <ngtcp2/ngtcp2_crypto_openssl.h> # include <ngtcp2/ngtcp2_crypto_quictls.h>
#endif // HAVE_LIBNGTCP2_CRYPTO_OPENSSL #endif // HAVE_LIBNGTCP2_CRYPTO_QUICTLS
#ifdef HAVE_LIBNGTCP2_CRYPTO_BORINGSSL #ifdef HAVE_LIBNGTCP2_CRYPTO_BORINGSSL
# include <ngtcp2/ngtcp2_crypto_boringssl.h> # include <ngtcp2/ngtcp2_crypto_boringssl.h>
#endif // HAVE_LIBNGTCP2_CRYPTO_BORINGSSL #endif // HAVE_LIBNGTCP2_CRYPTO_BORINGSSL
@@ -538,22 +538,40 @@ void Client::quic_restart_pkt_timer() {
} }
int Client::read_quic() { int Client::read_quic() {
std::array<uint8_t, 65536> buf; std::array<uint8_t, 65535> buf;
sockaddr_union su; sockaddr_union su;
socklen_t addrlen = sizeof(su);
int rv; int rv;
size_t pktcnt = 0; size_t pktcnt = 0;
ngtcp2_pkt_info pi{}; ngtcp2_pkt_info pi{};
iovec msg_iov;
msg_iov.iov_base = buf.data();
msg_iov.iov_len = buf.size();
msghdr msg{};
msg.msg_name = &su;
msg.msg_iov = &msg_iov;
msg.msg_iovlen = 1;
uint8_t msg_ctrl[CMSG_SPACE(sizeof(uint16_t))];
msg.msg_control = msg_ctrl;
auto ts = quic_timestamp(); auto ts = quic_timestamp();
for (;;) { for (;;) {
auto nread = msg.msg_namelen = sizeof(su);
recvfrom(fd, buf.data(), buf.size(), MSG_DONTWAIT, &su.sa, &addrlen); msg.msg_controllen = sizeof(msg_ctrl);
auto nread = recvmsg(fd, &msg, 0);
if (nread == -1) { if (nread == -1) {
return 0; return 0;
} }
auto gso_size = util::msghdr_get_udp_gro(&msg);
if (gso_size == 0) {
gso_size = static_cast<size_t>(nread);
}
assert(quic.conn); assert(quic.conn);
++worker->stats.udp_dgram_recv; ++worker->stats.udp_dgram_recv;
@@ -565,28 +583,41 @@ int Client::read_quic() {
}, },
{ {
&su.sa, &su.sa,
addrlen, msg.msg_namelen,
}, },
}; };
rv = ngtcp2_conn_read_pkt(quic.conn, &path, &pi, buf.data(), nread, ts); auto data = buf.data();
if (rv != 0) {
std::cerr << "ngtcp2_conn_read_pkt: " << ngtcp2_strerror(rv) << std::endl;
if (!quic.last_error.error_code) { for (;;) {
if (rv == NGTCP2_ERR_CRYPTO) { auto datalen = std::min(static_cast<size_t>(nread), gso_size);
ngtcp2_ccerr_set_tls_alert(&quic.last_error,
ngtcp2_conn_get_tls_alert(quic.conn), ++pktcnt;
nullptr, 0);
} else { rv = ngtcp2_conn_read_pkt(quic.conn, &path, &pi, data, datalen, ts);
ngtcp2_ccerr_set_liberr(&quic.last_error, rv, nullptr, 0); if (rv != 0) {
if (!quic.last_error.error_code) {
if (rv == NGTCP2_ERR_CRYPTO) {
ngtcp2_ccerr_set_tls_alert(&quic.last_error,
ngtcp2_conn_get_tls_alert(quic.conn),
nullptr, 0);
} else {
ngtcp2_ccerr_set_liberr(&quic.last_error, rv, nullptr, 0);
}
} }
return -1;
} }
return -1; nread -= datalen;
if (nread == 0) {
break;
}
data += datalen;
} }
if (++pktcnt == 100) { if (pktcnt >= 100) {
break; break;
} }
} }

View File

@@ -638,6 +638,8 @@ int Http3Upstream::init(const UpstreamAddr *faddr, const Address &remote_addr,
settings.rand_ctx.native_handle = &worker->get_randgen(); settings.rand_ctx.native_handle = &worker->get_randgen();
settings.token = token; settings.token = token;
settings.tokenlen = tokenlen; settings.tokenlen = tokenlen;
settings.initial_pkt_num = std::uniform_int_distribution<uint32_t>(
0, std::numeric_limits<int32_t>::max())(worker->get_randgen());
ngtcp2_transport_params params; ngtcp2_transport_params params;
ngtcp2_transport_params_default(&params); ngtcp2_transport_params_default(&params);
@@ -1498,7 +1500,7 @@ void Http3Upstream::on_handler_delete() {
auto worker = handler_->get_worker(); auto worker = handler_->get_worker();
auto quic_conn_handler = worker->get_quic_connection_handler(); auto quic_conn_handler = worker->get_quic_connection_handler();
std::vector<ngtcp2_cid> scids(ngtcp2_conn_get_num_scid(conn_) + 1); std::vector<ngtcp2_cid> scids(ngtcp2_conn_get_scid(conn_, nullptr) + 1);
ngtcp2_conn_get_scid(conn_, scids.data()); ngtcp2_conn_get_scid(conn_, scids.data());
scids.back() = hashed_scid_; scids.back() = hashed_scid_;

View File

@@ -59,8 +59,9 @@ void QUICListener::on_read() {
msg.msg_iov = &msg_iov; msg.msg_iov = &msg_iov;
msg.msg_iovlen = 1; msg.msg_iovlen = 1;
uint8_t uint8_t msg_ctrl[CMSG_SPACE(sizeof(uint8_t)) +
msg_ctrl[CMSG_SPACE(sizeof(uint8_t)) + CMSG_SPACE(sizeof(in6_pktinfo))]; CMSG_SPACE(sizeof(in6_pktinfo)) +
CMSG_SPACE(sizeof(uint16_t))];
msg.msg_control = msg_ctrl; msg.msg_control = msg_ctrl;
auto quic_conn_handler = worker_->get_quic_connection_handler(); auto quic_conn_handler = worker_->get_quic_connection_handler();
@@ -74,11 +75,11 @@ void QUICListener::on_read() {
return; return;
} }
++pktcnt;
Address local_addr{}; Address local_addr{};
if (util::msghdr_get_local_addr(local_addr, &msg, su.storage.ss_family) != if (util::msghdr_get_local_addr(local_addr, &msg, su.storage.ss_family) !=
0) { 0) {
++pktcnt;
continue; continue;
} }
@@ -88,24 +89,44 @@ void QUICListener::on_read() {
.ecn = util::msghdr_get_ecn(&msg, su.storage.ss_family), .ecn = util::msghdr_get_ecn(&msg, su.storage.ss_family),
}; };
if (LOG_ENABLED(INFO)) { auto gso_size = util::msghdr_get_udp_gro(&msg);
LOG(INFO) << "QUIC received packet: local=" if (gso_size == 0) {
<< util::to_numeric_addr(&local_addr) gso_size = static_cast<size_t>(nread);
<< " remote=" << util::to_numeric_addr(&su.sa, msg.msg_namelen)
<< " ecn=" << log::hex << pi.ecn << log::dec << " " << nread
<< " bytes";
} }
if (nread == 0) { auto data = buf.data();
continue;
for (;;) {
auto datalen = std::min(static_cast<size_t>(nread), gso_size);
++pktcnt;
if (LOG_ENABLED(INFO)) {
LOG(INFO) << "QUIC received packet: local="
<< util::to_numeric_addr(&local_addr) << " remote="
<< util::to_numeric_addr(&su.sa, msg.msg_namelen)
<< " ecn=" << log::hex << pi.ecn << log::dec << " " << datalen
<< " bytes";
}
if (datalen == 0) {
break;
}
Address remote_addr;
remote_addr.su = su;
remote_addr.len = msg.msg_namelen;
quic_conn_handler->handle_packet(faddr_, remote_addr, local_addr, pi,
data, datalen);
nread -= datalen;
if (nread == 0) {
break;
}
data += datalen;
} }
Address remote_addr;
remote_addr.su = su;
remote_addr.len = msg.msg_namelen;
quic_conn_handler->handle_packet(faddr_, remote_addr, local_addr, pi,
buf.data(), nread);
} }
} }

View File

@@ -64,9 +64,9 @@
#ifdef ENABLE_HTTP3 #ifdef ENABLE_HTTP3
# include <ngtcp2/ngtcp2.h> # include <ngtcp2/ngtcp2.h>
# include <ngtcp2/ngtcp2_crypto.h> # include <ngtcp2/ngtcp2_crypto.h>
# ifdef HAVE_LIBNGTCP2_CRYPTO_OPENSSL # ifdef HAVE_LIBNGTCP2_CRYPTO_QUICTLS
# include <ngtcp2/ngtcp2_crypto_openssl.h> # include <ngtcp2/ngtcp2_crypto_quictls.h>
# endif // HAVE_LIBNGTCP2_CRYPTO_OPENSSL # endif // HAVE_LIBNGTCP2_CRYPTO_QUICTLS
# ifdef HAVE_LIBNGTCP2_CRYPTO_BORINGSSL # ifdef HAVE_LIBNGTCP2_CRYPTO_BORINGSSL
# include <ngtcp2/ngtcp2_crypto_boringssl.h> # include <ngtcp2/ngtcp2_crypto_boringssl.h>
# endif // HAVE_LIBNGTCP2_CRYPTO_BORINGSSL # endif // HAVE_LIBNGTCP2_CRYPTO_BORINGSSL
@@ -1258,12 +1258,12 @@ SSL_CTX *create_quic_ssl_context(const char *private_key_file,
SSL_CTX_set_options(ssl_ctx, ssl_opts); SSL_CTX_set_options(ssl_ctx, ssl_opts);
# ifdef HAVE_LIBNGTCP2_CRYPTO_OPENSSL # ifdef HAVE_LIBNGTCP2_CRYPTO_QUICTLS
if (ngtcp2_crypto_openssl_configure_server_context(ssl_ctx) != 0) { if (ngtcp2_crypto_quictls_configure_server_context(ssl_ctx) != 0) {
LOG(FATAL) << "ngtcp2_crypto_openssl_configure_server_context failed"; LOG(FATAL) << "ngtcp2_crypto_quictls_configure_server_context failed";
DIE(); DIE();
} }
# endif // HAVE_LIBNGTCP2_CRYPTO_OPENSSL # endif // HAVE_LIBNGTCP2_CRYPTO_QUICTLS
# ifdef HAVE_LIBNGTCP2_CRYPTO_BORINGSSL # ifdef HAVE_LIBNGTCP2_CRYPTO_BORINGSSL
if (ngtcp2_crypto_boringssl_configure_server_context(ssl_ctx) != 0) { if (ngtcp2_crypto_boringssl_configure_server_context(ssl_ctx) != 0) {
LOG(FATAL) << "ngtcp2_crypto_boringssl_configure_server_context failed"; LOG(FATAL) << "ngtcp2_crypto_boringssl_configure_server_context failed";

View File

@@ -27,6 +27,7 @@
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
# include <unistd.h> # include <unistd.h>
#endif // HAVE_UNISTD_H #endif // HAVE_UNISTD_H
#include <netinet/udp.h>
#include <cstdio> #include <cstdio>
#include <memory> #include <memory>
@@ -892,6 +893,16 @@ int Worker::create_quic_server_socket(UpstreamAddr &faddr) {
# endif // defined(IP_MTU_DISCOVER) && defined(IP_PMTUDISC_DO) # endif // defined(IP_MTU_DISCOVER) && defined(IP_PMTUDISC_DO)
} }
# ifdef UDP_GRO
if (setsockopt(fd, IPPROTO_UDP, UDP_GRO, &val, sizeof(val)) == -1) {
auto error = errno;
LOG(WARN) << "Failed to set UDP_GRO option to listener socket: "
<< xsi_strerror(error, errbuf.data(), errbuf.size());
close(fd);
continue;
}
# endif // UDP_GRO
if (bind(fd, rp->ai_addr, rp->ai_addrlen) == -1) { if (bind(fd, rp->ai_addr, rp->ai_addrlen) == -1) {
auto error = errno; auto error = errno;
LOG(WARN) << "bind() syscall failed: " LOG(WARN) << "bind() syscall failed: "

View File

@@ -41,6 +41,7 @@
#ifdef HAVE_NETINET_IN_H #ifdef HAVE_NETINET_IN_H
# include <netinet/in.h> # include <netinet/in.h>
#endif // HAVE_NETINET_IN_H #endif // HAVE_NETINET_IN_H
#include <netinet/udp.h>
#ifdef _WIN32 #ifdef _WIN32
# include <ws2tcpip.h> # include <ws2tcpip.h>
#else // !_WIN32 #else // !_WIN32
@@ -1733,6 +1734,22 @@ unsigned int msghdr_get_ecn(msghdr *msg, int family) {
return 0; return 0;
} }
size_t msghdr_get_udp_gro(msghdr *msg) {
uint16_t gso_size = 0;
# ifdef UDP_GRO
for (auto cmsg = CMSG_FIRSTHDR(msg); cmsg; cmsg = CMSG_NXTHDR(msg, cmsg)) {
if (cmsg->cmsg_level == SOL_UDP && cmsg->cmsg_type == UDP_GRO) {
memcpy(&gso_size, CMSG_DATA(cmsg), sizeof(gso_size));
break;
}
}
# endif // UDP_GRO
return gso_size;
}
int fd_set_send_ecn(int fd, int family, unsigned int ecn) { int fd_set_send_ecn(int fd, int family, unsigned int ecn) {
switch (family) { switch (family) {
case AF_INET: case AF_INET:

View File

@@ -47,7 +47,9 @@
#include <map> #include <map>
#include <random> #include <random>
#include <ev.h> #ifdef HAVE_LIBEV
# include <ev.h>
#endif // HAVE_LIBEV
#include "url-parser/url_parser.h" #include "url-parser/url_parser.h"
@@ -697,6 +699,7 @@ template <typename Clock, typename Rep> Rep clock_precision() {
return duration.count(); return duration.count();
} }
#ifdef HAVE_LIBEV
template <typename Duration = std::chrono::steady_clock::duration> template <typename Duration = std::chrono::steady_clock::duration>
Duration duration_from(ev_tstamp d) { Duration duration_from(ev_tstamp d) {
return std::chrono::duration_cast<Duration>(std::chrono::duration<double>(d)); return std::chrono::duration_cast<Duration>(std::chrono::duration<double>(d));
@@ -705,6 +708,7 @@ Duration duration_from(ev_tstamp d) {
template <typename Duration> ev_tstamp ev_tstamp_from(const Duration &d) { template <typename Duration> ev_tstamp ev_tstamp_from(const Duration &d) {
return std::chrono::duration<double>(d).count(); return std::chrono::duration<double>(d).count();
} }
#endif // HAVE_LIBEV
int make_socket_closeonexec(int fd); int make_socket_closeonexec(int fd);
int make_socket_nonblocking(int fd); int make_socket_nonblocking(int fd);
@@ -955,6 +959,10 @@ int msghdr_get_local_addr(Address &dest, msghdr *msg, int family);
unsigned int msghdr_get_ecn(msghdr *msg, int family); unsigned int msghdr_get_ecn(msghdr *msg, int family);
// msghdr_get_udp_gro returns UDP_GRO value from |msg|. If UDP_GRO is
// not found, or UDP_GRO is not supported, this function returns 0.
size_t msghdr_get_udp_gro(msghdr *msg);
int fd_set_send_ecn(int fd, int family, unsigned int ecn); int fd_set_send_ecn(int fd, int family, unsigned int ecn);
#endif // ENABLE_HTTP3 #endif // ENABLE_HTTP3

View File

@@ -58,7 +58,7 @@ if(ENABLE_THIRD_PARTY)
"MRUBY_CONFIG=${CMAKE_CURRENT_SOURCE_DIR}/build_config.rb" "MRUBY_CONFIG=${CMAKE_CURRENT_SOURCE_DIR}/build_config.rb"
"BUILD_DIR=${MRUBY_BUILD_DIR}" "BUILD_DIR=${MRUBY_BUILD_DIR}"
"INSTALL_DIR=${MRUBY_BUILD_DIR}/install/bin" "INSTALL_DIR=${MRUBY_BUILD_DIR}/install/bin"
"CC=${CMAKE_C_COMPILER}" "CXX=${CMAKE_CXX_COMPILER}" "MRUBY_CC=${CMAKE_C_COMPILER}" "MRUBY_CXX=${CMAKE_CXX_COMPILER}"
"${CMAKE_CURRENT_SOURCE_DIR}/mruby/minirake" "${CMAKE_CURRENT_SOURCE_DIR}/mruby/minirake"
-f "${CMAKE_CURRENT_SOURCE_DIR}/mruby/Rakefile" -f "${CMAKE_CURRENT_SOURCE_DIR}/mruby/Rakefile"
${_byproducts} ${_byproducts}

View File

@@ -574,10 +574,9 @@ mruby:
MRUBY_CONFIG="${abs_builddir}/mruby/build/build_config.rb" \ MRUBY_CONFIG="${abs_builddir}/mruby/build/build_config.rb" \
BUILD_DIR="${abs_builddir}/mruby/build" \ BUILD_DIR="${abs_builddir}/mruby/build" \
INSTALL_DIR="${abs_builddir}/mruby/build/install/bin" \ INSTALL_DIR="${abs_builddir}/mruby/build/install/bin" \
CC="${CC}" CXX="$(firstword $(CXX))" LD="${LD}" \ MRUBY_CC="${CC}" MRUBY_CXX="$(firstword $(CXX))" MRUBY_LD="${LD}" \
CFLAGS="${CPPFLAGS} ${CFLAGS}" \ MRUBY_AR="${AR}" \
CXXFLAGS="$(wordlist 2, $(words $(CXX)), $(CXX)) ${CPPFLAGS} ${CXXFLAGS}" \ HOST="${host}" BUILD="${build}" \
LDFLAGS="${LDFLAGS}" \
"${srcdir}/mruby/minirake" -f "${srcdir}/mruby/Rakefile" "${srcdir}/mruby/minirake" -f "${srcdir}/mruby/Rakefile"
all-local: mruby all-local: mruby
@@ -586,7 +585,7 @@ clean-local:
[ ! -f "${abs_builddir}/mruby/build/build_config.rb" ] || \ [ ! -f "${abs_builddir}/mruby/build/build_config.rb" ] || \
MRUBY_CONFIG="${abs_builddir}/mruby/build/build_config.rb" \ MRUBY_CONFIG="${abs_builddir}/mruby/build/build_config.rb" \
BUILD_DIR="${abs_builddir}/mruby/build" \ BUILD_DIR="${abs_builddir}/mruby/build" \
CC="${CC}" \ MRUBY_CC="${CC}" \
"${srcdir}/mruby/minirake" -f "${srcdir}/mruby/Rakefile" clean "${srcdir}/mruby/minirake" -f "${srcdir}/mruby/Rakefile" clean
endif # HAVE_MRUBY endif # HAVE_MRUBY

View File

@@ -1,6 +1,16 @@
MRuby::Build.new do |conf| def config(conf)
toolchain :clang if ENV['CC'].include? "clang" toolchain :clang if ENV['MRUBY_CC'].include? "clang"
toolchain :gcc if ENV['CC'].include? "gcc" toolchain :gcc if ENV['MRUBY_CC'].include? "gcc"
conf.cc.command = ENV['MRUBY_CC']
conf.cxx.command = ENV['MRUBY_CXX']
if ENV['MRUBY_LD']
conf.linker.command = ENV['MRUBY_LD']
end
if ENV['MRUBY_AR']
conf.archiver.command = ENV['MRUBY_AR']
end
# C++ project needs this. Without this, mruby exception does not # C++ project needs this. Without this, mruby exception does not
# properly destroy C++ object allocated on stack. # properly destroy C++ object allocated on stack.
@@ -12,3 +22,13 @@ MRuby::Build.new do |conf|
conf.gembox 'default' conf.gembox 'default'
conf.gem :core => 'mruby-eval' conf.gem :core => 'mruby-eval'
end end
if ENV['BUILD'] == ENV['HOST'] then
MRuby::Build.new do |conf|
config(conf)
end
else
MRuby::CrossBuild.new(ENV['HOST']) do |conf|
config(conf)
end
end

View File

@@ -61,33 +61,41 @@ checks could be performed to get even stricter verification of the llhttp.
## Usage ## Usage
```C ```C
#include "stdio.h"
#include "llhttp.h" #include "llhttp.h"
#include "string.h"
llhttp_t parser; int handle_on_message_complete(llhttp_t* parser) {
llhttp_settings_t settings; fprintf(stdout, "Message completed!\n");
return 0;
}
/* Initialize user callbacks and settings */ int main() {
llhttp_settings_init(&settings); llhttp_t parser;
llhttp_settings_t settings;
/* Set user callback */ /*Initialize user callbacks and settings */
settings.on_message_complete = handle_on_message_complete; llhttp_settings_init(&settings);
/* Initialize the parser in HTTP_BOTH mode, meaning that it will select between /*Set user callback */
* HTTP_REQUEST and HTTP_RESPONSE parsing automatically while reading the first settings.on_message_complete = handle_on_message_complete;
* input.
*/
llhttp_init(&parser, HTTP_BOTH, &settings);
/* Parse request! */ /*Initialize the parser in HTTP_BOTH mode, meaning that it will select between
const char* request = "GET / HTTP/1.1\r\n\r\n"; *HTTP_REQUEST and HTTP_RESPONSE parsing automatically while reading the first
int request_len = strlen(request); *input.
*/
llhttp_init(&parser, HTTP_BOTH, &settings);
enum llhttp_errno err = llhttp_execute(&parser, request, request_len); /*Parse request! */
if (err == HPE_OK) { const char* request = "GET / HTTP/1.1\r\n\r\n";
/* Successfully parsed! */ int request_len = strlen(request);
} else {
fprintf(stderr, "Parse error: %s %s\n", llhttp_errno_name(err), enum llhttp_errno err = llhttp_execute(&parser, request, request_len);
parser.reason); if (err == HPE_OK) {
fprintf(stdout, "Successfully parsed!\n");
} else {
fprintf(stderr, "Parse error: %s %s\n", llhttp_errno_name(err), parser.reason);
}
} }
``` ```
For more information on API usage, please refer to [src/native/api.h](https://github.com/nodejs/llhttp/blob/main/src/native/api.h). For more information on API usage, please refer to [src/native/api.h](https://github.com/nodejs/llhttp/blob/main/src/native/api.h).
@@ -345,17 +353,34 @@ make
### Using with CMake ### Using with CMake
If you want to use this library in a CMake project you can use the snippet below. If you want to use this library in a CMake project as a shared library, you can use the snippet below.
``` ```
FetchContent_Declare(llhttp FetchContent_Declare(llhttp
URL "https://github.com/nodejs/llhttp/archive/refs/tags/v6.0.5.tar.gz") # Using version 6.0.5 URL "https://github.com/nodejs/llhttp/archive/refs/tags/release/v8.1.0.tar.gz")
FetchContent_MakeAvailable(llhttp) FetchContent_MakeAvailable(llhttp)
target_link_libraries(${EXAMPLE_PROJECT_NAME} ${PROJECT_LIBRARIES} llhttp ${PROJECT_NAME}) # Link with the llhttp_shared target
target_link_libraries(${EXAMPLE_PROJECT_NAME} ${PROJECT_LIBRARIES} llhttp_shared ${PROJECT_NAME})
``` ```
If you want to use this library in a CMake project as a static library, you can set some cache variables first.
```
FetchContent_Declare(llhttp
URL "https://github.com/nodejs/llhttp/archive/refs/tags/release/v8.1.0.tar.gz")
set(BUILD_SHARED_LIBS OFF CACHE INTERNAL "")
set(BUILD_STATIC_LIBS ON CACHE INTERNAL "")
FetchContent_MakeAvailable(llhttp)
# Link with the llhttp_static target
target_link_libraries(${EXAMPLE_PROJECT_NAME} ${PROJECT_LIBRARIES} llhttp_static ${PROJECT_NAME})
```
_Note that using the git repo directly (e.g., via a git repo url and tag) will not work with FetchContent_Declare because [CMakeLists.txt](./CMakeLists.txt) requires string replacements (e.g., `_RELEASE_`) before it will build._
## Building on Windows ## Building on Windows
### Installation ### Installation

View File

@@ -3,7 +3,7 @@
#define LLHTTP_VERSION_MAJOR 8 #define LLHTTP_VERSION_MAJOR 8
#define LLHTTP_VERSION_MINOR 1 #define LLHTTP_VERSION_MINOR 1
#define LLHTTP_VERSION_PATCH 0 #define LLHTTP_VERSION_PATCH 1
#ifndef LLHTTP_STRICT_MODE #ifndef LLHTTP_STRICT_MODE
# define LLHTTP_STRICT_MODE 0 # define LLHTTP_STRICT_MODE 0

View File

@@ -1,4 +1,11 @@
{ {
'variables': {
'llhttp_sources': [
'src/llhttp.c',
'src/api.c',
'src/http.c',
]
},
'targets': [ 'targets': [
{ {
'target_name': 'llhttp', 'target_name': 'llhttp',
@@ -7,7 +14,9 @@
'direct_dependent_settings': { 'direct_dependent_settings': {
'include_dirs': [ 'include' ], 'include_dirs': [ 'include' ],
}, },
'sources': [ 'src/llhttp.c', 'src/api.c', 'src/http.c' ], 'sources': [
'<@(llhttp_sources)',
],
}, },
] ]
} }

File diff suppressed because it is too large Load Diff