mirror of
https://github.com/nghttp2/nghttp2.git
synced 2025-12-07 02:28:53 +08:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d8e908286d | ||
|
|
915e26b33d | ||
|
|
5ab05402e4 | ||
|
|
0af9629cc1 | ||
|
|
53989dc70c | ||
|
|
290a697bf9 | ||
|
|
b63c88aab7 | ||
|
|
73e513601f |
@@ -1,95 +1,57 @@
|
||||
---
|
||||
Language: Cpp
|
||||
# BasedOnStyle: LLVM
|
||||
AccessModifierOffset: -2
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignConsecutiveAssignments: false
|
||||
AlignConsecutiveDeclarations: false
|
||||
ConstructorInitializerIndentWidth: 4
|
||||
AlignEscapedNewlinesLeft: false
|
||||
AlignOperands: true
|
||||
AlignTrailingComments: true
|
||||
AllowAllParametersOfDeclarationOnNextLine: true
|
||||
AllowShortBlocksOnASingleLine: false
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: All
|
||||
AllowShortIfStatementsOnASingleLine: false
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AlwaysBreakAfterDefinitionReturnType: None
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: false
|
||||
AllowShortFunctionsOnASingleLine: All
|
||||
AlwaysBreakTemplateDeclarations: false
|
||||
BinPackArguments: true
|
||||
BinPackParameters: true
|
||||
BraceWrapping:
|
||||
AfterClass: false
|
||||
AfterControlStatement: false
|
||||
AfterEnum: false
|
||||
AfterFunction: false
|
||||
AfterNamespace: false
|
||||
AfterObjCDeclaration: false
|
||||
AfterStruct: false
|
||||
AfterUnion: false
|
||||
BeforeCatch: false
|
||||
BeforeElse: false
|
||||
IndentBraces: false
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeBraces: Attach
|
||||
AlwaysBreakBeforeMultilineStrings: false
|
||||
BreakBeforeBinaryOperators: false
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializersBeforeComma: false
|
||||
BreakAfterJavaFieldAnnotations: false
|
||||
BreakStringLiterals: true
|
||||
BinPackParameters: true
|
||||
ColumnLimit: 80
|
||||
CommentPragmas: '^ IWYU pragma:'
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
||||
ConstructorInitializerIndentWidth: 4
|
||||
ContinuationIndentWidth: 4
|
||||
Cpp11BracedListStyle: true
|
||||
DerivePointerAlignment: false
|
||||
DisableFormat: false
|
||||
ExperimentalAutoDetectBinPacking: false
|
||||
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
|
||||
IncludeCategories:
|
||||
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
|
||||
Priority: 2
|
||||
- Regex: '^(<|"(gtest|isl|json)/)'
|
||||
Priority: 3
|
||||
- Regex: '.*'
|
||||
Priority: 1
|
||||
IncludeIsMainRegex: '$'
|
||||
IndentCaseLabels: false
|
||||
IndentWidth: 2
|
||||
IndentWrappedFunctionNames: false
|
||||
JavaScriptQuotes: Leave
|
||||
JavaScriptWrapImports: true
|
||||
KeepEmptyLinesAtTheStartOfBlocks: true
|
||||
MacroBlockBegin: ''
|
||||
MacroBlockEnd: ''
|
||||
IndentFunctionDeclarationAfterType: false
|
||||
MaxEmptyLinesToKeep: 1
|
||||
KeepEmptyLinesAtTheStartOfBlocks: true
|
||||
NamespaceIndentation: None
|
||||
ObjCBlockIndentWidth: 2
|
||||
ObjCSpaceAfterProperty: false
|
||||
ObjCSpaceBeforeProtocolList: true
|
||||
PenaltyBreakBeforeFirstCallParameter: 19
|
||||
PenaltyBreakComment: 300
|
||||
PenaltyBreakFirstLessLess: 120
|
||||
PenaltyBreakString: 1000
|
||||
PenaltyBreakFirstLessLess: 120
|
||||
PenaltyExcessCharacter: 1000000
|
||||
PenaltyReturnTypeOnItsOwnLine: 60
|
||||
PointerAlignment: Right
|
||||
ReflowComments: true
|
||||
SortIncludes: false
|
||||
SpaceAfterCStyleCast: false
|
||||
SpaceAfterTemplateKeyword: true
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesBeforeTrailingComments: 1
|
||||
SpacesInAngles: false
|
||||
SpacesInContainerLiterals: true
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
Cpp11BracedListStyle: true
|
||||
Standard: Cpp11
|
||||
IndentWidth: 2
|
||||
TabWidth: 8
|
||||
UseTab: Never
|
||||
BreakBeforeBraces: Attach
|
||||
SpacesInParentheses: false
|
||||
SpacesInAngles: false
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInContainerLiterals: true
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
ContinuationIndentWidth: 4
|
||||
CommentPragmas: '^ IWYU pragma:'
|
||||
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
|
||||
SpaceBeforeParens: ControlStatements
|
||||
DisableFormat: false
|
||||
...
|
||||
|
||||
|
||||
18
.travis.yml
18
.travis.yml
@@ -28,7 +28,6 @@ addons:
|
||||
- libevent-dev
|
||||
- libjansson-dev
|
||||
- libjemalloc-dev
|
||||
- libc-ares-dev
|
||||
- cmake
|
||||
- cmake-data
|
||||
before_install:
|
||||
@@ -44,7 +43,6 @@ before_script:
|
||||
- git clone https://github.com/tatsuhiro-t/spdylay.git
|
||||
- cd spdylay
|
||||
- autoreconf -i
|
||||
# Don't use ASAN for spdylay since failmalloc does not work with it.
|
||||
- ./configure --disable-src --disable-examples
|
||||
- make check
|
||||
- export SPDYLAY_HOME=$PWD
|
||||
@@ -52,14 +50,12 @@ before_script:
|
||||
# Now build nghttp2
|
||||
- if [ "$CI_BUILD" = "autotools" ]; then autoreconf -i; fi
|
||||
- git submodule update --init
|
||||
- if [ "$CI_BUILD" = "autotools" ]; then ./configure --enable-werror --with-mruby --with-neverbleed LIBSPDYLAY_CFLAGS="-I$SPDYLAY_HOME/lib/includes" LIBSPDYLAY_LIBS="-L$SPDYLAY_HOME/lib/.libs -lspdylay" CPPFLAGS=-fsanitize=address LDFLAGS=-fsanitize=address; fi
|
||||
- if [ "$CI_BUILD" = "autotools" ]; then ./configure --enable-werror --with-mruby --with-neverbleed LIBSPDYLAY_CFLAGS="-I$SPDYLAY_HOME/lib/includes" LIBSPDYLAY_LIBS="-L$SPDYLAY_HOME/lib/.libs -lspdylay"; fi
|
||||
- if [ "$CI_BUILD" = "cmake" ]; then cmake -DENABLE_WERROR=1 -DWITH_MRUBY=1 -DWITH_NEVERBLEED=1 -DSPDYLAY_INCLUDE_DIR="$SPDYLAY_HOME/lib/includes" -DSPDYLAY_LIBRARY="$SPDYLAY_HOME/lib/.libs/libspdylay.so"; fi
|
||||
script:
|
||||
- if [ "$CI_BUILD" = "autotools" ]; then make distcheck; fi
|
||||
- if [ "$CI_BUILD" = "cmake" ]; then make check; fi
|
||||
# As of April, 23, 2016, golang http2 build fails, probably because
|
||||
# the default go version is too old.
|
||||
# - cd integration-tests
|
||||
# - export GOPATH="$PWD/integration-tests/golang"
|
||||
# - make itprep
|
||||
# - make it
|
||||
- make
|
||||
- make check
|
||||
- cd integration-tests
|
||||
- export GOPATH="$PWD/integration-tests/golang"
|
||||
- make itprep
|
||||
- make it
|
||||
|
||||
19
AUTHORS
19
AUTHORS
@@ -17,18 +17,12 @@ github issues [2].
|
||||
Alek Storm
|
||||
Alex Nalivko
|
||||
Alexis La Goutte
|
||||
Amir Pakdel
|
||||
Anders Bakken
|
||||
Andreas Pohl
|
||||
Andy Davies
|
||||
Angus Gratton
|
||||
Ant Bryan
|
||||
Benedikt Christoph Wolters
|
||||
Benedikt Christoph Wolters
|
||||
Bernard Spil
|
||||
Bernard Spil
|
||||
Brian Card
|
||||
Brian Suh
|
||||
Daniel Stenberg
|
||||
Dave Reisner
|
||||
David Beitey
|
||||
@@ -37,8 +31,6 @@ Etienne Cimon
|
||||
Fabian Möller
|
||||
Fabian Wiesel
|
||||
Gabi Davar
|
||||
Google Inc.
|
||||
Jacob Champion
|
||||
Jan-E
|
||||
Janusz Dziemidowicz
|
||||
Jay Satiro
|
||||
@@ -53,9 +45,6 @@ Kit Chan
|
||||
Kyle Schomp
|
||||
Lucas Pardue
|
||||
MATSUMOTO Ryosuke
|
||||
Matt Rudary
|
||||
Matt Way
|
||||
Mike Conlen
|
||||
Mike Frysinger
|
||||
Nicholas Hurley
|
||||
Nora Shoemaker
|
||||
@@ -67,34 +56,26 @@ Remo E
|
||||
Reza Tavakoli
|
||||
Ross Smith II
|
||||
Scott Mitchell
|
||||
Soham Sinha
|
||||
Stefan Eissing
|
||||
Stephen Ludin
|
||||
Sunpoet Po-Chuan Hsieh
|
||||
Svante Signell
|
||||
Syohei YOSHIDA
|
||||
Tapanito
|
||||
Tatsuhiko Kubo
|
||||
Tatsuhiro Tsujikawa
|
||||
Tom Harwood
|
||||
Tomasz Buchert
|
||||
Tomasz Torcz
|
||||
Vernon Tang
|
||||
Viacheslav Biriukov
|
||||
Viktor Szépe
|
||||
Wenfeng Liu
|
||||
Xiaoguang Sun
|
||||
Zhuoyun Wei
|
||||
acesso
|
||||
ayanamist
|
||||
bxshi
|
||||
clemahieu
|
||||
dalf
|
||||
es
|
||||
fangdingjun
|
||||
kumagi
|
||||
lstefani
|
||||
makovich
|
||||
mod-h2-dev
|
||||
moparisthebest
|
||||
snnn
|
||||
|
||||
@@ -24,15 +24,15 @@
|
||||
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
# XXX using 1.8.90 instead of 1.9.0-DEV
|
||||
project(nghttp2 VERSION 1.23.1)
|
||||
project(nghttp2 VERSION 1.9.2)
|
||||
|
||||
# See versioning rule:
|
||||
# http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
|
||||
set(LT_CURRENT 27)
|
||||
set(LT_REVISION 3)
|
||||
set(LT_AGE 13)
|
||||
set(LT_CURRENT 20)
|
||||
set(LT_REVISION 0)
|
||||
set(LT_AGE 6)
|
||||
|
||||
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
|
||||
include(Version)
|
||||
|
||||
math(EXPR LT_SOVERSION "${LT_CURRENT} - ${LT_AGE}")
|
||||
@@ -59,7 +59,6 @@ find_package(PythonInterp)
|
||||
# Auto-detection of features that can be toggled
|
||||
find_package(OpenSSL 1.0.1)
|
||||
find_package(Libev 4.11)
|
||||
find_package(Libcares 1.7.5)
|
||||
find_package(ZLIB 1.2.3)
|
||||
if(OPENSSL_FOUND AND LIBEV_FOUND AND ZLIB_FOUND)
|
||||
set(ENABLE_APP_DEFAULT ON)
|
||||
@@ -110,9 +109,19 @@ foreach(_build_type "Release" "MinSizeRel" "RelWithDebInfo")
|
||||
endforeach()
|
||||
endforeach()
|
||||
|
||||
#
|
||||
# If we're running GCC or clang define _U_ to be "__attribute__((unused))"
|
||||
# so we can use _U_ to flag unused function parameters and not get warnings
|
||||
# about them. Otherwise, define _U_ to be an empty string so that _U_ used
|
||||
# to flag an unused function parameters will compile with other compilers.
|
||||
#
|
||||
# XXX - similar hints for other compilers?
|
||||
#
|
||||
if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
set(HINT_UNUSED_PARAM "__attribute__((unused))")
|
||||
set(HINT_NORETURN "__attribute__((noreturn))")
|
||||
else()
|
||||
set(HINT_UNUSED_PARAM)
|
||||
set(HINT_NORETURN)
|
||||
endif()
|
||||
|
||||
@@ -198,14 +207,6 @@ if(LIBEVENT_FOUND)
|
||||
# Must both link the core and openssl libraries.
|
||||
set(LIBEVENT_OPENSSL_LIBRARIES ${LIBEVENT_LIBRARIES})
|
||||
endif()
|
||||
# libc-ares (for src)
|
||||
set(HAVE_LIBCARES ${LIBCARES_FOUND})
|
||||
if(LIBCARES_FOUND)
|
||||
set(LIBCARES_INCLUDE_DIRS ${LIBCARES_INCLUDE_DIR})
|
||||
else()
|
||||
set(LIBCARES_INCLUDE_DIRS "")
|
||||
set(LIBCARES_LIBRARIES "")
|
||||
endif()
|
||||
# jansson (for src/nghttp, src/deflatehd and src/inflatehd)
|
||||
set(HAVE_JANSSON ${JANSSON_FOUND})
|
||||
# libxml2 (for src/nghttp)
|
||||
@@ -303,6 +304,7 @@ include(CheckFunctionExists)
|
||||
check_function_exists(_Exit HAVE__EXIT)
|
||||
check_function_exists(accept4 HAVE_ACCEPT4)
|
||||
|
||||
# timerfd_create was added in linux kernel 2.6.25
|
||||
include(CheckSymbolExists)
|
||||
# XXX does this correctly detect initgroups (un)availability on cygwin?
|
||||
check_symbol_exists(initgroups grp.h HAVE_DECL_INITGROUPS)
|
||||
@@ -314,6 +316,13 @@ if(NOT HAVE_DECL_INITGROUPS AND HAVE_UNISTD_H)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
check_function_exists(timerfd_create HAVE_TIMERFD_CREATE)
|
||||
# Checks for epoll availability, primarily for examples/tiny-nghttpd
|
||||
check_symbol_exists(epoll_create sys/epoll.h HAVE_EPOLL)
|
||||
if(HAVE_EPOLL AND HAVE_TIMERFD_CREATE)
|
||||
set(ENABLE_TINY_NGHTTPD 1)
|
||||
endif()
|
||||
|
||||
set(WARNCFLAGS)
|
||||
set(WARNCXXFLAGS)
|
||||
if(CMAKE_C_COMPILER_ID MATCHES "MSVC")
|
||||
@@ -399,10 +408,10 @@ configure_file(cmakeconfig.h.in config.h)
|
||||
# autotools-compatible names
|
||||
# Sphinx expects relative paths in the .rst files. Use the fact that the files
|
||||
# below are all one directory level deep.
|
||||
file(RELATIVE_PATH top_srcdir "${CMAKE_CURRENT_BINARY_DIR}/dir" "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
file(RELATIVE_PATH top_builddir "${CMAKE_CURRENT_BINARY_DIR}/dir" "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
set(abs_top_srcdir "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
set(abs_top_builddir "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
file(RELATIVE_PATH top_srcdir "${CMAKE_BINARY_DIR}/dir" "${CMAKE_SOURCE_DIR}")
|
||||
file(RELATIVE_PATH top_builddir "${CMAKE_BINARY_DIR}/dir" "${CMAKE_BINARY_DIR}")
|
||||
set(abs_top_srcdir "${CMAKE_SOURCE_DIR}")
|
||||
set(abs_top_builddir "${CMAKE_BINARY_DIR}")
|
||||
# libnghttp2.pc (pkg-config file)
|
||||
set(prefix "${CMAKE_INSTALL_PREFIX}")
|
||||
set(exec_prefix "${CMAKE_INSTALL_PREFIX}")
|
||||
@@ -441,7 +450,7 @@ foreach(name
|
||||
endforeach()
|
||||
|
||||
include_directories(
|
||||
"${CMAKE_CURRENT_BINARY_DIR}" # for config.h
|
||||
"${CMAKE_BINARY_DIR}" # for config.h
|
||||
)
|
||||
# For use in src/CMakeLists.txt
|
||||
set(PKGDATADIR "${CMAKE_INSTALL_FULL_DATADIR}/${CMAKE_PROJECT_NAME}")
|
||||
@@ -490,7 +499,6 @@ message(STATUS "summary of build options:
|
||||
OpenSSL: ${HAVE_OPENSSL} (LIBS='${OPENSSL_LIBRARIES}')
|
||||
Libxml2: ${HAVE_LIBXML2} (LIBS='${LIBXML2_LIBRARIES}')
|
||||
Libev: ${HAVE_LIBEV} (LIBS='${LIBEV_LIBRARIES}')
|
||||
Libc-ares: ${HAVE_LIBCARES} (LIBS='${LIBCARES_LIBRARIES}')
|
||||
Libevent(SSL): ${HAVE_LIBEVENT_OPENSSL} (LIBS='${LIBEVENT_OPENSSL_LIBRARIES}')
|
||||
Spdylay: ${HAVE_SPDYLAY} (LIBS='${SPDYLAY_LIBRARIES}')
|
||||
Jansson: ${HAVE_JANSSON} (LIBS='${JANSSON_LIBRARIES}')
|
||||
|
||||
@@ -45,8 +45,7 @@ EXTRA_DIST = nghttpx.conf.sample proxy.pac.sample android-config android-make \
|
||||
cmake/Version.cmake \
|
||||
cmake/FindCython.cmake \
|
||||
cmake/FindLibevent.cmake \
|
||||
cmake/FindJansson.cmake \
|
||||
cmake/FindLibcares.cmake
|
||||
cmake/FindJansson.cmake
|
||||
|
||||
.PHONY: clang-format
|
||||
|
||||
|
||||
206
README.rst
206
README.rst
@@ -58,11 +58,6 @@ To build the documentation, you need to install:
|
||||
|
||||
* sphinx (http://sphinx-doc.org/)
|
||||
|
||||
If you need libnghttp2 (C library) only, then the above packages are
|
||||
all you need. Use ``--enable-lib-only`` to ensure that only
|
||||
libnghttp2 is built. This avoids potential build error related to
|
||||
building bundled applications.
|
||||
|
||||
To build and run the application programs (``nghttp``, ``nghttpd``,
|
||||
``nghttpx`` and ``h2load``) in the ``src`` directory, the following packages
|
||||
are required:
|
||||
@@ -70,7 +65,6 @@ are required:
|
||||
* OpenSSL >= 1.0.1
|
||||
* libev >= 4.11
|
||||
* zlib >= 1.2.3
|
||||
* libc-ares >= 1.7.5
|
||||
|
||||
ALPN support requires OpenSSL >= 1.0.2 (released 22 January 2015).
|
||||
LibreSSL >= 2.2.0 can be used instead of OpenSSL, but OpenSSL has more
|
||||
@@ -81,19 +75,11 @@ To enable the SPDY protocol in the application program ``nghttpx`` and
|
||||
|
||||
* spdylay >= 1.3.2
|
||||
|
||||
We no longer recommend to build nghttp2 with SPDY protocol support
|
||||
enabled. SPDY support will be removed soon.
|
||||
|
||||
To enable ``-a`` option (getting linked assets from the downloaded
|
||||
resource) in ``nghttp``, the following package is required:
|
||||
|
||||
* libxml2 >= 2.7.7
|
||||
|
||||
To enable systemd support in nghttpx, the following package is
|
||||
required:
|
||||
|
||||
* libsystemd-dev >= 209
|
||||
|
||||
The HPACK tools require the following package:
|
||||
|
||||
* jansson >= 2.5
|
||||
@@ -107,11 +93,6 @@ To mitigate heap fragmentation in long running server programs
|
||||
|
||||
* jemalloc
|
||||
|
||||
.. note::
|
||||
|
||||
Alpine Linux currently does not support malloc replacement
|
||||
due to musl limitations. See details in issue `#762 <https://github.com/nghttp2/nghttp2/issues/762>`_.
|
||||
|
||||
libnghttp2_asio C++ library requires the following packages:
|
||||
|
||||
* libboost-dev >= 1.54.0
|
||||
@@ -123,17 +104,13 @@ The Python bindings require the following packages:
|
||||
* python >= 2.7
|
||||
* python-setuptools
|
||||
|
||||
If you are using Ubuntu 16.04 LTS (Xenial Xerus) or Debian 8 (jessie)
|
||||
and above, run the following to install the required packages:
|
||||
|
||||
.. code-block:: text
|
||||
If you are using Ubuntu 14.04 LTS (trusty) or Debian 7.0 (wheezy) and above run the following to install the needed packages::
|
||||
|
||||
sudo apt-get install g++ make binutils autoconf automake autotools-dev libtool pkg-config \
|
||||
zlib1g-dev libcunit1-dev libssl-dev libxml2-dev libev-dev libevent-dev libjansson-dev \
|
||||
libc-ares-dev libjemalloc-dev libsystemd-dev libspdylay-dev \
|
||||
cython python3-dev python-setuptools
|
||||
libjemalloc-dev cython python3-dev python-setuptools
|
||||
|
||||
Since Ubuntu 15.10, spdylay has been available as a package named
|
||||
From Ubuntu 15.10, spdylay has been available as a package named
|
||||
`libspdylay-dev`. For the earlier Ubuntu release, you need to build
|
||||
it yourself: http://tatsuhiro-t.github.io/spdylay/
|
||||
|
||||
@@ -157,12 +134,24 @@ minimizes the risk of private key leakage when serious bug like
|
||||
Heartbleed is exploited. The neverbleed is disabled by default. To
|
||||
enable it, use ``--with-neverbleed`` configure option.
|
||||
|
||||
In ordre to compile the source code, gcc >= 4.8.3 or clang >= 3.4 is
|
||||
required.
|
||||
Building from git
|
||||
-----------------
|
||||
|
||||
Building from git is easy, but please be sure that at least autoconf 2.68 is
|
||||
used::
|
||||
|
||||
$ autoreconf -i
|
||||
$ automake
|
||||
$ autoconf
|
||||
$ ./configure
|
||||
$ make
|
||||
|
||||
To compile the source code, gcc >= 4.8.3 or clang >= 3.4 is required.
|
||||
|
||||
.. note::
|
||||
|
||||
To enable mruby support in nghttpx, and use ``--with-mruby``
|
||||
To enable mruby support in nghttpx, run ``git submodule update
|
||||
--init`` before running configure script, and use ``--with-mruby``
|
||||
configure option.
|
||||
|
||||
.. note::
|
||||
@@ -183,79 +172,6 @@ required.
|
||||
applications were not built, then using ``--enable-app`` may find
|
||||
that cause, such as the missing dependency.
|
||||
|
||||
.. note::
|
||||
|
||||
In order to detect third party libraries, pkg-config is used
|
||||
(however we don't use pkg-config for some libraries (e.g., libev)).
|
||||
By default, pkg-config searches ``*.pc`` file in the standard
|
||||
locations (e.g., /usr/lib/pkgconfig). If it is necessary to use
|
||||
``*.pc`` file in the custom location, specify paths to
|
||||
``PKG_CONFIG_PATH`` environment variable, and pass it to configure
|
||||
script, like so:
|
||||
|
||||
.. code-block:: text
|
||||
|
||||
$ ./configure PKG_CONFIG_PATH=/path/to/pkgconfig
|
||||
|
||||
For pkg-config managed libraries, ``*_CFLAG`` and ``*_LIBS``
|
||||
environment variables are defined (e.g., ``OPENSSL_CFLAGS``,
|
||||
``OPENSSL_LIBS``). Specifying non-empty string to these variables
|
||||
completely overrides pkg-config. In other words, if they are
|
||||
specified, pkg-config is not used for detection, and user is
|
||||
responsible to specify the correct values to these variables. For
|
||||
complete list of these variables, run ``./configure -h``.
|
||||
|
||||
Building nghttp2 from release tar archive
|
||||
-----------------------------------------
|
||||
|
||||
The nghttp2 project regularly releases tar archives which includes
|
||||
nghttp2 source code, and generated build files. They can be
|
||||
downloaded from `Releases
|
||||
<https://github.com/nghttp2/nghttp2/releases>`_ page.
|
||||
|
||||
Building nghttp2 from git requires autotools development packages.
|
||||
Building from tar archives does not require them, and thus it is much
|
||||
easier. The usual build step is as follows:
|
||||
|
||||
.. code-block:: text
|
||||
|
||||
$ tar xf nghttp2-X.Y.Z.tar.bz2
|
||||
$ cd nghttp2-X.Y.Z
|
||||
$ ./configure
|
||||
$ make
|
||||
|
||||
Building from git
|
||||
-----------------
|
||||
|
||||
Building from git is easy, but please be sure that at least autoconf 2.68 is
|
||||
used:
|
||||
|
||||
.. code-block:: text
|
||||
|
||||
$ git submodule update --init
|
||||
$ autoreconf -i
|
||||
$ automake
|
||||
$ autoconf
|
||||
$ ./configure
|
||||
$ make
|
||||
|
||||
Notes for building on Windows (MSVC)
|
||||
------------------------------------
|
||||
|
||||
The easiest way to build native Windows nghttp2 dll is use `cmake
|
||||
<https://cmake.org/>`_. The free version of `Visual C++ Build Tools
|
||||
<http://landinghub.visualstudio.com/visual-cpp-build-tools>`_ works
|
||||
fine.
|
||||
|
||||
1. Install cmake for windows
|
||||
2. Open "Visual C++ ... Native Build Tool Command Prompt", and inside
|
||||
nghttp2 directly, run ``cmake``.
|
||||
3. Then run ``cmake --build`` to build library.
|
||||
4. nghttp2.dll, nghttp2.lib, nghttp2.exp are placed under lib directory.
|
||||
|
||||
Note that the above steps most likely produce nghttp2 library only.
|
||||
No bundled applications are compiled.
|
||||
|
||||
Notes for building on Windows (Mingw/Cygwin)
|
||||
--------------------------------------------
|
||||
|
||||
@@ -272,9 +188,7 @@ Secondly, you need to undefine the macro ``__STRICT_ANSI__``, if you
|
||||
not, the functions ``fdopen``, ``fileno`` and ``strptime`` will not
|
||||
available.
|
||||
|
||||
the sample command like this:
|
||||
|
||||
.. code-block:: text
|
||||
the sample command like this::
|
||||
|
||||
$ export CFLAGS="-U__STRICT_ANSI__ -I$libev_PREFIX/include -L$libev_PREFIX/lib"
|
||||
$ export CXXFLAGS=$CFLAGS
|
||||
@@ -285,18 +199,6 @@ If you want to compile the applications under ``examples/``, you need
|
||||
to remove or rename the ``event.h`` from libev's installation, because
|
||||
it conflicts with libevent's installation.
|
||||
|
||||
Notes for installation on Linux systems
|
||||
--------------------------------------------
|
||||
After installing nghttp2 tool suite with ``make install`` one might experience a similar error:
|
||||
|
||||
.. code-block:: text
|
||||
|
||||
nghttpx: error while loading shared libraries: libnghttp2.so.14: cannot open shared object file: No such file or directory
|
||||
|
||||
This means that the tool is unable to locate the ``libnghttp2.so`` shared library.
|
||||
|
||||
To update the shared library cache run ``sudo ldconfig``.
|
||||
|
||||
Building the documentation
|
||||
--------------------------
|
||||
|
||||
@@ -304,9 +206,7 @@ Building the documentation
|
||||
|
||||
Documentation is still incomplete.
|
||||
|
||||
To build the documentation, run:
|
||||
|
||||
.. code-block:: text
|
||||
To build the documentation, run::
|
||||
|
||||
$ make html
|
||||
|
||||
@@ -335,16 +235,12 @@ its testing framework. We depend on the following libraries:
|
||||
* https://github.com/tatsuhiro-t/spdy
|
||||
|
||||
To download the above packages, after settings ``GOPATH``, run the
|
||||
following command under ``integration-tests`` directory:
|
||||
|
||||
.. code-block:: text
|
||||
following command under ``integration-tests`` directory::
|
||||
|
||||
$ make itprep
|
||||
|
||||
To run the tests, run the following command under
|
||||
``integration-tests`` directory:
|
||||
|
||||
.. code-block:: text
|
||||
``integration-tests`` directory::
|
||||
|
||||
$ make it
|
||||
|
||||
@@ -465,9 +361,7 @@ nghttp - client
|
||||
with prior knowledge, HTTP Upgrade and NPN/ALPN TLS extension.
|
||||
|
||||
It has verbose output mode for framing information. Here is sample
|
||||
output from ``nghttp`` client:
|
||||
|
||||
.. code-block:: text
|
||||
output from ``nghttp`` client::
|
||||
|
||||
$ nghttp -nv https://nghttp2.org
|
||||
[ 0.190] Connected
|
||||
@@ -550,9 +444,7 @@ output from ``nghttp`` client:
|
||||
[ 0.228] send GOAWAY frame <length=8, flags=0x00, stream_id=0>
|
||||
(last_stream_id=2, error_code=NO_ERROR(0x00), opaque_data(0)=[])
|
||||
|
||||
The HTTP Upgrade is performed like so:
|
||||
|
||||
.. code-block:: text
|
||||
The HTTP Upgrade is performed like so::
|
||||
|
||||
$ nghttp -nvu http://nghttp2.org
|
||||
[ 0.011] Connected
|
||||
@@ -648,9 +540,7 @@ The HTTP Upgrade is performed like so:
|
||||
(last_stream_id=2, error_code=NO_ERROR(0x00), opaque_data(0)=[])
|
||||
|
||||
Using the ``-s`` option, ``nghttp`` prints out some timing information for
|
||||
requests, sorted by completion time:
|
||||
|
||||
.. code-block:: text
|
||||
requests, sorted by completion time::
|
||||
|
||||
$ nghttp -nas https://nghttp2.org/
|
||||
***** Statistics *****
|
||||
@@ -694,9 +584,7 @@ HTTP/2 connections. No HTTP Upgrade is supported.
|
||||
The ``-p`` option allows users to configure server push.
|
||||
|
||||
Just like ``nghttp``, it has a verbose output mode for framing
|
||||
information. Here is sample output from ``nghttpd``:
|
||||
|
||||
.. code-block:: text
|
||||
information. Here is sample output from ``nghttpd``::
|
||||
|
||||
$ nghttpd --no-tls -v 8080
|
||||
IPv4: listen 0.0.0.0:8080
|
||||
@@ -800,17 +688,13 @@ are not encrypted by default. To encrypt backend connections, use
|
||||
sample configuration file ``nghttpx.conf.sample``.
|
||||
|
||||
In the default mode, ``nghttpx`` works as reverse proxy to the backend
|
||||
server:
|
||||
|
||||
.. code-block:: text
|
||||
server::
|
||||
|
||||
Client <-- (HTTP/2, SPDY, HTTP/1.1) --> nghttpx <-- (HTTP/1.1, HTTP/2) --> Web Server
|
||||
[reverse proxy]
|
||||
|
||||
With the ``--http2-proxy`` option, it works as forward proxy, and it
|
||||
is so called secure HTTP/2 proxy (aka SPDY proxy):
|
||||
|
||||
.. code-block:: text
|
||||
is so called secure HTTP/2 proxy (aka SPDY proxy)::
|
||||
|
||||
Client <-- (HTTP/2, SPDY, HTTP/1.1) --> nghttpx <-- (HTTP/1.1) --> Proxy
|
||||
[secure proxy] (e.g., Squid, ATS)
|
||||
@@ -832,18 +716,14 @@ create a proxy.pac script like this:
|
||||
machine nghttpx is running on. Please note that Chrome requires a valid
|
||||
certificate for secure proxy.
|
||||
|
||||
Then run Chrome with the following arguments:
|
||||
|
||||
.. code-block:: text
|
||||
Then run Chrome with the following arguments::
|
||||
|
||||
$ google-chrome --proxy-pac-url=file:///path/to/proxy.pac --use-npn
|
||||
|
||||
The backend HTTP/2 connections can be tunneled through an HTTP proxy.
|
||||
The proxy is specified using ``--backend-http-proxy-uri``. The
|
||||
following figure illustrates how nghttpx talks to the outside HTTP/2
|
||||
proxy through an HTTP proxy:
|
||||
|
||||
.. code-block:: text
|
||||
proxy through an HTTP proxy::
|
||||
|
||||
Client <-- (HTTP/2, SPDY, HTTP/1.1) --> nghttpx <-- (HTTP/2) --
|
||||
|
||||
@@ -857,9 +737,7 @@ The ``h2load`` program is a benchmarking tool for HTTP/2 and SPDY.
|
||||
The SPDY support is enabled if the program was built with the spdylay
|
||||
library. The UI of ``h2load`` is heavily inspired by ``weighttp``
|
||||
(https://github.com/lighttpd/weighttp). The typical usage is as
|
||||
follows:
|
||||
|
||||
.. code-block:: text
|
||||
follows::
|
||||
|
||||
$ h2load -n100000 -c100 -m100 https://localhost:8443/
|
||||
starting benchmark...
|
||||
@@ -947,9 +825,7 @@ Example:
|
||||
With the ``-t`` option, the program can accept more familiar HTTP/1 style
|
||||
header field blocks. Each header set is delimited by an empty line:
|
||||
|
||||
Example:
|
||||
|
||||
.. code-block:: text
|
||||
Example::
|
||||
|
||||
:method: GET
|
||||
:scheme: https
|
||||
@@ -1445,7 +1321,7 @@ The extension module is called ``nghttp2``.
|
||||
determined by the ``configure`` script. If the detected Python version is not
|
||||
what you expect, specify a path to Python executable in a ``PYTHON``
|
||||
variable as an argument to configure script (e.g., ``./configure
|
||||
PYTHON=/usr/bin/python3.5``).
|
||||
PYTHON=/usr/bin/python3.4``).
|
||||
|
||||
The following example code illustrates basic usage of the HPACK compressor
|
||||
and decompressor in Python:
|
||||
@@ -1575,17 +1451,6 @@ See `Contribution Guidelines
|
||||
<https://nghttp2.org/documentation/contribute.html>`_ for more
|
||||
details.
|
||||
|
||||
Reporting vulnerability
|
||||
-----------------------
|
||||
|
||||
If you find a vulnerability in our software, please send the email to
|
||||
"tatsuhiro.t at gmail dot com" about its details instead of submitting
|
||||
issues on github issue page. It is a standard practice not to
|
||||
disclose vulnerability information publicly until a fixed version is
|
||||
released, or mitigation is worked out.
|
||||
|
||||
In the future, we may setup a dedicated mail address for this purpose.
|
||||
|
||||
Release schedule
|
||||
----------------
|
||||
|
||||
@@ -1598,8 +1463,3 @@ severe security bug fixes.
|
||||
|
||||
We have no plan to break API compatibility changes involving soname
|
||||
bump, so MAJOR version will stay 1 for the foreseeable future.
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
The MIT License
|
||||
|
||||
@@ -39,9 +39,9 @@ PATH="$TOOLCHAIN"/bin:"$PATH"
|
||||
--without-libxml2 \
|
||||
--disable-python-bindings \
|
||||
--disable-examples \
|
||||
--disable-threads \
|
||||
CC="$TOOLCHAIN"/bin/arm-linux-androideabi-clang \
|
||||
CXX="$TOOLCHAIN"/bin/arm-linux-androideabi-clang++ \
|
||||
--enable-werror \
|
||||
CC="$TOOLCHAIN"/bin/clang \
|
||||
CXX="$TOOLCHAIN"/bin/clang++ \
|
||||
CPPFLAGS="-fPIE -I$PREFIX/include" \
|
||||
PKG_CONFIG_LIBDIR="$PREFIX/lib/pkgconfig" \
|
||||
LDFLAGS="-fPIE -pie -L$PREFIX/lib"
|
||||
|
||||
53
appveyor.yml
53
appveyor.yml
@@ -1,53 +0,0 @@
|
||||
# Notes:
|
||||
# - Minimal appveyor.yml file is an empty file. All sections are optional.
|
||||
# - Indent each level of configuration with 2 spaces. Do not use tabs!
|
||||
# - All section names are case-sensitive.
|
||||
# - Section names should be unique on each level.
|
||||
|
||||
#---------------------------------#
|
||||
# general configuration #
|
||||
#---------------------------------#
|
||||
|
||||
# version format
|
||||
#version: 0.10.{build}
|
||||
|
||||
# branches to build
|
||||
branches:
|
||||
# blacklist
|
||||
except:
|
||||
- gh-pages
|
||||
|
||||
# Do not build on tags (GitHub only)
|
||||
skip_tags: true
|
||||
|
||||
#---------------------------------#
|
||||
# environment configuration #
|
||||
#---------------------------------#
|
||||
|
||||
os: Windows Server 2012
|
||||
|
||||
# scripts that run after cloning repository
|
||||
install:
|
||||
# install Win-Flex-Bison
|
||||
#- cmd: cinst winflexbison -y
|
||||
|
||||
#---------------------------------#
|
||||
# build configuration #
|
||||
#---------------------------------#
|
||||
|
||||
# scripts to run before build
|
||||
before_build:
|
||||
- cmd: cmake .
|
||||
|
||||
# scripts to run *after* solution is built and *before* automatic packaging occurs (web apps, NuGet packages, Azure Cloud Services)
|
||||
# before_package:
|
||||
|
||||
# scripts to run after build
|
||||
# after_build:
|
||||
|
||||
# to run your custom scripts instead of automatic MSBuild
|
||||
build_script:
|
||||
- cmd: cmake --build .
|
||||
|
||||
# to disable automatic builds
|
||||
# build: off
|
||||
52
author.py
52
author.py
@@ -1,52 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# script to extract commit author's name from standard input. The
|
||||
# input should be <AUTHOR>:<EMAIL>, one per line.
|
||||
# This script expects the input is created by git-log command:
|
||||
#
|
||||
# git log --format=%aN:%aE
|
||||
#
|
||||
# This script removes duplicates based on email address, breaking a
|
||||
# tie with longer author name. Among the all author names extract the
|
||||
# previous step, we remove duplicate by case-insensitive match.
|
||||
#
|
||||
# So we can do this in one line:
|
||||
#
|
||||
# git log --format=%aN:%aE | sort | uniq | ./author.py > authors
|
||||
|
||||
import sys
|
||||
|
||||
edict = {}
|
||||
|
||||
for line in sys.stdin:
|
||||
author, email = line.strip().split(':', 1)
|
||||
if email in edict:
|
||||
an = edict[email]
|
||||
if len(an) < len(author) or an > author:
|
||||
sys.stderr.write(
|
||||
'eliminated {} in favor of {}\n'.format(an, author))
|
||||
edict[email] = author
|
||||
else:
|
||||
sys.stderr.write(
|
||||
'eliminated {} in favor of {}\n'.format(author, an))
|
||||
else:
|
||||
edict[email] = author
|
||||
|
||||
names = list(sorted(edict.values()))
|
||||
|
||||
ndict = {}
|
||||
|
||||
for name in names:
|
||||
lowname = name.lower()
|
||||
if lowname in ndict:
|
||||
an = ndict[lowname]
|
||||
if an > name:
|
||||
sys.stderr.write('eliminated {} in favor of {}\n'.format(an, name))
|
||||
ndict[lowname] = name
|
||||
else:
|
||||
sys.stderr.write('eliminated {} in favor of {}\n'.format(name, an))
|
||||
else:
|
||||
ndict[lowname] = name
|
||||
|
||||
for name in sorted(ndict.values()):
|
||||
print name
|
||||
@@ -1,40 +0,0 @@
|
||||
# - Try to find libcares
|
||||
# Once done this will define
|
||||
# LIBCARES_FOUND - System has libcares
|
||||
# LIBCARES_INCLUDE_DIRS - The libcares include directories
|
||||
# LIBCARES_LIBRARIES - The libraries needed to use libcares
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
pkg_check_modules(PC_LIBCARES QUIET libcares)
|
||||
|
||||
find_path(LIBCARES_INCLUDE_DIR
|
||||
NAMES ares.h
|
||||
HINTS ${PC_LIBCARES_INCLUDE_DIRS}
|
||||
)
|
||||
find_library(LIBCARES_LIBRARY
|
||||
NAMES cares
|
||||
HINTS ${PC_LIBCARES_LIBRARY_DIRS}
|
||||
)
|
||||
|
||||
if(LIBCARES_INCLUDE_DIR)
|
||||
set(_version_regex "^#define[ \t]+ARES_VERSION_STR[ \t]+\"([^\"]+)\".*")
|
||||
file(STRINGS "${LIBCARES_INCLUDE_DIR}/ares_version.h"
|
||||
LIBCARES_VERSION REGEX "${_version_regex}")
|
||||
string(REGEX REPLACE "${_version_regex}" "\\1"
|
||||
LIBCARES_VERSION "${LIBCARES_VERSION}")
|
||||
unset(_version_regex)
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
# handle the QUIETLY and REQUIRED arguments and set LIBCARES_FOUND to TRUE
|
||||
# if all listed variables are TRUE and the requested version matches.
|
||||
find_package_handle_standard_args(Libcares REQUIRED_VARS
|
||||
LIBCARES_LIBRARY LIBCARES_INCLUDE_DIR
|
||||
VERSION_VAR LIBCARES_VERSION)
|
||||
|
||||
if(LIBCARES_FOUND)
|
||||
set(LIBCARES_LIBRARIES ${LIBCARES_LIBRARY})
|
||||
set(LIBCARES_INCLUDE_DIRS ${LIBCARES_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
mark_as_advanced(LIBCARES_INCLUDE_DIR LIBCARES_LIBRARY)
|
||||
@@ -1,3 +1,7 @@
|
||||
|
||||
/* Hint to the compiler that a function parameter is not used */
|
||||
#define _U_ @HINT_UNUSED_PARAM@
|
||||
|
||||
/* Hint to the compiler that a function never returns */
|
||||
#define NGHTTP2_NORETURN @HINT_NORETURN@
|
||||
|
||||
|
||||
152
configure.ac
152
configure.ac
@@ -25,7 +25,7 @@ dnl Do not change user variables!
|
||||
dnl http://www.gnu.org/software/automake/manual/html_node/Flag-Variables-Ordering.html
|
||||
|
||||
AC_PREREQ(2.61)
|
||||
AC_INIT([nghttp2], [1.23.1], [t-tujikawa@users.sourceforge.net])
|
||||
AC_INIT([nghttp2], [1.9.2], [t-tujikawa@users.sourceforge.net])
|
||||
AC_CONFIG_AUX_DIR([.])
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
@@ -44,9 +44,9 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
|
||||
|
||||
dnl See versioning rule:
|
||||
dnl http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
|
||||
AC_SUBST(LT_CURRENT, 27)
|
||||
AC_SUBST(LT_REVISION, 3)
|
||||
AC_SUBST(LT_AGE, 13)
|
||||
AC_SUBST(LT_CURRENT, 20)
|
||||
AC_SUBST(LT_REVISION, 0)
|
||||
AC_SUBST(LT_AGE, 6)
|
||||
|
||||
major=`echo $PACKAGE_VERSION |cut -d. -f1 | sed -e "s/[^0-9]//g"`
|
||||
minor=`echo $PACKAGE_VERSION |cut -d. -f2 | sed -e "s/[^0-9]//g"`
|
||||
@@ -119,13 +119,8 @@ AC_ARG_WITH([jemalloc],
|
||||
|
||||
AC_ARG_WITH([spdylay],
|
||||
[AS_HELP_STRING([--with-spdylay],
|
||||
[Use spdylay [default=no]])],
|
||||
[request_spdylay=$withval], [request_spdylay=no])
|
||||
|
||||
AC_ARG_WITH([systemd],
|
||||
[AS_HELP_STRING([--with-systemd],
|
||||
[Enable systemd support in nghttpx [default=check]])],
|
||||
[request_systemd=$withval], [request_systemd=check])
|
||||
[Use spdylay [default=check]])],
|
||||
[request_spdylay=$withval], [request_spdylay=check])
|
||||
|
||||
AC_ARG_WITH([mruby],
|
||||
[AS_HELP_STRING([--with-mruby],
|
||||
@@ -176,9 +171,19 @@ else
|
||||
AC_SUBST([CYTHON])
|
||||
fi
|
||||
|
||||
#
|
||||
# If we're running GCC or clang define _U_ to be "__attribute__((unused))"
|
||||
# so we can use _U_ to flag unused function parameters and not get warnings
|
||||
# about them. Otherwise, define _U_ to be an empty string so that _U_ used
|
||||
# to flag an unused function parameters will compile with other compilers.
|
||||
#
|
||||
# XXX - similar hints for other compilers?
|
||||
#
|
||||
if test "x$GCC" = "xyes" -o "x$CC" = "xclang" ; then
|
||||
AC_DEFINE([_U_], [__attribute__((unused))], [Hint to the compiler that a function parameters is not used])
|
||||
AC_DEFINE([NGHTTP2_NORETURN], [__attribute__((noreturn))], [Hint to the compiler that a function never return])
|
||||
else
|
||||
AC_DEFINE([_U_], , [Hint to the compiler that a function parameter is not used])
|
||||
AC_DEFINE([NGHTTP2_NORETURN], , [Hint to the compiler that a function never return])
|
||||
fi
|
||||
|
||||
@@ -229,41 +234,6 @@ std::map<int, int>().emplace(1, 2);
|
||||
[have_std_map_emplace=no
|
||||
AC_MSG_RESULT([no])])
|
||||
|
||||
# Check that std::atomic_* overloads for std::shared_ptr are
|
||||
# available.
|
||||
AC_MSG_CHECKING([whether std::atomic_* overloads for std::shared_ptr are available])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
|
||||
[[
|
||||
#include <memory>
|
||||
]],
|
||||
[[
|
||||
auto a = std::make_shared<int>(1000000007);
|
||||
auto p = std::atomic_load(&a);
|
||||
++*p;
|
||||
std::atomic_store(&a, p);
|
||||
]])],
|
||||
[AC_DEFINE([HAVE_ATOMIC_STD_SHARED_PTR], [1],
|
||||
[Define to 1 if you have the std::atomic_* overloads for std::shared_ptr.])
|
||||
have_atomic_std_shared_ptr=yes
|
||||
AC_MSG_RESULT([yes])],
|
||||
[have_atomic_std_shared_ptr=no
|
||||
AC_MSG_RESULT([no])])
|
||||
|
||||
# Check that thread_local storage specifier is available
|
||||
AC_MSG_CHECKING([whether thread_local storage class specifier is available.])
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
|
||||
,
|
||||
[[
|
||||
thread_local int a = 0;
|
||||
(void)a;
|
||||
]])],
|
||||
[AC_DEFINE([HAVE_THREAD_LOCAL], [1],
|
||||
[Define to 1 if you have thread_local storage specifier.])
|
||||
have_thread_local=yes
|
||||
AC_MSG_RESULT([yes])],
|
||||
[have_Thread_local=no
|
||||
AC_MSG_RESULT([no])])
|
||||
|
||||
CXXFLAGS=$save_CXXFLAGS
|
||||
|
||||
AC_LANG_POP()
|
||||
@@ -276,7 +246,7 @@ TESTLDADD=
|
||||
# Additional libraries required for programs under src directory.
|
||||
APPLDFLAGS=
|
||||
|
||||
case "$host_os" in
|
||||
case "$host" in
|
||||
*android*)
|
||||
android_build=yes
|
||||
# android does not need -pthread, but needs followng 3 libs for C++
|
||||
@@ -288,12 +258,6 @@ case "$host_os" in
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$host_os" in
|
||||
*solaris*)
|
||||
APPLDFLAGS="$APPLDFLAGS -lsocket -lnsl"
|
||||
;;
|
||||
esac
|
||||
|
||||
# zlib
|
||||
PKG_CHECK_MODULES([ZLIB], [zlib >= 1.2.3], [have_zlib=yes], [have_zlib=no])
|
||||
|
||||
@@ -365,13 +329,6 @@ if test "x${have_openssl}" = "xno"; then
|
||||
AC_MSG_NOTICE($OPENSSL_PKG_ERRORS)
|
||||
fi
|
||||
|
||||
# c-ares (for src)
|
||||
PKG_CHECK_MODULES([LIBCARES], [libcares >= 1.7.5], [have_libcares=yes],
|
||||
[have_libcares=no])
|
||||
if test "x${have_libcares}" = "xno"; then
|
||||
AC_MSG_NOTICE($LIBCARES_PKG_ERRORS)
|
||||
fi
|
||||
|
||||
# libevent_openssl (for examples)
|
||||
# 2.0.8 is required because we use evconnlistener_set_error_cb()
|
||||
PKG_CHECK_MODULES([LIBEVENT_OPENSSL], [libevent_openssl >= 2.0.8],
|
||||
@@ -390,32 +347,16 @@ else
|
||||
AC_MSG_NOTICE($JANSSON_PKG_ERRORS)
|
||||
fi
|
||||
|
||||
|
||||
# libsystemd (for src/nghttpx)
|
||||
have_libsystemd=no
|
||||
if test "x${request_systemd}" != "xno"; then
|
||||
PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 209], [have_libsystemd=yes],
|
||||
[have_libsystemd=no])
|
||||
if test "x${have_libsystemd}" = "xyes"; then
|
||||
AC_DEFINE([HAVE_LIBSYSTEMD], [1],
|
||||
[Define to 1 if you have `libsystemd` library.])
|
||||
else
|
||||
AC_MSG_NOTICE($SYSTEMD_PKG_ERRORS)
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x${request_systemd}" = "xyes" &&
|
||||
test "x${have_libsystemd}" != "xyes"; then
|
||||
AC_MSG_ERROR([systemd was requested (--with-systemd) but not found])
|
||||
fi
|
||||
|
||||
# libxml2 (for src/nghttp)
|
||||
PKG_CHECK_MODULES([LIBXML2], [libxml-2.0 >= 2.7.7],
|
||||
[have_libxml2=yes], [have_libxml2=no])
|
||||
if test "x${have_libxml2}" = "xyes"; then
|
||||
AC_DEFINE([HAVE_LIBXML2], [1], [Define to 1 if you have `libxml2` library.])
|
||||
else
|
||||
AC_MSG_NOTICE($LIBXML2_PKG_ERRORS)
|
||||
have_libxml2=no
|
||||
if test "x${request_libxml2}" != "xno"; then
|
||||
m4_ifdef([AM_PATH_XML2],
|
||||
[AM_PATH_XML2(2.7.7, [have_libxml2=yes], [have_libxml2=no])],
|
||||
[AC_MSG_WARN([configure was created without libxml2 detection macro; libxml2 detection is disabled])])
|
||||
|
||||
if test "x${have_libxml2}" = "xyes"; then
|
||||
AC_DEFINE([HAVE_LIBXML2], [1], [Define to 1 if you have `libxml2` library.])
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x${request_libxml2}" = "xyes" &&
|
||||
@@ -497,14 +438,13 @@ if test "x${request_asio_lib}" = "xyes"; then
|
||||
fi
|
||||
fi
|
||||
|
||||
# The nghttp, nghttpd and nghttpx under src depend on zlib, OpenSSL,
|
||||
# libev, and libc-ares.
|
||||
# The nghttp, nghttpd and nghttpx under src depend on zlib, OpenSSL
|
||||
# and libev
|
||||
enable_app=no
|
||||
if test "x${request_app}" != "xno" &&
|
||||
test "x${have_zlib}" = "xyes" &&
|
||||
test "x${have_openssl}" = "xyes" &&
|
||||
test "x${have_libev}" = "xyes" &&
|
||||
test "x${have_libcares}" = "xyes"; then
|
||||
test "x${have_libev}" = "xyes"; then
|
||||
enable_app=yes
|
||||
fi
|
||||
|
||||
@@ -659,26 +599,6 @@ AC_SYS_LARGEFILE
|
||||
AC_CHECK_MEMBER([struct tm.tm_gmtoff], [have_struct_tm_tm_gmtoff=yes],
|
||||
[have_struct_tm_tm_gmtoff=no], [[#include <time.h>]])
|
||||
|
||||
AC_CHECK_MEMBER([struct sockaddr_in.sin_len],
|
||||
[AC_DEFINE([HAVE_SOCKADDR_IN_SIN_LEN],[1],
|
||||
[Define to 1 if struct sockaddr_in has sin_len member.])],
|
||||
[],
|
||||
[[
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
]])
|
||||
|
||||
AC_CHECK_MEMBER([struct sockaddr_in6.sin6_len],
|
||||
[AC_DEFINE([HAVE_SOCKADDR_IN6_SIN6_LEN],[1],
|
||||
[Define to 1 if struct sockaddr_in6 has sin6_len member.])],
|
||||
[],
|
||||
[[
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
]])
|
||||
|
||||
if test "x$have_struct_tm_tm_gmtoff" = "xyes"; then
|
||||
AC_DEFINE([HAVE_STRUCT_TM_TM_GMTOFF], [1],
|
||||
[Define to 1 if you have `struct tm.tm_gmtoff` member.])
|
||||
@@ -740,6 +660,13 @@ AC_CHECK_DECLS([initgroups], [], [], [[
|
||||
#include <grp.h>
|
||||
]])
|
||||
|
||||
# Checks for epoll availability, primarily for examples/tiny-nghttpd
|
||||
AX_HAVE_EPOLL([have_epoll=yes], [have_epoll=no])
|
||||
|
||||
AM_CONDITIONAL([ENABLE_TINY_NGHTTPD],
|
||||
[ test "x${have_epoll}" = "xyes" &&
|
||||
test "x${have_timerfd_create}" = "xyes"])
|
||||
|
||||
save_CFLAGS=$CFLAGS
|
||||
save_CXXFLAGS=$CXXFLAGS
|
||||
|
||||
@@ -793,7 +720,6 @@ if test "x$werror" != "xno"; then
|
||||
AX_CHECK_COMPILE_FLAG([-Wredundant-decls], [CFLAGS="$CFLAGS -Wredundant-decls"])
|
||||
# Only work with Clang for the moment
|
||||
AX_CHECK_COMPILE_FLAG([-Wheader-guard], [CFLAGS="$CFLAGS -Wheader-guard"])
|
||||
AX_CHECK_COMPILE_FLAG([-Wsometimes-uninitialized], [CFLAGS="$CFLAGS -Wsometimes-uninitialized"])
|
||||
|
||||
# This is required because we pass format string as "const char*.
|
||||
AX_CHECK_COMPILE_FLAG([-Wno-format-nonliteral], [CFLAGS="$CFLAGS -Wno-format-nonliteral"])
|
||||
@@ -803,7 +729,6 @@ if test "x$werror" != "xno"; then
|
||||
AX_CHECK_COMPILE_FLAG([-Wall], [CXXFLAGS="$CXXFLAGS -Wall"])
|
||||
AX_CHECK_COMPILE_FLAG([-Werror], [CXXFLAGS="$CXXFLAGS -Werror"])
|
||||
AX_CHECK_COMPILE_FLAG([-Wformat-security], [CXXFLAGS="$CXXFLAGS -Wformat-security"])
|
||||
AX_CHECK_COMPILE_FLAG([-Wsometimes-uninitialized], [CXXFLAGS="$CXXFLAGS -Wsometimes-uninitialized"])
|
||||
AC_LANG_POP()
|
||||
fi
|
||||
|
||||
@@ -900,7 +825,6 @@ AC_MSG_NOTICE([summary of build options:
|
||||
C preprocessor: ${CPP}
|
||||
CPPFLAGS: ${CPPFLAGS}
|
||||
WARNCFLAGS: ${WARNCFLAGS}
|
||||
WARNCXXFLAGS: ${WARNCXXFLAGS}
|
||||
CXX1XCXXFLAGS: ${CXX1XCXXFLAGS}
|
||||
EXTRACFLAG: ${EXTRACFLAG}
|
||||
LIBS: ${LIBS}
|
||||
@@ -920,15 +844,13 @@ AC_MSG_NOTICE([summary of build options:
|
||||
Failmalloc: ${enable_failmalloc}
|
||||
Libs:
|
||||
OpenSSL: ${have_openssl} (CFLAGS='${OPENSSL_CFLAGS}' LIBS='${OPENSSL_LIBS}')
|
||||
Libxml2: ${have_libxml2} (CFLAGS='${LIBXML2_CPPFLAGS}' LIBS='${LIBXML2_LIBS}')
|
||||
Libxml2: ${have_libxml2} (CFLAGS='${XML_CPPFLAGS}' LIBS='${XML_LIBS}')
|
||||
Libev: ${have_libev} (CFLAGS='${LIBEV_CFLAGS}' LIBS='${LIBEV_LIBS}')
|
||||
Libc-ares ${have_libcares} (CFLAGS='${LIBCARES_CFLAGS}' LIBS='${LIBCARES_LIBS}')
|
||||
Libevent(SSL): ${have_libevent_openssl} (CFLAGS='${LIBEVENT_OPENSSL_CFLAGS}' LIBS='${LIBEVENT_OPENSSL_LIBS}')
|
||||
Spdylay: ${have_spdylay} (CFLAGS='${LIBSPDYLAY_CFLAGS}' LIBS='${LIBSPDYLAY_LIBS}')
|
||||
Jansson: ${have_jansson} (CFLAGS='${JANSSON_CFLAGS}' LIBS='${JANSSON_LIBS}')
|
||||
Jemalloc: ${have_jemalloc} (LIBS='${JEMALLOC_LIBS}')
|
||||
Zlib: ${have_zlib} (CFLAGS='${ZLIB_CFLAGS}' LIBS='${ZLIB_LIBS}')
|
||||
Systemd: ${have_libsystemd} (CFLAGS='${SYSTEMD_CFLAGS}' LIBS='${SYSTEMD_LIBS}')
|
||||
Boost CPPFLAGS: ${BOOST_CPPFLAGS}
|
||||
Boost LDFLAGS: ${BOOST_LDFLAGS}
|
||||
Boost::ASIO: ${BOOST_ASIO_LIB}
|
||||
|
||||
@@ -1,17 +1,10 @@
|
||||
[Unit]
|
||||
Description=HTTP/2 proxy
|
||||
Documentation=man:nghttpx
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=notify
|
||||
ExecStart=@bindir@/nghttpx --conf=/etc/nghttpx/nghttpx.conf
|
||||
ExecReload=/bin/kill --signal HUP $MAINPID
|
||||
KillSignal=SIGQUIT
|
||||
PrivateTmp=yes
|
||||
ProtectHome=yes
|
||||
ProtectSystem=full
|
||||
Restart=always
|
||||
Type=forking
|
||||
ExecStart=@bindir@/nghttpx --conf=/etc/nghttpx/nghttpx.conf --pid-file=/run/nghttpx.pid --daemon
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
@@ -13,7 +13,6 @@ set(APIDOCS
|
||||
nghttp2_hd_deflate_get_num_table_entries.rst
|
||||
nghttp2_hd_deflate_get_table_entry.rst
|
||||
nghttp2_hd_deflate_hd.rst
|
||||
nghttp2_hd_deflate_hd_vec.rst
|
||||
nghttp2_hd_deflate_new.rst
|
||||
nghttp2_hd_deflate_new2.rst
|
||||
nghttp2_hd_inflate_change_table_size.rst
|
||||
@@ -24,7 +23,6 @@ set(APIDOCS
|
||||
nghttp2_hd_inflate_get_num_table_entries.rst
|
||||
nghttp2_hd_inflate_get_table_entry.rst
|
||||
nghttp2_hd_inflate_hd.rst
|
||||
nghttp2_hd_inflate_hd2.rst
|
||||
nghttp2_hd_inflate_new.rst
|
||||
nghttp2_hd_inflate_new2.rst
|
||||
nghttp2_http2_strerror.rst
|
||||
@@ -32,10 +30,7 @@ set(APIDOCS
|
||||
nghttp2_nv_compare_name.rst
|
||||
nghttp2_option_del.rst
|
||||
nghttp2_option_new.rst
|
||||
nghttp2_option_set_builtin_recv_extension_type.rst
|
||||
nghttp2_option_set_max_deflate_dynamic_table_size.rst
|
||||
nghttp2_option_set_max_reserved_remote_streams.rst
|
||||
nghttp2_option_set_max_send_header_block_length.rst
|
||||
nghttp2_option_set_no_auto_ping_ack.rst
|
||||
nghttp2_option_set_no_auto_window_update.rst
|
||||
nghttp2_option_set_no_http_messaging.rst
|
||||
@@ -58,15 +53,13 @@ set(APIDOCS
|
||||
nghttp2_session_callbacks_set_on_begin_frame_callback.rst
|
||||
nghttp2_session_callbacks_set_on_begin_headers_callback.rst
|
||||
nghttp2_session_callbacks_set_on_data_chunk_recv_callback.rst
|
||||
nghttp2_session_callbacks_set_on_extension_chunk_recv_callback.rst
|
||||
nghttp2_session_callbacks_set_on_frame_not_send_callback.rst
|
||||
nghttp2_session_callbacks_set_on_frame_recv_callback.rst
|
||||
nghttp2_session_callbacks_set_on_extension_chunk_recv_callback.rst
|
||||
nghttp2_session_callbacks_set_on_frame_send_callback.rst
|
||||
nghttp2_session_callbacks_set_on_header_callback.rst
|
||||
nghttp2_session_callbacks_set_on_header_callback2.rst
|
||||
nghttp2_session_callbacks_set_on_invalid_frame_recv_callback.rst
|
||||
nghttp2_session_callbacks_set_on_invalid_header_callback.rst
|
||||
nghttp2_session_callbacks_set_on_invalid_header_callback2.rst
|
||||
nghttp2_session_callbacks_set_on_stream_close_callback.rst
|
||||
nghttp2_session_callbacks_set_pack_extension_callback.rst
|
||||
nghttp2_session_callbacks_set_recv_callback.rst
|
||||
@@ -74,9 +67,6 @@ set(APIDOCS
|
||||
nghttp2_session_callbacks_set_send_callback.rst
|
||||
nghttp2_session_callbacks_set_send_data_callback.rst
|
||||
nghttp2_session_callbacks_set_unpack_extension_callback.rst
|
||||
nghttp2_session_change_stream_priority.rst
|
||||
nghttp2_session_check_request_allowed.rst
|
||||
nghttp2_session_check_server_session.rst
|
||||
nghttp2_session_client_new.rst
|
||||
nghttp2_session_client_new2.rst
|
||||
nghttp2_session_client_new3.rst
|
||||
@@ -88,11 +78,7 @@ set(APIDOCS
|
||||
nghttp2_session_find_stream.rst
|
||||
nghttp2_session_get_effective_local_window_size.rst
|
||||
nghttp2_session_get_effective_recv_data_length.rst
|
||||
nghttp2_session_get_hd_deflate_dynamic_table_size.rst
|
||||
nghttp2_session_get_hd_inflate_dynamic_table_size.rst
|
||||
nghttp2_session_get_last_proc_stream_id.rst
|
||||
nghttp2_session_get_local_settings.rst
|
||||
nghttp2_session_get_local_window_size.rst
|
||||
nghttp2_session_get_next_stream_id.rst
|
||||
nghttp2_session_get_outbound_queue_size.rst
|
||||
nghttp2_session_get_remote_settings.rst
|
||||
@@ -101,19 +87,20 @@ set(APIDOCS
|
||||
nghttp2_session_get_stream_effective_local_window_size.rst
|
||||
nghttp2_session_get_stream_effective_recv_data_length.rst
|
||||
nghttp2_session_get_stream_local_close.rst
|
||||
nghttp2_session_get_stream_local_window_size.rst
|
||||
nghttp2_session_get_stream_remote_close.rst
|
||||
nghttp2_session_get_stream_remote_window_size.rst
|
||||
nghttp2_session_get_stream_user_data.rst
|
||||
nghttp2_session_mem_recv.rst
|
||||
nghttp2_session_mem_send.rst
|
||||
nghttp2_session_recv.rst
|
||||
nghttp2_session_change_stream_priority.rst
|
||||
nghttp2_session_check_request_allowed.rst
|
||||
nghttp2_session_check_server_session.rst
|
||||
nghttp2_session_resume_data.rst
|
||||
nghttp2_session_send.rst
|
||||
nghttp2_session_server_new.rst
|
||||
nghttp2_session_server_new2.rst
|
||||
nghttp2_session_server_new3.rst
|
||||
nghttp2_session_set_local_window_size.rst
|
||||
nghttp2_session_set_next_stream_id.rst
|
||||
nghttp2_session_set_stream_user_data.rst
|
||||
nghttp2_session_terminate_session.rst
|
||||
@@ -122,7 +109,6 @@ set(APIDOCS
|
||||
nghttp2_session_upgrade2.rst
|
||||
nghttp2_session_want_read.rst
|
||||
nghttp2_session_want_write.rst
|
||||
nghttp2_set_debug_vprintf_callback.rst
|
||||
nghttp2_stream_get_first_child.rst
|
||||
nghttp2_stream_get_next_sibling.rst
|
||||
nghttp2_stream_get_parent.rst
|
||||
@@ -131,7 +117,6 @@ set(APIDOCS
|
||||
nghttp2_stream_get_sum_dependency_weight.rst
|
||||
nghttp2_stream_get_weight.rst
|
||||
nghttp2_strerror.rst
|
||||
nghttp2_submit_altsvc.rst
|
||||
nghttp2_submit_data.rst
|
||||
nghttp2_submit_extension.rst
|
||||
nghttp2_submit_goaway.rst
|
||||
|
||||
@@ -37,7 +37,6 @@ APIDOCS= \
|
||||
nghttp2_hd_deflate_get_num_table_entries.rst \
|
||||
nghttp2_hd_deflate_get_table_entry.rst \
|
||||
nghttp2_hd_deflate_hd.rst \
|
||||
nghttp2_hd_deflate_hd_vec.rst \
|
||||
nghttp2_hd_deflate_new.rst \
|
||||
nghttp2_hd_deflate_new2.rst \
|
||||
nghttp2_hd_inflate_change_table_size.rst \
|
||||
@@ -48,7 +47,6 @@ APIDOCS= \
|
||||
nghttp2_hd_inflate_get_num_table_entries.rst \
|
||||
nghttp2_hd_inflate_get_table_entry.rst \
|
||||
nghttp2_hd_inflate_hd.rst \
|
||||
nghttp2_hd_inflate_hd2.rst \
|
||||
nghttp2_hd_inflate_new.rst \
|
||||
nghttp2_hd_inflate_new2.rst \
|
||||
nghttp2_http2_strerror.rst \
|
||||
@@ -56,13 +54,9 @@ APIDOCS= \
|
||||
nghttp2_nv_compare_name.rst \
|
||||
nghttp2_option_del.rst \
|
||||
nghttp2_option_new.rst \
|
||||
nghttp2_option_set_builtin_recv_extension_type.rst \
|
||||
nghttp2_option_set_max_deflate_dynamic_table_size.rst \
|
||||
nghttp2_option_set_max_reserved_remote_streams.rst \
|
||||
nghttp2_option_set_max_send_header_block_length.rst \
|
||||
nghttp2_option_set_no_auto_ping_ack.rst \
|
||||
nghttp2_option_set_no_auto_window_update.rst \
|
||||
nghttp2_option_set_no_closed_streams.rst \
|
||||
nghttp2_option_set_no_http_messaging.rst \
|
||||
nghttp2_option_set_no_recv_client_magic.rst \
|
||||
nghttp2_option_set_peer_max_concurrent_streams.rst \
|
||||
@@ -90,8 +84,6 @@ APIDOCS= \
|
||||
nghttp2_session_callbacks_set_on_header_callback.rst \
|
||||
nghttp2_session_callbacks_set_on_header_callback2.rst \
|
||||
nghttp2_session_callbacks_set_on_invalid_frame_recv_callback.rst \
|
||||
nghttp2_session_callbacks_set_on_invalid_header_callback.rst \
|
||||
nghttp2_session_callbacks_set_on_invalid_header_callback2.rst \
|
||||
nghttp2_session_callbacks_set_on_stream_close_callback.rst \
|
||||
nghttp2_session_callbacks_set_pack_extension_callback.rst \
|
||||
nghttp2_session_callbacks_set_recv_callback.rst \
|
||||
@@ -99,9 +91,6 @@ APIDOCS= \
|
||||
nghttp2_session_callbacks_set_send_callback.rst \
|
||||
nghttp2_session_callbacks_set_send_data_callback.rst \
|
||||
nghttp2_session_callbacks_set_unpack_extension_callback.rst \
|
||||
nghttp2_session_change_stream_priority.rst \
|
||||
nghttp2_session_check_request_allowed.rst \
|
||||
nghttp2_session_check_server_session.rst \
|
||||
nghttp2_session_client_new.rst \
|
||||
nghttp2_session_client_new2.rst \
|
||||
nghttp2_session_client_new3.rst \
|
||||
@@ -113,11 +102,7 @@ APIDOCS= \
|
||||
nghttp2_session_find_stream.rst \
|
||||
nghttp2_session_get_effective_local_window_size.rst \
|
||||
nghttp2_session_get_effective_recv_data_length.rst \
|
||||
nghttp2_session_get_hd_deflate_dynamic_table_size.rst \
|
||||
nghttp2_session_get_hd_inflate_dynamic_table_size.rst \
|
||||
nghttp2_session_get_last_proc_stream_id.rst \
|
||||
nghttp2_session_get_local_settings.rst \
|
||||
nghttp2_session_get_local_window_size.rst \
|
||||
nghttp2_session_get_next_stream_id.rst \
|
||||
nghttp2_session_get_outbound_queue_size.rst \
|
||||
nghttp2_session_get_remote_settings.rst \
|
||||
@@ -126,19 +111,20 @@ APIDOCS= \
|
||||
nghttp2_session_get_stream_effective_local_window_size.rst \
|
||||
nghttp2_session_get_stream_effective_recv_data_length.rst \
|
||||
nghttp2_session_get_stream_local_close.rst \
|
||||
nghttp2_session_get_stream_local_window_size.rst \
|
||||
nghttp2_session_get_stream_remote_close.rst \
|
||||
nghttp2_session_get_stream_remote_window_size.rst \
|
||||
nghttp2_session_get_stream_user_data.rst \
|
||||
nghttp2_session_mem_recv.rst \
|
||||
nghttp2_session_mem_send.rst \
|
||||
nghttp2_session_recv.rst \
|
||||
nghttp2_session_change_stream_priority.rst \
|
||||
nghttp2_session_check_request_allowed.rst \
|
||||
nghttp2_session_check_server_session.rst \
|
||||
nghttp2_session_resume_data.rst \
|
||||
nghttp2_session_send.rst \
|
||||
nghttp2_session_server_new.rst \
|
||||
nghttp2_session_server_new2.rst \
|
||||
nghttp2_session_server_new3.rst \
|
||||
nghttp2_session_set_local_window_size.rst \
|
||||
nghttp2_session_set_next_stream_id.rst \
|
||||
nghttp2_session_set_stream_user_data.rst \
|
||||
nghttp2_session_terminate_session.rst \
|
||||
@@ -147,7 +133,6 @@ APIDOCS= \
|
||||
nghttp2_session_upgrade2.rst \
|
||||
nghttp2_session_want_read.rst \
|
||||
nghttp2_session_want_write.rst \
|
||||
nghttp2_set_debug_vprintf_callback.rst \
|
||||
nghttp2_stream_get_first_child.rst \
|
||||
nghttp2_stream_get_next_sibling.rst \
|
||||
nghttp2_stream_get_parent.rst \
|
||||
@@ -156,7 +141,6 @@ APIDOCS= \
|
||||
nghttp2_stream_get_sum_dependency_weight.rst \
|
||||
nghttp2_stream_get_weight.rst \
|
||||
nghttp2_strerror.rst \
|
||||
nghttp2_submit_altsvc.rst \
|
||||
nghttp2_submit_data.rst \
|
||||
nghttp2_submit_extension.rst \
|
||||
nghttp2_submit_goaway.rst \
|
||||
@@ -267,7 +251,7 @@ apiref.rst: \
|
||||
$(APIDOCS): apiref.rst
|
||||
|
||||
clean-local:
|
||||
[ $(srcdir) = $(builddir) ] || for i in $(RST_FILES); do [ -e $(builddir)/$$i ] && rm -f $(builddir)/$$i; done
|
||||
[ $(srcdir) = $(builddir) ] || for i in $(RST_FILES); do [ -e $(builddir)/$$i ] && rm $(builddir)/$$i; done
|
||||
-rm -f apiref.rst
|
||||
-rm -f $(APIDOCS)
|
||||
-rm -rf $(BUILDDIR)/*
|
||||
|
||||
@@ -15,7 +15,6 @@ from docutils import nodes
|
||||
from docutils.parsers.rst import directives
|
||||
|
||||
from sphinx import addnodes
|
||||
from sphinx import version_info
|
||||
from sphinx.roles import XRefRole
|
||||
from sphinx.locale import l_, _
|
||||
from sphinx.domains import Domain, ObjType, Index
|
||||
@@ -232,8 +231,8 @@ class RubyObject(ObjectDescription):
|
||||
|
||||
indextext = self.get_index_text(modname, name_cls)
|
||||
if indextext:
|
||||
self.indexnode['entries'].append(
|
||||
_make_index('single', indextext, fullname, fullname))
|
||||
self.indexnode['entries'].append(('single', indextext,
|
||||
fullname, fullname))
|
||||
|
||||
def before_content(self):
|
||||
# needed for automatic qualification of members (reset in subclasses)
|
||||
@@ -416,19 +415,11 @@ class RubyModule(Directive):
|
||||
# modindex currently
|
||||
if not noindex:
|
||||
indextext = _('%s (module)') % modname
|
||||
inode = addnodes.index(entries=[_make_index(
|
||||
'single', indextext, 'module-' + modname, modname)])
|
||||
inode = addnodes.index(entries=[('single', indextext,
|
||||
'module-' + modname, modname)])
|
||||
ret.append(inode)
|
||||
return ret
|
||||
|
||||
def _make_index(entrytype, entryname, target, ignored, key=None):
|
||||
# Sphinx 1.4 introduced backward incompatible changes, it now
|
||||
# requires 5 tuples. Last one is categorization key. See
|
||||
# http://www.sphinx-doc.org/en/stable/extdev/nodes.html#sphinx.addnodes.index
|
||||
if version_info >= (1, 4, 0, '', 0):
|
||||
return (entrytype, entryname, target, ignored, key)
|
||||
else:
|
||||
return (entrytype, entryname, target, ignored)
|
||||
|
||||
class RubyCurrentModule(Directive):
|
||||
"""
|
||||
|
||||
1
doc/_themes/sphinx_rtd_theme/layout.html
vendored
1
doc/_themes/sphinx_rtd_theme/layout.html
vendored
@@ -81,7 +81,6 @@
|
||||
|
||||
<body class="wy-body-for-nav" role="document">
|
||||
|
||||
{% block extrabody %} {% endblock %}
|
||||
<div class="wy-grid-for-nav">
|
||||
|
||||
{# SIDE NAV, TOGGLES ON MOBILE #}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -8,7 +8,7 @@ _h2load()
|
||||
_get_comp_words_by_ref cur prev
|
||||
case $cur in
|
||||
-*)
|
||||
COMPREPLY=( $( compgen -W '--connection-window-bits --clients --verbose --ciphers --rate --no-tls-proto --header-table-size --requests --base-uri --h1 --threads --npn-list --rate-period --data --version --connection-inactivity-timeout --timing-script-file --encoder-header-table-size --max-concurrent-streams --connection-active-timeout --input-file --help --window-bits --header ' -- "$cur" ) )
|
||||
COMPREPLY=( $( compgen -W '--connection-window-bits --clients --verbose --ciphers --rate --no-tls-proto --requests --base-uri --h1 --threads --npn-list --rate-period --data --version --connection-inactivity-timeout --timing-script-file --max-concurrent-streams --connection-active-timeout --input-file --header --window-bits --help ' -- "$cur" ) )
|
||||
;;
|
||||
*)
|
||||
_filedir
|
||||
|
||||
@@ -8,7 +8,7 @@ _nghttp()
|
||||
_get_comp_words_by_ref cur prev
|
||||
case $cur in
|
||||
-*)
|
||||
COMPREPLY=( $( compgen -W '--no-push --verbose --no-dep --get-assets --har --header-table-size --multiply --encoder-header-table-size --padding --hexdump --max-concurrent-streams --continuation --connection-window-bits --peer-max-concurrent-streams --timeout --data --no-content-length --version --color --cert --upgrade --remote-name --trailer --weight --help --key --null-out --window-bits --expect-continue --stat --no-verify-peer --header ' -- "$cur" ) )
|
||||
COMPREPLY=( $( compgen -W '--no-push --verbose --no-dep --get-assets --har --header-table-size --multiply --padding --hexdump --max-concurrent-streams --continuation --connection-window-bits --peer-max-concurrent-streams --timeout --data --no-content-length --version --color --cert --upgrade --remote-name --trailer --weight --help --key --null-out --window-bits --stat --header ' -- "$cur" ) )
|
||||
;;
|
||||
*)
|
||||
_filedir
|
||||
|
||||
@@ -8,7 +8,7 @@ _nghttpd()
|
||||
_get_comp_words_by_ref cur prev
|
||||
case $cur in
|
||||
-*)
|
||||
COMPREPLY=( $( compgen -W '--htdocs --verbose --daemon --echo-upload --error-gzip --push --header-table-size --encoder-header-table-size --padding --hexdump --max-concurrent-streams --no-tls --connection-window-bits --mime-types-file --no-content-length --workers --version --color --early-response --dh-param-file --trailer --address --window-bits --verify-client --help ' -- "$cur" ) )
|
||||
COMPREPLY=( $( compgen -W '--htdocs --verbose --daemon --echo-upload --error-gzip --push --header-table-size --padding --hexdump --max-concurrent-streams --no-tls --connection-window-bits --mime-types-file --no-content-length --workers --version --color --early-response --dh-param-file --trailer --address --window-bits --verify-client --help ' -- "$cur" ) )
|
||||
;;
|
||||
*)
|
||||
_filedir
|
||||
|
||||
@@ -8,7 +8,7 @@ _nghttpx()
|
||||
_get_comp_words_by_ref cur prev
|
||||
case $cur in
|
||||
-*)
|
||||
COMPREPLY=( $( compgen -W '--worker-read-rate --include --frontend-http2-dump-response-header --tls-ticket-key-file --verify-client-cacert --max-response-header-fields --backend-http2-window-size --frontend-keep-alive-timeout --backend-request-buffer --max-request-header-fields --fastopen --backend-connect-timeout --tls-max-proto-version --conf --dns-lookup-timeout --backend-http2-max-concurrent-streams --worker-write-burst --npn-list --dns-max-try --fetch-ocsp-response-file --no-via --tls-session-cache-memcached-cert-file --no-http2-cipher-black-list --mruby-file --client-no-http2-cipher-black-list --stream-read-timeout --client-ciphers --ocsp-update-interval --forwarded-for --accesslog-syslog --dns-cache-timeout --frontend-http2-read-timeout --listener-disable-timeout --ciphers --client-psk-secrets --strip-incoming-x-forwarded-for --no-server-rewrite --private-key-passwd-file --backend-keep-alive-timeout --backend-http-proxy-uri --frontend-max-requests --rlimit-nofile --no-strip-incoming-x-forwarded-proto --tls-ticket-key-memcached-cert-file --no-verify-ocsp --forwarded-by --tls-session-cache-memcached-private-key-file --error-page --ocsp-startup --backend-write-timeout --tls-dyn-rec-warmup-threshold --tls-ticket-key-memcached-max-retry --frontend-http2-window-size --http2-no-cookie-crumbling --worker-read-burst --dh-param-file --accesslog-format --errorlog-syslog --redirect-https-port --request-header-field-buffer --api-max-request-body --frontend-http2-decoder-dynamic-table-size --errorlog-file --frontend-http2-max-concurrent-streams --psk-secrets --frontend-write-timeout --tls-ticket-key-cipher --read-burst --no-add-x-forwarded-proto --backend --server-name --insecure --backend-max-backoff --log-level --host-rewrite --tls-ticket-key-memcached-interval --frontend-http2-setting-timeout --frontend-http2-connection-window-size --worker-frontend-connections --syslog-facility --no-server-push --no-location-rewrite --single-thread --tls-session-cache-memcached --no-ocsp --backend-response-buffer --tls-min-proto-version --workers --add-forwarded --worker-write-rate --add-request-header --backend-http2-settings-timeout --subcert --ecdh-curves --no-kqueue --help --frontend-frame-debug --tls-sct-dir --pid-file --frontend-http2-dump-request-header --daemon --write-rate --altsvc --backend-http2-decoder-dynamic-table-size --user --add-x-forwarded-for --frontend-read-timeout --tls-ticket-key-memcached-max-fail --backlog --write-burst --backend-connections-per-host --response-header-field-buffer --tls-ticket-key-memcached-address-family --padding --tls-session-cache-memcached-address-family --stream-write-timeout --cacert --tls-ticket-key-memcached-private-key-file --accesslog-write-early --backend-address-family --backend-http2-connection-window-size --version --add-response-header --backend-read-timeout --frontend-http2-optimize-window-size --frontend --accesslog-file --http2-proxy --backend-http2-encoder-dynamic-table-size --client-private-key-file --single-process --client-cert-file --tls-ticket-key-memcached --tls-dyn-rec-idle-timeout --frontend-http2-optimize-write-buffer-size --verify-client --frontend-http2-encoder-dynamic-table-size --read-rate --backend-connections-per-frontend --strip-incoming-forwarded ' -- "$cur" ) )
|
||||
COMPREPLY=( $( compgen -W '--worker-read-rate --include --frontend-http2-dump-response-header --tls-ticket-key-file --verify-client-cacert --max-response-header-fields --backend-request-buffer --max-request-header-fields --backend-http2-connection-window-bits --conf --backend-http2-max-concurrent-streams --worker-write-burst --npn-list --fetch-ocsp-response-file --no-via --tls-session-cache-memcached-cert-file --no-http2-cipher-black-list --mruby-file --no-server-push --stream-read-timeout --tls-ticket-key-memcached --forwarded-for --accesslog-syslog --frontend-http2-read-timeout --listener-disable-timeout --frontend-http2-connection-window-bits --ciphers --strip-incoming-x-forwarded-for --private-key-passwd-file --backend-keep-alive-timeout --backend-http-proxy-uri --rlimit-nofile --tls-ticket-key-memcached-cert-file --ocsp-update-interval --backend-address-family --tls-session-cache-memcached-private-key-file --error-page --backend-write-timeout --tls-dyn-rec-warmup-threshold --tls-ticket-key-memcached-max-retry --http2-no-cookie-crumbling --worker-read-burst --dh-param-file --accesslog-format --errorlog-syslog --request-header-field-buffer --errorlog-file --frontend-http2-max-concurrent-streams --frontend-write-timeout --tls-ticket-key-cipher --read-burst --backend --insecure --log-level --host-rewrite --tls-proto-list --tls-ticket-key-memcached-interval --worker-frontend-connections --syslog-facility --fastopen --no-location-rewrite --tls-session-cache-memcached --no-ocsp --backend-response-buffer --workers --add-forwarded --frontend-http2-window-bits --worker-write-rate --add-request-header --backend-tls-sni-field --subcert --help --frontend-frame-debug --pid-file --frontend-http2-dump-request-header --daemon --write-rate --altsvc --user --add-x-forwarded-for --frontend-read-timeout --tls-ticket-key-memcached-max-fail --backlog --write-burst --backend-connections-per-host --backend-http2-window-bits --response-header-field-buffer --tls-ticket-key-memcached-address-family --padding --tls-session-cache-memcached-address-family --stream-write-timeout --cacert --tls-ticket-key-memcached-private-key-file --forwarded-by --version --add-response-header --backend-read-timeout --frontend --accesslog-file --http2-proxy --client-private-key-file --client-cert-file --accept-proxy-protocol --tls-dyn-rec-idle-timeout --verify-client --read-rate --backend-connections-per-frontend --strip-incoming-forwarded ' -- "$cur" ) )
|
||||
;;
|
||||
*)
|
||||
_filedir
|
||||
|
||||
36
doc/h2load.1
36
doc/h2load.1
@@ -1,6 +1,6 @@
|
||||
.\" Man page generated from reStructuredText.
|
||||
.
|
||||
.TH "H2LOAD" "1" "May 30, 2017" "1.23.1" "nghttp2"
|
||||
.TH "H2LOAD" "1" "April 03, 2016" "1.9.2" "nghttp2"
|
||||
.SH NAME
|
||||
h2load \- HTTP/2 benchmarking tool
|
||||
.
|
||||
@@ -123,15 +123,13 @@ Add/Override a header to the requests.
|
||||
.B \-\-ciphers=<SUITE>
|
||||
Set allowed cipher list. The format of the string is
|
||||
described in OpenSSL ciphers(1).
|
||||
.sp
|
||||
Default: \fBECDHE\-ECDSA\-AES256\-GCM\-SHA384:ECDHE\-RSA\-AES256\-GCM\-SHA384:ECDHE\-ECDSA\-CHACHA20\-POLY1305:ECDHE\-RSA\-CHACHA20\-POLY1305:ECDHE\-ECDSA\-AES128\-GCM\-SHA256:ECDHE\-RSA\-AES128\-GCM\-SHA256:ECDHE\-ECDSA\-AES256\-SHA384:ECDHE\-RSA\-AES256\-SHA384:ECDHE\-ECDSA\-AES128\-SHA256:ECDHE\-RSA\-AES128\-SHA256\fP
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.B \-p, \-\-no\-tls\-proto=<PROTOID>
|
||||
Specify ALPN identifier of the protocol to be used when
|
||||
accessing http URI without SSL/TLS.
|
||||
Available protocols: h2c and
|
||||
Available protocols: spdy/2, spdy/3, spdy/3.1, h2c and
|
||||
http/1.1
|
||||
.sp
|
||||
Default: \fBh2c\fP
|
||||
@@ -140,9 +138,7 @@ Default: \fBh2c\fP
|
||||
.TP
|
||||
.B \-d, \-\-data=<PATH>
|
||||
Post FILE to server. The request method is changed to
|
||||
POST. For http/1.1 connection, if \fI\%\-d\fP is used, the
|
||||
maximum number of in\-flight pipelined requests is set to
|
||||
1.
|
||||
POST.
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
@@ -153,7 +149,7 @@ representing the number of connections to be made per
|
||||
rate period. The maximum number of connections to be
|
||||
made is given in \fI\%\-c\fP option. This rate will be
|
||||
distributed among threads as evenly as possible. For
|
||||
example, with \fI\%\-t\fP2 and \fI\%\-r\fP4, each thread gets 2
|
||||
example, with \fB\-t2\fP and \fB\-r4\fP, each thread gets 2
|
||||
connections per period. When the rate is 0, the program
|
||||
will run as it normally does, creating connections at
|
||||
whatever variable rate it wants. The default value for
|
||||
@@ -233,7 +229,7 @@ NPN. The parameter must be delimited by a single comma
|
||||
only and any white spaces are treated as a part of
|
||||
protocol string.
|
||||
.sp
|
||||
Default: \fBh2,h2\-16,h2\-14,http/1.1\fP
|
||||
Default: \fBh2,h2\-16,h2\-14,spdy/3.1,spdy/3,spdy/2,http/1.1\fP
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
@@ -244,23 +240,6 @@ http/1.1 for both http and https URI.
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.B \-\-header\-table\-size=<SIZE>
|
||||
Specify decoder header table size.
|
||||
.sp
|
||||
Default: \fB4K\fP
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.B \-\-encoder\-header\-table\-size=<SIZE>
|
||||
Specify encoder header table size. The decoder (server)
|
||||
specifies the maximum dynamic table size it accepts.
|
||||
Then the negotiated dynamic table size is the minimum of
|
||||
this option value and the value which server specified.
|
||||
.sp
|
||||
Default: \fB4K\fP
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.B \-v, \-\-verbose
|
||||
Output debug information.
|
||||
.UNINDENT
|
||||
@@ -275,9 +254,6 @@ Display version information and exit.
|
||||
Display this help and exit.
|
||||
.UNINDENT
|
||||
.sp
|
||||
The <SIZE> argument is an integer and an optional unit (e.g., 10K is
|
||||
10 * 1024). Units are K, M and G (powers of 1024).
|
||||
.sp
|
||||
The <DURATION> argument is an integer and an optional unit (e.g., 1s
|
||||
is 1 second and 500ms is 500 milliseconds). Units are h, m, s or ms
|
||||
(hours, minutes, seconds and milliseconds, respectively). If a unit
|
||||
@@ -436,7 +412,7 @@ performance. To set smaller flow control window, use \fI\%\-w\fP and
|
||||
window size described in HTTP/2 and SPDY protocol specification.
|
||||
.SH SEE ALSO
|
||||
.sp
|
||||
\fBnghttp(1)\fP, \fBnghttpd(1)\fP, \fBnghttpx(1)\fP
|
||||
\fInghttp(1)\fP, \fInghttpd(1)\fP, \fInghttpx(1)\fP
|
||||
.SH AUTHOR
|
||||
Tatsuhiro Tsujikawa
|
||||
.SH COPYRIGHT
|
||||
|
||||
@@ -74,14 +74,14 @@ OPTIONS
|
||||
.. option:: -w, --window-bits=<N>
|
||||
|
||||
Sets the stream level initial window size to (2\*\*<N>)-1.
|
||||
For SPDY, 2\*\*<N> is used instead.
|
||||
For SPDY, 2**<N> is used instead.
|
||||
|
||||
Default: ``30``
|
||||
|
||||
.. option:: -W, --connection-window-bits=<N>
|
||||
|
||||
Sets the connection level initial window size to
|
||||
(2\*\*<N>)-1. For SPDY, if <N> is strictly less than 16,
|
||||
(2**<N>)-1. For SPDY, if <N> is strictly less than 16,
|
||||
this option is ignored. Otherwise 2\*\*<N> is used for
|
||||
SPDY.
|
||||
|
||||
@@ -96,13 +96,11 @@ OPTIONS
|
||||
Set allowed cipher list. The format of the string is
|
||||
described in OpenSSL ciphers(1).
|
||||
|
||||
Default: ``ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256``
|
||||
|
||||
.. option:: -p, --no-tls-proto=<PROTOID>
|
||||
|
||||
Specify ALPN identifier of the protocol to be used when
|
||||
accessing http URI without SSL/TLS.
|
||||
Available protocols: h2c and
|
||||
Available protocols: spdy/2, spdy/3, spdy/3.1, h2c and
|
||||
http/1.1
|
||||
|
||||
Default: ``h2c``
|
||||
@@ -110,9 +108,7 @@ OPTIONS
|
||||
.. option:: -d, --data=<PATH>
|
||||
|
||||
Post FILE to server. The request method is changed to
|
||||
POST. For http/1.1 connection, if :option:`-d` is used, the
|
||||
maximum number of in-flight pipelined requests is set to
|
||||
1.
|
||||
POST.
|
||||
|
||||
.. option:: -r, --rate=<N>
|
||||
|
||||
@@ -122,7 +118,7 @@ OPTIONS
|
||||
rate period. The maximum number of connections to be
|
||||
made is given in :option:`-c` option. This rate will be
|
||||
distributed among threads as evenly as possible. For
|
||||
example, with :option:`-t`\2 and :option:`-r`\4, each thread gets 2
|
||||
example, with :option:`-t2` and :option:`\-r4`, each thread gets 2
|
||||
connections per period. When the rate is 0, the program
|
||||
will run as it normally does, creating connections at
|
||||
whatever variable rate it wants. The default value for
|
||||
@@ -196,7 +192,7 @@ OPTIONS
|
||||
only and any white spaces are treated as a part of
|
||||
protocol string.
|
||||
|
||||
Default: ``h2,h2-16,h2-14,http/1.1``
|
||||
Default: ``h2,h2-16,h2-14,spdy/3.1,spdy/3,spdy/2,http/1.1``
|
||||
|
||||
.. option:: --h1
|
||||
|
||||
@@ -204,21 +200,6 @@ OPTIONS
|
||||
:option:`--no-tls-proto`\=http/1.1, which effectively force
|
||||
http/1.1 for both http and https URI.
|
||||
|
||||
.. option:: --header-table-size=<SIZE>
|
||||
|
||||
Specify decoder header table size.
|
||||
|
||||
Default: ``4K``
|
||||
|
||||
.. option:: --encoder-header-table-size=<SIZE>
|
||||
|
||||
Specify encoder header table size. The decoder (server)
|
||||
specifies the maximum dynamic table size it accepts.
|
||||
Then the negotiated dynamic table size is the minimum of
|
||||
this option value and the value which server specified.
|
||||
|
||||
Default: ``4K``
|
||||
|
||||
.. option:: -v, --verbose
|
||||
|
||||
Output debug information.
|
||||
@@ -233,9 +214,6 @@ OPTIONS
|
||||
|
||||
|
||||
|
||||
The <SIZE> argument is an integer and an optional unit (e.g., 10K is
|
||||
10 * 1024). Units are K, M and G (powers of 1024).
|
||||
|
||||
The <DURATION> argument is an integer and an optional unit (e.g., 1s
|
||||
is 1 second and 500ms is 500 milliseconds). Units are h, m, s or ms
|
||||
(hours, minutes, seconds and milliseconds, respectively). If a unit
|
||||
|
||||
35
doc/nghttp.1
35
doc/nghttp.1
@@ -1,6 +1,6 @@
|
||||
.\" Man page generated from reStructuredText.
|
||||
.
|
||||
.TH "NGHTTP" "1" "May 30, 2017" "1.23.1" "nghttp2"
|
||||
.TH "NGHTTP" "1" "April 03, 2016" "1.9.2" "nghttp2"
|
||||
.SH NAME
|
||||
nghttp \- HTTP/2 client
|
||||
.
|
||||
@@ -142,13 +142,10 @@ HTTP upgrade request is performed with OPTIONS method.
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.B \-p, \-\-weight=<WEIGHT>
|
||||
Sets weight of given URI. This option can be used
|
||||
multiple times, and N\-th \fI\%\-p\fP option sets weight of N\-th
|
||||
URI in the command line. If the number of \fI\%\-p\fP option is
|
||||
less than the number of URI, the last \fI\%\-p\fP option value is
|
||||
repeated. If there is no \fI\%\-p\fP option, default weight, 16,
|
||||
is assumed. The valid value range is
|
||||
Sets priority group weight. The valid value range is
|
||||
[1, 256], inclusive.
|
||||
.sp
|
||||
Default: \fB16\fP
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
@@ -170,14 +167,6 @@ multiple header table size change.
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.B \-\-encoder\-header\-table\-size=<SIZE>
|
||||
Specify encoder header table size. The decoder (server)
|
||||
specifies the maximum dynamic table size it accepts.
|
||||
Then the negotiated dynamic table size is the minimum of
|
||||
this option value and the value which server specified.
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.B \-b, \-\-padding=<N>
|
||||
Add at most <N> bytes to a frame payload as padding.
|
||||
Specify 0 to disable padding.
|
||||
@@ -228,20 +217,6 @@ accepts.
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.B \-\-expect\-continue
|
||||
Perform an Expect/Continue handshake: wait to send DATA
|
||||
(up to a short timeout) until the server sends a 100
|
||||
Continue interim response. This option is ignored unless
|
||||
combined with the \fI\%\-d\fP option.
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.B \-y, \-\-no\-verify\-peer
|
||||
Suppress warning on server certificate verification
|
||||
failure.
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.B \-\-version
|
||||
Display version information and exit.
|
||||
.UNINDENT
|
||||
@@ -317,7 +292,7 @@ stream 11 with the weight 12. The other resources (e.g., icon) depend
|
||||
on stream 11 with the weight 2.
|
||||
.SH SEE ALSO
|
||||
.sp
|
||||
\fBnghttpd(1)\fP, \fBnghttpx(1)\fP, \fBh2load(1)\fP
|
||||
\fInghttpd(1)\fP, \fInghttpx(1)\fP, \fIh2load(1)\fP
|
||||
.SH AUTHOR
|
||||
Tatsuhiro Tsujikawa
|
||||
.SH COPYRIGHT
|
||||
|
||||
@@ -107,14 +107,11 @@ OPTIONS
|
||||
|
||||
.. option:: -p, --weight=<WEIGHT>
|
||||
|
||||
Sets weight of given URI. This option can be used
|
||||
multiple times, and N-th :option:`-p` option sets weight of N-th
|
||||
URI in the command line. If the number of :option:`-p` option is
|
||||
less than the number of URI, the last :option:`-p` option value is
|
||||
repeated. If there is no :option:`-p` option, default weight, 16,
|
||||
is assumed. The valid value range is
|
||||
Sets priority group weight. The valid value range is
|
||||
[1, 256], inclusive.
|
||||
|
||||
Default: ``16``
|
||||
|
||||
.. option:: -M, --peer-max-concurrent-streams=<N>
|
||||
|
||||
Use <N> as SETTINGS_MAX_CONCURRENT_STREAMS value of
|
||||
@@ -131,13 +128,6 @@ OPTIONS
|
||||
frame payload before the last value, to simulate
|
||||
multiple header table size change.
|
||||
|
||||
.. option:: --encoder-header-table-size=<SIZE>
|
||||
|
||||
Specify encoder header table size. The decoder (server)
|
||||
specifies the maximum dynamic table size it accepts.
|
||||
Then the negotiated dynamic table size is the minimum of
|
||||
this option value and the value which server specified.
|
||||
|
||||
.. option:: -b, --padding=<N>
|
||||
|
||||
Add at most <N> bytes to a frame payload as padding.
|
||||
@@ -179,18 +169,6 @@ OPTIONS
|
||||
The number of concurrent pushed streams this client
|
||||
accepts.
|
||||
|
||||
.. option:: --expect-continue
|
||||
|
||||
Perform an Expect/Continue handshake: wait to send DATA
|
||||
(up to a short timeout) until the server sends a 100
|
||||
Continue interim response. This option is ignored unless
|
||||
combined with the :option:`-d` option.
|
||||
|
||||
.. option:: -y, --no-verify-peer
|
||||
|
||||
Suppress warning on server certificate verification
|
||||
failure.
|
||||
|
||||
.. option:: --version
|
||||
|
||||
Display version information and exit.
|
||||
@@ -223,9 +201,7 @@ implementation.
|
||||
|
||||
When connection is established, nghttp sends 5 PRIORITY frames to idle
|
||||
streams 3, 5, 7, 9 and 11 to create "anchor" nodes in dependency
|
||||
tree:
|
||||
|
||||
.. code-block:: text
|
||||
tree::
|
||||
|
||||
+-----+
|
||||
|id=0 |
|
||||
|
||||
@@ -12,9 +12,7 @@ implementation.
|
||||
|
||||
When connection is established, nghttp sends 5 PRIORITY frames to idle
|
||||
streams 3, 5, 7, 9 and 11 to create "anchor" nodes in dependency
|
||||
tree:
|
||||
|
||||
.. code-block:: text
|
||||
tree::
|
||||
|
||||
+-----+
|
||||
|id=0 |
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
.\" Man page generated from reStructuredText.
|
||||
.
|
||||
.TH "NGHTTPD" "1" "May 30, 2017" "1.23.1" "nghttp2"
|
||||
.TH "NGHTTPD" "1" "April 03, 2016" "1.9.2" "nghttp2"
|
||||
.SH NAME
|
||||
nghttpd \- HTTP/2 server
|
||||
.
|
||||
@@ -99,14 +99,6 @@ Specify decoder header table size.
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.B \-\-encoder\-header\-table\-size=<SIZE>
|
||||
Specify encoder header table size. The decoder (client)
|
||||
specifies the maximum dynamic table size it accepts.
|
||||
Then the negotiated dynamic table size is the minimum of
|
||||
this option value and the value which client specified.
|
||||
.UNINDENT
|
||||
.INDENT 0.0
|
||||
.TP
|
||||
.B \-\-color
|
||||
Force colored log output.
|
||||
.UNINDENT
|
||||
@@ -217,7 +209,7 @@ The <SIZE> argument is an integer and an optional unit (e.g., 10K is
|
||||
10 * 1024). Units are K, M and G (powers of 1024).
|
||||
.SH SEE ALSO
|
||||
.sp
|
||||
\fBnghttp(1)\fP, \fBnghttpx(1)\fP, \fBh2load(1)\fP
|
||||
\fInghttp(1)\fP, \fInghttpx(1)\fP, \fIh2load(1)\fP
|
||||
.SH AUTHOR
|
||||
Tatsuhiro Tsujikawa
|
||||
.SH COPYRIGHT
|
||||
|
||||
@@ -70,13 +70,6 @@ OPTIONS
|
||||
|
||||
Specify decoder header table size.
|
||||
|
||||
.. option:: --encoder-header-table-size=<SIZE>
|
||||
|
||||
Specify encoder header table size. The decoder (client)
|
||||
specifies the maximum dynamic table size it accepts.
|
||||
Then the negotiated dynamic table size is the minimum of
|
||||
this option value and the value which client specified.
|
||||
|
||||
.. option:: --color
|
||||
|
||||
Force colored log output.
|
||||
|
||||
825
doc/nghttpx.1
825
doc/nghttpx.1
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
203
doc/nghttpx.h2r
203
doc/nghttpx.h2r
@@ -41,33 +41,6 @@ FILES
|
||||
:option:`--conf` option cannot be used in the configuration file and
|
||||
will be ignored if specified.
|
||||
|
||||
Error log
|
||||
Error log is written to stderr by default. It can be configured
|
||||
using :option:`--errorlog-file`. The format of log message is as
|
||||
follows:
|
||||
|
||||
<datetime> <master-pid> <current-pid> <thread-id> <level> (<filename>:<line>) <msg>
|
||||
|
||||
<datetime>
|
||||
It is a conbination of date and time when the log is written. It
|
||||
is in ISO 8601 format.
|
||||
|
||||
<master-pid>
|
||||
It is a master process ID.
|
||||
|
||||
<current-pid>
|
||||
It is a process ID which writes this log.
|
||||
|
||||
<thread-id>
|
||||
It is a thread ID which writes this log. It would be unique
|
||||
within <current-pid>.
|
||||
|
||||
<filename> and <line>
|
||||
They are source file name, and line number which produce this log.
|
||||
|
||||
<msg>
|
||||
It is a log message body.
|
||||
|
||||
SIGNALS
|
||||
-------
|
||||
|
||||
@@ -76,25 +49,14 @@ SIGQUIT
|
||||
accepting connection. After all connections are handled, nghttpx
|
||||
exits.
|
||||
|
||||
SIGHUP
|
||||
Reload configuration file given in :option:`--conf`.
|
||||
|
||||
SIGUSR1
|
||||
Reopen log files.
|
||||
|
||||
SIGUSR2
|
||||
|
||||
Fork and execute nghttpx. It will execute the binary in the same
|
||||
path with same command-line arguments and environment variables. As
|
||||
of nghttpx version 1.20.0, the new master process sends SIGQUIT to
|
||||
the original master process when it is ready to serve requests. For
|
||||
the earlier versions of nghttpx, user has to send SIGQUIT to the
|
||||
original master process.
|
||||
|
||||
The difference between SIGUSR2 (+ SIGQUIT) and SIGHUP is that former
|
||||
is usually used to execute new binary, and the master process is
|
||||
newly spawned. On the other hand, the latter just reloads
|
||||
configuration file, and the same master process continues to exist.
|
||||
path with same command-line arguments and environment variables.
|
||||
After new process comes up, sending SIGQUIT to the original process
|
||||
to perform hot swapping.
|
||||
|
||||
.. note::
|
||||
|
||||
@@ -123,7 +85,7 @@ backend server and extracts URI-reference with parameter
|
||||
and pushes those URIs to the frontend client. Here is a sample Link
|
||||
header field to initiate server push:
|
||||
|
||||
.. code-block:: text
|
||||
.. code-block:: http
|
||||
|
||||
Link: </fonts/font.woff>; rel=preload
|
||||
Link: </css/theme.css>; rel=preload
|
||||
@@ -171,22 +133,6 @@ be customized using :option:`--fetch-ocsp-response-file` option.
|
||||
If OCSP query is failed, previous OCSP response, if any, is continued
|
||||
to be used.
|
||||
|
||||
:option:`--fetch-ocsp-response-file` option provides wide range of
|
||||
possibility to manage OCSP response. It can take an arbitrary script
|
||||
or executable. The requirement is that it supports the command-line
|
||||
interface of ``fetch-ocsp-response`` script, and it must return a
|
||||
valid DER encoded OCSP response on success. It must return exit code
|
||||
0 on success, and 75 for temporary error, and the other error code for
|
||||
generic failure. For large cluster of servers, it is not efficient
|
||||
for each server to perform OCSP query using ``fetch-ocsp-response``.
|
||||
Instead, you can retrieve OCSP response in some way, and store it in a
|
||||
disk or a shared database. Then specify a program in
|
||||
:option:`--fetch-ocsp-response-file` to fetch it from those stores.
|
||||
This could provide a way to share the OCSP response between fleet of
|
||||
servers, and also any OCSP query strategy can be applied which may be
|
||||
beyond the ability of nghttpx itself or ``fetch-ocsp-response``
|
||||
script.
|
||||
|
||||
TLS SESSION RESUMPTION
|
||||
----------------------
|
||||
|
||||
@@ -256,24 +202,6 @@ from the given file. In this case, nghttpx does not rotate key
|
||||
automatically. To rotate key, one has to restart nghttpx (see
|
||||
SIGNALS).
|
||||
|
||||
CERTIFICATE TRANSPARENCY
|
||||
------------------------
|
||||
|
||||
nghttpx supports TLS ``signed_certificate_timestamp`` extension (`RFC
|
||||
6962 <https://tools.ietf.org/html/rfc6962>`_). The relevant options
|
||||
are :option:`--tls-sct-dir` and ``sct-dir`` parameter in
|
||||
:option:`--subcert`. They takes a directory, and nghttpx reads all
|
||||
files whose extension is ``.sct`` under the directory. The ``*.sct``
|
||||
files are encoded as ``SignedCertificateTimestamp`` struct described
|
||||
in `section 3.2 of RFC 69662
|
||||
<https://tools.ietf.org/html/rfc6962#section-3.2>`_. This format is
|
||||
the same one used by `nginx-ct
|
||||
<https://github.com/grahamedgecombe/nginx-ct>`_ and `mod_ssl_ct
|
||||
<https://httpd.apache.org/docs/trunk/mod/mod_ssl_ct.html>`_.
|
||||
`ct-submit <https://github.com/grahamedgecombe/ct-submit>`_ can be
|
||||
used to submit certificates to log servers, and obtain the
|
||||
``SignedCertificateTimestamp`` struct which can be used with nghttpx.
|
||||
|
||||
MRUBY SCRIPTING
|
||||
---------------
|
||||
|
||||
@@ -337,28 +265,7 @@ respectively.
|
||||
|
||||
.. rb:attr_reader:: remote_addr
|
||||
|
||||
Return IP address of a remote client. If connection is made
|
||||
via UNIX domain socket, this returns the string "localhost".
|
||||
|
||||
.. rb:attr_reader:: server_addr
|
||||
|
||||
Return address of server that accepted the connection. This
|
||||
is a string which specified in :option:`--frontend` option,
|
||||
excluding port number, and not a resolved IP address. For
|
||||
UNIX domain socket, this is a path to UNIX domain socket.
|
||||
|
||||
.. rb:attr_reader:: server_port
|
||||
|
||||
Return port number of the server frontend which accepted the
|
||||
connection from client.
|
||||
|
||||
.. rb:attr_reader:: tls_used
|
||||
|
||||
Return true if TLS is used on the connection.
|
||||
|
||||
.. rb:attr_reader:: tls_sni
|
||||
|
||||
Return the TLS SNI value which client sent in this connection.
|
||||
Return IP address of a remote client.
|
||||
|
||||
.. rb:class:: Request
|
||||
|
||||
@@ -394,13 +301,7 @@ respectively.
|
||||
|
||||
Request path, including query component (i.e., /index.html).
|
||||
On assignment, copy of given value is assigned. The path does
|
||||
not include authority component of URI. This may include
|
||||
query component. nghttpx makes certain normalization for
|
||||
path. It decodes percent-encoding for unreserved characters
|
||||
(see https://tools.ietf.org/html/rfc3986#section-2.3), and
|
||||
resolves ".." and ".". But it may leave characters which
|
||||
should be percent-encoded as is. So be careful when comparing
|
||||
path against desired string.
|
||||
not include authority component of URI.
|
||||
|
||||
.. rb:attr_reader:: headers
|
||||
|
||||
@@ -427,7 +328,7 @@ respectively.
|
||||
|
||||
Clear all existing request header fields.
|
||||
|
||||
.. rb:method:: push(uri)
|
||||
.. rb:method:: push uri
|
||||
|
||||
Initiate to push resource identified by *uri*. Only HTTP/2
|
||||
protocol supports this feature. For the other protocols, this
|
||||
@@ -502,18 +403,6 @@ respectively.
|
||||
existing header fields, and then add required header fields.
|
||||
It is an error to call this method twice for a given request.
|
||||
|
||||
.. rb:method:: send_info(status, headers)
|
||||
|
||||
Send non-final (informational) response to a client. *status*
|
||||
must be in the range [100, 199], inclusive. *headers* is a
|
||||
hash containing response header fields. Its key must be a
|
||||
string, and the associated value must be either string or
|
||||
array of strings. Since this is not a final response, even if
|
||||
this method is invoked, request is still forwarded to a
|
||||
backend unless :rb:meth:`Nghttpx::Response#return` is called.
|
||||
This method can be called multiple times. It cannot be called
|
||||
after :rb:meth:`Nghttpx::Response#return` is called.
|
||||
|
||||
MRUBY EXAMPLES
|
||||
~~~~~~~~~~~~~~
|
||||
|
||||
@@ -550,84 +439,6 @@ addresses:
|
||||
|
||||
App.new
|
||||
|
||||
API ENDPOINTS
|
||||
-------------
|
||||
|
||||
nghttpx exposes API endpoints to manipulate it via HTTP based API. By
|
||||
default, API endpoint is disabled. To enable it, add a dedicated
|
||||
frontend for API using :option:`--frontend` option with "api"
|
||||
parameter. All requests which come from this frontend address, will
|
||||
be treated as API request.
|
||||
|
||||
The response is normally JSON dictionary, and at least includes the
|
||||
following keys:
|
||||
|
||||
status
|
||||
The status of the request processing. The following values are
|
||||
defined:
|
||||
|
||||
Success
|
||||
The request was successful.
|
||||
|
||||
Failure
|
||||
The request was failed. No change has been made.
|
||||
|
||||
code
|
||||
HTTP status code
|
||||
|
||||
Additionally, depending on the API endpoint, ``data`` key may be
|
||||
present, and its value contains the API endpoint specific data.
|
||||
|
||||
We wrote "normally", since nghttpx may return ordinal HTML response in
|
||||
some cases where the error has occurred before reaching API endpoint
|
||||
(e.g., header field is too large).
|
||||
|
||||
The following section describes available API endpoints.
|
||||
|
||||
POST /api/v1beta1/backendconfig
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
This API replaces the current backend server settings with the
|
||||
requested ones. The request method should be POST, but PUT is also
|
||||
acceptable. The request body must be nghttpx configuration file
|
||||
format. For configuration file format, see `FILES`_ section. The
|
||||
line separator inside the request body must be single LF (0x0A).
|
||||
Currently, only :option:`backend <--backend>` option is parsed, the
|
||||
others are simply ignored. The semantics of this API is replace the
|
||||
current backend with the backend options in request body. Describe
|
||||
the desired set of backend severs, and nghttpx makes it happen. If
|
||||
there is no :option:`backend <--backend>` option is found in request
|
||||
body, the current set of backend is replaced with the :option:`backend
|
||||
<--backend>` option's default value, which is ``127.0.0.1,80``.
|
||||
|
||||
The replacement is done instantly without breaking existing
|
||||
connections or requests. It also avoids any process creation as is
|
||||
the case with hot swapping with signals.
|
||||
|
||||
The one limitation is that only numeric IP address is allowd in
|
||||
:option:`backend <--backend>` in request body unless "dns" parameter
|
||||
is used while non numeric hostname is allowed in command-line or
|
||||
configuration file is read using :option:`--conf`.
|
||||
|
||||
GET /api/v1beta1/configrevision
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
This API returns configuration revision of the current nghttpx. The
|
||||
configuration revision is opaque string, and it changes after each
|
||||
reloading by SIGHUP. With this API, an external application knows
|
||||
that whether nghttpx has finished reloading its configuration by
|
||||
comparing the configuration revisions between before and after
|
||||
reloading. It is recommended to disable persistent (keep-alive)
|
||||
connection for this purpose in order to avoid to send a request using
|
||||
the reused connection which may bound to an old process.
|
||||
|
||||
This API returns response including ``data`` key. Its value is JSON
|
||||
object, and it contains at least the following key:
|
||||
|
||||
configRevision
|
||||
The configuration revision of the current nghttpx
|
||||
|
||||
|
||||
SEE ALSO
|
||||
--------
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ functions, and it also interacts with it via many API function calls.
|
||||
An application can create as many :type:`nghttp2_session` object as it
|
||||
wants. But single :type:`nghttp2_session` object must be used by a
|
||||
single thread at the same time. This is not so hard to enforce since
|
||||
most event-based architecture applications use is single thread per
|
||||
most event-based architecture applicatons use is single thread per
|
||||
core, and handling one connection I/O is done by single thread.
|
||||
|
||||
To feed input to :type:`nghttp2_session` object, one can use
|
||||
@@ -116,10 +116,7 @@ briefly describe what the library does in this area. In the following
|
||||
description, without loss of generality we omit CONTINUATION frame
|
||||
since they must follow HEADERS frame and are processed atomically. In
|
||||
other words, they are just one big HEADERS frame. To disable these
|
||||
validations, use `nghttp2_option_set_no_http_messaging()`. Please
|
||||
note that disabling this feature does not change the fundamental
|
||||
client and server model of HTTP. That is, even if the validation is
|
||||
disabled, only client can send requests.
|
||||
validations, use `nghttp2_option_set_no_http_messaging()`.
|
||||
|
||||
For HTTP request, including those carried by PUSH_PROMISE, HTTP
|
||||
message starts with one HEADERS frame containing request headers. It
|
||||
@@ -152,11 +149,13 @@ header fields must not appear: "Connection", "Keep-Alive",
|
||||
Each header field name and value must obey the field-name and
|
||||
field-value production rules described in `RFC 7230, section
|
||||
3.2. <https://tools.ietf.org/html/rfc7230#section-3.2>`_.
|
||||
Additionally, all field name must be lower cased. The invalid header
|
||||
fields are treated as stream error, and that stream is reset. If
|
||||
application wants to treat these headers in their own way, use
|
||||
`nghttp2_on_invalid_header_callback
|
||||
<https://nghttp2.org/documentation/types.html#c.nghttp2_on_invalid_header_callback>`_.
|
||||
Additionally, all field name must be lower cased. While the pseudo
|
||||
header fields must satisfy these rules, we just ignore illegal regular
|
||||
headers (this means that these header fields are not passed to
|
||||
application callback). This is because these illegal header fields
|
||||
are floating around in existing internet and resetting stream just
|
||||
because of this may break many web sites. This is especially true if
|
||||
we forward to or translate from HTTP/1 traffic.
|
||||
|
||||
For "http" or "https" URIs, ":path" pseudo header fields must start
|
||||
with "/". The only exception is OPTIONS request, in that case, "*" is
|
||||
@@ -174,73 +173,16 @@ parsed as 64 bit signed integer. The sum of data length in the
|
||||
following DATA frames must match with the number in "Content-Length"
|
||||
header field if it is present (this does not include padding bytes).
|
||||
|
||||
RFC 7230 says that server must not send "Content-Length" in any
|
||||
response with 1xx, and 204 status code. It also says that
|
||||
"Content-Length" is not allowed in any response with 200 status code
|
||||
to a CONNECT request. nghttp2 enforces them as well.
|
||||
|
||||
Any deviation results in stream error of type PROTOCOL_ERROR. If
|
||||
error is found in PUSH_PROMISE frame, stream error is raised against
|
||||
promised stream.
|
||||
|
||||
The order of transmission of the HTTP/2 frames
|
||||
----------------------------------------------
|
||||
|
||||
This section describes the internals of libnghttp2 about the
|
||||
scheduling of transmission of HTTP/2 frames. This is pretty much
|
||||
internal stuff, so the details could change in the future versions of
|
||||
the library.
|
||||
|
||||
libnghttp2 categorizes HTTP/2 frames into 4 categories: urgent,
|
||||
regular, syn_stream, and data in the order of higher priority.
|
||||
|
||||
The urgent category includes PING and SETTINGS. They are sent with
|
||||
highest priority. The order inside the category is FIFO.
|
||||
|
||||
The regular category includes frames other than PING, SETTINGS, DATA,
|
||||
and HEADERS which does not create stream (which counts toward
|
||||
concurrent stream limit). The order inside the category is FIFO.
|
||||
|
||||
The syn_stream category includes HEADERS frame which creates stream,
|
||||
that counts toward the concurrent stream limit.
|
||||
|
||||
The data category includes DATA frame, and the scheduling among DATA
|
||||
frames are determined by HTTP/2 dependency tree.
|
||||
|
||||
If the application wants to send frames in the specific order, and the
|
||||
default transmission order does not fit, it has to schedule frames by
|
||||
itself using the callbacks (e.g.,
|
||||
:type:`nghttp2_on_frame_send_callback`).
|
||||
|
||||
RST_STREAM has special side effect when it is submitted by
|
||||
`nghttp2_submit_rst_stream()`. It cancels all pending HEADERS and
|
||||
DATA frames whose stream ID matches the one in the RST_STREAM frame.
|
||||
This may cause unexpected behaviour for the application in some cases.
|
||||
For example, suppose that application wants to send RST_STREAM after
|
||||
sending response HEADERS and DATA. Because of the reason we mentioned
|
||||
above, the following code does not work:
|
||||
|
||||
.. code-block:: c
|
||||
|
||||
nghttp2_submit_response(...)
|
||||
nghttp2_submit_rst_stream(...)
|
||||
|
||||
RST_STREAM cancels HEADERS (and DATA), and just RST_STREAM is sent.
|
||||
The correct way is use :type:`nghttp2_on_frame_send_callback`, and
|
||||
after HEADERS and DATA frames are sent, issue
|
||||
`nghttp2_submit_rst_stream()`. FYI,
|
||||
:type:`nghttp2_on_frame_not_send_callback` tells you why frames are
|
||||
not sent.
|
||||
|
||||
Implement user defined HTTP/2 non-critical extensions
|
||||
-----------------------------------------------------
|
||||
Implement HTTP/2 non-critical extensions
|
||||
----------------------------------------
|
||||
|
||||
As of nghttp2 v1.8.0, we have added HTTP/2 non-critical extension
|
||||
framework, which lets application send and receive user defined custom
|
||||
HTTP/2 non-critical extension frames. nghttp2 also offers built-in
|
||||
functionality to send and receive official HTTP/2 extension frames
|
||||
(e.g., ALTSVC frame). For these built-in handler, refer to the next
|
||||
section.
|
||||
framework, which lets application send and receive HTTP/2 non-critical
|
||||
extension frames.
|
||||
|
||||
To send extension frame, use `nghttp2_submit_extension()`, and
|
||||
implement :type:`nghttp2_pack_extension_callback`. The callback
|
||||
@@ -441,41 +383,3 @@ its creation:
|
||||
.. code-block:: c
|
||||
|
||||
nghttp2_session_client_new2(&session, callbacks, user_data, option);
|
||||
|
||||
How to use built-in HTTP/2 extension frame handlers
|
||||
---------------------------------------------------
|
||||
|
||||
In the previous section, we talked about the user defined HTTP/2
|
||||
extension frames. In this section, we talk about HTTP/2 extension
|
||||
frame support built into nghttp2 library.
|
||||
|
||||
As of this writing, nghttp2 supports ALTSVC extension frame. To send
|
||||
ALTSVC frame, use `nghttp2_submit_altsvc()` function.
|
||||
|
||||
To receive ALTSVC frame through built-in functionality, application
|
||||
has to use `nghttp2_option_set_builtin_recv_extension_type()` to
|
||||
indicate the willingness of receiving ALTSVC frame:
|
||||
|
||||
.. code-block:: c
|
||||
|
||||
nghttp2_option_set_builtin_recv_extension_type(option, NGHTTP2_ALTSVC);
|
||||
|
||||
This is very similar to the case when we used to receive user defined
|
||||
frames.
|
||||
|
||||
If the same frame type is set using
|
||||
`nghttp2_option_set_builtin_recv_extension_type()` and
|
||||
`nghttp2_option_set_user_recv_extension_type()`, the latter takes
|
||||
precedence. Application can implement its own frame handler rather
|
||||
than using built-in handler.
|
||||
|
||||
The :type:`nghttp2_option` must be set to :type:`nghttp2_session` on
|
||||
its creation, like so:
|
||||
|
||||
.. code-block:: c
|
||||
|
||||
nghttp2_session_client_new2(&session, callbacks, user_data, option);
|
||||
|
||||
When ALTSVC is received, :type:`nghttp2_on_frame_recv_callback` will
|
||||
be called as usual.
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ Building Android binary
|
||||
=======================
|
||||
|
||||
In this article, we briefly describe how to build Android binary using
|
||||
`Android NDK <https://developer.android.com/ndk/index.html>`_
|
||||
`Android NDK <http://developer.android.com/tools/sdk/ndk/index.html>`_
|
||||
cross-compiler on Debian Linux.
|
||||
|
||||
The easiest way to build android binary is use Dockerfile.android.
|
||||
@@ -17,32 +17,35 @@ installed in the following way. First, let us introduce
|
||||
under ``$ANDROID_HOME/toolchain``. An user can freely choose the path
|
||||
for ``ANDROID_HOME``. For example, to install toolchain under
|
||||
``$ANDROID_HOME/toolchain``, do this in the the directory where NDK is
|
||||
unpacked:
|
||||
unpacked::
|
||||
|
||||
.. code-block:: text
|
||||
$ build/tools/make-standalone-toolchain.sh \
|
||||
--install-dir=$ANDROID_HOME/toolchain \
|
||||
--toolchain=arm-linux-androideabi-4.9 \
|
||||
--llvm-version=3.5 \
|
||||
--platform=android-16
|
||||
|
||||
$ build/tools/make_standalone_toolchain.py \
|
||||
--arch arm --api 16 --stl gnustl \
|
||||
--install-dir $ANDROID_HOME/toolchain
|
||||
The additional flag ``--system=linux-x86_64`` may be required if you
|
||||
are using x86_64 system.
|
||||
|
||||
The API level (``--api``) is not important here because we don't use
|
||||
Android specific C/C++ API.
|
||||
The platform level is not important here because we don't use Android
|
||||
specific C/C++ API.
|
||||
|
||||
The dependent libraries, such as OpenSSL, libev, and c-ares should be
|
||||
built with the toolchain and installed under
|
||||
``$ANDROID_HOME/usr/local``. We recommend to build these libraries as
|
||||
static library to make the deployment easier. libxml2 support is
|
||||
currently disabled.
|
||||
The dependent libraries, such as OpenSSL and libev should be built
|
||||
with the toolchain and installed under ``$ANDROID_HOME/usr/local``.
|
||||
We recommend to build these libraries as static library to make the
|
||||
deployment easier. libxml2 support is currently disabled.
|
||||
|
||||
Although zlib comes with Android NDK, it seems not to be a part of
|
||||
public API, so we have to built it for our own. That also provides us
|
||||
proper .pc file as a bonus.
|
||||
|
||||
If SPDY support is required for nghttpx and h2load, build and install
|
||||
spdylay as well.
|
||||
|
||||
Before running ``android-config`` and ``android-make``,
|
||||
``ANDROID_HOME`` environment variable must be set to point to the
|
||||
correct path. Also add ``$ANDROID_HOME/toolchain/bin`` to ``PATH``:
|
||||
|
||||
.. code-block:: text
|
||||
correct path. Also add ``$ANDROID_HOME/toolchain/bin`` to ``PATH``::
|
||||
|
||||
$ export PATH=$PATH:$ANDROID_HOME/toolchain/bin
|
||||
|
||||
@@ -94,26 +97,6 @@ patch, to configure libev, use the following script:
|
||||
|
||||
And run ``make install`` to build and install.
|
||||
|
||||
To configure c-ares, use the following script:
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
#!/bin/sh -e
|
||||
|
||||
if [ -z "$ANDROID_HOME" ]; then
|
||||
echo 'No $ANDROID_HOME specified.'
|
||||
exit 1
|
||||
fi
|
||||
PREFIX=$ANDROID_HOME/usr/local
|
||||
TOOLCHAIN=$ANDROID_HOME/toolchain
|
||||
PATH=$TOOLCHAIN/bin:$PATH
|
||||
|
||||
./configure \
|
||||
--host=arm-linux-androideabi \
|
||||
--build=`dpkg-architecture -qDEB_BUILD_GNU_TYPE` \
|
||||
--prefix=$PREFIX \
|
||||
--disable-shared
|
||||
|
||||
To configure zlib, use the following script:
|
||||
|
||||
.. code-block:: sh
|
||||
@@ -143,13 +126,39 @@ To configure zlib, use the following script:
|
||||
|
||||
And run ``make install`` to build and install.
|
||||
|
||||
To configure spdylay, use the following script:
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
#!/bin/sh -e
|
||||
|
||||
if [ -z "$ANDROID_HOME" ]; then
|
||||
echo 'No $ANDROID_HOME specified.'
|
||||
exit 1
|
||||
fi
|
||||
PREFIX=$ANDROID_HOME/usr/local
|
||||
TOOLCHAIN=$ANDROID_HOME/toolchain
|
||||
PATH=$TOOLCHAIN/bin:$PATH
|
||||
|
||||
./configure \
|
||||
--disable-shared \
|
||||
--host=arm-linux-androideabi \
|
||||
--build=`dpkg-architecture -qDEB_BUILD_GNU_TYPE` \
|
||||
--prefix=$PREFIX \
|
||||
--without-libxml2 \
|
||||
--disable-src \
|
||||
--disable-examples \
|
||||
CPPFLAGS="-I$PREFIX/include" \
|
||||
PKG_CONFIG_LIBDIR="$PREFIX/lib/pkgconfig" \
|
||||
LDFLAGS="-L$PREFIX/lib"
|
||||
|
||||
And run ``make install`` to build and install.
|
||||
|
||||
After prerequisite libraries are prepared, run ``android-config`` and
|
||||
then ``android-make`` to compile nghttp2 source files.
|
||||
|
||||
If all went well, application binaries, such as nghttpx, are created
|
||||
under src directory. Strip debugging information from the binary
|
||||
using the following command:
|
||||
|
||||
.. code-block:: text
|
||||
using the following command::
|
||||
|
||||
$ arm-linux-androideabi-strip src/nghttpx
|
||||
|
||||
@@ -26,7 +26,8 @@ Coding style
|
||||
We use clang-format to format source code consistently. The
|
||||
clang-format configuration file .clang-format is located at the root
|
||||
directory. Since clang-format produces slightly different results
|
||||
between versions, we currently use clang-format 4.0.
|
||||
between versions, we currently use clang-format which comes with
|
||||
clang-3.6.
|
||||
|
||||
To detect any violation to the coding style, we recommend to setup git
|
||||
pre-commit hook to check coding style of the changes you introduced.
|
||||
@@ -34,7 +35,7 @@ The pre-commit file is located at the root directory. Copy it under
|
||||
.git/hooks and make sure that it is executable. The pre-commit script
|
||||
uses clang-format-diff.py to detect any style errors. If it is not in
|
||||
your PATH or it exists under different name (e.g.,
|
||||
clang-format-diff-4.0 in debian), either add it to PATH variable or
|
||||
clang-format-diff-3.6 in debian), either add it to PATH variable or
|
||||
add git option ``clangformatdiff.binary`` to point to the script.
|
||||
|
||||
For emacs users, integrating clang-format to emacs is very easy.
|
||||
|
||||
@@ -12,7 +12,7 @@ Compiling from source
|
||||
---------------------
|
||||
|
||||
h2load is compiled alongside nghttp2 and requires that the
|
||||
``--enable-app`` flag is passed to ``./configure`` and `required
|
||||
``--enable-apps`` flag is passed to ``./configure`` and `required
|
||||
dependencies <https://github.com/nghttp2/nghttp2#requirements>`_ are
|
||||
available during compilation. For details on compiling, see `nghttp2:
|
||||
Building from Git
|
||||
|
||||
@@ -51,4 +51,3 @@ Resources
|
||||
|
||||
* HTTP/2 https://tools.ietf.org/html/rfc7540
|
||||
* HPACK https://tools.ietf.org/html/rfc7541
|
||||
* HTTP Alternative Services https://tools.ietf.org/html/rfc7838
|
||||
|
||||
@@ -48,16 +48,12 @@ explicitly.
|
||||
The backend is supposed to be Web server. For example, to make
|
||||
nghttpx listen to encrypted HTTP/2 requests at port 8443, and a
|
||||
backend Web server is configured to listen to HTTP request at port
|
||||
8080 in the same host, run nghttpx command-line like this:
|
||||
|
||||
.. code-block:: text
|
||||
8080 in the same host, run nghttpx command-line like this::
|
||||
|
||||
$ nghttpx -f0.0.0.0,8443 -b127.0.0.1,8080 /path/to/server.key /path/to/server.crt
|
||||
|
||||
Then HTTP/2 enabled client can access to the nghttpx in HTTP/2. For
|
||||
example, you can send GET request to the server using nghttp:
|
||||
|
||||
.. code-block:: text
|
||||
example, you can send GET request to the server using nghttp::
|
||||
|
||||
$ nghttp -nv https://localhost:8443/
|
||||
|
||||
@@ -93,9 +89,7 @@ connection, use :option:`--backend` option, and specify ``h2`` in
|
||||
For example, to make nghttpx listen to encrypted HTTP/2 requests at
|
||||
port 8443, and a backend HTTP proxy server is configured to listen to
|
||||
HTTP/1 request at port 8080 in the same host, run nghttpx command-line
|
||||
like this:
|
||||
|
||||
.. code-block:: text
|
||||
like this::
|
||||
|
||||
$ nghttpx -s -f'*,8443' -b127.0.0.1,8080 /path/to/server.key /path/to/server.crt
|
||||
|
||||
@@ -124,17 +118,13 @@ to proxy.pac file, something like this:
|
||||
|
||||
file:///path/to/proxy.pac
|
||||
|
||||
For Chromium, use following command-line:
|
||||
|
||||
.. code-block:: text
|
||||
For Chromium, use following command-line::
|
||||
|
||||
$ google-chrome --proxy-pac-url=file:///path/to/proxy.pac --use-npn
|
||||
|
||||
As HTTP/1 proxy server, Squid may work as out-of-box. Traffic server
|
||||
requires to be configured as forward proxy. Here is the minimum
|
||||
configuration items to edit:
|
||||
|
||||
.. code-block:: text
|
||||
configuration items to edit::
|
||||
|
||||
CONFIG proxy.config.reverse_proxy.enabled INT 0
|
||||
CONFIG proxy.config.url_remap.remap_required INT 0
|
||||
@@ -144,11 +134,6 @@ Consult Traffic server `documentation
|
||||
to know how to configure traffic server as forward proxy and its
|
||||
security implications.
|
||||
|
||||
ALPN support
|
||||
------------
|
||||
|
||||
ALPN support requires OpenSSL >= 1.0.2.
|
||||
|
||||
Disable frontend SSL/TLS
|
||||
------------------------
|
||||
|
||||
@@ -167,9 +152,9 @@ Enable SSL/TLS on memcached connection
|
||||
--------------------------------------
|
||||
|
||||
By default, memcached connection is not encrypted. To enable
|
||||
encryption, use ``tls`` keyword in
|
||||
:option:`--tls-ticket-key-memcached` for TLS ticket key, and
|
||||
:option:`--tls-session-cache-memcached` for TLS session cache.
|
||||
encryption, use :option:`--tls-ticket-key-memcached-tls` for TLS
|
||||
ticket key, and use :option:`--tls-session-cache-memcached-tls` for
|
||||
TLS session cache.
|
||||
|
||||
Specifying additional server certificates
|
||||
-----------------------------------------
|
||||
@@ -211,17 +196,17 @@ Rewriting location header field
|
||||
nghttpx automatically rewrites location response header field if the
|
||||
following all conditions satisfy:
|
||||
|
||||
* In the default mode (:option:`--http2-proxy` is not used)
|
||||
* :option:`--no-location-rewrite` is not used
|
||||
* URI in location header field is an absolute URI
|
||||
* URI in location header field is not absolute URI or is not https URI.
|
||||
* URI in location header field includes non empty host component.
|
||||
* host (without port) in URI in location header field must match the
|
||||
host appearing in ``:authority`` or ``host`` header field.
|
||||
host appearing in :authority or host header field.
|
||||
|
||||
When rewrite happens, URI scheme is replaced with the ones used in
|
||||
frontend, and authority is replaced with which appears in
|
||||
``:authority``, or ``host`` request header field. ``:authority``
|
||||
header field has precedence over ``host``.
|
||||
When rewrite happens, URI scheme and port are replaced with the ones
|
||||
used in frontend, and host is replaced with which appears in
|
||||
:authority or host request header field. :authority header field has
|
||||
precedence. If the above conditions are not met with the host value
|
||||
in :authority header field, rewrite is retried with the value in host
|
||||
header field.
|
||||
|
||||
Hot swapping
|
||||
------------
|
||||
@@ -229,21 +214,12 @@ Hot swapping
|
||||
nghttpx supports hot swapping using signals. The hot swapping in
|
||||
nghttpx is multi step process. First send USR2 signal to nghttpx
|
||||
process. It will do fork and execute new executable, using same
|
||||
command-line arguments and environment variables.
|
||||
|
||||
As of nghttpx version 1.20.0, that is all you have to do. The new
|
||||
master process sends QUIT signal to the original process, when it is
|
||||
ready to serve requests, to shut it down gracefully.
|
||||
|
||||
For earlier versions of nghttpx, you have to do one more thing. At
|
||||
this point, both current and new processes can accept requests. To
|
||||
gracefully shutdown current process, send QUIT signal to current
|
||||
nghttpx process. When all existing frontend connections are done, the
|
||||
current process will exit. At this point, only new nghttpx process
|
||||
exists and serves incoming requests.
|
||||
|
||||
If you want to just reload configuration file without executing new
|
||||
binary, send SIGHUP to nghttpx master process.
|
||||
command-line arguments and environment variables. At this point, both
|
||||
current and new processes can accept requests. To gracefully shutdown
|
||||
current process, send QUIT signal to current nghttpx process. When
|
||||
all existing frontend connections are done, the current process will
|
||||
exit. At this point, only new nghttpx process exists and serves
|
||||
incoming requests.
|
||||
|
||||
Re-opening log files
|
||||
--------------------
|
||||
@@ -349,9 +325,10 @@ requests, do this:
|
||||
backend=serv1,3000;/;proto=h2
|
||||
backend=serv1,3000;/ws/;proto=http/1.1
|
||||
|
||||
The default backend protocol is HTTP/1.1.
|
||||
Note that the backends share the same pattern must have the same
|
||||
backend protocol. The default backend protocol is HTTP/1.1.
|
||||
|
||||
TLS can be enabled per pattern basis:
|
||||
TLS can be enabed per pattern basis:
|
||||
|
||||
.. code-block:: text
|
||||
|
||||
@@ -361,96 +338,6 @@ TLS can be enabled per pattern basis:
|
||||
In the above case, connection to serv1 will be encrypted by TLS. On
|
||||
the other hand, connection to serv2 will not be encrypted by TLS.
|
||||
|
||||
Dynamic hostname lookup
|
||||
-----------------------
|
||||
|
||||
By default, nghttpx performs backend hostname lookup at start up, or
|
||||
configuration reload, and keeps using them in its entire session. To
|
||||
make nghttpx perform hostname lookup dynamically, use ``dns``
|
||||
parameter in :option:`--backend` option, like so:
|
||||
|
||||
.. code-block:: text
|
||||
|
||||
backend=foo.example.com;;dns
|
||||
|
||||
nghttpx will cache resolved addresses for certain period of time. To
|
||||
change this cache period, use :option:`--dns-cache-timeout`.
|
||||
|
||||
Enable PROXY protocol
|
||||
---------------------
|
||||
|
||||
PROXY protocol can be enabled per frontend. In order to enable PROXY
|
||||
protocol, use ``proxyproto`` parameter in :option:`--frontend` option,
|
||||
like so:
|
||||
|
||||
.. code-block:: text
|
||||
|
||||
frontend=*,443;proxyproto
|
||||
|
||||
PSK cipher suites
|
||||
-----------------
|
||||
|
||||
nghttpx supports pre-shared key (PSK) cipher suites for both frontend
|
||||
and backend TLS connections. For frontend connection, use
|
||||
:option:`--psk-secrets` option to specify a file which contains PSK
|
||||
identity and secrets. The format of the file is
|
||||
``<identity>:<hex-secret>``, where ``<identity>`` is PSK identity, and
|
||||
``<hex-secret>`` is PSK secret in hex, like so:
|
||||
|
||||
.. code-block:: text
|
||||
|
||||
client1:9567800e065e078085c241d54a01c6c3f24b3bab71a606600f4c6ad2c134f3b9
|
||||
client2:b1376c3f8f6dcf7c886c5bdcceecd1e6f1d708622b6ddd21bda26ebd0c0bca99
|
||||
|
||||
nghttpx server accepts any of the identity and secret pairs in the
|
||||
file. The default cipher suite list does not contain PSK cipher
|
||||
suites. In order to use PSK, PSK cipher suite must be enabled by
|
||||
using :option:`--ciphers` option. The desired PSK cipher suite may be
|
||||
listed in `HTTP/2 cipher black list
|
||||
<https://tools.ietf.org/html/rfc7540#appendix-A>`_. In order to use
|
||||
such PSK cipher suite with HTTP/2, disable HTTP/2 cipher black list by
|
||||
using :option:`--no-http2-cipher-black-list` option. But you should
|
||||
understand its implications.
|
||||
|
||||
At the time of writing, even if only PSK cipher suites are specified
|
||||
in :option:`--ciphers` option, certificate and private key are still
|
||||
required.
|
||||
|
||||
For backend connection, use :option:`--client-psk-secrets` option to
|
||||
specify a file which contains single PSK identity and secret. The
|
||||
format is the same as the file used by :option:`--psk-secrets`
|
||||
described above, but only first identity and secret pair is solely
|
||||
used, like so:
|
||||
|
||||
.. code-block:: text
|
||||
|
||||
client2:b1376c3f8f6dcf7c886c5bdcceecd1e6f1d708622b6ddd21bda26ebd0c0bca99
|
||||
|
||||
The default cipher suite list does not contain PSK cipher suites. In
|
||||
order to use PSK, PSK cipher suite must be enabled by using
|
||||
:option:`--client-ciphers` option. The desired PSK cipher suite may
|
||||
be listed in `HTTP/2 cipher black list
|
||||
<https://tools.ietf.org/html/rfc7540#appendix-A>`_. In order to use
|
||||
such PSK cipher suite with HTTP/2, disable HTTP/2 cipher black list by
|
||||
using :option:`--client-no-http2-cipher-black-list` option. But you
|
||||
should understand its implications.
|
||||
|
||||
Migration from nghttpx v1.18.x or earlier
|
||||
-----------------------------------------
|
||||
|
||||
As of nghttpx v1.19.0, :option:`--ciphers` option only changes cipher
|
||||
list for frontend TLS connection. In order to change cipher list for
|
||||
backend connection, use :option:`--client-ciphers` option.
|
||||
|
||||
Similarly, :option:`--no-http2-cipher-black-list` option only disables
|
||||
HTTP/2 cipher black list for frontend connection. In order to disable
|
||||
HTTP/2 cipher black list for backend connection, use
|
||||
:option:`--client-no-http2-cipher-black-list` option.
|
||||
|
||||
``--accept-proxy-protocol`` option was deprecated. Instead, use
|
||||
``proxyproto`` parameter in :option:`--frontend` option to enable
|
||||
PROXY protocol support per frontend.
|
||||
|
||||
Migration from nghttpx v1.8.0 or earlier
|
||||
----------------------------------------
|
||||
|
||||
@@ -496,12 +383,3 @@ Use following options instead of ``--client-proxy``:
|
||||
http2-proxy=yes
|
||||
frontend=<ADDR>,<PORT>;no-tls
|
||||
backend=<ADDR>,<PORT>;;proto=h2;tls
|
||||
|
||||
We also removed ``--backend-http2-connections-per-worker`` option. It
|
||||
was present because previously the number of backend h2 connection was
|
||||
statically configured, and defaulted to 1. Now the number of backend
|
||||
h2 connection is increased on demand. We know the maximum number of
|
||||
concurrent streams per connection. When we push as many request as
|
||||
the maximum concurrency to the one connection, we create another new
|
||||
connection so that we can distribute load and avoid delay the request
|
||||
processing. This is done automatically without any configuration.
|
||||
|
||||
@@ -13,7 +13,7 @@ The extension module is called ``nghttp2``.
|
||||
determined by configure script. If the detected Python version is not
|
||||
what you expect, specify a path to Python executable in ``PYTHON``
|
||||
variable as an argument to configure script (e.g., ``./configure
|
||||
PYTHON=/usr/bin/python3.5``).
|
||||
PYTHON=/usr/bin/python3.4``).
|
||||
|
||||
HPACK API
|
||||
---------
|
||||
@@ -136,15 +136,13 @@ HTTP/2 servers
|
||||
|
||||
.. note::
|
||||
|
||||
We use :py:mod:`asyncio` for HTTP/2 server classes, and ALPN.
|
||||
Therefore, Python 3.5 or later is required to use these objects.
|
||||
To explicitly configure nghttp2 build to use Python 3.5, specify
|
||||
the ``PYTHON`` variable to the path to Python 3.5 executable when
|
||||
invoking configure script like this:
|
||||
We use :py:mod:`asyncio` for HTTP/2 server classes. Therefore,
|
||||
Python 3.4 or later is required to use these objects. To
|
||||
explicitly configure nghttp2 build to use Python 3.4, specify the
|
||||
``PYTHON`` variable to the path to Python 3.4 executable when
|
||||
invoking configure script like this::
|
||||
|
||||
.. code-block:: text
|
||||
|
||||
$ ./configure PYTHON=/usr/bin/python3.5
|
||||
$ ./configure PYTHON=/usr/bin/python3.4
|
||||
|
||||
.. py:class:: HTTP2Server(address, RequestHandlerClass, ssl=None)
|
||||
|
||||
|
||||
@@ -7,9 +7,7 @@ the end of this page. It also resides in the examples directory in
|
||||
the archive or repository.
|
||||
|
||||
This simple client takes a single HTTPS URI and retrieves the resource
|
||||
at the URI. The synopsis is:
|
||||
|
||||
.. code-block:: text
|
||||
at the URI. The synopsis is::
|
||||
|
||||
$ libevent-client HTTPS_URI
|
||||
|
||||
@@ -33,17 +31,6 @@ protocol the library supports::
|
||||
return SSL_TLSEXT_ERR_OK;
|
||||
}
|
||||
|
||||
If you are following TLS related RFC, you know that NPN is not the
|
||||
standardized way to negotiate HTTP/2. NPN itself is not event
|
||||
published as RFC. The standard way to negotiate HTTP/2 is ALPN,
|
||||
Application-Layer Protocol Negotiation Extension, defined in `RFC 7301
|
||||
<https://tools.ietf.org/html/rfc7301>`_. The one caveat of ALPN is
|
||||
that OpenSSL >= 1.0.2 is required. We use macro to enable/disable
|
||||
ALPN support depending on OpenSSL version. OpenSSL's ALPN
|
||||
implementation does not require callback function like the above. But
|
||||
we have to instruct OpenSSL SSL_CTX to use ALPN, which we'll talk
|
||||
about soon.
|
||||
|
||||
The callback is added to the SSL_CTX object using
|
||||
``SSL_CTX_set_next_proto_select_cb()``::
|
||||
|
||||
@@ -59,18 +46,9 @@ The callback is added to the SSL_CTX object using
|
||||
SSL_OP_NO_COMPRESSION |
|
||||
SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION);
|
||||
SSL_CTX_set_next_proto_select_cb(ssl_ctx, select_next_proto_cb, NULL);
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x10002000L
|
||||
SSL_CTX_set_alpn_protos(ssl_ctx, (const unsigned char *)"\x02h2", 3);
|
||||
#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L
|
||||
|
||||
return ssl_ctx;
|
||||
}
|
||||
|
||||
Here we see ``SSL_CTX_get_alpn_protos()`` function call. We instructs
|
||||
OpenSSL to notify the server that we support h2, ALPN identifier for
|
||||
HTTP/2.
|
||||
|
||||
The example client defines a couple of structs:
|
||||
|
||||
We define and use a ``http2_session_data`` structure to store data
|
||||
@@ -146,27 +124,7 @@ underlying network socket::
|
||||
if (events & BEV_EVENT_CONNECTED) {
|
||||
int fd = bufferevent_getfd(bev);
|
||||
int val = 1;
|
||||
const unsigned char *alpn = NULL;
|
||||
unsigned int alpnlen = 0;
|
||||
SSL *ssl;
|
||||
|
||||
fprintf(stderr, "Connected\n");
|
||||
|
||||
ssl = bufferevent_openssl_get_ssl(session_data->bev);
|
||||
|
||||
SSL_get0_next_proto_negotiated(ssl, &alpn, &alpnlen);
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x10002000L
|
||||
if (alpn == NULL) {
|
||||
SSL_get0_alpn_selected(ssl, &alpn, &alpnlen);
|
||||
}
|
||||
#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L
|
||||
|
||||
if (alpn == NULL || alpnlen != 2 || memcmp("h2", alpn, 2) != 0) {
|
||||
fprintf(stderr, "h2 is not negotiated\n");
|
||||
delete_http2_session_data(session_data);
|
||||
return;
|
||||
}
|
||||
|
||||
setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (char *)&val, sizeof(val));
|
||||
initialize_nghttp2_session(session_data);
|
||||
send_client_connection_header(session_data);
|
||||
@@ -186,9 +144,6 @@ underlying network socket::
|
||||
delete_http2_session_data(session_data);
|
||||
}
|
||||
|
||||
Here we validate that HTTP/2 is negotiated, and if not, drop
|
||||
connection.
|
||||
|
||||
For ``BEV_EVENT_EOF``, ``BEV_EVENT_ERROR``, and ``BEV_EVENT_TIMEOUT``
|
||||
events, we just simply tear down the connection.
|
||||
|
||||
|
||||
@@ -78,16 +78,15 @@ header data. To initialize the object, use
|
||||
|
||||
int nghttp2_hd_inflate_new(nghttp2_hd_inflater **inflater_ptr);
|
||||
|
||||
To inflate header data, use `nghttp2_hd_inflate_hd2()`::
|
||||
To inflate header data, use `nghttp2_hd_inflate_hd()`::
|
||||
|
||||
ssize_t nghttp2_hd_inflate_hd2(nghttp2_hd_inflater *inflater,
|
||||
nghttp2_nv *nv_out, int *inflate_flags,
|
||||
const uint8_t *in, size_t inlen,
|
||||
int in_final);
|
||||
ssize_t nghttp2_hd_inflate_hd(nghttp2_hd_inflater *inflater,
|
||||
nghttp2_nv *nv_out, int *inflate_flags,
|
||||
uint8_t *in, size_t inlen, int in_final);
|
||||
|
||||
`nghttp2_hd_inflate_hd2()` reads a stream of bytes and outputs a
|
||||
single header field at a time. Multiple calls are normally required to
|
||||
read a full stream of bytes and output all of the header fields.
|
||||
`nghttp2_hd_inflate_hd()` reads a stream of bytes and outputs a single
|
||||
header field at a time. Multiple calls are normally required to read a
|
||||
full stream of bytes and output all of the header fields.
|
||||
|
||||
The *inflater* is the inflater object initialized above. The *nv_out*
|
||||
is a pointer to a :type:`nghttp2_nv` into which one header field may
|
||||
@@ -119,7 +118,11 @@ If *in_final* is zero and the :macro:`NGHTTP2_HD_INFLATE_EMIT` flag is
|
||||
not set, it indicates that all given data was processed. The caller
|
||||
is required to pass additional data.
|
||||
|
||||
Example usage of `nghttp2_hd_inflate_hd2()` is shown in the
|
||||
It is important to note that the function may produce one or more
|
||||
header fields even if *inlen* is 0 when *in_final* is nonzero, due to
|
||||
differential encoding.
|
||||
|
||||
Example usage of `nghttp2_hd_inflate_hd()` is shown in the
|
||||
`inflate_header_block()` function in `deflate.c`_.
|
||||
|
||||
Finally, to delete a :type:`nghttp2_hd_inflater` object, use
|
||||
|
||||
@@ -10,9 +10,7 @@ archive or repository.
|
||||
|
||||
This simple server takes 3 arguments: The port number to listen on,
|
||||
the path to your SSL/TLS private key file, and the path to your
|
||||
certificate file. The synopsis is:
|
||||
|
||||
.. code-block:: text
|
||||
certificate file. The synopsis is::
|
||||
|
||||
$ libevent-server PORT /path/to/server.key /path/to/server.crt
|
||||
|
||||
@@ -27,17 +25,7 @@ application protocols the server supports to a client. In this
|
||||
example program, when creating the ``SSL_CTX`` object, we store the
|
||||
application protocol name in the wire format of NPN in a statically
|
||||
allocated buffer. This is safe because we only create one ``SSL_CTX``
|
||||
object in the program's entire lifetime.
|
||||
|
||||
If you are following TLS related RFC, you know that NPN is not the
|
||||
standardized way to negotiate HTTP/2. NPN itself is not even
|
||||
published as RFC. The standard way to negotiate HTTP/2 is ALPN,
|
||||
Application-Layer Protocol Negotiation Extension, defined in `RFC 7301
|
||||
<https://tools.ietf.org/html/rfc7301>`_. The one caveat of ALPN is
|
||||
that OpenSSL >= 1.0.2 is required. We use macro to enable/disable
|
||||
ALPN support depending on OpenSSL version. In ALPN, client sends the
|
||||
list of supported application protocols, and server selects one of
|
||||
them. We provide the callback for it::
|
||||
object in the program's entire lifetime::
|
||||
|
||||
static unsigned char next_proto_list[256];
|
||||
static size_t next_proto_list_len;
|
||||
@@ -49,22 +37,6 @@ them. We provide the callback for it::
|
||||
return SSL_TLSEXT_ERR_OK;
|
||||
}
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x10002000L
|
||||
static int alpn_select_proto_cb(SSL *ssl _U_, const unsigned char **out,
|
||||
unsigned char *outlen, const unsigned char *in,
|
||||
unsigned int inlen, void *arg _U_) {
|
||||
int rv;
|
||||
|
||||
rv = nghttp2_select_next_protocol((unsigned char **)out, outlen, in, inlen);
|
||||
|
||||
if (rv != 1) {
|
||||
return SSL_TLSEXT_ERR_NOACK;
|
||||
}
|
||||
|
||||
return SSL_TLSEXT_ERR_OK;
|
||||
}
|
||||
#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L
|
||||
|
||||
static SSL_CTX *create_ssl_ctx(const char *key_file, const char *cert_file) {
|
||||
SSL_CTX *ssl_ctx;
|
||||
EC_KEY *ecdh;
|
||||
@@ -79,11 +51,6 @@ them. We provide the callback for it::
|
||||
next_proto_list_len = 1 + NGHTTP2_PROTO_VERSION_ID_LEN;
|
||||
|
||||
SSL_CTX_set_next_protos_advertised_cb(ssl_ctx, next_proto_cb, NULL);
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x10002000L
|
||||
SSL_CTX_set_alpn_select_cb(ssl_ctx, alpn_select_proto_cb, NULL);
|
||||
#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L
|
||||
|
||||
return ssl_ctx;
|
||||
}
|
||||
|
||||
@@ -97,11 +64,6 @@ OpenSSL implementation, we just assign the pointer to the NPN buffers
|
||||
we filled in earlier. The NPN callback function is set to the
|
||||
``SSL_CTX`` object using ``SSL_CTX_set_next_protos_advertised_cb()``.
|
||||
|
||||
In ``alpn_select_proto_cb()``, we use `nghttp2_select_next_protocol()`
|
||||
to select application protocol. The `nghttp2_select_next_protocol()`
|
||||
returns 1 only if it selected h2 (ALPN identifier for HTTP/2), and out
|
||||
parameters were assigned accordingly.
|
||||
|
||||
Next, let's take a look at the main structures used by the example
|
||||
application:
|
||||
|
||||
@@ -205,31 +167,11 @@ underlying network socket::
|
||||
static void eventcb(struct bufferevent *bev _U_, short events, void *ptr) {
|
||||
http2_session_data *session_data = (http2_session_data *)ptr;
|
||||
if (events & BEV_EVENT_CONNECTED) {
|
||||
const unsigned char *alpn = NULL;
|
||||
unsigned int alpnlen = 0;
|
||||
SSL *ssl;
|
||||
|
||||
fprintf(stderr, "%s connected\n", session_data->client_addr);
|
||||
|
||||
ssl = bufferevent_openssl_get_ssl(session_data->bev);
|
||||
|
||||
SSL_get0_next_proto_negotiated(ssl, &alpn, &alpnlen);
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x10002000L
|
||||
if (alpn == NULL) {
|
||||
SSL_get0_alpn_selected(ssl, &alpn, &alpnlen);
|
||||
}
|
||||
#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L
|
||||
|
||||
if (alpn == NULL || alpnlen != 2 || memcmp("h2", alpn, 2) != 0) {
|
||||
fprintf(stderr, "%s h2 is not negotiated\n", session_data->client_addr);
|
||||
delete_http2_session_data(session_data);
|
||||
return;
|
||||
}
|
||||
|
||||
initialize_nghttp2_session(session_data);
|
||||
|
||||
if (send_server_connection_header(session_data) != 0 ||
|
||||
session_send(session_data) != 0) {
|
||||
if (send_server_connection_header(session_data) != 0) {
|
||||
delete_http2_session_data(session_data);
|
||||
return;
|
||||
}
|
||||
@@ -246,9 +188,6 @@ underlying network socket::
|
||||
delete_http2_session_data(session_data);
|
||||
}
|
||||
|
||||
Here we validate that HTTP/2 is negotiated, and if not, drop
|
||||
connection.
|
||||
|
||||
For the ``BEV_EVENT_EOF``, ``BEV_EVENT_ERROR``, and
|
||||
``BEV_EVENT_TIMEOUT`` events, we just simply tear down the connection.
|
||||
The ``delete_http2_session_data()`` function destroys the
|
||||
|
||||
@@ -29,6 +29,10 @@ if(ENABLE_EXAMPLES)
|
||||
add_executable(libevent-server libevent-server.c $<TARGET_OBJECTS:http-parser>)
|
||||
add_executable(deflate deflate.c $<TARGET_OBJECTS:http-parser>)
|
||||
|
||||
if(ENABLE_TINY_NGHTTPD)
|
||||
add_executable(tiny-nghttpd tiny-nghttpd.c $<TARGET_OBJECTS:http-parser>)
|
||||
endif()
|
||||
|
||||
if(ENABLE_ASIO_LIB)
|
||||
foreach(name asio-sv asio-sv2 asio-cl asio-cl2)
|
||||
add_executable(${name} ${name}.cc $<TARGET_OBJECTS:http-parser>)
|
||||
|
||||
@@ -51,6 +51,14 @@ libevent_server_SOURCES = libevent-server.c
|
||||
|
||||
deflate_SOURCES = deflate.c
|
||||
|
||||
if ENABLE_TINY_NGHTTPD
|
||||
|
||||
noinst_PROGRAMS += tiny-nghttpd
|
||||
|
||||
tiny_nghttpd_SOURCES = tiny-nghttpd.c
|
||||
|
||||
endif # ENABLE_TINY_NGHTTPD
|
||||
|
||||
if ENABLE_ASIO_LIB
|
||||
|
||||
noinst_PROGRAMS += asio-sv asio-sv2 asio-cl asio-cl2
|
||||
@@ -62,11 +70,11 @@ ASIOCPPFLAGS = ${AM_CPPFLAGS} ${BOOST_CPPFLAGS}
|
||||
ASIOLDADD = $(top_builddir)/lib/libnghttp2.la \
|
||||
$(top_builddir)/src/libnghttp2_asio.la @JEMALLOC_LIBS@ \
|
||||
$(top_builddir)/third-party/libhttp-parser.la \
|
||||
@OPENSSL_LIBS@ \
|
||||
${BOOST_LDFLAGS} \
|
||||
${BOOST_ASIO_LIB} \
|
||||
${BOOST_THREAD_LIB} \
|
||||
${BOOST_SYSTEM_LIB} \
|
||||
@OPENSSL_LIBS@ \
|
||||
@APPLDFLAGS@
|
||||
|
||||
asio_sv_SOURCES = asio-sv.cc
|
||||
|
||||
@@ -66,13 +66,13 @@ enum { IO_NONE, WANT_READ, WANT_WRITE };
|
||||
|
||||
#define MAKE_NV(NAME, VALUE) \
|
||||
{ \
|
||||
(uint8_t *)NAME, (uint8_t *)VALUE, sizeof(NAME) - 1, sizeof(VALUE) - 1, \
|
||||
(uint8_t *) NAME, (uint8_t *)VALUE, sizeof(NAME) - 1, sizeof(VALUE) - 1, \
|
||||
NGHTTP2_NV_FLAG_NONE \
|
||||
}
|
||||
|
||||
#define MAKE_NV_CS(NAME, VALUE) \
|
||||
{ \
|
||||
(uint8_t *)NAME, (uint8_t *)VALUE, sizeof(NAME) - 1, strlen(VALUE), \
|
||||
(uint8_t *) NAME, (uint8_t *)VALUE, sizeof(NAME) - 1, strlen(VALUE), \
|
||||
NGHTTP2_NV_FLAG_NONE \
|
||||
}
|
||||
|
||||
@@ -159,13 +159,10 @@ static void diec(const char *func, int error_code) {
|
||||
* bytes actually written. See the documentation of
|
||||
* nghttp2_send_callback for the details.
|
||||
*/
|
||||
static ssize_t send_callback(nghttp2_session *session, const uint8_t *data,
|
||||
size_t length, int flags, void *user_data) {
|
||||
static ssize_t send_callback(nghttp2_session *session _U_, const uint8_t *data,
|
||||
size_t length, int flags _U_, void *user_data) {
|
||||
struct Connection *connection;
|
||||
int rv;
|
||||
(void)session;
|
||||
(void)flags;
|
||||
|
||||
connection = (struct Connection *)user_data;
|
||||
connection->want_io = IO_NONE;
|
||||
ERR_clear_error();
|
||||
@@ -189,13 +186,10 @@ static ssize_t send_callback(nghttp2_session *session, const uint8_t *data,
|
||||
* |length| bytes. Returns the number of bytes stored in |buf|. See
|
||||
* the documentation of nghttp2_recv_callback for the details.
|
||||
*/
|
||||
static ssize_t recv_callback(nghttp2_session *session, uint8_t *buf,
|
||||
size_t length, int flags, void *user_data) {
|
||||
static ssize_t recv_callback(nghttp2_session *session _U_, uint8_t *buf,
|
||||
size_t length, int flags _U_, void *user_data) {
|
||||
struct Connection *connection;
|
||||
int rv;
|
||||
(void)session;
|
||||
(void)flags;
|
||||
|
||||
connection = (struct Connection *)user_data;
|
||||
connection->want_io = IO_NONE;
|
||||
ERR_clear_error();
|
||||
@@ -216,19 +210,18 @@ static ssize_t recv_callback(nghttp2_session *session, uint8_t *buf,
|
||||
}
|
||||
|
||||
static int on_frame_send_callback(nghttp2_session *session,
|
||||
const nghttp2_frame *frame, void *user_data) {
|
||||
const nghttp2_frame *frame,
|
||||
void *user_data _U_) {
|
||||
size_t i;
|
||||
(void)user_data;
|
||||
|
||||
switch (frame->hd.type) {
|
||||
case NGHTTP2_HEADERS:
|
||||
if (nghttp2_session_get_stream_user_data(session, frame->hd.stream_id)) {
|
||||
const nghttp2_nv *nva = frame->headers.nva;
|
||||
printf("[INFO] C ----------------------------> S (HEADERS)\n");
|
||||
for (i = 0; i < frame->headers.nvlen; ++i) {
|
||||
fwrite(nva[i].name, 1, nva[i].namelen, stdout);
|
||||
fwrite(nva[i].name, nva[i].namelen, 1, stdout);
|
||||
printf(": ");
|
||||
fwrite(nva[i].value, 1, nva[i].valuelen, stdout);
|
||||
fwrite(nva[i].value, nva[i].valuelen, 1, stdout);
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
@@ -244,10 +237,9 @@ static int on_frame_send_callback(nghttp2_session *session,
|
||||
}
|
||||
|
||||
static int on_frame_recv_callback(nghttp2_session *session,
|
||||
const nghttp2_frame *frame, void *user_data) {
|
||||
const nghttp2_frame *frame,
|
||||
void *user_data _U_) {
|
||||
size_t i;
|
||||
(void)user_data;
|
||||
|
||||
switch (frame->hd.type) {
|
||||
case NGHTTP2_HEADERS:
|
||||
if (frame->headers.cat == NGHTTP2_HCAT_RESPONSE) {
|
||||
@@ -257,9 +249,9 @@ static int on_frame_recv_callback(nghttp2_session *session,
|
||||
if (req) {
|
||||
printf("[INFO] C <---------------------------- S (HEADERS)\n");
|
||||
for (i = 0; i < frame->headers.nvlen; ++i) {
|
||||
fwrite(nva[i].name, 1, nva[i].namelen, stdout);
|
||||
fwrite(nva[i].name, nva[i].namelen, 1, stdout);
|
||||
printf(": ");
|
||||
fwrite(nva[i].value, 1, nva[i].valuelen, stdout);
|
||||
fwrite(nva[i].value, nva[i].valuelen, 1, stdout);
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
@@ -282,11 +274,9 @@ static int on_frame_recv_callback(nghttp2_session *session,
|
||||
* we submit GOAWAY and close the session.
|
||||
*/
|
||||
static int on_stream_close_callback(nghttp2_session *session, int32_t stream_id,
|
||||
uint32_t error_code, void *user_data) {
|
||||
uint32_t error_code _U_,
|
||||
void *user_data _U_) {
|
||||
struct Request *req;
|
||||
(void)error_code;
|
||||
(void)user_data;
|
||||
|
||||
req = nghttp2_session_get_stream_user_data(session, stream_id);
|
||||
if (req) {
|
||||
int rv;
|
||||
@@ -303,13 +293,11 @@ static int on_stream_close_callback(nghttp2_session *session, int32_t stream_id,
|
||||
* The implementation of nghttp2_on_data_chunk_recv_callback type. We
|
||||
* use this function to print the received response body.
|
||||
*/
|
||||
static int on_data_chunk_recv_callback(nghttp2_session *session, uint8_t flags,
|
||||
int32_t stream_id, const uint8_t *data,
|
||||
size_t len, void *user_data) {
|
||||
static int on_data_chunk_recv_callback(nghttp2_session *session,
|
||||
uint8_t flags _U_, int32_t stream_id,
|
||||
const uint8_t *data, size_t len,
|
||||
void *user_data _U_) {
|
||||
struct Request *req;
|
||||
(void)flags;
|
||||
(void)user_data;
|
||||
|
||||
req = nghttp2_session_get_stream_user_data(session, stream_id);
|
||||
if (req) {
|
||||
printf("[INFO] C <---------------------------- S (DATA chunk)\n"
|
||||
@@ -350,13 +338,10 @@ static void setup_nghttp2_callbacks(nghttp2_session_callbacks *callbacks) {
|
||||
* HTTP/2 protocol, if server does not offer HTTP/2 the nghttp2
|
||||
* library supports, we terminate program.
|
||||
*/
|
||||
static int select_next_proto_cb(SSL *ssl, unsigned char **out,
|
||||
static int select_next_proto_cb(SSL *ssl _U_, unsigned char **out,
|
||||
unsigned char *outlen, const unsigned char *in,
|
||||
unsigned int inlen, void *arg) {
|
||||
unsigned int inlen, void *arg _U_) {
|
||||
int rv;
|
||||
(void)ssl;
|
||||
(void)arg;
|
||||
|
||||
/* nghttp2_select_next_protocol() selects HTTP/2 protocol the
|
||||
nghttp2 library supports. */
|
||||
rv = nghttp2_select_next_protocol(out, outlen, in, inlen);
|
||||
@@ -472,12 +457,11 @@ static void ctl_poll(struct pollfd *pollfd, struct Connection *connection) {
|
||||
static void submit_request(struct Connection *connection, struct Request *req) {
|
||||
int32_t stream_id;
|
||||
/* Make sure that the last item is NULL */
|
||||
const nghttp2_nv nva[] = {MAKE_NV(":method", "GET"),
|
||||
MAKE_NV_CS(":path", req->path),
|
||||
MAKE_NV(":scheme", "https"),
|
||||
MAKE_NV_CS(":authority", req->hostport),
|
||||
MAKE_NV("accept", "*/*"),
|
||||
MAKE_NV("user-agent", "nghttp2/" NGHTTP2_VERSION)};
|
||||
const nghttp2_nv nva[] = {
|
||||
MAKE_NV(":method", "GET"), MAKE_NV_CS(":path", req->path),
|
||||
MAKE_NV(":scheme", "https"), MAKE_NV_CS(":authority", req->hostport),
|
||||
MAKE_NV("accept", "*/*"),
|
||||
MAKE_NV("user-agent", "nghttp2/" NGHTTP2_VERSION)};
|
||||
|
||||
stream_id = nghttp2_submit_request(connection->session, NULL, nva,
|
||||
sizeof(nva) / sizeof(nva[0]), NULL, req);
|
||||
@@ -578,11 +562,7 @@ static void fetch_uri(const struct URI *uri) {
|
||||
diec("nghttp2_session_client_new", rv);
|
||||
}
|
||||
|
||||
rv = nghttp2_submit_settings(connection.session, NGHTTP2_FLAG_NONE, NULL, 0);
|
||||
|
||||
if (rv != 0) {
|
||||
diec("nghttp2_submit_settings", rv);
|
||||
}
|
||||
nghttp2_submit_settings(connection.session, NGHTTP2_FLAG_NONE, NULL, 0);
|
||||
|
||||
/* Submit the HTTP request to the outbound queue. */
|
||||
submit_request(&connection, &req);
|
||||
@@ -711,6 +691,9 @@ int main(int argc, char **argv) {
|
||||
act.sa_handler = SIG_IGN;
|
||||
sigaction(SIGPIPE, &act, 0);
|
||||
|
||||
#ifndef OPENSSL_IS_BORINGSSL
|
||||
OPENSSL_config(NULL);
|
||||
#endif /* OPENSSL_IS_BORINGSSL */
|
||||
SSL_load_error_strings();
|
||||
SSL_library_init();
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
#define MAKE_NV(K, V) \
|
||||
{ \
|
||||
(uint8_t *)K, (uint8_t *)V, sizeof(K) - 1, sizeof(V) - 1, \
|
||||
(uint8_t *) K, (uint8_t *)V, sizeof(K) - 1, sizeof(V) - 1, \
|
||||
NGHTTP2_NV_FLAG_NONE \
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ static void deflate(nghttp2_hd_deflater *deflater,
|
||||
static int inflate_header_block(nghttp2_hd_inflater *inflater, uint8_t *in,
|
||||
size_t inlen, int final);
|
||||
|
||||
int main() {
|
||||
int main(int argc _U_, char **argv _U_) {
|
||||
int rv;
|
||||
nghttp2_hd_deflater *deflater;
|
||||
nghttp2_hd_inflater *inflater;
|
||||
@@ -109,9 +109,9 @@ static void deflate(nghttp2_hd_deflater *deflater,
|
||||
printf("Input (%zu byte(s)):\n\n", sum);
|
||||
|
||||
for (i = 0; i < nvlen; ++i) {
|
||||
fwrite(nva[i].name, 1, nva[i].namelen, stdout);
|
||||
fwrite(nva[i].name, nva[i].namelen, 1, stdout);
|
||||
printf(": ");
|
||||
fwrite(nva[i].value, 1, nva[i].valuelen, stdout);
|
||||
fwrite(nva[i].value, nva[i].valuelen, 1, stdout);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
@@ -186,9 +186,9 @@ int inflate_header_block(nghttp2_hd_inflater *inflater, uint8_t *in,
|
||||
inlen -= proclen;
|
||||
|
||||
if (inflate_flags & NGHTTP2_HD_INFLATE_EMIT) {
|
||||
fwrite(nv.name, 1, nv.namelen, stderr);
|
||||
fwrite(nv.name, nv.namelen, 1, stderr);
|
||||
fprintf(stderr, ": ");
|
||||
fwrite(nv.value, 1, nv.valuelen, stderr);
|
||||
fwrite(nv.value, nv.valuelen, 1, stderr);
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
|
||||
|
||||
@@ -179,9 +179,9 @@ static void delete_http2_session_data(http2_session_data *session_data) {
|
||||
|
||||
static void print_header(FILE *f, const uint8_t *name, size_t namelen,
|
||||
const uint8_t *value, size_t valuelen) {
|
||||
fwrite(name, 1, namelen, f);
|
||||
fwrite(name, namelen, 1, f);
|
||||
fprintf(f, ": ");
|
||||
fwrite(value, 1, valuelen, f);
|
||||
fwrite(value, valuelen, 1, f);
|
||||
fprintf(f, "\n");
|
||||
}
|
||||
|
||||
@@ -199,27 +199,22 @@ static void print_headers(FILE *f, nghttp2_nv *nva, size_t nvlen) {
|
||||
/* nghttp2_send_callback. Here we transmit the |data|, |length| bytes,
|
||||
to the network. Because we are using libevent bufferevent, we just
|
||||
write those bytes into bufferevent buffer. */
|
||||
static ssize_t send_callback(nghttp2_session *session, const uint8_t *data,
|
||||
size_t length, int flags, void *user_data) {
|
||||
static ssize_t send_callback(nghttp2_session *session _U_, const uint8_t *data,
|
||||
size_t length, int flags _U_, void *user_data) {
|
||||
http2_session_data *session_data = (http2_session_data *)user_data;
|
||||
struct bufferevent *bev = session_data->bev;
|
||||
(void)session;
|
||||
(void)flags;
|
||||
|
||||
bufferevent_write(bev, data, length);
|
||||
return (ssize_t)length;
|
||||
}
|
||||
|
||||
/* nghttp2_on_header_callback: Called when nghttp2 library emits
|
||||
single header name/value pair. */
|
||||
static int on_header_callback(nghttp2_session *session,
|
||||
static int on_header_callback(nghttp2_session *session _U_,
|
||||
const nghttp2_frame *frame, const uint8_t *name,
|
||||
size_t namelen, const uint8_t *value,
|
||||
size_t valuelen, uint8_t flags, void *user_data) {
|
||||
size_t valuelen, uint8_t flags _U_,
|
||||
void *user_data) {
|
||||
http2_session_data *session_data = (http2_session_data *)user_data;
|
||||
(void)session;
|
||||
(void)flags;
|
||||
|
||||
switch (frame->hd.type) {
|
||||
case NGHTTP2_HEADERS:
|
||||
if (frame->headers.cat == NGHTTP2_HCAT_RESPONSE &&
|
||||
@@ -234,12 +229,10 @@ static int on_header_callback(nghttp2_session *session,
|
||||
|
||||
/* nghttp2_on_begin_headers_callback: Called when nghttp2 library gets
|
||||
started to receive header block. */
|
||||
static int on_begin_headers_callback(nghttp2_session *session,
|
||||
static int on_begin_headers_callback(nghttp2_session *session _U_,
|
||||
const nghttp2_frame *frame,
|
||||
void *user_data) {
|
||||
http2_session_data *session_data = (http2_session_data *)user_data;
|
||||
(void)session;
|
||||
|
||||
switch (frame->hd.type) {
|
||||
case NGHTTP2_HEADERS:
|
||||
if (frame->headers.cat == NGHTTP2_HCAT_RESPONSE &&
|
||||
@@ -254,11 +247,9 @@ static int on_begin_headers_callback(nghttp2_session *session,
|
||||
|
||||
/* nghttp2_on_frame_recv_callback: Called when nghttp2 library
|
||||
received a complete frame from the remote peer. */
|
||||
static int on_frame_recv_callback(nghttp2_session *session,
|
||||
static int on_frame_recv_callback(nghttp2_session *session _U_,
|
||||
const nghttp2_frame *frame, void *user_data) {
|
||||
http2_session_data *session_data = (http2_session_data *)user_data;
|
||||
(void)session;
|
||||
|
||||
switch (frame->hd.type) {
|
||||
case NGHTTP2_HEADERS:
|
||||
if (frame->headers.cat == NGHTTP2_HCAT_RESPONSE &&
|
||||
@@ -275,15 +266,13 @@ static int on_frame_recv_callback(nghttp2_session *session,
|
||||
is meant to the stream we initiated, print the received data in
|
||||
stdout, so that the user can redirect its output to the file
|
||||
easily. */
|
||||
static int on_data_chunk_recv_callback(nghttp2_session *session, uint8_t flags,
|
||||
int32_t stream_id, const uint8_t *data,
|
||||
size_t len, void *user_data) {
|
||||
static int on_data_chunk_recv_callback(nghttp2_session *session _U_,
|
||||
uint8_t flags _U_, int32_t stream_id,
|
||||
const uint8_t *data, size_t len,
|
||||
void *user_data) {
|
||||
http2_session_data *session_data = (http2_session_data *)user_data;
|
||||
(void)session;
|
||||
(void)flags;
|
||||
|
||||
if (session_data->stream_data->stream_id == stream_id) {
|
||||
fwrite(data, 1, len, stdout);
|
||||
fwrite(data, len, 1, stdout);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -298,7 +287,7 @@ static int on_stream_close_callback(nghttp2_session *session, int32_t stream_id,
|
||||
int rv;
|
||||
|
||||
if (session_data->stream_data->stream_id == stream_id) {
|
||||
fprintf(stderr, "Stream %d closed with error_code=%u\n", stream_id,
|
||||
fprintf(stderr, "Stream %d closed with error_code=%d\n", stream_id,
|
||||
error_code);
|
||||
rv = nghttp2_session_terminate_session(session, NGHTTP2_NO_ERROR);
|
||||
if (rv != 0) {
|
||||
@@ -311,12 +300,9 @@ static int on_stream_close_callback(nghttp2_session *session, int32_t stream_id,
|
||||
/* NPN TLS extension client callback. We check that server advertised
|
||||
the HTTP/2 protocol the nghttp2 library supports. If not, exit
|
||||
the program. */
|
||||
static int select_next_proto_cb(SSL *ssl, unsigned char **out,
|
||||
static int select_next_proto_cb(SSL *ssl _U_, unsigned char **out,
|
||||
unsigned char *outlen, const unsigned char *in,
|
||||
unsigned int inlen, void *arg) {
|
||||
(void)ssl;
|
||||
(void)arg;
|
||||
|
||||
unsigned int inlen, void *arg _U_) {
|
||||
if (nghttp2_select_next_protocol(out, outlen, in, inlen) <= 0) {
|
||||
errx(1, "Server did not advertise " NGHTTP2_PROTO_VERSION_ID);
|
||||
}
|
||||
@@ -336,11 +322,6 @@ static SSL_CTX *create_ssl_ctx(void) {
|
||||
SSL_OP_NO_COMPRESSION |
|
||||
SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION);
|
||||
SSL_CTX_set_next_proto_select_cb(ssl_ctx, select_next_proto_cb, NULL);
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x10002000L
|
||||
SSL_CTX_set_alpn_protos(ssl_ctx, (const unsigned char *)"\x02h2", 3);
|
||||
#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L
|
||||
|
||||
return ssl_ctx;
|
||||
}
|
||||
|
||||
@@ -397,13 +378,13 @@ static void send_client_connection_header(http2_session_data *session_data) {
|
||||
|
||||
#define MAKE_NV(NAME, VALUE, VALUELEN) \
|
||||
{ \
|
||||
(uint8_t *)NAME, (uint8_t *)VALUE, sizeof(NAME) - 1, VALUELEN, \
|
||||
(uint8_t *) NAME, (uint8_t *)VALUE, sizeof(NAME) - 1, VALUELEN, \
|
||||
NGHTTP2_NV_FLAG_NONE \
|
||||
}
|
||||
|
||||
#define MAKE_NV2(NAME, VALUE) \
|
||||
{ \
|
||||
(uint8_t *)NAME, (uint8_t *)VALUE, sizeof(NAME) - 1, sizeof(VALUE) - 1, \
|
||||
(uint8_t *) NAME, (uint8_t *)VALUE, sizeof(NAME) - 1, sizeof(VALUE) - 1, \
|
||||
NGHTTP2_NV_FLAG_NONE \
|
||||
}
|
||||
|
||||
@@ -475,10 +456,8 @@ static void readcb(struct bufferevent *bev, void *ptr) {
|
||||
receiving GOAWAY, we check the some conditions on the nghttp2
|
||||
library and output buffer of bufferevent. If it indicates we have
|
||||
no business to this session, tear down the connection. */
|
||||
static void writecb(struct bufferevent *bev, void *ptr) {
|
||||
static void writecb(struct bufferevent *bev _U_, void *ptr) {
|
||||
http2_session_data *session_data = (http2_session_data *)ptr;
|
||||
(void)bev;
|
||||
|
||||
if (nghttp2_session_want_read(session_data->session) == 0 &&
|
||||
nghttp2_session_want_write(session_data->session) == 0 &&
|
||||
evbuffer_get_length(bufferevent_get_output(session_data->bev)) == 0) {
|
||||
@@ -496,27 +475,7 @@ static void eventcb(struct bufferevent *bev, short events, void *ptr) {
|
||||
if (events & BEV_EVENT_CONNECTED) {
|
||||
int fd = bufferevent_getfd(bev);
|
||||
int val = 1;
|
||||
const unsigned char *alpn = NULL;
|
||||
unsigned int alpnlen = 0;
|
||||
SSL *ssl;
|
||||
|
||||
fprintf(stderr, "Connected\n");
|
||||
|
||||
ssl = bufferevent_openssl_get_ssl(session_data->bev);
|
||||
|
||||
SSL_get0_next_proto_negotiated(ssl, &alpn, &alpnlen);
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x10002000L
|
||||
if (alpn == NULL) {
|
||||
SSL_get0_alpn_selected(ssl, &alpn, &alpnlen);
|
||||
}
|
||||
#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L
|
||||
|
||||
if (alpn == NULL || alpnlen != 2 || memcmp("h2", alpn, 2) != 0) {
|
||||
fprintf(stderr, "h2 is not negotiated\n");
|
||||
delete_http2_session_data(session_data);
|
||||
return;
|
||||
}
|
||||
|
||||
setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (char *)&val, sizeof(val));
|
||||
initialize_nghttp2_session(session_data);
|
||||
send_client_connection_header(session_data);
|
||||
@@ -610,6 +569,9 @@ int main(int argc, char **argv) {
|
||||
act.sa_handler = SIG_IGN;
|
||||
sigaction(SIGPIPE, &act, NULL);
|
||||
|
||||
#ifndef OPENSSL_IS_BORINGSSL
|
||||
OPENSSL_config(NULL);
|
||||
#endif /* OPENSSL_IS_BORINGSSL */
|
||||
SSL_load_error_strings();
|
||||
SSL_library_init();
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
|
||||
#define MAKE_NV(NAME, VALUE) \
|
||||
{ \
|
||||
(uint8_t *)NAME, (uint8_t *)VALUE, sizeof(NAME) - 1, sizeof(VALUE) - 1, \
|
||||
(uint8_t *) NAME, (uint8_t *)VALUE, sizeof(NAME) - 1, sizeof(VALUE) - 1, \
|
||||
NGHTTP2_NV_FLAG_NONE \
|
||||
}
|
||||
|
||||
@@ -109,34 +109,13 @@ struct app_context {
|
||||
static unsigned char next_proto_list[256];
|
||||
static size_t next_proto_list_len;
|
||||
|
||||
static int next_proto_cb(SSL *ssl, const unsigned char **data,
|
||||
unsigned int *len, void *arg) {
|
||||
(void)ssl;
|
||||
(void)arg;
|
||||
|
||||
static int next_proto_cb(SSL *s _U_, const unsigned char **data,
|
||||
unsigned int *len, void *arg _U_) {
|
||||
*data = next_proto_list;
|
||||
*len = (unsigned int)next_proto_list_len;
|
||||
return SSL_TLSEXT_ERR_OK;
|
||||
}
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x10002000L
|
||||
static int alpn_select_proto_cb(SSL *ssl, const unsigned char **out,
|
||||
unsigned char *outlen, const unsigned char *in,
|
||||
unsigned int inlen, void *arg) {
|
||||
int rv;
|
||||
(void)ssl;
|
||||
(void)arg;
|
||||
|
||||
rv = nghttp2_select_next_protocol((unsigned char **)out, outlen, in, inlen);
|
||||
|
||||
if (rv != 1) {
|
||||
return SSL_TLSEXT_ERR_NOACK;
|
||||
}
|
||||
|
||||
return SSL_TLSEXT_ERR_OK;
|
||||
}
|
||||
#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L
|
||||
|
||||
/* Create SSL_CTX. */
|
||||
static SSL_CTX *create_ssl_ctx(const char *key_file, const char *cert_file) {
|
||||
SSL_CTX *ssl_ctx;
|
||||
@@ -173,11 +152,6 @@ static SSL_CTX *create_ssl_ctx(const char *key_file, const char *cert_file) {
|
||||
next_proto_list_len = 1 + NGHTTP2_PROTO_VERSION_ID_LEN;
|
||||
|
||||
SSL_CTX_set_next_protos_advertised_cb(ssl_ctx, next_proto_cb, NULL);
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x10002000L
|
||||
SSL_CTX_set_alpn_select_cb(ssl_ctx, alpn_select_proto_cb, NULL);
|
||||
#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L
|
||||
|
||||
return ssl_ctx;
|
||||
}
|
||||
|
||||
@@ -202,10 +176,8 @@ static void add_stream(http2_session_data *session_data,
|
||||
}
|
||||
}
|
||||
|
||||
static void remove_stream(http2_session_data *session_data,
|
||||
static void remove_stream(http2_session_data *session_data _U_,
|
||||
http2_stream_data *stream_data) {
|
||||
(void)session_data;
|
||||
|
||||
stream_data->prev->next = stream_data->next;
|
||||
if (stream_data->next) {
|
||||
stream_data->next->prev = stream_data->prev;
|
||||
@@ -316,13 +288,10 @@ static int session_recv(http2_session_data *session_data) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static ssize_t send_callback(nghttp2_session *session, const uint8_t *data,
|
||||
size_t length, int flags, void *user_data) {
|
||||
static ssize_t send_callback(nghttp2_session *session _U_, const uint8_t *data,
|
||||
size_t length, int flags _U_, void *user_data) {
|
||||
http2_session_data *session_data = (http2_session_data *)user_data;
|
||||
struct bufferevent *bev = session_data->bev;
|
||||
(void)session;
|
||||
(void)flags;
|
||||
|
||||
/* Avoid excessive buffering in server side. */
|
||||
if (evbuffer_get_length(bufferevent_get_output(session_data->bev)) >=
|
||||
OUTPUT_WOULDBLOCK_THRESHOLD) {
|
||||
@@ -385,17 +354,13 @@ static char *percent_decode(const uint8_t *value, size_t valuelen) {
|
||||
return res;
|
||||
}
|
||||
|
||||
static ssize_t file_read_callback(nghttp2_session *session, int32_t stream_id,
|
||||
uint8_t *buf, size_t length,
|
||||
uint32_t *data_flags,
|
||||
static ssize_t file_read_callback(nghttp2_session *session _U_,
|
||||
int32_t stream_id _U_, uint8_t *buf,
|
||||
size_t length, uint32_t *data_flags,
|
||||
nghttp2_data_source *source,
|
||||
void *user_data) {
|
||||
void *user_data _U_) {
|
||||
int fd = source->fd;
|
||||
ssize_t r;
|
||||
(void)session;
|
||||
(void)stream_id;
|
||||
(void)user_data;
|
||||
|
||||
while ((r = read(fd, buf, length)) == -1 && errno == EINTR)
|
||||
;
|
||||
if (r == -1) {
|
||||
@@ -468,12 +433,10 @@ static int error_reply(nghttp2_session *session,
|
||||
static int on_header_callback(nghttp2_session *session,
|
||||
const nghttp2_frame *frame, const uint8_t *name,
|
||||
size_t namelen, const uint8_t *value,
|
||||
size_t valuelen, uint8_t flags, void *user_data) {
|
||||
size_t valuelen, uint8_t flags _U_,
|
||||
void *user_data _U_) {
|
||||
http2_stream_data *stream_data;
|
||||
const char PATH[] = ":path";
|
||||
(void)flags;
|
||||
(void)user_data;
|
||||
|
||||
switch (frame->hd.type) {
|
||||
case NGHTTP2_HEADERS:
|
||||
if (frame->headers.cat != NGHTTP2_HCAT_REQUEST) {
|
||||
@@ -586,10 +549,9 @@ static int on_frame_recv_callback(nghttp2_session *session,
|
||||
}
|
||||
|
||||
static int on_stream_close_callback(nghttp2_session *session, int32_t stream_id,
|
||||
uint32_t error_code, void *user_data) {
|
||||
uint32_t error_code _U_, void *user_data) {
|
||||
http2_session_data *session_data = (http2_session_data *)user_data;
|
||||
http2_stream_data *stream_data;
|
||||
(void)error_code;
|
||||
|
||||
stream_data = nghttp2_session_get_stream_user_data(session, stream_id);
|
||||
if (!stream_data) {
|
||||
@@ -642,10 +604,8 @@ static int send_server_connection_header(http2_session_data *session_data) {
|
||||
|
||||
/* readcb for bufferevent after client connection header was
|
||||
checked. */
|
||||
static void readcb(struct bufferevent *bev, void *ptr) {
|
||||
static void readcb(struct bufferevent *bev _U_, void *ptr) {
|
||||
http2_session_data *session_data = (http2_session_data *)ptr;
|
||||
(void)bev;
|
||||
|
||||
if (session_recv(session_data) != 0) {
|
||||
delete_http2_session_data(session_data);
|
||||
return;
|
||||
@@ -677,35 +637,14 @@ static void writecb(struct bufferevent *bev, void *ptr) {
|
||||
}
|
||||
|
||||
/* eventcb for bufferevent */
|
||||
static void eventcb(struct bufferevent *bev, short events, void *ptr) {
|
||||
static void eventcb(struct bufferevent *bev _U_, short events, void *ptr) {
|
||||
http2_session_data *session_data = (http2_session_data *)ptr;
|
||||
if (events & BEV_EVENT_CONNECTED) {
|
||||
const unsigned char *alpn = NULL;
|
||||
unsigned int alpnlen = 0;
|
||||
SSL *ssl;
|
||||
(void)bev;
|
||||
|
||||
fprintf(stderr, "%s connected\n", session_data->client_addr);
|
||||
|
||||
ssl = bufferevent_openssl_get_ssl(session_data->bev);
|
||||
|
||||
SSL_get0_next_proto_negotiated(ssl, &alpn, &alpnlen);
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x10002000L
|
||||
if (alpn == NULL) {
|
||||
SSL_get0_alpn_selected(ssl, &alpn, &alpnlen);
|
||||
}
|
||||
#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L
|
||||
|
||||
if (alpn == NULL || alpnlen != 2 || memcmp("h2", alpn, 2) != 0) {
|
||||
fprintf(stderr, "%s h2 is not negotiated\n", session_data->client_addr);
|
||||
delete_http2_session_data(session_data);
|
||||
return;
|
||||
}
|
||||
|
||||
initialize_nghttp2_session(session_data);
|
||||
|
||||
if (send_server_connection_header(session_data) != 0 ||
|
||||
session_send(session_data) != 0) {
|
||||
if (send_server_connection_header(session_data) != 0) {
|
||||
delete_http2_session_data(session_data);
|
||||
return;
|
||||
}
|
||||
@@ -723,11 +662,10 @@ static void eventcb(struct bufferevent *bev, short events, void *ptr) {
|
||||
}
|
||||
|
||||
/* callback for evconnlistener */
|
||||
static void acceptcb(struct evconnlistener *listener, int fd,
|
||||
static void acceptcb(struct evconnlistener *listener _U_, int fd,
|
||||
struct sockaddr *addr, int addrlen, void *arg) {
|
||||
app_context *app_ctx = (app_context *)arg;
|
||||
http2_session_data *session_data;
|
||||
(void)listener;
|
||||
|
||||
session_data = create_http2_session_data(app_ctx, fd, addr, addrlen);
|
||||
|
||||
@@ -802,6 +740,9 @@ int main(int argc, char **argv) {
|
||||
act.sa_handler = SIG_IGN;
|
||||
sigaction(SIGPIPE, &act, NULL);
|
||||
|
||||
#ifndef OPENSSL_IS_BORINGSSL
|
||||
OPENSSL_config(NULL);
|
||||
#endif /* OPENSSL_IS_BORINGSSL */
|
||||
SSL_load_error_strings();
|
||||
SSL_library_init();
|
||||
|
||||
|
||||
1344
examples/tiny-nghttpd.c
Normal file
1344
examples/tiny-nghttpd.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,33 +0,0 @@
|
||||
Fuzzer
|
||||
======
|
||||
|
||||
This directory contains fuzzer target mainly written to integrate
|
||||
nghttp2 into `oss-fuzz <https://github.com/google/oss-fuzz>`_.
|
||||
|
||||
fuzz_target.cc contains an entry point of fuzzer. corpus directory
|
||||
contains initial data for fuzzer.
|
||||
|
||||
The file name of initial data under corpus is the lower-cased hex
|
||||
string of SHA-256 hash of its own content.
|
||||
|
||||
corpus/h2spec contains input data which was recorded when we ran
|
||||
`h2spec <https://github.com/summerwind/h2spec>`_ against nghttpd.
|
||||
|
||||
corpus/nghttp contains input data which was recorded when we ran
|
||||
nghttp against nghttpd with some varying command line options of
|
||||
nghttp.
|
||||
|
||||
|
||||
To build fuzz_target.cc, make sure that libnghttp2 is built with
|
||||
following compiler/linker flags:
|
||||
|
||||
.. code-block:: text
|
||||
|
||||
CPPFLAGS="-fsanitize-coverage=edge -fsanitize=addres"
|
||||
LDFLAGS="-fsanitize-coverage=edge -fsanitize=addres"
|
||||
|
||||
Then, fuzz_target.cc can be built using the following command:
|
||||
|
||||
.. code-block:: text
|
||||
|
||||
$ clang++ -fsanitize-coverage=edge -fsanitize=address -I../lib/includes -std=c++11 fuzz_target.cc ../lib/.libs/libnghttp2.a /usr/lib/llvm-3.9/lib/libFuzzer.a -o nghttp2_fuzzer
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,2 +0,0 @@
|
||||
INVALID CONNECTION PREFACE
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user