• Home
  • Raw
  • Download

Lines Matching +full:ipv4 +full:- +full:second +full:- +full:language +full:- +full:is +full:- +full:cpp

1 nghttp2 - HTTP/2 C Library
4 This is an implementation of the Hypertext Transfer Protocol version 2
7 The framing layer of HTTP/2 is implemented as a reusable C library.
14 An experimental high level C++ library is also available.
20 ------------------
23 HTTP/2 and `RFC 7541 <https://tools.ietf.org/html/rfc7541>`_ HPACK -
27 (https://github.com/tatsuhiro-t/spdylay) project.
30 ------------------
37 This endpoint supports ``h2``, ``h2-16``, ``h2-14``, and
46 ------------
48 The following package is required to build the libnghttp2 library:
50 * pkg-config >= 0.20
52 To build and run the unit test programs, the following package is
59 * sphinx (http://sphinx-doc.org/)
62 all you need. Use ``--enable-lib-only`` to ensure that only
63 libnghttp2 is built. This avoids potential build error related to
73 * libc-ares >= 1.7.5
79 To enable ``-a`` option (getting linked assets from the downloaded
80 resource) in ``nghttp``, the following package is required:
84 To enable systemd support in nghttpx, the following package is
87 * libsystemd-dev >= 209
93 To build sources under the examples directory, libevent is required:
95 * libevent-openssl >= 2.0.8
98 (``nghttpd`` and ``nghttpx``), jemalloc is recommended:
109 * libboost-dev >= 1.54.0
110 * libboost-thread-dev >= 1.54.0
116 * python-setuptools
121 .. code-block:: text
123 sudo apt-get install g++ make binutils autoconf automake autotools-dev libtool pkg-config \
124 zlib1g-dev libcunit1-dev libssl-dev libxml2-dev libev-dev libevent-dev libjansson-dev \
125 libc-ares-dev libjemalloc-dev libsystemd-dev \
126 cython python3-dev python-setuptools
129 <https://github.com/mruby/mruby>`_ is required. We need to build
131 mrgems, mruby is manged by git submodule under third-party/mruby
132 directory. Currently, mruby support for nghttpx is disabled by
133 default. To enable mruby support, use ``--with-mruby`` configure
134 option. Note that at the time of this writing, libmruby-dev and mruby
145 Heartbleed is exploited. The neverbleed is disabled by default. To
146 enable it, use ``--with-neverbleed`` configure option.
149 is known to be adequate. In order to compile the C++ source code, gcc
150 >= 6.0 or clang >= 6.0 is required. C++ source code requires C++14
151 language features.
155 To enable mruby support in nghttpx, and use ``--with-mruby``
160 Mac OS X users may need the ``--disable-threads`` configure option to
161 disable multi-threading in nghttpd, nghttpx and h2load to prevent
162 them from crashing. A patch is welcome to make multi threading work
168 and h2load), you must use the ``--enable-app`` configure option and
171 applications, and enable ``--enable-app`` automatically, so you
173 applications were not built, then using ``--enable-app`` may find
178 In order to detect third party libraries, pkg-config is used
179 (however we don't use pkg-config for some libraries (e.g., libev)).
180 By default, pkg-config searches ``*.pc`` file in the standard
181 locations (e.g., /usr/lib/pkgconfig). If it is necessary to use
186 .. code-block:: text
190 For pkg-config managed libraries, ``*_CFLAG`` and ``*_LIBS``
192 ``OPENSSL_LIBS``). Specifying non-empty string to these variables
193 completely overrides pkg-config. In other words, if they are
194 specified, pkg-config is not used for detection, and user is
196 complete list of these variables, run ``./configure -h``.
199 -----------------------------------------
207 Building from tar archives does not require them, and thus it is much
208 easier. The usual build step is as follows:
210 .. code-block:: text
212 $ tar xf nghttp2-X.Y.Z.tar.bz2
213 $ cd nghttp2-X.Y.Z
218 -----------------
220 Building from git is easy, but please be sure that at least autoconf 2.68 is
223 .. code-block:: text
225 $ git submodule update --init
226 $ autoreconf -i
233 ------------------------------------
235 The easiest way to build native Windows nghttp2 dll is use `cmake
237 <http://landinghub.visualstudio.com/visual-cpp-build-tools>`_ works
243 3. Then run ``cmake --build`` to build library.
250 --------------------------------------------
253 ``libnghttp2-X.dll`` and ``libnghttp2.a``.
267 .. code-block:: text
269 $ export CFLAGS="-U__STRICT_ANSI__ -I$libev_PREFIX/include -L$libev_PREFIX/lib"
279 --------------------------------------------
282 .. code-block:: text
286 This means that the tool is unable to locate the ``libnghttp2.so`` shared library.
291 --------------------------
295 Documentation is still incomplete.
299 .. code-block:: text
307 The online documentation is available at
311 ----------
316 -----------------
319 written in the `Go programming language <http://golang.org/>`_ and uses
324 * https://github.com/tatsuhiro-t/go-nghttp2
329 ``integration-tests`` directory:
331 .. code-block:: text
338 ---------------------------------
343 ALPN protocol ID is now ``h2`` and ``h2c``
346 Previously we announced ``h2-14`` and ``h2c-14``. v1.0.0 implements
355 recompiling is enough for this change.
361 connection preface. This is technically not correct, since client
362 connection preface is composed of 24 bytes client magic byte string
376 Since v1.0.0, client magic is sent by library (see next subsection),
379 Client magic is sent by library
382 Previously nghttp2 library did not send client magic, which is first
385 magic is sent by library via first call of ``nghttp2_session_send()``
391 Remove HTTP Alternative Services (Alt-Svc) related code
394 Alt-Svc specification is not finalized yet. To make our API stable,
395 we have decided to remove all Alt-Svc related API from nghttp2.
400 We have already removed the functionality of Alt-Svc in v0.7 series
414 the code so that it is treated as ``nghttp2_error``.
436 ---------------------------------
440 nghttp - client
443 ``nghttp`` is a HTTP/2 client. It can connect to the HTTP/2 server
446 It has verbose output mode for framing information. Here is sample
449 .. code-block:: text
451 $ nghttp -nv https://nghttp2.org
484 accept-encoding: gzip, deflate
485 user-agent: nghttp2/1.0.1-DEV
493 [ 0.221] recv (stream_id=13) accept-encoding: gzip, deflate
494 [ 0.222] recv (stream_id=13) user-agent: nghttp2/1.0.1-DEV
500 [ 0.222] recv (stream_id=13) content-type: text/html
501 [ 0.222] recv (stream_id=13) last-modified: Fri, 15 May 2015 15:38:06 GMT
502 [ 0.222] recv (stream_id=13) etag: W/"555612de-19f6"
504 [ 0.222] recv (stream_id=13) content-encoding: gzip
505 [ 0.222] recv (stream_id=13) server: nghttpx nghttp2/1.0.1-DEV
507 [ 0.222] recv (stream_id=13) strict-transport-security: max-age=31536000
516 [ 0.222] recv (stream_id=2) content-type: text/css
517 [ 0.222] recv (stream_id=2) last-modified: Fri, 15 May 2015 15:38:06 GMT
518 [ 0.222] recv (stream_id=2) etag: W/"555612de-9845"
519 [ 0.222] recv (stream_id=2) content-encoding: gzip
520 [ 0.222] recv (stream_id=2) server: nghttpx nghttp2/1.0.1-DEV
522 [ 0.222] recv (stream_id=2) strict-transport-security: max-age=31536000
532 The HTTP Upgrade is performed like so:
534 .. code-block:: text
536 $ nghttp -nvu http://nghttp2.org
541 Connection: Upgrade, HTTP2-Settings
543 HTTP2-Settings: AAMAAABkAAQAAP__
545 User-Agent: nghttp2/1.0.1-DEV
582 [ 0.019] recv (stream_id=1) user-agent: nghttp2/1.0.1-DEV
588 [ 0.019] recv (stream_id=1) content-type: text/html
589 [ 0.019] recv (stream_id=1) content-length: 6646
590 [ 0.019] recv (stream_id=1) last-modified: Fri, 15 May 2015 15:38:06 GMT
591 [ 0.019] recv (stream_id=1) etag: "555612de-19f6"
593 [ 0.019] recv (stream_id=1) accept-ranges: bytes
594 [ 0.019] recv (stream_id=1) server: nghttpx nghttp2/1.0.1-DEV
604 [ 0.019] recv (stream_id=2) content-type: text/css
605 [ 0.019] recv (stream_id=2) content-length: 38981
606 [ 0.019] recv (stream_id=2) last-modified: Fri, 15 May 2015 15:38:06 GMT
607 [ 0.019] recv (stream_id=2) etag: "555612de-9845"
608 [ 0.019] recv (stream_id=2) accept-ranges: bytes
609 [ 0.019] recv (stream_id=2) server: nghttpx nghttp2/1.0.1-DEV
629 Using the ``-s`` option, ``nghttp`` prints out some timing information for
632 .. code-block:: text
634 $ nghttp -nas https://nghttp2.org/
641 relative to connectEnd. If '*' is shown, this was
643 process: responseEnd - requestStart
649 see http://www.w3.org/TR/resource-timing/#processing-model
657 15 +78.12ms +38.66ms 39.46ms 200 3K /javascripts/modernizr-2.0.js
659 Using the ``-r`` option, ``nghttp`` writes more detailed timing data to
662 nghttpd - server
665 ``nghttpd`` is a multi-threaded static web server.
667 By default, it uses SSL/TLS connection. Use ``--no-tls`` option to
671 HTTP/2 connections. No HTTP Upgrade is supported.
673 The ``-p`` option allows users to configure server push.
676 information. Here is sample output from ``nghttpd``:
678 .. code-block:: text
680 $ nghttpd --no-tls -v 8080
681 IPv4: listen 0.0.0.0:8080
708 [id=1] [ 1.521] recv (stream_id=13) accept-encoding: gzip, deflate
709 [id=1] [ 1.521] recv (stream_id=13) user-agent: nghttp2/1.0.0-DEV
722 server: nghttpd nghttp2/1.0.0-DEV
723 content-length: 10
724 cache-control: max-age=3600
726 last-modified: Tue, 30 Sep 2014 12:40:52 GMT
734 nghttpx - proxy
737 ``nghttpx`` is a multi-threaded reverse proxy for HTTP/2, and
741 We reworked ``nghttpx`` command-line interface, and as a result, there
742 are several incompatibles from 1.8.0 or earlier. This is necessary to
746 <https://nghttp2.org/documentation/nghttpx-howto.html#migration-from-nghttpx-v1-8-0-or-earlier>`_
749 ``nghttpx`` implements `important performance-oriented features
750 <https://istlsfastyet.com/#server-performance>`_ in TLS, such as
762 ``--http2-proxy`` HTTP/2, HTTP/1.1 HTTP/1.1, HTTP/2 Forward proxy
765 The interesting mode at the moment is the default mode. It works like
770 default. To disable encryption, use the ``no-tls`` keyword in
771 ``--frontend`` option. If encryption is disabled, incoming HTTP/1.1
774 encrypt backend connections, use ``tls`` keyword in ``--backend``
777 ``nghttpx`` supports a configuration file. See the ``--conf`` option and
783 .. code-block:: text
785 Client <-- (HTTP/2, HTTP/1.1) --> nghttpx <-- (HTTP/1.1, HTTP/2) --> Web Server
788 With the ``--http2-proxy`` option, it works as forward proxy, and it
789 is so called secure HTTP/2 proxy:
791 .. code-block:: text
793 Client <-- (HTTP/2, HTTP/1.1) --> nghttpx <-- (HTTP/1.1) --> Proxy
800 HTTP/2 proxy. One way to configure Chrome to use a secure proxy is to
803 .. code-block:: javascript
809 ``SERVERADDR`` and ``PORT`` is the hostname/address and port of the
810 machine nghttpx is running on. Please note that Chrome requires a valid
815 .. code-block:: text
817 $ google-chrome --proxy-pac-url=file:///path/to/proxy.pac --use-npn
820 The proxy is specified using ``--backend-http-proxy-uri``. The
824 .. code-block:: text
826 Client <-- (HTTP/2, HTTP/1.1) --> nghttpx <-- (HTTP/2) --
828 --===================---> HTTP/2 Proxy
829 (HTTP proxy tunnel) (e.g., nghttpx -s)
832 -----------------
834 The ``h2load`` program is a benchmarking tool for HTTP/2. The UI of
835 ``h2load`` is heavily inspired by ``weighttp``
836 (https://github.com/lighttpd/weighttp). The typical usage is as
839 .. code-block:: text
841 $ h2load -n100000 -c100 -m100 https://localhost:8443/
845 Cipher: ECDHE-RSA-AES128-GCM-SHA256
846 Server Temp Key: ECDH P-256 256 bits
862 min max mean sd +/- sd
869 per client. With the ``-t`` option, ``h2load`` will use multiple native
874 **Don't use this tool against publicly available servers.** That is
879 -----------
881 The ``src`` directory contains the HPACK tools. The ``deflatehd`` program is a
882 command-line header compression tool. The ``inflatehd`` program is a
883 command-line header decompression tool. Both tools read input from
886 format described at https://github.com/http2jp/hpack-test-case.
888 deflatehd - header compressor
891 The ``deflatehd`` program reads JSON data or HTTP/1-style header fields from
897 appear. Each item in the sequence is a JSON object and it must
898 include a ``headers`` key. Its value is an array of JSON objects,
903 .. code-block:: json
924 With the ``-t`` option, the program can accept more familiar HTTP/1 style
925 header field blocks. Each header set is delimited by an empty line:
929 .. code-block:: text
936 user-agent: nghttp2
938 The output is in JSON object. It should include a ``cases`` key and its
939 value is an array of JSON objects, which has at least the following keys:
964 .. code-block:: json
989 "user-agent": "nghttp2"
1015 "user-agent": "nghttp2"
1027 With the ``-d`` option, the extra ``header_table`` key is added and its
1033 The entry in the header table. If ``referenced`` is ``true``, it
1034 is in the reference set. The ``size`` includes the overhead (32
1036 The ``name`` is the header field name and the ``value`` is the
1053 ``max_deflate_size`` buffer. Since the header table size is still
1060 .. code-block:: json
1085 "user-agent": "nghttp2"
1093 "name": "user-agent",
1154 "user-agent": "nghttp2"
1169 "name": "user-agent",
1212 inflatehd - header decompressor
1221 item in the sequence is a JSON object and it must have at least a
1222 ``wire`` key. Its value is a compressed header block as a hex string.
1226 .. code-block:: json
1236 The output is a JSON object. It should include a ``cases`` key and its
1237 value is an array of JSON objects, which has at least following keys:
1254 .. code-block:: json
1276 "user-agent": "nghttp2"
1293 "user-agent": "nghttp2"
1310 With the ``-d`` option, the extra ``header_table`` key is added and its
1312 corresponding header set was processed. The format is the same as
1316 ----------------------------------------------
1318 libnghttp2_asio is C++ library built on top of libnghttp2 and provides
1323 libnghttp2_asio is not built by default. Use the ``--enable-asio-lib``
1331 The server API is designed to build an HTTP/2 server very easily to utilize
1335 .. code-block:: cpp
1358 Here is sample code to use the client API:
1360 .. code-block:: cpp
1383 req->on_response([](const response &res) {
1387 std::cerr << kv.first << ": " << kv.second.value << "\n";
1397 req->on_close([&sess](uint32_t error_code) {
1413 ---------------
1419 The extension module is called ``nghttp2``.
1421 ``make`` will build the bindings and target Python version is
1422 determined by the ``configure`` script. If the detected Python version is not
1430 .. code-block:: python
1449 The ``BaseRequestHandler`` class is used to handle the HTTP/2 stream.
1453 The first callback method invoked is ``on_headers()``. It is called
1456 If the request has a request body, ``on_data(data)`` is invoked for each
1459 Once the entire request is received, ``on_request_done()`` is invoked.
1461 When the stream is closed, ``on_close(error_code)`` is called.
1480 Scheme of the request URI. This is a value of :scheme header
1484 Method of this stream. This is a value of :method header field.
1487 This is a value of :authority or host header field.
1490 This is a value of :path header field.
1495 .. code-block:: python
1506 request_headers = [('content-length', '3')],
1512 request_headers = [('content-length', '10')],
1517 headers = [('content-type', 'text/plain')],
1518 body=io.BytesIO(b'nghttp2-python FTW'))
1524 # give None to ssl to make the server non-SSL/TLS
1529 ------------
1535 code under the same license nghttp2 is already using unless stated and
1556 -----------------------
1560 issues on github issue page. It is a standard practice not to
1561 disclose vulnerability information publicly until a fixed version is
1562 released, or mitigation is worked out.
1567 ----------------
1580 -------