Update doc
This commit is contained in:
parent
6326aec089
commit
8658163aac
72
README.rst
72
README.rst
|
@ -348,10 +348,10 @@ a reverse proxy and listens for ``h2-11``, SPDY and HTTP/1.1 and can
|
||||||
be deployed SSL/TLS terminator for existing web server.
|
be deployed SSL/TLS terminator for existing web server.
|
||||||
|
|
||||||
The default mode, ``--http2-proxy`` and ``--http2-bridge`` modes use
|
The default mode, ``--http2-proxy`` and ``--http2-bridge`` modes use
|
||||||
SSL/TLS in the frontend connection by default. To disable SSL/TLS, use
|
SSL/TLS in the frontend connection by default. To disable SSL/TLS,
|
||||||
``--frontend-no-tls`` option. If that option is used, SPDY is disabled
|
use ``--frontend-no-tls`` option. If that option is used, SPDY is
|
||||||
in the frontend and incoming HTTP/1.1 connection can be upgraded to
|
disabled in the frontend and incoming HTTP/1.1 connection can be
|
||||||
HTTP/2 through HTTP Upgrade.
|
upgraded to HTTP/2 through HTTP Upgrade.
|
||||||
|
|
||||||
The ``--http2-bridge``, ``--client`` and ``--client-proxy`` modes use
|
The ``--http2-bridge``, ``--client`` and ``--client-proxy`` modes use
|
||||||
SSL/TLS in the backend connection by deafult. To disable SSL/TLS, use
|
SSL/TLS in the backend connection by deafult. To disable SSL/TLS, use
|
||||||
|
@ -423,11 +423,11 @@ The frontend HTTP/1.1 connection can be upgraded to HTTP/2
|
||||||
through HTTP Upgrade.
|
through HTTP Upgrade.
|
||||||
|
|
||||||
For the operation modes which talk to the backend in HTTP/2 over
|
For the operation modes which talk to the backend in HTTP/2 over
|
||||||
SSL/TLS, the backend connections can be tunneled through HTTP
|
SSL/TLS, the backend connections can be tunneled through HTTP proxy.
|
||||||
proxy. The proxy is specified using ``--backend-http-proxy-uri``
|
The proxy is specified using ``--backend-http-proxy-uri`` option. The
|
||||||
option. The following figure illustrates the example of
|
following figure illustrates the example of ``--http2-bridge`` and
|
||||||
``--http2-bridge`` and ``--backend-http-proxy-uri`` options to talk to
|
``--backend-http-proxy-uri`` options to talk to the outside HTTP/2
|
||||||
the outside HTTP/2 proxy through HTTP proxy::
|
proxy through HTTP proxy::
|
||||||
|
|
||||||
Client <-- (HTTP/2, SPDY, HTTP/1.1) --> nghttpx <-- (HTTP/2) --
|
Client <-- (HTTP/2, SPDY, HTTP/1.1) --> nghttpx <-- (HTTP/2) --
|
||||||
|
|
||||||
|
@ -439,9 +439,9 @@ Benchmarking tool
|
||||||
|
|
||||||
The ``h2load`` program is a benchmarking tool for HTTP/2 and SPDY.
|
The ``h2load`` program is a benchmarking tool for HTTP/2 and SPDY.
|
||||||
The SPDY support is enabled if the program was built with spdylay
|
The SPDY support is enabled if the program was built with spdylay
|
||||||
library. The UI of ``h2load`` is heavily inspired by
|
library. The UI of ``h2load`` is heavily inspired by ``weighttp``
|
||||||
``weighttp`` (https://github.com/lighttpd/weighttp). The typical usage
|
(https://github.com/lighttpd/weighttp). The typical usage is as
|
||||||
is as follows::
|
follows::
|
||||||
|
|
||||||
$ src/h2load -n1000 -c10 -m10 https://127.0.0.1:8443/
|
$ src/h2load -n1000 -c10 -m10 https://127.0.0.1:8443/
|
||||||
starting benchmark...
|
starting benchmark...
|
||||||
|
@ -468,8 +468,8 @@ avoid saturating single core on client side.
|
||||||
|
|
||||||
.. warning::
|
.. warning::
|
||||||
|
|
||||||
**Don't use this tool against publicly available servers.** That
|
**Don't use this tool against publicly available servers.** That is
|
||||||
is considered a DOS attack. Please only use against your private
|
considered a DOS attack. Please only use against your private
|
||||||
servers.
|
servers.
|
||||||
|
|
||||||
HPACK tools
|
HPACK tools
|
||||||
|
@ -478,9 +478,9 @@ HPACK tools
|
||||||
The ``src`` directory contains HPACK tools. The ``deflatehd`` is a
|
The ``src`` directory contains HPACK tools. The ``deflatehd`` is a
|
||||||
command-line header compression tool. The ``inflatehd`` is
|
command-line header compression tool. The ``inflatehd`` is
|
||||||
command-line header decompression tool. Both tools read input from
|
command-line header decompression tool. Both tools read input from
|
||||||
stdin and write output to stdout. The errors are written to
|
stdin and write output to stdout. The errors are written to stderr.
|
||||||
stderr. They take JSON as input and output. We use the same JSON data
|
They take JSON as input and output. We use (mostly) same JSON data
|
||||||
format used in https://github.com/Jxck/hpack-test-case
|
format described at https://github.com/http2jp/hpack-test-case
|
||||||
|
|
||||||
deflatehd - header compressor
|
deflatehd - header compressor
|
||||||
+++++++++++++++++++++++++++++
|
+++++++++++++++++++++++++++++
|
||||||
|
@ -488,11 +488,11 @@ deflatehd - header compressor
|
||||||
The ``deflatehd`` reads JSON data or HTTP/1-style header fields from
|
The ``deflatehd`` reads JSON data or HTTP/1-style header fields from
|
||||||
stdin and outputs compressed header block in JSON.
|
stdin and outputs compressed header block in JSON.
|
||||||
|
|
||||||
For the JSON input, the root JSON object must include ``cases``
|
For the JSON input, the root JSON object must include ``cases`` key.
|
||||||
key. Its value has to include the sequence of input header set. They
|
Its value has to include the sequence of input header set. They share
|
||||||
share the same compression context and are processed in the order they
|
the same compression context and are processed in the order they
|
||||||
appear. Each item in the sequence is a JSON object and it must
|
appear. Each item in the sequence is a JSON object and it must
|
||||||
include ``headers`` key. Its value is an array of a JSON object ,
|
include ``headers`` key. Its value is an array of a JSON object,
|
||||||
which includes exactly one name/value pair.
|
which includes exactly one name/value pair.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
@ -621,18 +621,15 @@ The output can be used as the input for ``inflatehd`` and
|
||||||
|
|
||||||
With ``-d`` option, the extra ``header_table`` key is added and its
|
With ``-d`` option, the extra ``header_table`` key is added and its
|
||||||
associated value includes the state of dynamic header table after the
|
associated value includes the state of dynamic header table after the
|
||||||
corresponding header set was processed. The value includes at least the
|
corresponding header set was processed. The value includes at least
|
||||||
following keys:
|
the following keys:
|
||||||
|
|
||||||
entries
|
entries
|
||||||
The entry in the header table. If ``referenced`` is ``true``, it
|
The entry in the header table. If ``referenced`` is ``true``, it
|
||||||
is in the reference set. The ``size`` includes the overhead (32
|
is in the reference set. The ``size`` includes the overhead (32
|
||||||
bytes). The ``index`` corresponds to the index of header table.
|
bytes). The ``index`` corresponds to the index of header table.
|
||||||
The ``name`` is the header field name and the ``value`` is the
|
The ``name`` is the header field name and the ``value`` is the
|
||||||
header field value. They may be displayed as ``**DEALLOCATED**``,
|
header field value.
|
||||||
which means that the memory for that string is freed and not
|
|
||||||
available. This will happen when the specifying smaller value in
|
|
||||||
``-S`` than ``-s``.
|
|
||||||
|
|
||||||
size
|
size
|
||||||
The sum of the spaces entries occupied, this includes the
|
The sum of the spaces entries occupied, this includes the
|
||||||
|
@ -914,8 +911,8 @@ Python bindings
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
This ``python`` directory contains nghttp2 Python bindings. The
|
This ``python`` directory contains nghttp2 Python bindings. The
|
||||||
bindings currently provide HPACK compressor and decompressor
|
bindings currently provide HPACK compressor and decompressor classes
|
||||||
classes and HTTP/2 server.
|
and HTTP/2 server.
|
||||||
|
|
||||||
The extension module is called ``nghttp2``.
|
The extension module is called ``nghttp2``.
|
||||||
|
|
||||||
|
@ -944,12 +941,12 @@ and decompressor in Python:
|
||||||
print(hdrs)
|
print(hdrs)
|
||||||
|
|
||||||
The ``nghttp2.HTTP2Server`` class builds on top of the asyncio event
|
The ``nghttp2.HTTP2Server`` class builds on top of the asyncio event
|
||||||
loop. On construction, *RequestHandlerClass* must be given, which must
|
loop. On construction, *RequestHandlerClass* must be given, which
|
||||||
be a subclass of ``nghttp2.BaseRequestHandler`` class.
|
must be a subclass of ``nghttp2.BaseRequestHandler`` class.
|
||||||
|
|
||||||
The ``BaseRequestHandler`` class is used to handle the HTTP/2
|
The ``BaseRequestHandler`` class is used to handle the HTTP/2 stream.
|
||||||
stream. By default, it does nothing. It must be subclassed to
|
By default, it does nothing. It must be subclassed to handle each
|
||||||
handle each event callback method.
|
event callback method.
|
||||||
|
|
||||||
The first callback method invoked is ``on_headers()``. It is called
|
The first callback method invoked is ``on_headers()``. It is called
|
||||||
when HEADERS frame, which includes request header fields, has arrived.
|
when HEADERS frame, which includes request header fields, has arrived.
|
||||||
|
@ -961,8 +958,8 @@ When whole request is received, ``on_request_done()`` is invoked.
|
||||||
|
|
||||||
When stream is closed, ``on_close(error_code)`` is called.
|
When stream is closed, ``on_close(error_code)`` is called.
|
||||||
|
|
||||||
The application can send response using ``send_response()`` method. It
|
The application can send response using ``send_response()`` method.
|
||||||
can be used in ``on_headers()``, ``on_data()`` or
|
It can be used in ``on_headers()``, ``on_data()`` or
|
||||||
``on_request_done()``.
|
``on_request_done()``.
|
||||||
|
|
||||||
The application can push resource using ``push()`` method. It must be
|
The application can push resource using ``push()`` method. It must be
|
||||||
|
@ -978,7 +975,8 @@ stream_id
|
||||||
Stream ID of this stream.
|
Stream ID of this stream.
|
||||||
|
|
||||||
scheme
|
scheme
|
||||||
Scheme of the request URI. This is a value of :scheme header field.
|
Scheme of the request URI. This is a value of :scheme header
|
||||||
|
field.
|
||||||
|
|
||||||
method
|
method
|
||||||
Method of this stream. This is a value of :method header field.
|
Method of this stream. This is a value of :method header field.
|
||||||
|
|
Loading…
Reference in New Issue