Update doc

This commit is contained in:
Tatsuhiro Tsujikawa 2015-01-24 01:06:41 +09:00
parent 6875b63692
commit bed3902c61
28 changed files with 4843 additions and 3484 deletions

File diff suppressed because one or more lines are too long

2
_static/jquery.js vendored
View File

@ -11,7 +11,7 @@
* Copyright 2011, The Dojo Foundation
* Released under the MIT, BSD, and GPL Licenses.
*
* Date: Thu Aug 1 23:20:30 BRT 2013
* Date: Fri Aug 29 09:46:34 UTC 2014
*/
(function( window, undefined ) {

View File

@ -40,6 +40,7 @@
.highlight .nv { color: #bb60d5 } /* Name.Variable */
.highlight .ow { color: #007020; font-weight: bold } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mb { color: #208050 } /* Literal.Number.Bin */
.highlight .mf { color: #208050 } /* Literal.Number.Float */
.highlight .mh { color: #208050 } /* Literal.Number.Hex */
.highlight .mi { color: #208050 } /* Literal.Number.Integer */

File diff suppressed because it is too large Load Diff

View File

@ -7,14 +7,14 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>API Reference &mdash; nghttp2 0.6.3-DEV documentation</title>
<title>API Reference &mdash; nghttp2 0.7.2-DEV documentation</title>
<link href='https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700&subset=latin,cyrillic' rel='stylesheet' type='text/css'>
@ -28,7 +28,7 @@
<link rel="top" title="nghttp2 0.6.3-DEV documentation" href="index.html"/>
<link rel="top" title="nghttp2 0.7.2-DEV documentation" href="index.html"/>
<link rel="next" title="libnghttp2_asio: High level HTTP/2 C++ library" href="libnghttp2_asio.html"/>
<link rel="prev" title="h2load - HTTP/2 benchmarking tool - HOW-TO" href="h2load-howto.html"/>
@ -47,6 +47,7 @@
<a href="index.html" class="fa fa-home"> nghttp2</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
@ -59,6 +60,7 @@
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="package_README.html">nghttp2 - HTTP/2 C Library</a><ul>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#development-status">Development Status</a></li>
@ -66,6 +68,8 @@
<li class="toctree-l2"><a class="reference internal" href="package_README.html#requirements">Requirements</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#build-from-git">Build from git</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#building-documentation">Building documentation</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#unit-tests">Unit tests</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#integration-tests">Integration tests</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#client-server-and-proxy-programs">Client, Server and Proxy programs</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#benchmarking-tool">Benchmarking tool</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#hpack-tools">HPACK tools</a></li>
@ -74,6 +78,10 @@
<li class="toctree-l2"><a class="reference internal" href="package_README.html#contribution">Contribution</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="contribute.html">Contribution Guidelines</a><ul>
<li class="toctree-l2"><a class="reference internal" href="contribute.html#coding-style">Coding style</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="building-android-binary.html">Building Android binary</a></li>
<li class="toctree-l1"><a class="reference internal" href="tutorial-client.html">Tutorial: HTTP/2 client</a><ul>
<li class="toctree-l2"><a class="reference internal" href="tutorial-client.html#libevent-client-c">libevent-client.c</a></li>
@ -90,34 +98,32 @@
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttp.1.html">nghttp(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttpd.1.html">nghttpd(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttpx.1.html">nghttpx(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#files">FILES</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#signals">SIGNALS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="h2load.1.html">h2load(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
@ -131,8 +137,9 @@
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#specifying-additional-ca-certificate">Specifying additional CA certificate</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#read-write-rate-limit">Read/write rate limit</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#rewriting-location-header-field">Rewriting location header field</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#hot-deploy">Hot deploy</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#hot-swapping">Hot swapping</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#re-opening-log-files">Re-opening log files</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#multiple-http-1-backend-addresses">Multiple HTTP/1 backend addresses</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="h2load-howto.html">h2load - HTTP/2 benchmarking tool - HOW-TO</a><ul>
@ -166,9 +173,11 @@
<li class="toctree-l1"><a class="reference internal" href="asio_http2.h.html">asio_http2.h</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/tatsuhiro-t/nghttp2">Source</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/tatsuhiro-t/nghttp2/issues">Issues</a></li>
<li class="toctree-l1"><a class="reference external" href="https://nghttp2.org/">nghttp2.org</a></li>
</ul>
</div>
&nbsp;
</nav>
@ -222,9 +231,11 @@ do not send client connection preface
responsible to send it before sending any HTTP/2 frames using these
functions if <a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_session</span></tt></a> is configured as client.
Similarly, <a class="reference internal" href="#c.nghttp2_session_recv" title="nghttp2_session_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_recv()</span></tt></a> and <a class="reference internal" href="#c.nghttp2_session_mem_recv" title="nghttp2_session_mem_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_mem_recv()</span></tt></a>
do not consume client connection preface. The applications are
responsible to receive it before calling these functions if
<a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_session</span></tt></a> is configured as server.</p>
do not consume client connection preface unless
<a class="reference internal" href="#c.nghttp2_option_set_recv_client_preface" title="nghttp2_option_set_recv_client_preface"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_option_set_recv_client_preface()</span></tt></a> is used with nonzero option
value. The applications are responsible to receive it before calling
these functions if <a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_session</span></tt></a> is configured as server and
<a class="reference internal" href="#c.nghttp2_option_set_recv_client_preface" title="nghttp2_option_set_recv_client_preface"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_option_set_recv_client_preface()</span></tt></a> is not used.</p>
</div>
<div class="section" id="macros">
<h2>Macros<a class="headerlink" href="#macros" title="Permalink to this headline"></a></h2>
@ -367,7 +378,7 @@ Invalid argument passed.</p>
<dt id="c.NGHTTP2_ERR_BUFFER_ERROR">
<tt class="descname">NGHTTP2_ERR_BUFFER_ERROR</tt><a class="headerlink" href="#c.NGHTTP2_ERR_BUFFER_ERROR" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">-502</span></tt>)
Ouf of buffer space.</p>
Out of buffer space.</p>
</dd></dl>
<dl class="macro">
@ -569,6 +580,14 @@ DATA frame for a given stream has been already submitted and has
not been fully processed yet.</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_ERR_SESSION_CLOSING">
<tt class="descname">NGHTTP2_ERR_SESSION_CLOSING</tt><a class="headerlink" href="#c.NGHTTP2_ERR_SESSION_CLOSING" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">-530</span></tt>)
The current session is closing due to a connection error or
<a class="reference internal" href="#c.nghttp2_session_terminate_session" title="nghttp2_session_terminate_session"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_terminate_session()</span></tt></a> is called.</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_ERR_FATAL">
<tt class="descname">NGHTTP2_ERR_FATAL</tt><a class="headerlink" href="#c.NGHTTP2_ERR_FATAL" title="Permalink to this definition"></a></dt>
@ -908,6 +927,13 @@ ENHANCE_YOUR_CALM</p>
INADEQUATE_SECURITY</p>
</dd></dl>
<dl class="macro">
<dt id="c.NGHTTP2_HTTP_1_1_REQUIRED">
<tt class="descname">NGHTTP2_HTTP_1_1_REQUIRED</tt><a class="headerlink" href="#c.NGHTTP2_HTTP_1_1_REQUIRED" title="Permalink to this definition"></a></dt>
<dd><p>(<tt class="docutils literal"><span class="pre">0x0d</span></tt>)
HTTP_1_1_REQUIRED</p>
</dd></dl>
</dd></dl>
<dl class="type">
@ -1686,7 +1712,7 @@ check that stream is still alive using its own stream management or
<p>Only HEADERS and DATA frame can signal the end of incoming data.
If <tt class="docutils literal"><span class="pre">frame-&gt;hd.flags</span> <span class="pre">&amp;</span> <span class="pre">NGHTTP2_FLAG_END_STREAM</span></tt> is nonzero, the
<em>frame</em> is the last frame from the remote peer in this stream.</p>
<p>This callback won&#8217;t be called for CONTINUATION frames.
<p>This callback won't be called for CONTINUATION frames.
HEADERS/PUSH_PROMISE + CONTINUATIONs are treated as single frame.</p>
<p>The implementation of this function must return 0 if it succeeds.
If nonzero value is returned, it is treated as fatal error and
@ -1860,6 +1886,10 @@ check against the <em>name</em> and the <em>value</em>. For example, the
helper function <a class="reference internal" href="#c.nghttp2_check_header_name" title="nghttp2_check_header_name"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_check_header_name()</span></tt></a> and
<a class="reference internal" href="#c.nghttp2_check_header_value" title="nghttp2_check_header_value"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_check_header_value()</span></tt></a> provide simple validation against
HTTP2 header field construction rule.</p>
<p>HTTP/2 specification requires that pseudo header fields (header
field starting with ':') must appear in front of regular header
fields. The library does not validate this requirement. The
application must check them if it matters.</p>
<p>If the application uses <a class="reference internal" href="#c.nghttp2_session_mem_recv" title="nghttp2_session_mem_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_mem_recv()</span></tt></a>, it can return
<a class="reference internal" href="#c.NGHTTP2_ERR_PAUSE" title="NGHTTP2_ERR_PAUSE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_PAUSE</span></tt></a> to make <a class="reference internal" href="#c.nghttp2_session_mem_recv" title="nghttp2_session_mem_recv"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_mem_recv()</span></tt></a>
return without processing further input bytes. The memory pointed
@ -1954,6 +1984,105 @@ immediately return <a class="reference internal" href="#c.NGHTTP2_ERR_CALLBACK_F
this structure are intentionally hidden from the public API.</p>
</dd></dl>
<dl class="type">
<dt id="c.nghttp2_malloc">
typedef void *<tt class="descname">(*nghttp2_malloc)</tt><big>(</big>size_t<em>&nbsp;size</em>, void<em>&nbsp;*mem_user_data</em><big>)</big><a class="headerlink" href="#c.nghttp2_malloc" title="Permalink to this definition"></a></dt>
<dd><p>Custom memory allocator to replace malloc(). The <em>mem_user_data</em>
is the mem_user_data member of <a class="reference internal" href="#c.nghttp2_mem" title="nghttp2_mem"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_mem</span></tt></a> structure.</p>
</dd></dl>
<dl class="type">
<dt id="c.nghttp2_free">
typedef void <tt class="descname">(*nghttp2_free)</tt><big>(</big>void<em>&nbsp;*ptr</em>, void<em>&nbsp;*mem_user_data</em><big>)</big><a class="headerlink" href="#c.nghttp2_free" title="Permalink to this definition"></a></dt>
<dd><p>Custom memory allocator to replace free(). The <em>mem_user_data</em> is
the mem_user_data member of <a class="reference internal" href="#c.nghttp2_mem" title="nghttp2_mem"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_mem</span></tt></a> structure.</p>
</dd></dl>
<dl class="type">
<dt id="c.nghttp2_calloc">
typedef void *<tt class="descname">(*nghttp2_calloc)</tt><big>(</big>size_t<em>&nbsp;nmemb</em>, size_t<em>&nbsp;size</em>, void<em>&nbsp;*mem_user_data</em><big>)</big><a class="headerlink" href="#c.nghttp2_calloc" title="Permalink to this definition"></a></dt>
<dd><p>Custom memory allocator to replace calloc(). The <em>mem_user_data</em>
is the mem_user_data member of <a class="reference internal" href="#c.nghttp2_mem" title="nghttp2_mem"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_mem</span></tt></a> structure.</p>
</dd></dl>
<dl class="type">
<dt id="c.nghttp2_realloc">
typedef void *<tt class="descname">(*nghttp2_realloc)</tt><big>(</big>void<em>&nbsp;*ptr</em>, size_t<em>&nbsp;size</em>, void<em>&nbsp;*mem_user_data</em><big>)</big><a class="headerlink" href="#c.nghttp2_realloc" title="Permalink to this definition"></a></dt>
<dd><p>Custom memory allocator to replace realloc(). The <em>mem_user_data</em>
is the mem_user_data member of <a class="reference internal" href="#c.nghttp2_mem" title="nghttp2_mem"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_mem</span></tt></a> structure.</p>
</dd></dl>
<dl class="type">
<dt id="c.nghttp2_mem">
<tt class="descname">nghttp2_mem</tt><a class="headerlink" href="#c.nghttp2_mem" title="Permalink to this definition"></a></dt>
<dd><p>Custom memory allocator functions and user defined pointer. The
<em>mem_user_data</em> member is passed to each allocator function. This
can be used, for example, to achieve per-session memory pool.</p>
<p>In the following example code, <tt class="docutils literal"><span class="pre">my_malloc</span></tt>, <tt class="docutils literal"><span class="pre">my_free</span></tt>,
<tt class="docutils literal"><span class="pre">my_calloc</span></tt> and <tt class="docutils literal"><span class="pre">my_realloc</span></tt> are the replacement of the
standard allocators <tt class="docutils literal"><span class="pre">malloc</span></tt>, <tt class="docutils literal"><span class="pre">free</span></tt>, <tt class="docutils literal"><span class="pre">calloc</span></tt> and
<tt class="docutils literal"><span class="pre">realloc</span></tt> respectively:</p>
<div class="highlight-c"><div class="highlight"><pre><span class="kt">void</span> <span class="o">*</span><span class="nf">my_malloc_cb</span><span class="p">(</span><span class="kt">size_t</span> <span class="n">size</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">mem_user_data</span><span class="p">)</span> <span class="p">{</span>
<span class="k">return</span> <span class="n">my_malloc</span><span class="p">(</span><span class="n">size</span><span class="p">);</span>
<span class="p">}</span>
<span class="kt">void</span> <span class="nf">my_free_cb</span><span class="p">(</span><span class="kt">void</span> <span class="o">*</span><span class="n">ptr</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">mem_user_data</span><span class="p">)</span> <span class="p">{</span> <span class="n">my_free</span><span class="p">(</span><span class="n">ptr</span><span class="p">);</span> <span class="p">}</span>
<span class="kt">void</span> <span class="o">*</span><span class="nf">my_calloc_cb</span><span class="p">(</span><span class="kt">size_t</span> <span class="n">nmemb</span><span class="p">,</span> <span class="kt">size_t</span> <span class="n">size</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">mem_user_data</span><span class="p">)</span> <span class="p">{</span>
<span class="k">return</span> <span class="n">my_calloc</span><span class="p">(</span><span class="n">nmemb</span><span class="p">,</span> <span class="n">size</span><span class="p">);</span>
<span class="p">}</span>
<span class="kt">void</span> <span class="o">*</span><span class="nf">my_realloc_cb</span><span class="p">(</span><span class="kt">void</span> <span class="o">*</span><span class="n">ptr</span><span class="p">,</span> <span class="kt">size_t</span> <span class="n">size</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">mem_user_data</span><span class="p">)</span> <span class="p">{</span>
<span class="k">return</span> <span class="n">my_realloc</span><span class="p">(</span><span class="n">ptr</span><span class="p">,</span> <span class="n">size</span><span class="p">);</span>
<span class="p">}</span>
<span class="kt">void</span> <span class="nf">session_new</span><span class="p">()</span> <span class="p">{</span>
<span class="n">nghttp2_session</span> <span class="o">*</span><span class="n">session</span><span class="p">;</span>
<span class="n">nghttp2_session_callbacks</span> <span class="o">*</span><span class="n">callbacks</span><span class="p">;</span>
<span class="n">nghttp2_mem</span> <span class="n">mem</span> <span class="o">=</span> <span class="p">{</span><span class="nb">NULL</span><span class="p">,</span> <span class="n">my_malloc_cb</span><span class="p">,</span> <span class="n">my_free_cb</span><span class="p">,</span> <span class="n">my_calloc_cb</span><span class="p">,</span>
<span class="n">my_realloc_cb</span><span class="p">};</span>
<span class="p">...</span>
<span class="n">nghttp2_session_client_new3</span><span class="p">(</span><span class="o">&amp;</span><span class="n">session</span><span class="p">,</span> <span class="n">callbacks</span><span class="p">,</span> <span class="nb">NULL</span><span class="p">,</span> <span class="nb">NULL</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">mem</span><span class="p">);</span>
<span class="p">...</span>
<span class="p">}</span>
</pre></div>
</div>
<dl class="member">
<dt id="c.nghttp2_mem.mem_user_data">
void *<tt class="descname">mem_user_data</tt><a class="headerlink" href="#c.nghttp2_mem.mem_user_data" title="Permalink to this definition"></a></dt>
<dd><p>An arbitrary user supplied data. This is passed to each
allocator function.</p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_mem.malloc">
<a class="reference internal" href="#c.nghttp2_malloc" title="nghttp2_malloc">nghttp2_malloc</a> <tt class="descname">malloc</tt><a class="headerlink" href="#c.nghttp2_mem.malloc" title="Permalink to this definition"></a></dt>
<dd><p>Custom allocator function to replace malloc().</p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_mem.free">
<a class="reference internal" href="#c.nghttp2_free" title="nghttp2_free">nghttp2_free</a> <tt class="descname">free</tt><a class="headerlink" href="#c.nghttp2_mem.free" title="Permalink to this definition"></a></dt>
<dd><p>Custom allocator function to replace free().</p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_mem.calloc">
<a class="reference internal" href="#c.nghttp2_calloc" title="nghttp2_calloc">nghttp2_calloc</a> <tt class="descname">calloc</tt><a class="headerlink" href="#c.nghttp2_mem.calloc" title="Permalink to this definition"></a></dt>
<dd><p>Custom allocator function to replace calloc().</p>
</dd></dl>
<dl class="member">
<dt id="c.nghttp2_mem.realloc">
<a class="reference internal" href="#c.nghttp2_realloc" title="nghttp2_realloc">nghttp2_realloc</a> <tt class="descname">realloc</tt><a class="headerlink" href="#c.nghttp2_mem.realloc" title="Permalink to this definition"></a></dt>
<dd><p>Custom allocator function to replace realloc().</p>
</dd></dl>
</dd></dl>
<dl class="type">
<dt id="c.nghttp2_option">
<tt class="descname">nghttp2_option</tt><a class="headerlink" href="#c.nghttp2_option" title="Permalink to this definition"></a></dt>
@ -2124,9 +2253,9 @@ void <tt class="descname">nghttp2_option_del</tt><big>(</big><a class="reference
void <tt class="descname">nghttp2_option_set_no_auto_window_update</tt><big>(</big><a class="reference internal" href="#c.nghttp2_option" title="nghttp2_option">nghttp2_option</a><em>&nbsp;*option</em>, int<em>&nbsp;val</em><big>)</big><a class="headerlink" href="#c.nghttp2_option_set_no_auto_window_update" title="Permalink to this definition"></a></dt>
<dd><p>This option prevents the library from sending WINDOW_UPDATE for a
connection automatically. If this option is set to nonzero, the
library won&#8217;t send WINDOW_UPDATE for DATA until application calls
library won't send WINDOW_UPDATE for DATA until application calls
<a class="reference internal" href="#c.nghttp2_session_consume" title="nghttp2_session_consume"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_consume()</span></tt></a> to indicate the consumed amount of
data. Don&#8217;t use <a class="reference internal" href="#c.nghttp2_submit_window_update" title="nghttp2_submit_window_update"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_submit_window_update()</span></tt></a> for this purpose.
data. Don't use <a class="reference internal" href="#c.nghttp2_submit_window_update" title="nghttp2_submit_window_update"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_submit_window_update()</span></tt></a> for this purpose.
By default, this option is set to zero.</p>
</dd></dl>
@ -2240,6 +2369,44 @@ negative error codes:</p>
</dl>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_session_client_new3">
int <tt class="descname">nghttp2_session_client_new3</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;**session_ptr</em>, const <a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em>&nbsp;*callbacks</em>, void<em>&nbsp;*user_data</em>, const <a class="reference internal" href="#c.nghttp2_option" title="nghttp2_option">nghttp2_option</a><em>&nbsp;*option</em>, <a class="reference internal" href="#c.nghttp2_mem" title="nghttp2_mem">nghttp2_mem</a><em>&nbsp;*mem</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_client_new3" title="Permalink to this definition"></a></dt>
<dd><p>Like <a class="reference internal" href="#c.nghttp2_session_client_new2" title="nghttp2_session_client_new2"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_client_new2()</span></tt></a>, but with additional custom
memory allocator specified in the <em>mem</em>.</p>
<p>The <em>mem</em> can be <tt class="docutils literal"><span class="pre">NULL</span></tt> and the call is equivalent to
<a class="reference internal" href="#c.nghttp2_session_client_new2" title="nghttp2_session_client_new2"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_client_new2()</span></tt></a>.</p>
<p>This function does not take ownership <em>mem</em>. The application is
responsible for freeing <em>mem</em>.</p>
<p>The library code does not refer to <em>mem</em> pointer after this
function returns, so the application can safely free it.</p>
<p>This function returns 0 if it succeeds, or one of the following
negative error codes:</p>
<dl class="docutils">
<dt><a class="reference internal" href="#c.NGHTTP2_ERR_NOMEM" title="NGHTTP2_ERR_NOMEM"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_NOMEM</span></tt></a></dt>
<dd>Out of memory.</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_session_server_new3">
int <tt class="descname">nghttp2_session_server_new3</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;**session_ptr</em>, const <a class="reference internal" href="#c.nghttp2_session_callbacks" title="nghttp2_session_callbacks">nghttp2_session_callbacks</a><em>&nbsp;*callbacks</em>, void<em>&nbsp;*user_data</em>, const <a class="reference internal" href="#c.nghttp2_option" title="nghttp2_option">nghttp2_option</a><em>&nbsp;*option</em>, <a class="reference internal" href="#c.nghttp2_mem" title="nghttp2_mem">nghttp2_mem</a><em>&nbsp;*mem</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_server_new3" title="Permalink to this definition"></a></dt>
<dd><p>Like <a class="reference internal" href="#c.nghttp2_session_server_new2" title="nghttp2_session_server_new2"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_server_new2()</span></tt></a>, but with additional custom
memory allocator specified in the <em>mem</em>.</p>
<p>The <em>mem</em> can be <tt class="docutils literal"><span class="pre">NULL</span></tt> and the call is equivalent to
<a class="reference internal" href="#c.nghttp2_session_server_new2" title="nghttp2_session_server_new2"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_server_new2()</span></tt></a>.</p>
<p>This function does not take ownership <em>mem</em>. The application is
responsible for freeing <em>mem</em>.</p>
<p>The library code does not refer to <em>mem</em> pointer after this
function returns, so the application can safely free it.</p>
<p>This function returns 0 if it succeeds, or one of the following
negative error codes:</p>
<dl class="docutils">
<dt><a class="reference internal" href="#c.NGHTTP2_ERR_NOMEM" title="NGHTTP2_ERR_NOMEM"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_NOMEM</span></tt></a></dt>
<dd>Out of memory.</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_session_del">
void <tt class="descname">nghttp2_session_del</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_del" title="Permalink to this definition"></a></dt>
@ -2528,7 +2695,7 @@ that and returns effective window size.</p>
<dl class="function">
<dt id="c.nghttp2_session_get_stream_remote_window_size">
int32_t <tt class="descname">nghttp2_session_get_stream_remote_window_size</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a>*<em>&nbsp;session</em>, int32_t<em>&nbsp;stream_id</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_get_stream_remote_window_size" title="Permalink to this definition"></a></dt>
int32_t <tt class="descname">nghttp2_session_get_stream_remote_window_size</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, int32_t<em>&nbsp;stream_id</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_get_stream_remote_window_size" title="Permalink to this definition"></a></dt>
<dd><p>Returns the remote window size for a given stream <em>stream_id</em>.</p>
<p>This is the amount of flow-controlled payload (e.g., DATA) that the
local endpoint can send without stream level WINDOW_UPDATE. There
@ -2541,21 +2708,21 @@ min(<a class="reference internal" href="#c.nghttp2_session_get_stream_remote_win
<dl class="function">
<dt id="c.nghttp2_session_get_remote_window_size">
int32_t <tt class="descname">nghttp2_session_get_remote_window_size</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a>*<em>&nbsp;session</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_get_remote_window_size" title="Permalink to this definition"></a></dt>
int32_t <tt class="descname">nghttp2_session_get_remote_window_size</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_get_remote_window_size" title="Permalink to this definition"></a></dt>
<dd><p>Returns the remote window size for a connection.</p>
<p>This function always succeeds.</p>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_session_get_stream_local_close">
int <tt class="descname">nghttp2_session_get_stream_local_close</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a>*<em>&nbsp;session</em>, int32_t<em>&nbsp;stream_id</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_get_stream_local_close" title="Permalink to this definition"></a></dt>
int <tt class="descname">nghttp2_session_get_stream_local_close</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, int32_t<em>&nbsp;stream_id</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_get_stream_local_close" title="Permalink to this definition"></a></dt>
<dd><p>Returns 1 if local peer half closed the given stream <em>stream_id</em>.
Returns 0 if it did not. Returns -1 if no such stream exists.</p>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_session_get_stream_remote_close">
int <tt class="descname">nghttp2_session_get_stream_remote_close</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a>*<em>&nbsp;session</em>, int32_t<em>&nbsp;stream_id</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_get_stream_remote_close" title="Permalink to this definition"></a></dt>
int <tt class="descname">nghttp2_session_get_stream_remote_close</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, int32_t<em>&nbsp;stream_id</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_get_stream_remote_close" title="Permalink to this definition"></a></dt>
<dd><p>Returns 1 if remote peer half closed the given stream <em>stream_id</em>.
Returns 0 if it did not. Returns -1 if no such stream exists.</p>
</dd></dl>
@ -2564,8 +2731,10 @@ Returns 0 if it did not. Returns -1 if no such stream exists.</p>
<dt id="c.nghttp2_session_terminate_session">
int <tt class="descname">nghttp2_session_terminate_session</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, uint32_t<em>&nbsp;error_code</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_terminate_session" title="Permalink to this definition"></a></dt>
<dd><p>Signals the session so that the connection should be terminated.</p>
<p>The last stream ID is the ID of a stream for which
<a class="reference internal" href="#c.nghttp2_on_frame_recv_callback" title="nghttp2_on_frame_recv_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_frame_recv_callback</span></tt></a> was called most recently.</p>
<p>The last stream ID is the minimum value between the stream ID of a
stream for which <a class="reference internal" href="#c.nghttp2_on_frame_recv_callback" title="nghttp2_on_frame_recv_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_frame_recv_callback</span></tt></a> was called
most recently and the last stream ID we have sent to the peer
previously.</p>
<p>The <em>error_code</em> is the error code of this GOAWAY frame. The
pre-defined error code is one of <a class="reference internal" href="#c.nghttp2_error_code" title="nghttp2_error_code"><tt class="xref c c-macro docutils literal"><span class="pre">nghttp2_error_code</span></tt></a>.</p>
<p>After the transmission, both <a class="reference internal" href="#c.nghttp2_session_want_read" title="nghttp2_session_want_read"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_want_read()</span></tt></a> and
@ -2587,12 +2756,54 @@ int <tt class="descname">nghttp2_session_terminate_session2</tt><big>(</big><a c
<dd><p>Signals the session so that the connection should be terminated.</p>
<p>This function behaves like <a class="reference internal" href="#c.nghttp2_session_terminate_session" title="nghttp2_session_terminate_session"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_terminate_session()</span></tt></a>,
but the last stream ID can be specified by the application for fine
grained control of stream.</p>
grained control of stream. The HTTP/2 specification does not allow
last_stream_id to be increased. So the actual value sent as
last_stream_id is the minimum value between the given
<em>last_stream_id</em> and the last_stream_id we have previously sent to
the peer.</p>
<p>The <em>last_stream_id</em> is peer's stream ID or 0. So if <em>session</em> is
initialized as client, <em>last_stream_id</em> must be even or 0. If
<em>session</em> is initialized as server, <em>last_stream_id</em> must be odd or
0.</p>
<p>This function returns 0 if it succeeds, or one of the following
negative error codes:</p>
<dl class="docutils">
<dt><a class="reference internal" href="#c.NGHTTP2_ERR_NOMEM" title="NGHTTP2_ERR_NOMEM"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_NOMEM</span></tt></a></dt>
<dd>Out of memory.</dd>
<dt><a class="reference internal" href="#c.NGHTTP2_ERR_INVALID_ARGUMENT" title="NGHTTP2_ERR_INVALID_ARGUMENT"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_INVALID_ARGUMENT</span></tt></a></dt>
<dd>The <em>last_stream_id</em> is invalid.</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_submit_shutdown_notice">
int <tt class="descname">nghttp2_submit_shutdown_notice</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em><big>)</big><a class="headerlink" href="#c.nghttp2_submit_shutdown_notice" title="Permalink to this definition"></a></dt>
<dd><p>Signals to the client that the server started graceful shutdown
procedure.</p>
<p>This function is only usable for server. If this function is
called with client side session, this function returns
<a class="reference internal" href="#c.NGHTTP2_ERR_INVALID_STATE" title="NGHTTP2_ERR_INVALID_STATE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_INVALID_STATE</span></tt></a>.</p>
<p>To gracefully shutdown HTTP/2 session, server should call this
function to send GOAWAY with last_stream_id (1u &lt;&lt; 31) - 1. And
after some delay (e.g., 1 RTT), send another GOAWAY with the stream
ID that the server has some processing using
<a class="reference internal" href="#c.nghttp2_submit_goaway" title="nghttp2_submit_goaway"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_submit_goaway()</span></tt></a>. See also
<a class="reference internal" href="#c.nghttp2_session_get_last_proc_stream_id" title="nghttp2_session_get_last_proc_stream_id"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_get_last_proc_stream_id()</span></tt></a>.</p>
<p>Unlike <a class="reference internal" href="#c.nghttp2_submit_goaway" title="nghttp2_submit_goaway"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_submit_goaway()</span></tt></a>, this function just sends GOAWAY
and does nothing more. This is a mere indication to the client
that session shutdown is imminent. The application should call
<a class="reference internal" href="#c.nghttp2_submit_goaway" title="nghttp2_submit_goaway"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_submit_goaway()</span></tt></a> with appropriate last_stream_id after
this call.</p>
<p>If one or more GOAWAY frame have been already sent by either
<a class="reference internal" href="#c.nghttp2_submit_goaway" title="nghttp2_submit_goaway"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_submit_goaway()</span></tt></a> or <a class="reference internal" href="#c.nghttp2_session_terminate_session" title="nghttp2_session_terminate_session"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_terminate_session()</span></tt></a>,
this function has no effect.</p>
<p>This function returns 0 if it succeeds, or one of the following
negative error codes:</p>
<dl class="docutils">
<dt><a class="reference internal" href="#c.NGHTTP2_ERR_NOMEM" title="NGHTTP2_ERR_NOMEM"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_NOMEM</span></tt></a></dt>
<dd>Out of memory.</dd>
<dt><a class="reference internal" href="#c.NGHTTP2_ERR_INVALID_STATE" title="NGHTTP2_ERR_INVALID_STATE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_INVALID_STATE</span></tt></a></dt>
<dd>The <em>session</em> is initialized as client.</dd>
</dl>
</dd></dl>
@ -2604,6 +2815,29 @@ The <em>id</em> must be one of values defined in
<a class="reference internal" href="#c.nghttp2_settings_id" title="nghttp2_settings_id"><tt class="xref c c-macro docutils literal"><span class="pre">nghttp2_settings_id</span></tt></a>.</p>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_session_set_next_stream_id">
int <tt class="descname">nghttp2_session_set_next_stream_id</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, int32_t<em>&nbsp;next_stream_id</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_set_next_stream_id" title="Permalink to this definition"></a></dt>
<dd><p>Tells the <em>session</em> that next stream ID is <em>next_stream_id</em>. The
<em>next_stream_id</em> must be equal or greater than the value returned
by <a class="reference internal" href="#c.nghttp2_session_get_next_stream_id" title="nghttp2_session_get_next_stream_id"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_get_next_stream_id()</span></tt></a>.</p>
<p>This function returns 0 if it succeeds, or one of the following
negative error codes:</p>
<dl class="docutils">
<dt><a class="reference internal" href="#c.NGHTTP2_ERR_INVALID_ARGUMENT" title="NGHTTP2_ERR_INVALID_ARGUMENT"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_INVALID_ARGUMENT</span></tt></a></dt>
<dd>The <em>next_stream_id</em> is strictly less than the value
<a class="reference internal" href="#c.nghttp2_session_get_next_stream_id" title="nghttp2_session_get_next_stream_id"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_get_next_stream_id()</span></tt></a> returns.</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_session_get_next_stream_id">
uint32_t <tt class="descname">nghttp2_session_get_next_stream_id</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_get_next_stream_id" title="Permalink to this definition"></a></dt>
<dd><p>Returns the next outgoing stream ID. Notice that return type is
uint32_t. If we run out of stream ID for this session, this
function returns 1 &lt;&lt; 31.</p>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_session_consume">
int <tt class="descname">nghttp2_session_consume</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, int32_t<em>&nbsp;stream_id</em>, size_t<em>&nbsp;size</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_consume" title="Permalink to this definition"></a></dt>
@ -2728,7 +2962,7 @@ strictly less than <a class="reference internal" href="#c.NGHTTP2_MIN_WEIGHT" ti
<p>The <em>nva</em> is an array of name/value pair <a class="reference internal" href="#c.nghttp2_nv" title="nghttp2_nv"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_nv</span></tt></a> with
<em>nvlen</em> elements. The application is responsible to include
required pseudo-header fields (header field whose name starts with
&#8221;:&#8221;) in <em>nva</em> and must place pseudo-headers before regular header
&quot;:&quot;) in <em>nva</em> and must place pseudo-headers before regular header
fields.</p>
<p>This function creates copies of all name/value pairs in <em>nva</em>. It
also lower-cases all names in <em>nva</em>. The order of elements in
@ -2773,7 +3007,7 @@ frames against the stream <em>stream_id</em>.</p>
<p>The <em>nva</em> is an array of name/value pair <a class="reference internal" href="#c.nghttp2_nv" title="nghttp2_nv"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_nv</span></tt></a> with
<em>nvlen</em> elements. The application is responsible to include
required pseudo-header fields (header field whose name starts with
&#8221;:&#8221;) in <em>nva</em> and must place pseudo-headers before regular header
&quot;:&quot;) in <em>nva</em> and must place pseudo-headers before regular header
fields.</p>
<p>This function creates copies of all name/value pairs in <em>nva</em>. It
also lower-cases all names in <em>nva</em>. The order of elements in
@ -2790,7 +3024,7 @@ When pushing a resource using this function, the <em>session</em> must be
configured using <a class="reference internal" href="#c.nghttp2_session_server_new" title="nghttp2_session_server_new"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_server_new()</span></tt></a> or its variants and
the target stream denoted by the <em>stream_id</em> must be reserved using
<a class="reference internal" href="#c.nghttp2_submit_push_promise" title="nghttp2_submit_push_promise"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_submit_push_promise()</span></tt></a>.</p>
<p>To send non-final response headers (e.g., HTTP status 101), don&#8217;t
<p>To send non-final response headers (e.g., HTTP status 101), don't
use this function because this function half-closes the outbound
stream. Instead, use <a class="reference internal" href="#c.nghttp2_submit_headers" title="nghttp2_submit_headers"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_submit_headers()</span></tt></a> for this purpose.</p>
<p>This function returns 0 if it succeeds, or one of the following
@ -2801,6 +3035,12 @@ negative error codes:</p>
<dt><a class="reference internal" href="#c.NGHTTP2_ERR_INVALID_ARGUMENT" title="NGHTTP2_ERR_INVALID_ARGUMENT"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_INVALID_ARGUMENT</span></tt></a></dt>
<dd>The <em>stream_id</em> is 0.</dd>
</dl>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p class="last">Calling this function twice for the same stream ID may lead to
program crash. It is generally considered to a programming error
to commit response twice.</p>
</div>
</dd></dl>
<dl class="function">
@ -2833,7 +3073,7 @@ strictly less than <a class="reference internal" href="#c.NGHTTP2_MIN_WEIGHT" ti
<p>The <em>nva</em> is an array of name/value pair <a class="reference internal" href="#c.nghttp2_nv" title="nghttp2_nv"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_nv</span></tt></a> with
<em>nvlen</em> elements. The application is responsible to include
required pseudo-header fields (header field whose name starts with
&#8221;:&#8221;) in <em>nva</em> and must place pseudo-headers before regular header
&quot;:&quot;) in <em>nva</em> and must place pseudo-headers before regular header
fields.</p>
<p>This function creates copies of all name/value pairs in <em>nva</em>. It
also lower-cases all names in <em>nva</em>. The order of elements in
@ -2956,7 +3196,7 @@ indicates the number of <a class="reference internal" href="#c.nghttp2_settings_
<a class="reference internal" href="#c.NGHTTP2_FLAG_NONE" title="NGHTTP2_FLAG_NONE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_FLAG_NONE</span></tt></a>.</p>
<p>This function does not take ownership of the <em>iv</em>. This function
copies all the elements in the <em>iv</em>.</p>
<p>While updating individual stream&#8217;s local window size, if the window
<p>While updating individual stream's local window size, if the window
size becomes strictly larger than NGHTTP2_MAX_WINDOW_SIZE,
RST_STREAM is issued against such a stream.</p>
<p>SETTINGS with <a class="reference internal" href="#c.NGHTTP2_FLAG_ACK" title="NGHTTP2_FLAG_ACK"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_FLAG_ACK</span></tt></a> is automatically submitted
@ -2987,7 +3227,7 @@ the last sequence of the PUSH_PROMISE or CONTINUATION frame.</p>
<p>The <em>nva</em> is an array of name/value pair <a class="reference internal" href="#c.nghttp2_nv" title="nghttp2_nv"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_nv</span></tt></a> with
<em>nvlen</em> elements. The application is responsible to include
required pseudo-header fields (header field whose name starts with
&#8221;:&#8221;) in <em>nva</em> and must place pseudo-headers before regular header
&quot;:&quot;) in <em>nva</em> and must place pseudo-headers before regular header
fields.</p>
<p>This function creates copies of all name/value pairs in <em>nva</em>. It
also lower-cases all names in <em>nva</em>. The order of elements in
@ -3011,7 +3251,8 @@ client.</dd>
<dd>No stream ID is available because maximum stream ID was
reached.</dd>
<dt><a class="reference internal" href="#c.NGHTTP2_ERR_INVALID_ARGUMENT" title="NGHTTP2_ERR_INVALID_ARGUMENT"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_INVALID_ARGUMENT</span></tt></a></dt>
<dd>The <em>stream_id</em> is 0.</dd>
<dd>The <em>stream_id</em> is 0; The <em>stream_id</em> does not designate stream
that peer initiated.</dd>
</dl>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
@ -3026,7 +3267,7 @@ frame.</p>
<dl class="function">
<dt id="c.nghttp2_submit_ping">
int <tt class="descname">nghttp2_submit_ping</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, uint8_t<em>&nbsp;flags</em>, const uint8_t<em>&nbsp;*opaque_data</em><big>)</big><a class="headerlink" href="#c.nghttp2_submit_ping" title="Permalink to this definition"></a></dt>
<dd><p>Submits PING frame. You don&#8217;t have to send PING back when you
<dd><p>Submits PING frame. You don't have to send PING back when you
received PING frame. The library automatically submits PING frame
in this case.</p>
<p>The <em>flags</em> is currently ignored and should be
@ -3051,27 +3292,49 @@ the error code <em>error_code</em>.</p>
<p>The pre-defined error code is one of <a class="reference internal" href="#c.nghttp2_error_code" title="nghttp2_error_code"><tt class="xref c c-macro docutils literal"><span class="pre">nghttp2_error_code</span></tt></a>.</p>
<p>The <em>flags</em> is currently ignored and should be
<a class="reference internal" href="#c.NGHTTP2_FLAG_NONE" title="NGHTTP2_FLAG_NONE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_FLAG_NONE</span></tt></a>.</p>
<p>The <em>last_stream_id</em> is peer's stream ID or 0. So if <em>session</em> is
initialized as client, <em>last_stream_id</em> must be even or 0. If
<em>session</em> is initialized as server, <em>last_stream_id</em> must be odd or
0.</p>
<p>The HTTP/2 specification says last_stream_id must not be increased
from the value previously sent. So the actual value sent as
last_stream_id is the minimum value between the given
<em>last_stream_id</em> and the last_stream_id previously sent to the
peer.</p>
<p>If the <em>opaque_data</em> is not <tt class="docutils literal"><span class="pre">NULL</span></tt> and <em>opaque_data_len</em> is not
zero, those data will be sent as additional debug data. The
library makes a copy of the memory region pointed by <em>opaque_data</em>
with the length <em>opaque_data_len</em>, so the caller does not need to
keep this memory after the return of this function. If the
<em>opaque_data_len</em> is 0, the <em>opaque_data</em> could be <tt class="docutils literal"><span class="pre">NULL</span></tt>.</p>
<p>To shutdown gracefully, first send GOAWAY with <tt class="docutils literal"><span class="pre">last_stream_id</span> <span class="pre">=</span>
<span class="pre">(1u</span> <span class="pre">&lt;&lt;</span> <span class="pre">31)</span> <span class="pre">-</span> <span class="pre">1</span></tt>. After 1 RTT, call either
<a class="reference internal" href="#c.nghttp2_submit_goaway" title="nghttp2_submit_goaway"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_submit_goaway()</span></tt></a>, <a class="reference internal" href="#c.nghttp2_session_terminate_session" title="nghttp2_session_terminate_session"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_terminate_session()</span></tt></a> or
<a class="reference internal" href="#c.nghttp2_session_terminate_session2" title="nghttp2_session_terminate_session2"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_terminate_session2()</span></tt></a>. The latter 2 will close
HTTP/2 session immediately after transmission of the frame.</p>
<p>After successful transmission of GOAWAY, following things happen.
All incoming streams having strictly more than <em>last_stream_id</em> are
closed. All incoming HEADERS which starts new stream are simply
ignored. After all active streams are handled, both
<a class="reference internal" href="#c.nghttp2_session_want_read" title="nghttp2_session_want_read"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_want_read()</span></tt></a> and <a class="reference internal" href="#c.nghttp2_session_want_write" title="nghttp2_session_want_write"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_want_write()</span></tt></a>
return 0 and the application can close session.</p>
<p>This function returns 0 if it succeeds, or one of the following
negative error codes:</p>
<dl class="docutils">
<dt><a class="reference internal" href="#c.NGHTTP2_ERR_NOMEM" title="NGHTTP2_ERR_NOMEM"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_NOMEM</span></tt></a></dt>
<dd>Out of memory.</dd>
<dt><a class="reference internal" href="#c.NGHTTP2_ERR_INVALID_ARGUMENT" title="NGHTTP2_ERR_INVALID_ARGUMENT"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_INVALID_ARGUMENT</span></tt></a></dt>
<dd>The <em>opaque_data_len</em> is too large.</dd>
<dd>The <em>opaque_data_len</em> is too large; the <em>last_stream_id</em> is
invalid.</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_session_get_last_proc_stream_id">
int32_t <tt class="descname">nghttp2_session_get_last_proc_stream_id</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_get_last_proc_stream_id" title="Permalink to this definition"></a></dt>
<dd><p>Returns the last stream ID of a stream for which
<a class="reference internal" href="#c.nghttp2_on_frame_recv_callback" title="nghttp2_on_frame_recv_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_on_frame_recv_callback</span></tt></a> was invoked most recently.
The returned value can be used as last_stream_id parameter for
<a class="reference internal" href="#c.nghttp2_submit_goaway" title="nghttp2_submit_goaway"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_submit_goaway()</span></tt></a> and
<a class="reference internal" href="#c.nghttp2_session_terminate_session2" title="nghttp2_session_terminate_session2"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_terminate_session2()</span></tt></a>.</p>
<p>This function always succeeds.</p>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_submit_window_update">
int <tt class="descname">nghttp2_submit_window_update</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, uint8_t<em>&nbsp;flags</em>, int32_t<em>&nbsp;stream_id</em>, int32_t<em>&nbsp;window_size_increment</em><big>)</big><a class="headerlink" href="#c.nghttp2_submit_window_update" title="Permalink to this definition"></a></dt>
@ -3104,27 +3367,9 @@ negative error codes:</p>
<dl class="function">
<dt id="c.nghttp2_submit_altsvc">
int <tt class="descname">nghttp2_submit_altsvc</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em>&nbsp;*session</em>, uint8_t<em>&nbsp;flags</em>, int32_t<em>&nbsp;stream_id</em>, uint32_t<em>&nbsp;max_age</em>, uint16_t<em>&nbsp;port</em>, const uint8_t<em>&nbsp;*protocol_id</em>, size_t<em>&nbsp;protocol_id_len</em>, const uint8_t<em>&nbsp;*host</em>, size_t<em>&nbsp;host_len</em>, const uint8_t<em>&nbsp;*origin</em>, size_t<em>&nbsp;origin_len</em><big>)</big><a class="headerlink" href="#c.nghttp2_submit_altsvc" title="Permalink to this definition"></a></dt>
<dd><p>Submits ALTSVC frame with given parameters.</p>
<p>The <em>flags</em> is currently ignored and should be
<a class="reference internal" href="#c.NGHTTP2_FLAG_NONE" title="NGHTTP2_FLAG_NONE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_FLAG_NONE</span></tt></a>.</p>
<p>Only the server can send the ALTSVC frame. If <em>session</em> is
initialized as client, this function fails and returns
<a class="reference internal" href="#c.NGHTTP2_ERR_PROTO" title="NGHTTP2_ERR_PROTO"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_PROTO</span></tt></a>.</p>
<p>If the <em>protocol_id_len</em> is 0, the <em>protocol_id</em> could be <tt class="docutils literal"><span class="pre">NULL</span></tt>.</p>
<p>If the <em>host_len</em> is 0, the <em>host</em> could be <tt class="docutils literal"><span class="pre">NULL</span></tt>.</p>
<p>If the <em>origin_len</em> is 0, the <em>origin</em> could be <tt class="docutils literal"><span class="pre">NULL</span></tt>.</p>
<p>This function returns 0 if it succeeds, or one of the following
negative error codes:</p>
<dl class="docutils">
<dt><a class="reference internal" href="#c.NGHTTP2_ERR_NOMEM" title="NGHTTP2_ERR_NOMEM"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_NOMEM</span></tt></a></dt>
<dd>Out of memory.</dd>
<dt><a class="reference internal" href="#c.NGHTTP2_ERR_PROTO" title="NGHTTP2_ERR_PROTO"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_PROTO</span></tt></a></dt>
<dd>The function is invoked with <em>session</em> which was initialized as
client.</dd>
<dt><a class="reference internal" href="#c.NGHTTP2_ERR_INVALID_ARGUMENT" title="NGHTTP2_ERR_INVALID_ARGUMENT"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_INVALID_ARGUMENT</span></tt></a></dt>
<dd>The combined length of <em>protocol_id_len</em>, <em>host_len</em> and
<em>origin_len</em> is is too large.</dd>
</dl>
<dd><p>This function previously submits ALTSVC frame with given
parameters, but is deprecated and will be removed in a future
release. This function does nothing and just return 0.</p>
</dd></dl>
<dl class="function">
@ -3141,7 +3386,7 @@ than <tt class="docutils literal"><span class="pre">rhs-&gt;name</span></tt>; or
<dt id="c.nghttp2_select_next_protocol">
int <tt class="descname">nghttp2_select_next_protocol</tt><big>(</big>unsigned char<em>&nbsp;**out</em>, unsigned char<em>&nbsp;*outlen</em>, const unsigned char<em>&nbsp;*in</em>, unsigned int<em>&nbsp;inlen</em><big>)</big><a class="headerlink" href="#c.nghttp2_select_next_protocol" title="Permalink to this definition"></a></dt>
<dd><p>A helper function for dealing with NPN in client side or ALPN in
server side. The <em>in</em> contains peer&#8217;s protocol list in preferable
server side. The <em>in</em> contains peer's protocol list in preferable
order. The format of <em>in</em> is length-prefixed and not
null-terminated. For example, <tt class="docutils literal"><span class="pre">HTTP-draft-04/2.0</span></tt> and
<tt class="docutils literal"><span class="pre">http/1.1</span></tt> stored in <em>in</em> like this:</p>
@ -3154,9 +3399,9 @@ null-terminated. For example, <tt class="docutils literal"><span class="pre">HT
</div>
<p>The selection algorithm is as follows:</p>
<ol class="arabic simple">
<li>If peer&#8217;s list contains HTTP/2 protocol the library supports,
<li>If peer's list contains HTTP/2 protocol the library supports,
it is selected and returns 1. The following step is not taken.</li>
<li>If peer&#8217;s list contains <tt class="docutils literal"><span class="pre">http/1.1</span></tt>, this function selects
<li>If peer's list contains <tt class="docutils literal"><span class="pre">http/1.1</span></tt>, this function selects
<tt class="docutils literal"><span class="pre">http/1.1</span></tt> and returns 0. The following step is not taken.</li>
<li>This function selects nothing and returns -1 (So called
non-overlap case). In this case, <em>out</em> and <em>outlen</em> are left
@ -3239,6 +3484,19 @@ negative error codes:</p>
</dl>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_hd_deflate_new2">
int <tt class="descname">nghttp2_hd_deflate_new2</tt><big>(</big><a class="reference internal" href="#c.nghttp2_hd_deflater" title="nghttp2_hd_deflater">nghttp2_hd_deflater</a><em>&nbsp;**deflater_ptr</em>, size_t<em>&nbsp;deflate_hd_table_bufsize_max</em>, <a class="reference internal" href="#c.nghttp2_mem" title="nghttp2_mem">nghttp2_mem</a><em>&nbsp;*mem</em><big>)</big><a class="headerlink" href="#c.nghttp2_hd_deflate_new2" title="Permalink to this definition"></a></dt>
<dd><p>Like <a class="reference internal" href="#c.nghttp2_hd_deflate_new" title="nghttp2_hd_deflate_new"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_hd_deflate_new()</span></tt></a>, but with additional custom memory
allocator specified in the <em>mem</em>.</p>
<p>The <em>mem</em> can be <tt class="docutils literal"><span class="pre">NULL</span></tt> and the call is equivalent to
<a class="reference internal" href="#c.nghttp2_hd_deflate_new" title="nghttp2_hd_deflate_new"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_hd_deflate_new()</span></tt></a>.</p>
<p>This function does not take ownership <em>mem</em>. The application is
responsible for freeing <em>mem</em>.</p>
<p>The library code does not refer to <em>mem</em> pointer after this
function returns, so the application can safely free it.</p>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_hd_deflate_del">
void <tt class="descname">nghttp2_hd_deflate_del</tt><big>(</big><a class="reference internal" href="#c.nghttp2_hd_deflater" title="nghttp2_hd_deflater">nghttp2_hd_deflater</a><em>&nbsp;*deflater</em><big>)</big><a class="headerlink" href="#c.nghttp2_hd_deflate_del" title="Permalink to this definition"></a></dt>
@ -3312,6 +3570,19 @@ negative error codes:</p>
</dl>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_hd_inflate_new2">
int <tt class="descname">nghttp2_hd_inflate_new2</tt><big>(</big><a class="reference internal" href="#c.nghttp2_hd_inflater" title="nghttp2_hd_inflater">nghttp2_hd_inflater</a><em>&nbsp;**inflater_ptr</em>, <a class="reference internal" href="#c.nghttp2_mem" title="nghttp2_mem">nghttp2_mem</a><em>&nbsp;*mem</em><big>)</big><a class="headerlink" href="#c.nghttp2_hd_inflate_new2" title="Permalink to this definition"></a></dt>
<dd><p>Like <a class="reference internal" href="#c.nghttp2_hd_inflate_new" title="nghttp2_hd_inflate_new"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_hd_inflate_new()</span></tt></a>, but with additional custom memory
allocator specified in the <em>mem</em>.</p>
<p>The <em>mem</em> can be <tt class="docutils literal"><span class="pre">NULL</span></tt> and the call is equivalent to
<a class="reference internal" href="#c.nghttp2_hd_inflate_new" title="nghttp2_hd_inflate_new"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_hd_inflate_new()</span></tt></a>.</p>
<p>This function does not take ownership <em>mem</em>. The application is
responsible for freeing <em>mem</em>.</p>
<p>The library code does not refer to <em>mem</em> pointer after this
function returns, so the application can safely free it.</p>
</dd></dl>
<dl class="function">
<dt id="c.nghttp2_hd_inflate_del">
void <tt class="descname">nghttp2_hd_inflate_del</tt><big>(</big><a class="reference internal" href="#c.nghttp2_hd_inflater" title="nghttp2_hd_inflater">nghttp2_hd_inflater</a><em>&nbsp;*inflater</em><big>)</big><a class="headerlink" href="#c.nghttp2_hd_inflate_del" title="Permalink to this definition"></a></dt>
@ -3436,11 +3707,12 @@ always succeeds.</p>
<div role="contentinfo">
<p>
&copy; Copyright 2012, 2014, Tatsuhiro Tsujikawa.
&copy; Copyright 2012, 2015, Tatsuhiro Tsujikawa.
</p>
</div>
<a href="https://github.com/snide/sphinx_rtd_theme">Sphinx theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
@ -3456,7 +3728,7 @@ always succeeds.</p>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'0.6.3-DEV',
VERSION:'0.7.2-DEV',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: false

View File

@ -7,14 +7,14 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>asio_http2.h &mdash; nghttp2 0.6.3-DEV documentation</title>
<title>asio_http2.h &mdash; nghttp2 0.7.2-DEV documentation</title>
<link href='https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700&subset=latin,cyrillic' rel='stylesheet' type='text/css'>
@ -28,7 +28,7 @@
<link rel="top" title="nghttp2 0.6.3-DEV documentation" href="index.html"/>
<link rel="top" title="nghttp2 0.7.2-DEV documentation" href="index.html"/>
<link rel="prev" title="nghttp2ver.h" href="nghttp2ver.h.html"/>
@ -46,6 +46,7 @@
<a href="index.html" class="fa fa-home"> nghttp2</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
@ -58,6 +59,7 @@
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="package_README.html">nghttp2 - HTTP/2 C Library</a><ul>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#development-status">Development Status</a></li>
@ -65,6 +67,8 @@
<li class="toctree-l2"><a class="reference internal" href="package_README.html#requirements">Requirements</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#build-from-git">Build from git</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#building-documentation">Building documentation</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#unit-tests">Unit tests</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#integration-tests">Integration tests</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#client-server-and-proxy-programs">Client, Server and Proxy programs</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#benchmarking-tool">Benchmarking tool</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#hpack-tools">HPACK tools</a></li>
@ -73,6 +77,10 @@
<li class="toctree-l2"><a class="reference internal" href="package_README.html#contribution">Contribution</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="contribute.html">Contribution Guidelines</a><ul>
<li class="toctree-l2"><a class="reference internal" href="contribute.html#coding-style">Coding style</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="building-android-binary.html">Building Android binary</a></li>
<li class="toctree-l1"><a class="reference internal" href="tutorial-client.html">Tutorial: HTTP/2 client</a><ul>
<li class="toctree-l2"><a class="reference internal" href="tutorial-client.html#libevent-client-c">libevent-client.c</a></li>
@ -89,34 +97,32 @@
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttp.1.html">nghttp(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttpd.1.html">nghttpd(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttpx.1.html">nghttpx(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#files">FILES</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#signals">SIGNALS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="h2load.1.html">h2load(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
@ -130,8 +136,9 @@
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#specifying-additional-ca-certificate">Specifying additional CA certificate</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#read-write-rate-limit">Read/write rate limit</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#rewriting-location-header-field">Rewriting location header field</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#hot-deploy">Hot deploy</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#hot-swapping">Hot swapping</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#re-opening-log-files">Re-opening log files</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#multiple-http-1-backend-addresses">Multiple HTTP/1 backend addresses</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="h2load-howto.html">h2load - HTTP/2 benchmarking tool - HOW-TO</a><ul>
@ -165,9 +172,11 @@
<li class="toctree-l1 current"><a class="current reference internal" href="">asio_http2.h</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/tatsuhiro-t/nghttp2">Source</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/tatsuhiro-t/nghttp2/issues">Issues</a></li>
<li class="toctree-l1"><a class="reference external" href="https://nghttp2.org/">nghttp2.org</a></li>
</ul>
</div>
&nbsp;
</nav>
@ -199,7 +208,7 @@
<div class="section" id="asio-http2-h">
<h1>asio_http2.h<a class="headerlink" href="#asio-http2-h" title="Permalink to this headline"></a></h1>
<div class="highlight-c"><div class="highlight"><pre><span class="cm">/*</span>
<div class="highlight-cpp"><div class="highlight"><pre><span class="cm">/*</span>
<span class="cm"> * nghttp2 - HTTP/2 C Library</span>
<span class="cm"> *</span>
<span class="cm"> * Copyright (c) 2014 Tatsuhiro Tsujikawa</span>
@ -232,9 +241,9 @@
<span class="cp">#include &lt;vector&gt;</span>
<span class="cp">#include &lt;functional&gt;</span>
<span class="n">namespace</span> <span class="n">nghttp2</span> <span class="p">{</span>
<span class="k">namespace</span> <span class="n">nghttp2</span> <span class="p">{</span>
<span class="n">namespace</span> <span class="n">asio_http2</span> <span class="p">{</span>
<span class="k">namespace</span> <span class="n">asio_http2</span> <span class="p">{</span>
<span class="k">struct</span> <span class="n">header</span> <span class="p">{</span>
<span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">name</span><span class="p">;</span>
@ -254,13 +263,13 @@
<span class="c1">// callback until application calls response::resume(). This is</span>
<span class="c1">// useful when there is no data to send at the moment but there will</span>
<span class="c1">// be more to come in near future.</span>
<span class="k">typedef</span> <span class="n">std</span><span class="o">::</span><span class="n">function</span><span class="o">&lt;</span><span class="n">std</span><span class="o">::</span><span class="n">pair</span><span class="o">&lt;</span><span class="kt">ssize_t</span><span class="p">,</span> <span class="kt">bool</span><span class="o">&gt;</span>
<span class="p">(</span><span class="kt">uint8_t</span> <span class="o">*</span><span class="n">buf</span><span class="p">,</span> <span class="n">std</span><span class="o">::</span><span class="kt">size_t</span> <span class="n">len</span><span class="p">)</span><span class="o">&gt;</span> <span class="n">read_cb</span><span class="p">;</span>
<span class="k">typedef</span> <span class="n">std</span><span class="o">::</span><span class="n">function</span><span class="o">&lt;</span><span class="n">std</span><span class="o">::</span><span class="n">pair</span><span class="o">&lt;</span><span class="kt">ssize_t</span><span class="p">,</span> <span class="kt">bool</span><span class="o">&gt;</span><span class="p">(</span><span class="kt">uint8_t</span> <span class="o">*</span><span class="n">buf</span><span class="p">,</span> <span class="n">std</span><span class="o">::</span><span class="kt">size_t</span> <span class="n">len</span><span class="p">)</span><span class="o">&gt;</span>
<span class="n">read_cb</span><span class="p">;</span>
<span class="n">class</span> <span class="n">channel_impl</span><span class="p">;</span>
<span class="k">class</span> <span class="nc">channel_impl</span><span class="p">;</span>
<span class="n">class</span> <span class="n">channel</span> <span class="p">{</span>
<span class="nl">public:</span>
<span class="k">class</span> <span class="nc">channel</span> <span class="p">{</span>
<span class="k">public</span><span class="o">:</span>
<span class="c1">// Application must not call this directly.</span>
<span class="n">channel</span><span class="p">();</span>
@ -273,25 +282,26 @@
<span class="c1">// Application must not call this directly.</span>
<span class="n">channel_impl</span> <span class="o">&amp;</span><span class="n">impl</span><span class="p">();</span>
<span class="nl">private:</span>
<span class="k">private</span><span class="o">:</span>
<span class="n">std</span><span class="o">::</span><span class="n">unique_ptr</span><span class="o">&lt;</span><span class="n">channel_impl</span><span class="o">&gt;</span> <span class="n">impl_</span><span class="p">;</span>
<span class="p">};</span>
<span class="k">typedef</span> <span class="n">std</span><span class="o">::</span><span class="n">function</span><span class="o">&lt;</span><span class="kt">void</span><span class="p">(</span><span class="n">channel</span> <span class="o">&amp;</span><span class="p">)</span><span class="o">&gt;</span> <span class="n">thread_cb</span><span class="p">;</span>
<span class="n">namespace</span> <span class="n">server</span> <span class="p">{</span>
<span class="k">namespace</span> <span class="n">server</span> <span class="p">{</span>
<span class="n">class</span> <span class="n">request_impl</span><span class="p">;</span>
<span class="n">class</span> <span class="n">response_impl</span><span class="p">;</span>
<span class="k">class</span> <span class="nc">request_impl</span><span class="p">;</span>
<span class="k">class</span> <span class="nc">response_impl</span><span class="p">;</span>
<span class="n">class</span> <span class="n">request</span> <span class="p">{</span>
<span class="nl">public:</span>
<span class="k">class</span> <span class="nc">request</span> <span class="p">{</span>
<span class="k">public</span><span class="o">:</span>
<span class="c1">// Application must not call this directly.</span>
<span class="n">request</span><span class="p">();</span>
<span class="c1">// Returns request headers. The pusedo headers, which start with</span>
<span class="c1">// colon (;), are exluced from this list.</span>
<span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">vector</span><span class="o">&lt;</span><span class="n">header</span><span class="o">&gt;&amp;</span> <span class="n">headers</span><span class="p">()</span> <span class="k">const</span><span class="p">;</span>
<span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">vector</span><span class="o">&lt;</span><span class="n">header</span><span class="o">&gt;</span> <span class="o">&amp;</span><span class="n">headers</span><span class="p">()</span> <span class="k">const</span><span class="p">;</span>
<span class="c1">// Returns method (e.g., GET).</span>
<span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="o">&amp;</span><span class="n">method</span><span class="p">()</span> <span class="k">const</span><span class="p">;</span>
@ -343,12 +353,13 @@
<span class="c1">// Application must not call this directly.</span>
<span class="n">request_impl</span> <span class="o">&amp;</span><span class="n">impl</span><span class="p">();</span>
<span class="nl">private:</span>
<span class="k">private</span><span class="o">:</span>
<span class="n">std</span><span class="o">::</span><span class="n">unique_ptr</span><span class="o">&lt;</span><span class="n">request_impl</span><span class="o">&gt;</span> <span class="n">impl_</span><span class="p">;</span>
<span class="p">};</span>
<span class="n">class</span> <span class="n">response</span> <span class="p">{</span>
<span class="nl">public:</span>
<span class="k">class</span> <span class="nc">response</span> <span class="p">{</span>
<span class="k">public</span><span class="o">:</span>
<span class="c1">// Application must not call this directly.</span>
<span class="n">response</span><span class="p">();</span>
@ -375,26 +386,26 @@
<span class="c1">// Application must not call this directly.</span>
<span class="n">response_impl</span> <span class="o">&amp;</span><span class="n">impl</span><span class="p">();</span>
<span class="nl">private:</span>
<span class="k">private</span><span class="o">:</span>
<span class="n">std</span><span class="o">::</span><span class="n">unique_ptr</span><span class="o">&lt;</span><span class="n">response_impl</span><span class="o">&gt;</span> <span class="n">impl_</span><span class="p">;</span>
<span class="p">};</span>
<span class="c1">// This is so called request callback. Called every time request is</span>
<span class="c1">// received.</span>
<span class="k">typedef</span> <span class="n">std</span><span class="o">::</span><span class="n">function</span><span class="o">&lt;</span><span class="kt">void</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">shared_ptr</span><span class="o">&lt;</span><span class="n">request</span><span class="o">&gt;</span><span class="p">,</span>
<span class="n">std</span><span class="o">::</span><span class="n">shared_ptr</span><span class="o">&lt;</span><span class="n">response</span><span class="o">&gt;</span><span class="p">)</span><span class="o">&gt;</span> <span class="n">request_cb</span><span class="p">;</span>
<span class="k">typedef</span> <span class="n">std</span><span class="o">::</span><span class="n">function</span><span class="o">&lt;</span><span class="kt">void</span><span class="p">(</span><span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">shared_ptr</span><span class="o">&lt;</span><span class="n">request</span><span class="o">&gt;</span> <span class="o">&amp;</span><span class="p">,</span>
<span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">shared_ptr</span><span class="o">&lt;</span><span class="n">response</span><span class="o">&gt;</span> <span class="o">&amp;</span><span class="p">)</span><span class="o">&gt;</span> <span class="n">request_cb</span><span class="p">;</span>
<span class="n">class</span> <span class="n">http2_impl</span><span class="p">;</span>
<span class="k">class</span> <span class="nc">http2_impl</span><span class="p">;</span>
<span class="n">class</span> <span class="n">http2</span> <span class="p">{</span>
<span class="nl">public:</span>
<span class="k">class</span> <span class="nc">http2</span> <span class="p">{</span>
<span class="k">public</span><span class="o">:</span>
<span class="n">http2</span><span class="p">();</span>
<span class="o">~</span><span class="n">http2</span><span class="p">();</span>
<span class="c1">// Starts listening connection on given address and port. The</span>
<span class="c1">// incoming requests are handled by given callback |cb|.</span>
<span class="kt">void</span> <span class="nf">listen</span><span class="p">(</span><span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&amp;</span> <span class="n">address</span><span class="p">,</span> <span class="kt">uint16_t</span> <span class="n">port</span><span class="p">,</span>
<span class="n">request_cb</span> <span class="n">cb</span><span class="p">);</span>
<span class="kt">void</span> <span class="nf">listen</span><span class="p">(</span><span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="o">&amp;</span><span class="n">address</span><span class="p">,</span> <span class="kt">uint16_t</span> <span class="n">port</span><span class="p">,</span> <span class="n">request_cb</span> <span class="n">cb</span><span class="p">);</span>
<span class="c1">// Sets number of native threads to handle incoming HTTP request.</span>
<span class="c1">// It defaults to 1.</span>
@ -409,7 +420,12 @@
<span class="c1">// of thread to handle incoming HTTP request. For this purpose, see</span>
<span class="c1">// num_threads().</span>
<span class="kt">void</span> <span class="nf">num_concurrent_tasks</span><span class="p">(</span><span class="kt">size_t</span> <span class="n">num_concurrent_tasks</span><span class="p">);</span>
<span class="nl">private:</span>
<span class="c1">// Sets the maximum length to which the queue of pending</span>
<span class="c1">// connections.</span>
<span class="kt">void</span> <span class="nf">backlog</span><span class="p">(</span><span class="kt">int</span> <span class="n">backlog</span><span class="p">);</span>
<span class="k">private</span><span class="o">:</span>
<span class="n">std</span><span class="o">::</span><span class="n">unique_ptr</span><span class="o">&lt;</span><span class="n">http2_impl</span><span class="o">&gt;</span> <span class="n">impl_</span><span class="p">;</span>
<span class="p">};</span>
@ -434,7 +450,7 @@
<span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">percent_decode</span><span class="p">(</span><span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="o">&amp;</span><span class="n">s</span><span class="p">);</span>
<span class="c1">// Returns HTTP date representation of current posix time |t|.</span>
<span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">http_date</span><span class="p">(</span><span class="kt">time_t</span> <span class="n">t</span><span class="p">);</span>
<span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">http_date</span><span class="p">(</span><span class="kt">int64_t</span> <span class="n">t</span><span class="p">);</span>
<span class="p">}</span> <span class="c1">// namespace asio_http2</span>
@ -461,11 +477,12 @@
<div role="contentinfo">
<p>
&copy; Copyright 2012, 2014, Tatsuhiro Tsujikawa.
&copy; Copyright 2012, 2015, Tatsuhiro Tsujikawa.
</p>
</div>
<a href="https://github.com/snide/sphinx_rtd_theme">Sphinx theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
@ -481,7 +498,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'0.6.3-DEV',
VERSION:'0.7.2-DEV',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: false

View File

@ -7,14 +7,14 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Building Android binary &mdash; nghttp2 0.6.3-DEV documentation</title>
<title>Building Android binary &mdash; nghttp2 0.7.2-DEV documentation</title>
<link href='https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700&subset=latin,cyrillic' rel='stylesheet' type='text/css'>
@ -28,9 +28,9 @@
<link rel="top" title="nghttp2 0.6.3-DEV documentation" href="index.html"/>
<link rel="top" title="nghttp2 0.7.2-DEV documentation" href="index.html"/>
<link rel="next" title="Tutorial: HTTP/2 client" href="tutorial-client.html"/>
<link rel="prev" title="nghttp2 - HTTP/2 C Library" href="package_README.html"/>
<link rel="prev" title="Contribution Guidelines" href="contribute.html"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script>
@ -47,6 +47,7 @@
<a href="index.html" class="fa fa-home"> nghttp2</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
@ -59,6 +60,7 @@
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="package_README.html">nghttp2 - HTTP/2 C Library</a><ul>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#development-status">Development Status</a></li>
@ -66,6 +68,8 @@
<li class="toctree-l2"><a class="reference internal" href="package_README.html#requirements">Requirements</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#build-from-git">Build from git</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#building-documentation">Building documentation</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#unit-tests">Unit tests</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#integration-tests">Integration tests</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#client-server-and-proxy-programs">Client, Server and Proxy programs</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#benchmarking-tool">Benchmarking tool</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#hpack-tools">HPACK tools</a></li>
@ -74,6 +78,10 @@
<li class="toctree-l2"><a class="reference internal" href="package_README.html#contribution">Contribution</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="contribute.html">Contribution Guidelines</a><ul>
<li class="toctree-l2"><a class="reference internal" href="contribute.html#coding-style">Coding style</a></li>
</ul>
</li>
<li class="toctree-l1 current"><a class="current reference internal" href="">Building Android binary</a></li>
<li class="toctree-l1"><a class="reference internal" href="tutorial-client.html">Tutorial: HTTP/2 client</a><ul>
<li class="toctree-l2"><a class="reference internal" href="tutorial-client.html#libevent-client-c">libevent-client.c</a></li>
@ -90,34 +98,32 @@
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttp.1.html">nghttp(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttpd.1.html">nghttpd(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttpx.1.html">nghttpx(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#files">FILES</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#signals">SIGNALS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="h2load.1.html">h2load(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
@ -131,8 +137,9 @@
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#specifying-additional-ca-certificate">Specifying additional CA certificate</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#read-write-rate-limit">Read/write rate limit</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#rewriting-location-header-field">Rewriting location header field</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#hot-deploy">Hot deploy</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#hot-swapping">Hot swapping</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#re-opening-log-files">Re-opening log files</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#multiple-http-1-backend-addresses">Multiple HTTP/1 backend addresses</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="h2load-howto.html">h2load - HTTP/2 benchmarking tool - HOW-TO</a><ul>
@ -166,9 +173,11 @@
<li class="toctree-l1"><a class="reference internal" href="asio_http2.h.html">asio_http2.h</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/tatsuhiro-t/nghttp2">Source</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/tatsuhiro-t/nghttp2/issues">Issues</a></li>
<li class="toctree-l1"><a class="reference external" href="https://nghttp2.org/">nghttp2.org</a></li>
</ul>
</div>
&nbsp;
</nav>
@ -203,6 +212,10 @@
<p>In this article, we briefly describe how to build Android binary using
<a class="reference external" href="http://developer.android.com/tools/sdk/ndk/index.html">Android NDK</a>
cross-compiler on Debian Linux.</p>
<p>The easiest way to build android binary is use Dockerfile.android.
See Dockerfile.android for more details. If you cannot use
Dockerfile.android for whatever reason, continue to read the rest of
this article.</p>
<p>We offer <tt class="docutils literal"><span class="pre">android-config</span></tt> and <tt class="docutils literal"><span class="pre">android-make</span></tt> scripts to make the
build easier. To make these script work, NDK toolchain must be
installed in the following way. First, let us introduce
@ -213,18 +226,20 @@ for <tt class="docutils literal"><span class="pre">ANDROID_HOME</span></tt>. Fo
unpacked:</p>
<div class="highlight-c"><div class="highlight"><pre>$ build/tools/make-standalone-toolchain.sh \
--install-dir=$ANDROID_HOME/toolchain \
--toolchain=arm-linux-androideabi-4.8
--toolchain=arm-linux-androideabi-4.9 \
--llvm-version=3.5 \
--platform=android-16
</pre></div>
</div>
<p>The additional flag <tt class="docutils literal"><span class="pre">--system=linux-x86_64</span></tt> may be required if you
are using x86_64 system.</p>
<p>The platform level is not important here because we don&#8217;t use Android
<p>The platform level is not important here because we don't use Android
specific C/C++ API.</p>
<p>The dependent libraries, such as OpenSSL and libevent should be built
<p>The dependent libraries, such as OpenSSL and libev should be built
with the toolchain and installed under <tt class="docutils literal"><span class="pre">$ANDROID_HOME/usr/local</span></tt>.
We recommend to build these libraries as static library to make the
deployment easier. libxml2 support is currently disabled.</p>
<p>We use zlib which comes with Android NDK, so we don&#8217;t have to build it
<p>We use zlib which comes with Android NDK, so we don't have to build it
by ourselves.</p>
<p>If SPDY support is required for nghttpx and h2load, build and install
spdylay as well.</p>
@ -235,69 +250,71 @@ correct path. Also add <tt class="docutils literal"><span class="pre">$ANDROID_
</pre></div>
</div>
<p>To configure OpenSSL, use the following script:</p>
<div class="highlight-c"><div class="highlight"><pre>#!/bin/sh
<div class="highlight-sh"><div class="highlight"><pre><span class="c">#!/bin/sh</span>
if [ -z &quot;$ANDROID_HOME&quot; ]; then
echo &#39;No $ANDROID_HOME specified.&#39;
exit 1
fi
PREFIX=$ANDROID_HOME/usr/local
TOOLCHAIN=$ANDROID_HOME/toolchain
PATH=$TOOLCHAIN/bin:$PATH
<span class="k">if</span> <span class="o">[</span> -z <span class="s2">&quot;</span><span class="nv">$ANDROID_HOME</span><span class="s2">&quot;</span> <span class="o">]</span><span class="p">;</span> <span class="k">then</span>
<span class="nb">echo</span> <span class="s1">&#39;No $ANDROID_HOME specified.&#39;</span>
<span class="nb">exit </span>1
<span class="k">fi</span>
<span class="nv">PREFIX</span><span class="o">=</span><span class="nv">$ANDROID_HOME</span>/usr/local
<span class="nv">TOOLCHAIN</span><span class="o">=</span><span class="nv">$ANDROID_HOME</span>/toolchain
<span class="nv">PATH</span><span class="o">=</span><span class="nv">$TOOLCHAIN</span>/bin:<span class="nv">$PATH</span>
export CROSS_COMPILE=$TOOLCHAIN/bin/arm-linux-androideabi-
./Configure --prefix=$PREFIX android
<span class="nb">export </span><span class="nv">CROSS_COMPILE</span><span class="o">=</span><span class="nv">$TOOLCHAIN</span>/bin/arm-linux-androideabi-
./Configure --prefix<span class="o">=</span><span class="nv">$PREFIX</span> android
</pre></div>
</div>
<p>And run <tt class="docutils literal"><span class="pre">make</span> <span class="pre">install</span></tt> to build and install.</p>
<p>To configure libevent, use the following script:</p>
<div class="highlight-c"><div class="highlight"><pre>#!/bin/sh
<p>We cannot compile libev without modification. Apply <a class="reference external" href="https://gist.github.com/tatsuhiro-t/48c45f08950f587180ed">this patch</a> before
configuring libev. This patch is for libev-4.19. After applying the
patch, to configure libev, use the following script:</p>
<div class="highlight-sh"><div class="highlight"><pre><span class="c">#!/bin/sh</span>
if [ -z &quot;$ANDROID_HOME&quot; ]; then
echo &#39;No $ANDROID_HOME specified.&#39;
exit 1
fi
PREFIX=$ANDROID_HOME/usr/local
TOOLCHAIN=$ANDROID_HOME/toolchain
PATH=$TOOLCHAIN/bin:$PATH
<span class="k">if</span> <span class="o">[</span> -z <span class="s2">&quot;</span><span class="nv">$ANDROID_HOME</span><span class="s2">&quot;</span> <span class="o">]</span><span class="p">;</span> <span class="k">then</span>
<span class="nb">echo</span> <span class="s1">&#39;No $ANDROID_HOME specified.&#39;</span>
<span class="nb">exit </span>1
<span class="k">fi</span>
<span class="nv">PREFIX</span><span class="o">=</span><span class="nv">$ANDROID_HOME</span>/usr/local
<span class="nv">TOOLCHAIN</span><span class="o">=</span><span class="nv">$ANDROID_HOME</span>/toolchain
<span class="nv">PATH</span><span class="o">=</span><span class="nv">$TOOLCHAIN</span>/bin:<span class="nv">$PATH</span>
./configure \
--host=arm-linux-androideabi \
--build=`dpkg-architecture -qDEB_BUILD_GNU_TYPE` \
--prefix=$PREFIX \
--disable-shared \
--enable-static \
CPPFLAGS=-I$PREFIX/include \
LDFLAGS=-L$PREFIX/lib
./configure <span class="se">\</span>
--host<span class="o">=</span>arm-linux-androideabi <span class="se">\</span>
--build<span class="o">=</span><span class="sb">`</span>dpkg-architecture -qDEB_BUILD_GNU_TYPE<span class="sb">`</span> <span class="se">\</span>
--prefix<span class="o">=</span><span class="nv">$PREFIX</span> <span class="se">\</span>
--disable-shared <span class="se">\</span>
--enable-static <span class="se">\</span>
<span class="nv">CPPFLAGS</span><span class="o">=</span>-I<span class="nv">$PREFIX</span>/include <span class="se">\</span>
<span class="nv">LDFLAGS</span><span class="o">=</span>-L<span class="nv">$PREFIX</span>/lib
</pre></div>
</div>
<p>And run <tt class="docutils literal"><span class="pre">make</span> <span class="pre">install</span></tt> to build and install.</p>
<p>To configure spdylay, use the following script:</p>
<div class="highlight-c"><div class="highlight"><pre>if [ -z &quot;$ANDROID_HOME&quot; ]; then
echo &#39;No $ANDROID_HOME specified.&#39;
exit 1
fi
PREFIX=$ANDROID_HOME/usr/local
TOOLCHAIN=$ANDROID_HOME/toolchain
PATH=$TOOLCHAIN/bin:$PATH
<div class="highlight-sh"><div class="highlight"><pre><span class="k">if</span> <span class="o">[</span> -z <span class="s2">&quot;</span><span class="nv">$ANDROID_HOME</span><span class="s2">&quot;</span> <span class="o">]</span><span class="p">;</span> <span class="k">then</span>
<span class="nb">echo</span> <span class="s1">&#39;No $ANDROID_HOME specified.&#39;</span>
<span class="nb">exit </span>1
<span class="k">fi</span>
<span class="nv">PREFIX</span><span class="o">=</span><span class="nv">$ANDROID_HOME</span>/usr/local
<span class="nv">TOOLCHAIN</span><span class="o">=</span><span class="nv">$ANDROID_HOME</span>/toolchain
<span class="nv">PATH</span><span class="o">=</span><span class="nv">$TOOLCHAIN</span>/bin:<span class="nv">$PATH</span>
./configure \
--disable-shared \
--host=arm-linux-androideabi \
--build=`dpkg-architecture -qDEB_BUILD_GNU_TYPE` \
--prefix=$PREFIX \
--without-libxml2 \
--disable-src \
--disable-examples \
CPPFLAGS=&quot;-I$PREFIX/include&quot; \
PKG_CONFIG_LIBDIR=&quot;$PREFIX/lib/pkgconfig&quot; \
LDFLAGS=&quot;-L$PREFIX/lib&quot;
./configure <span class="se">\</span>
--disable-shared <span class="se">\</span>
--host<span class="o">=</span>arm-linux-androideabi <span class="se">\</span>
--build<span class="o">=</span><span class="sb">`</span>dpkg-architecture -qDEB_BUILD_GNU_TYPE<span class="sb">`</span> <span class="se">\</span>
--prefix<span class="o">=</span><span class="nv">$PREFIX</span> <span class="se">\</span>
--without-libxml2 <span class="se">\</span>
--disable-src <span class="se">\</span>
--disable-examples <span class="se">\</span>
<span class="nv">CPPFLAGS</span><span class="o">=</span><span class="s2">&quot;-I</span><span class="nv">$PREFIX</span><span class="s2">/include&quot;</span> <span class="se">\</span>
<span class="nv">PKG_CONFIG_LIBDIR</span><span class="o">=</span><span class="s2">&quot;</span><span class="nv">$PREFIX</span><span class="s2">/lib/pkgconfig&quot;</span> <span class="se">\</span>
<span class="nv">LDFLAGS</span><span class="o">=</span><span class="s2">&quot;-L</span><span class="nv">$PREFIX</span><span class="s2">/lib&quot;</span>
</pre></div>
</div>
<p>And run <tt class="docutils literal"><span class="pre">make</span> <span class="pre">install</span></tt> to build and install. After spdylay
installation, edit $ANDROID_HOME/usr/local/lib/pkgconfig/libspdylay.pc
and remove the following line:</p>
<div class="highlight-c"><div class="highlight"><pre><span class="n">Requires</span><span class="p">.</span><span class="n">private</span><span class="o">:</span> <span class="n">zlib</span>
<div class="highlight-c"><div class="highlight"><pre><span class="n">Requires</span><span class="p">.</span><span class="nl">private</span><span class="p">:</span> <span class="n">zlib</span>
</pre></div>
</div>
<p>After prerequisite libraries are prepared, run <tt class="docutils literal"><span class="pre">android-config</span></tt> and
@ -319,7 +336,7 @@ using the following command:</p>
<a href="tutorial-client.html" class="btn btn-neutral float-right" title="Tutorial: HTTP/2 client">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="package_README.html" class="btn btn-neutral" title="nghttp2 - HTTP/2 C Library"><span class="fa fa-arrow-circle-left"></span> Previous</a>
<a href="contribute.html" class="btn btn-neutral" title="Contribution Guidelines"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
@ -328,11 +345,12 @@ using the following command:</p>
<div role="contentinfo">
<p>
&copy; Copyright 2012, 2014, Tatsuhiro Tsujikawa.
&copy; Copyright 2012, 2015, Tatsuhiro Tsujikawa.
</p>
</div>
<a href="https://github.com/snide/sphinx_rtd_theme">Sphinx theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
@ -348,7 +366,7 @@ using the following command:</p>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'0.6.3-DEV',
VERSION:'0.7.2-DEV',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: false

325
contribute.html Normal file
View File

@ -0,0 +1,325 @@
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Contribution Guidelines &mdash; nghttp2 0.7.2-DEV documentation</title>
<link href='https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700&subset=latin,cyrillic' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="top" title="nghttp2 0.7.2-DEV documentation" href="index.html"/>
<link rel="next" title="Building Android binary" href="building-android-binary.html"/>
<link rel="prev" title="nghttp2 - HTTP/2 C Library" href="package_README.html"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script>
</head>
<body class="wy-body-for-nav" role="document">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-nav-search">
<a href="index.html" class="fa fa-home"> nghttp2</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="package_README.html">nghttp2 - HTTP/2 C Library</a><ul>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#development-status">Development Status</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#public-test-server">Public Test Server</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#requirements">Requirements</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#build-from-git">Build from git</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#building-documentation">Building documentation</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#unit-tests">Unit tests</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#integration-tests">Integration tests</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#client-server-and-proxy-programs">Client, Server and Proxy programs</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#benchmarking-tool">Benchmarking tool</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#hpack-tools">HPACK tools</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#libnghttp2-asio-high-level-http-2-c-library">libnghttp2_asio: High level HTTP/2 C++ library</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#python-bindings">Python bindings</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#contribution">Contribution</a></li>
</ul>
</li>
<li class="toctree-l1 current"><a class="current reference internal" href="">Contribution Guidelines</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#coding-style">Coding style</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="building-android-binary.html">Building Android binary</a></li>
<li class="toctree-l1"><a class="reference internal" href="tutorial-client.html">Tutorial: HTTP/2 client</a><ul>
<li class="toctree-l2"><a class="reference internal" href="tutorial-client.html#libevent-client-c">libevent-client.c</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="tutorial-server.html">Tutorial: HTTP/2 server</a><ul>
<li class="toctree-l2"><a class="reference internal" href="tutorial-server.html#libevent-server-c">libevent-server.c</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="tutorial-hpack.html">Tutorial: HPACK API</a><ul>
<li class="toctree-l2"><a class="reference internal" href="tutorial-hpack.html#deflating-encoding-headers">Deflating (encoding) headers</a></li>
<li class="toctree-l2"><a class="reference internal" href="tutorial-hpack.html#inflating-decoding-headers">Inflating (decoding) headers</a></li>
<li class="toctree-l2"><a class="reference internal" href="tutorial-hpack.html#deflate-c">deflate.c</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttp.1.html">nghttp(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttpd.1.html">nghttpd(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttpx.1.html">nghttpx(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#files">FILES</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#signals">SIGNALS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="h2load.1.html">h2load(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttpx-howto.html">nghttpx - HTTP/2 proxy - HOW-TO</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#default-mode">Default mode</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#http-2-proxy-mode">HTTP/2 proxy mode</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#client-mode">Client mode</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#client-proxy-mode">Client proxy mode</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#http-2-bridge-mode">HTTP/2 bridge mode</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#disable-ssl-tls">Disable SSL/TLS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#specifying-additional-ca-certificate">Specifying additional CA certificate</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#read-write-rate-limit">Read/write rate limit</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#rewriting-location-header-field">Rewriting location header field</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#hot-swapping">Hot swapping</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#re-opening-log-files">Re-opening log files</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#multiple-http-1-backend-addresses">Multiple HTTP/1 backend addresses</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="h2load-howto.html">h2load - HTTP/2 benchmarking tool - HOW-TO</a><ul>
<li class="toctree-l2"><a class="reference internal" href="h2load-howto.html#basic-usage">Basic Usage</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load-howto.html#flow-control">Flow Control</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load-howto.html#multi-threading">Multi-Threading</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load-howto.html#selecting-protocol-for-clear-text">Selecting protocol for clear text</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load-howto.html#multiple-uris">Multiple URIs</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="apiref.html">API Reference</a><ul>
<li class="toctree-l2"><a class="reference internal" href="apiref.html#includes">Includes</a></li>
<li class="toctree-l2"><a class="reference internal" href="apiref.html#remarks">Remarks</a></li>
<li class="toctree-l2"><a class="reference internal" href="apiref.html#macros">Macros</a></li>
<li class="toctree-l2"><a class="reference internal" href="apiref.html#enums">Enums</a></li>
<li class="toctree-l2"><a class="reference internal" href="apiref.html#types-structs-unions-and-typedefs">Types (structs, unions and typedefs)</a></li>
<li class="toctree-l2"><a class="reference internal" href="apiref.html#functions">Functions</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="libnghttp2_asio.html">libnghttp2_asio: High level HTTP/2 C++ library</a><ul>
<li class="toctree-l2"><a class="reference internal" href="libnghttp2_asio.html#server-api">Server API</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="python-apiref.html">Python API Reference</a><ul>
<li class="toctree-l2"><a class="reference internal" href="python-apiref.html#hpack-api">HPACK API</a></li>
<li class="toctree-l2"><a class="reference internal" href="python-apiref.html#http-2-servers">HTTP/2 servers</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttp2.h.html">nghttp2.h</a></li>
<li class="toctree-l1"><a class="reference internal" href="nghttp2ver.h.html">nghttp2ver.h</a></li>
<li class="toctree-l1"><a class="reference internal" href="asio_http2.h.html">asio_http2.h</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/tatsuhiro-t/nghttp2">Source</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/tatsuhiro-t/nghttp2/issues">Issues</a></li>
<li class="toctree-l1"><a class="reference external" href="https://nghttp2.org/">nghttp2.org</a></li>
</ul>
</div>
&nbsp;
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">nghttp2</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html">Docs</a> &raquo;</li>
<li>Contribution Guidelines</li>
<li class="wy-breadcrumbs-aside">
</li>
</ul>
<hr/>
</div>
<div role="main" class="document">
<div class="section" id="contribution-guidelines">
<h1>Contribution Guidelines<a class="headerlink" href="#contribution-guidelines" title="Permalink to this headline"></a></h1>
<p>[This text was composed based on 1.2. License section of curl/libcurl
project.]</p>
<p>When contributing with code, you agree to put your changes and new
code under the same license nghttp2 is already using unless stated and
agreed otherwise.</p>
<p>When changing existing source code, you do not alter the copyright of
the original file(s). The copyright will still be owned by the
original creator(s) or those who have been assigned copyright by the
original author(s).</p>
<p>By submitting a patch to the nghttp2 project, you are assumed to have
the right to the code and to be allowed by your employer or whatever
to hand over that patch/code to us. We will credit you for your
changes as far as possible, to give credit but also to keep a trace
back to who made what changes. Please always provide us with your
full real name when contributing!</p>
<div class="section" id="coding-style">
<h2>Coding style<a class="headerlink" href="#coding-style" title="Permalink to this headline"></a></h2>
<p>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 which comes with
clang-3.5.</p>
<p>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.
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-3.5 in debian), either add it to PATH variable or
add git option <tt class="docutils literal"><span class="pre">clangformatdiff.binary</span></tt> to point to the script.</p>
<p>For emacs users, integrating clang-format to emacs is very easy.
clang-format.el should come with clang distribution. If it is not
found, download it from <a class="reference external" href="https://llvm.org/svn/llvm-project/cfe/trunk/tools/clang-format/clang-format.el">here</a>.
And add these lines to your .emacs file:</p>
<div class="highlight-lisp"><div class="highlight"><pre><span class="c1">;; From</span>
<span class="c1">;; https://code.google.com/p/chromium/wiki/Emacs#Use_Google&#39;s_C++_style!</span>
<span class="p">(</span><span class="nb">load</span> <span class="s">&quot;/&lt;path/to&gt;/clang-format.el&quot;</span><span class="p">)</span>
<span class="p">(</span><span class="nv">add-hook</span> <span class="ss">&#39;c-mode-common-hook</span>
<span class="p">(</span><span class="k">function</span> <span class="p">(</span><span class="k">lambda</span> <span class="p">()</span> <span class="p">(</span><span class="nv">local-set-key</span> <span class="p">(</span><span class="nv">kbd</span> <span class="s">&quot;TAB&quot;</span><span class="p">)</span>
<span class="ss">&#39;clang-format-region</span><span class="p">))))</span>
</pre></div>
</div>
<p>You can find other editor integration in
<a class="reference external" href="http://clang.llvm.org/docs/ClangFormat.html">http://clang.llvm.org/docs/ClangFormat.html</a>.</p>
</div>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="building-android-binary.html" class="btn btn-neutral float-right" title="Building Android binary">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="package_README.html" class="btn btn-neutral" title="nghttp2 - HTTP/2 C Library"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
&copy; Copyright 2012, 2015, Tatsuhiro Tsujikawa.
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'0.7.2-DEV',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: false
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.StickyNav.enable();
});
</script>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@ -7,14 +7,14 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>h2load - HTTP/2 benchmarking tool - HOW-TO &mdash; nghttp2 0.6.3-DEV documentation</title>
<title>h2load - HTTP/2 benchmarking tool - HOW-TO &mdash; nghttp2 0.7.2-DEV documentation</title>
<link href='https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700&subset=latin,cyrillic' rel='stylesheet' type='text/css'>
@ -28,7 +28,7 @@
<link rel="top" title="nghttp2 0.6.3-DEV documentation" href="index.html"/>
<link rel="top" title="nghttp2 0.7.2-DEV documentation" href="index.html"/>
<link rel="next" title="API Reference" href="apiref.html"/>
<link rel="prev" title="nghttpx - HTTP/2 proxy - HOW-TO" href="nghttpx-howto.html"/>
@ -47,6 +47,7 @@
<a href="index.html" class="fa fa-home"> nghttp2</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
@ -59,6 +60,7 @@
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="package_README.html">nghttp2 - HTTP/2 C Library</a><ul>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#development-status">Development Status</a></li>
@ -66,6 +68,8 @@
<li class="toctree-l2"><a class="reference internal" href="package_README.html#requirements">Requirements</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#build-from-git">Build from git</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#building-documentation">Building documentation</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#unit-tests">Unit tests</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#integration-tests">Integration tests</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#client-server-and-proxy-programs">Client, Server and Proxy programs</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#benchmarking-tool">Benchmarking tool</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#hpack-tools">HPACK tools</a></li>
@ -74,6 +78,10 @@
<li class="toctree-l2"><a class="reference internal" href="package_README.html#contribution">Contribution</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="contribute.html">Contribution Guidelines</a><ul>
<li class="toctree-l2"><a class="reference internal" href="contribute.html#coding-style">Coding style</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="building-android-binary.html">Building Android binary</a></li>
<li class="toctree-l1"><a class="reference internal" href="tutorial-client.html">Tutorial: HTTP/2 client</a><ul>
<li class="toctree-l2"><a class="reference internal" href="tutorial-client.html#libevent-client-c">libevent-client.c</a></li>
@ -90,34 +98,32 @@
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttp.1.html">nghttp(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttpd.1.html">nghttpd(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttpx.1.html">nghttpx(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#files">FILES</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#signals">SIGNALS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="h2load.1.html">h2load(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
@ -131,8 +137,9 @@
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#specifying-additional-ca-certificate">Specifying additional CA certificate</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#read-write-rate-limit">Read/write rate limit</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#rewriting-location-header-field">Rewriting location header field</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#hot-deploy">Hot deploy</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#hot-swapping">Hot swapping</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#re-opening-log-files">Re-opening log files</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#multiple-http-1-backend-addresses">Multiple HTTP/1 backend addresses</a></li>
</ul>
</li>
<li class="toctree-l1 current"><a class="current reference internal" href="">h2load - HTTP/2 benchmarking tool - HOW-TO</a><ul>
@ -166,9 +173,11 @@
<li class="toctree-l1"><a class="reference internal" href="asio_http2.h.html">asio_http2.h</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/tatsuhiro-t/nghttp2">Source</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/tatsuhiro-t/nghttp2/issues">Issues</a></li>
<li class="toctree-l1"><a class="reference external" href="https://nghttp2.org/">nghttp2.org</a></li>
</ul>
</div>
&nbsp;
</nav>
@ -225,9 +234,9 @@ concurrent streams:</p>
</div>
<p>The benchmarking result looks like this:</p>
<div class="highlight-c"><div class="highlight"><pre><span class="n">finished</span> <span class="n">in</span> <span class="mi">0</span> <span class="n">sec</span><span class="p">,</span> <span class="mi">385</span> <span class="n">millisec</span> <span class="n">and</span> <span class="mi">851</span> <span class="n">microsec</span><span class="p">,</span> <span class="mi">2591</span> <span class="n">req</span><span class="o">/</span><span class="n">s</span><span class="p">,</span> <span class="mi">1689</span> <span class="n">kbytes</span><span class="o">/</span><span class="n">s</span>
<span class="nl">requests:</span> <span class="mi">1000</span> <span class="n">total</span><span class="p">,</span> <span class="mi">1000</span> <span class="n">started</span><span class="p">,</span> <span class="mi">1000</span> <span class="n">done</span><span class="p">,</span> <span class="mi">1000</span> <span class="n">succeeded</span><span class="p">,</span> <span class="mi">0</span> <span class="n">failed</span><span class="p">,</span> <span class="mi">0</span> <span class="n">errored</span>
<span class="n">status</span> <span class="n">codes</span><span class="o">:</span> <span class="mi">1000</span> <span class="mi">2</span><span class="n">xx</span><span class="p">,</span> <span class="mi">0</span> <span class="mi">3</span><span class="n">xx</span><span class="p">,</span> <span class="mi">0</span> <span class="mi">4</span><span class="n">xx</span><span class="p">,</span> <span class="mi">0</span> <span class="mi">5</span><span class="n">xx</span>
<span class="nl">traffic:</span> <span class="mi">667500</span> <span class="n">bytes</span> <span class="n">total</span><span class="p">,</span> <span class="mi">28700</span> <span class="n">bytes</span> <span class="n">headers</span><span class="p">,</span> <span class="mi">612000</span> <span class="n">bytes</span> <span class="n">data</span>
<span class="nl">requests</span><span class="p">:</span> <span class="mi">1000</span> <span class="n">total</span><span class="p">,</span> <span class="mi">1000</span> <span class="n">started</span><span class="p">,</span> <span class="mi">1000</span> <span class="n">done</span><span class="p">,</span> <span class="mi">1000</span> <span class="n">succeeded</span><span class="p">,</span> <span class="mi">0</span> <span class="n">failed</span><span class="p">,</span> <span class="mi">0</span> <span class="n">errored</span>
<span class="n">status</span> <span class="nl">codes</span><span class="p">:</span> <span class="mi">1000</span> <span class="mi">2</span><span class="n">xx</span><span class="p">,</span> <span class="mi">0</span> <span class="mi">3</span><span class="n">xx</span><span class="p">,</span> <span class="mi">0</span> <span class="mi">4</span><span class="n">xx</span><span class="p">,</span> <span class="mi">0</span> <span class="mi">5</span><span class="n">xx</span>
<span class="nl">traffic</span><span class="p">:</span> <span class="mi">667500</span> <span class="n">bytes</span> <span class="n">total</span><span class="p">,</span> <span class="mi">28700</span> <span class="n">bytes</span> <span class="n">headers</span><span class="p">,</span> <span class="mi">612000</span> <span class="n">bytes</span> <span class="n">data</span>
</pre></div>
</div>
<p>The number of <tt class="docutils literal"><span class="pre">failed</span></tt> is the number of requests returned with non
@ -300,11 +309,12 @@ and ignores those parts in the rest of the URIs.</p>
<div role="contentinfo">
<p>
&copy; Copyright 2012, 2014, Tatsuhiro Tsujikawa.
&copy; Copyright 2012, 2015, Tatsuhiro Tsujikawa.
</p>
</div>
<a href="https://github.com/snide/sphinx_rtd_theme">Sphinx theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
@ -320,7 +330,7 @@ and ignores those parts in the rest of the URIs.</p>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'0.6.3-DEV',
VERSION:'0.7.2-DEV',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: false

View File

@ -7,14 +7,14 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>h2load(1) &mdash; nghttp2 0.6.3-DEV documentation</title>
<title>h2load(1) &mdash; nghttp2 0.7.2-DEV documentation</title>
<link href='https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700&subset=latin,cyrillic' rel='stylesheet' type='text/css'>
@ -28,7 +28,7 @@
<link rel="top" title="nghttp2 0.6.3-DEV documentation" href="index.html"/>
<link rel="top" title="nghttp2 0.7.2-DEV documentation" href="index.html"/>
<link rel="next" title="nghttpx - HTTP/2 proxy - HOW-TO" href="nghttpx-howto.html"/>
<link rel="prev" title="nghttpx(1)" href="nghttpx.1.html"/>
@ -47,6 +47,7 @@
<a href="index.html" class="fa fa-home"> nghttp2</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
@ -59,6 +60,7 @@
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="package_README.html">nghttp2 - HTTP/2 C Library</a><ul>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#development-status">Development Status</a></li>
@ -66,6 +68,8 @@
<li class="toctree-l2"><a class="reference internal" href="package_README.html#requirements">Requirements</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#build-from-git">Build from git</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#building-documentation">Building documentation</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#unit-tests">Unit tests</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#integration-tests">Integration tests</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#client-server-and-proxy-programs">Client, Server and Proxy programs</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#benchmarking-tool">Benchmarking tool</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#hpack-tools">HPACK tools</a></li>
@ -74,6 +78,10 @@
<li class="toctree-l2"><a class="reference internal" href="package_README.html#contribution">Contribution</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="contribute.html">Contribution Guidelines</a><ul>
<li class="toctree-l2"><a class="reference internal" href="contribute.html#coding-style">Coding style</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="building-android-binary.html">Building Android binary</a></li>
<li class="toctree-l1"><a class="reference internal" href="tutorial-client.html">Tutorial: HTTP/2 client</a><ul>
<li class="toctree-l2"><a class="reference internal" href="tutorial-client.html#libevent-client-c">libevent-client.c</a></li>
@ -90,34 +98,32 @@
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttp.1.html">nghttp(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttpd.1.html">nghttpd(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttpx.1.html">nghttpx(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#files">FILES</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#signals">SIGNALS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1 current"><a class="current reference internal" href="">h2load(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="#see-also">SEE ALSO</a></li>
</ul>
</li>
@ -131,8 +137,9 @@
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#specifying-additional-ca-certificate">Specifying additional CA certificate</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#read-write-rate-limit">Read/write rate limit</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#rewriting-location-header-field">Rewriting location header field</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#hot-deploy">Hot deploy</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#hot-swapping">Hot swapping</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#re-opening-log-files">Re-opening log files</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#multiple-http-1-backend-addresses">Multiple HTTP/1 backend addresses</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="h2load-howto.html">h2load - HTTP/2 benchmarking tool - HOW-TO</a><ul>
@ -166,9 +173,11 @@
<li class="toctree-l1"><a class="reference internal" href="asio_http2.h.html">asio_http2.h</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/tatsuhiro-t/nghttp2">Source</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/tatsuhiro-t/nghttp2/issues">Issues</a></li>
<li class="toctree-l1"><a class="reference external" href="https://nghttp2.org/">nghttp2.org</a></li>
</ul>
</div>
&nbsp;
</nav>
@ -200,106 +209,122 @@
<div class="section" id="h2load-1">
<h1>h2load(1)<a class="headerlink" href="#h2load-1" title="Permalink to this headline"></a></h1>
<div class="section" id="name">
<h2>NAME<a class="headerlink" href="#name" title="Permalink to this headline"></a></h2>
<p>h2load - HTTP/2 benchmarking tool</p>
</div>
<div class="section" id="synopsis">
<h2>SYNOPSIS<a class="headerlink" href="#synopsis" title="Permalink to this headline"></a></h2>
<p><strong>h2load</strong> [OPTIONS]... &lt;URI&gt;...</p>
<p><strong>h2load</strong> [OPTIONS]... [URI]...</p>
</div>
<div class="section" id="description">
<h2>DESCRIPTION<a class="headerlink" href="#description" title="Permalink to this headline"></a></h2>
<p>benchmarking tool for HTTP/2 and SPDY server</p>
<dl class="option">
<dt id="cmdoption-h2load-arg-URI">
<tt class="descname">URI</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption-h2load-arg-URI" title="Permalink to this definition"></a></dt>
<dd><p>Specify URI to access. Multiple URIs can be
specified. URIs are used in this order for each
client. All URIs are used, then first URI is
used and then 2nd URI, and so on. The scheme,
host and port in the subsequent URIs, if present,
are ignored. Those in the first URI are used
solely.</p>
<dl class="describe">
<dt>
<tt class="descname">&lt;URI&gt;</tt></dt>
<dd><p>Specify URI to access. Multiple URIs can be specified.
URIs are used in this order for each client. All URIs
are used, then first URI is used and then 2nd URI, and
so on. The scheme, host and port in the subsequent
URIs, if present, are ignored. Those in the first URI
are used solely.</p>
</dd></dl>
</div>
<div class="section" id="options">
<h2>OPTIONS<a class="headerlink" href="#options" title="Permalink to this headline"></a></h2>
<h2>OPTIONS:<a class="headerlink" href="#options" title="Permalink to this headline"></a></h2>
<dl class="option">
<dt id="cmdoption-h2load-n">
<span id="cmdoption-h2load--requests"></span><tt class="descname">-n</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--requests</tt><tt class="descclassname">=&lt;N&gt;</tt><a class="headerlink" href="#cmdoption-h2load-n" title="Permalink to this definition"></a></dt>
<dd><p>Number of requests. Default: 1</p>
<dt id="cmdoption-n">
<span id="cmdoption--requests"></span><tt class="descname">-n</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--requests</tt><tt class="descclassname">=&lt;N&gt;</tt><a class="headerlink" href="#cmdoption-n" title="Permalink to this definition"></a></dt>
<dd><p>Number of requests.</p>
<p>Default: <tt class="docutils literal"><span class="pre">1</span></tt></p>
</dd></dl>
<dl class="option">
<dt id="cmdoption-h2load-c">
<span id="cmdoption-h2load--clients"></span><tt class="descname">-c</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--clients</tt><tt class="descclassname">=&lt;N&gt;</tt><a class="headerlink" href="#cmdoption-h2load-c" title="Permalink to this definition"></a></dt>
<dd><p>Number of concurrent clients. Default: 1</p>
<dt id="cmdoption-c">
<span id="cmdoption--clients"></span><tt class="descname">-c</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--clients</tt><tt class="descclassname">=&lt;N&gt;</tt><a class="headerlink" href="#cmdoption-c" title="Permalink to this definition"></a></dt>
<dd><p>Number of concurrent clients.</p>
<p>Default: <tt class="docutils literal"><span class="pre">1</span></tt></p>
</dd></dl>
<dl class="option">
<dt id="cmdoption-h2load-t">
<span id="cmdoption-h2load--threads"></span><tt class="descname">-t</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--threads</tt><tt class="descclassname">=&lt;N&gt;</tt><a class="headerlink" href="#cmdoption-h2load-t" title="Permalink to this definition"></a></dt>
<dd><p>Number of native threads. Default: 1</p>
<dt id="cmdoption-t">
<span id="cmdoption--threads"></span><tt class="descname">-t</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--threads</tt><tt class="descclassname">=&lt;N&gt;</tt><a class="headerlink" href="#cmdoption-t" title="Permalink to this definition"></a></dt>
<dd><p>Number of native threads.</p>
<p>Default: <tt class="docutils literal"><span class="pre">1</span></tt></p>
</dd></dl>
<dl class="option">
<dt id="cmdoption-h2load-m">
<span id="cmdoption-h2load--max-concurrent-streams"></span><tt class="descname">-m</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--max-concurrent-streams</tt><tt class="descclassname">=(auto|&lt;N&gt;)</tt><a class="headerlink" href="#cmdoption-h2load-m" title="Permalink to this definition"></a></dt>
<dd><p>Max concurrent streams to issue per session. If
&#8220;auto&#8221; is given, the number of given URIs is
used. Default: auto</p>
<dt id="cmdoption-i">
<span id="cmdoption--input-file"></span><tt class="descname">-i</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--input-file</tt><tt class="descclassname">=&lt;FILE&gt;</tt><a class="headerlink" href="#cmdoption-i" title="Permalink to this definition"></a></dt>
<dd><p>Path of a file with multiple URIs are seperated by EOLs.
This option will disable URIs getting from command-line.
If '-' is given as &lt;FILE&gt;, URIs will be read from stdin.
URIs are used in this order for each client. All URIs
are used, then first URI is used and then 2nd URI, and
so on. The scheme, host and port in the subsequent
URIs, if present, are ignored. Those in the first URI
are used solely.</p>
</dd></dl>
<dl class="option">
<dt id="cmdoption-h2load-w">
<span id="cmdoption-h2load--window-bits"></span><tt class="descname">-w</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--window-bits</tt><tt class="descclassname">=&lt;N&gt;</tt><a class="headerlink" href="#cmdoption-h2load-w" title="Permalink to this definition"></a></dt>
<dd><p>Sets the stream level initial window size to
(2**&lt;N&gt;)-1. For SPDY, 2**&lt;N&gt; is used instead.</p>
<dt id="cmdoption-m">
<span id="cmdoption--max-concurrent-streams"></span><tt class="descname">-m</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--max-concurrent-streams</tt><tt class="descclassname">=(auto|&lt;N&gt;)</tt><a class="headerlink" href="#cmdoption-m" title="Permalink to this definition"></a></dt>
<dd><p>Max concurrent streams to issue per session. If &quot;auto&quot;
is given, the number of given URIs is used.</p>
<p>Default: <tt class="docutils literal"><span class="pre">auto</span></tt></p>
</dd></dl>
<dl class="option">
<dt id="cmdoption-h2load-W">
<span id="cmdoption-h2load--connection-window-bits"></span><tt class="descname">-W</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--connection-window-bits</tt><tt class="descclassname">=&lt;N&gt;</tt><a class="headerlink" href="#cmdoption-h2load-W" title="Permalink to this definition"></a></dt>
<dt id="cmdoption-w">
<span id="cmdoption--window-bits"></span><tt class="descname">-w</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--window-bits</tt><tt class="descclassname">=&lt;N&gt;</tt><a class="headerlink" href="#cmdoption-w" title="Permalink to this definition"></a></dt>
<dd><p>Sets the stream level initial window size to (2**&lt;N&gt;)-1.
For SPDY, 2**&lt;N&gt; is used instead.</p>
</dd></dl>
<dl class="option">
<dt id="cmdoption-W">
<span id="cmdoption--connection-window-bits"></span><tt class="descname">-W</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--connection-window-bits</tt><tt class="descclassname">=&lt;N&gt;</tt><a class="headerlink" href="#cmdoption-W" title="Permalink to this definition"></a></dt>
<dd><p>Sets the connection level initial window size to
(2**&lt;N&gt;)-1. For SPDY, if &lt;N&gt; is strictly less
than 16, this option is ignored. Otherwise
2**&lt;N&gt; is used for SPDY.</p>
(2**&lt;N&gt;)-1. For SPDY, if &lt;N&gt; is strictly less than 16,
this option is ignored. Otherwise 2**&lt;N&gt; is used for
SPDY.</p>
</dd></dl>
<dl class="option">
<dt id="cmdoption-h2load-p">
<span id="cmdoption-h2load--no-tls-proto"></span><tt class="descname">-p</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--no-tls-proto</tt><tt class="descclassname">=&lt;PROTOID&gt;</tt><a class="headerlink" href="#cmdoption-h2load-p" title="Permalink to this definition"></a></dt>
<dd><p>Specify ALPN identifier of the protocol to be
used when accessing http URI without SSL/TLS.
Available protocols: spdy/2, spdy/3, spdy/3.1 and
h2c-14
Default: h2c-14</p>
<dt id="cmdoption-H">
<span id="cmdoption--header"></span><tt class="descname">-H</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--header</tt><tt class="descclassname">=&lt;HEADER&gt;</tt><a class="headerlink" href="#cmdoption-H" title="Permalink to this definition"></a></dt>
<dd><p>Add/Override a header to the requests.</p>
</dd></dl>
<dl class="option">
<dt id="cmdoption-h2load-v">
<span id="cmdoption-h2load--verbose"></span><tt class="descname">-v</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--verbose</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption-h2load-v" title="Permalink to this definition"></a></dt>
<dt id="cmdoption-p">
<span id="cmdoption--no-tls-proto"></span><tt class="descname">-p</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--no-tls-proto</tt><tt class="descclassname">=&lt;PROTOID&gt;</tt><a class="headerlink" href="#cmdoption-p" title="Permalink to this definition"></a></dt>
<dd><p>Specify ALPN identifier of the protocol to be used when
accessing http URI without SSL/TLS.
Available protocols: spdy/2, spdy/3, spdy/3.1 and h2c-14</p>
<p>Default: <tt class="docutils literal"><span class="pre">h2c-14</span></tt></p>
</dd></dl>
<dl class="option">
<dt id="cmdoption-v">
<span id="cmdoption--verbose"></span><tt class="descname">-v</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--verbose</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption-v" title="Permalink to this definition"></a></dt>
<dd><p>Output debug information.</p>
</dd></dl>
<dl class="option">
<dt id="cmdoption-h2load--version">
<tt class="descname">--version</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption-h2load--version" title="Permalink to this definition"></a></dt>
<dt id="cmdoption--version">
<tt class="descname">--version</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption--version" title="Permalink to this definition"></a></dt>
<dd><p>Display version information and exit.</p>
</dd></dl>
<dl class="option">
<dt id="cmdoption-h2load-h">
<span id="cmdoption-h2load--help"></span><tt class="descname">-h</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--help</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption-h2load-h" title="Permalink to this definition"></a></dt>
<dt id="cmdoption-h">
<span id="cmdoption--help"></span><tt class="descname">-h</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--help</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption-h" title="Permalink to this definition"></a></dt>
<dd><p>Display this help and exit.</p>
</dd></dl>
</div>
<div class="section" id="see-also">
<h2>SEE ALSO<a class="headerlink" href="#see-also" title="Permalink to this headline"></a></h2>
<p>nghttp(1), nghttpd(1), nghttpx(1)</p>
<p><em class="manpage">nghttp(1)</em>, <em class="manpage">nghttpd(1)</em>, <em class="manpage">nghttpx(1)</em></p>
</div>
</div>
@ -321,11 +346,12 @@ Default: h2c-14</p>
<div role="contentinfo">
<p>
&copy; Copyright 2012, 2014, Tatsuhiro Tsujikawa.
&copy; Copyright 2012, 2015, Tatsuhiro Tsujikawa.
</p>
</div>
<a href="https://github.com/snide/sphinx_rtd_theme">Sphinx theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
@ -341,7 +367,7 @@ Default: h2c-14</p>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'0.6.3-DEV',
VERSION:'0.7.2-DEV',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: false

View File

@ -7,14 +7,14 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>nghttp2 - HTTP/2 C Library &mdash; nghttp2 0.6.3-DEV documentation</title>
<title>nghttp2 - HTTP/2 C Library &mdash; nghttp2 0.7.2-DEV documentation</title>
<link href='https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700&subset=latin,cyrillic' rel='stylesheet' type='text/css'>
@ -28,7 +28,7 @@
<link rel="top" title="nghttp2 0.6.3-DEV documentation" href="#"/>
<link rel="top" title="nghttp2 0.7.2-DEV documentation" href="#"/>
<link rel="next" title="nghttp2 - HTTP/2 C Library" href="package_README.html"/>
@ -46,6 +46,7 @@
<a href="#" class="fa fa-home"> nghttp2</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
@ -58,6 +59,7 @@
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul>
<li class="toctree-l1"><a class="reference internal" href="package_README.html">nghttp2 - HTTP/2 C Library</a><ul>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#development-status">Development Status</a></li>
@ -65,6 +67,8 @@
<li class="toctree-l2"><a class="reference internal" href="package_README.html#requirements">Requirements</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#build-from-git">Build from git</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#building-documentation">Building documentation</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#unit-tests">Unit tests</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#integration-tests">Integration tests</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#client-server-and-proxy-programs">Client, Server and Proxy programs</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#benchmarking-tool">Benchmarking tool</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#hpack-tools">HPACK tools</a></li>
@ -73,6 +77,10 @@
<li class="toctree-l2"><a class="reference internal" href="package_README.html#contribution">Contribution</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="contribute.html">Contribution Guidelines</a><ul>
<li class="toctree-l2"><a class="reference internal" href="contribute.html#coding-style">Coding style</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="building-android-binary.html">Building Android binary</a></li>
<li class="toctree-l1"><a class="reference internal" href="tutorial-client.html">Tutorial: HTTP/2 client</a><ul>
<li class="toctree-l2"><a class="reference internal" href="tutorial-client.html#libevent-client-c">libevent-client.c</a></li>
@ -89,34 +97,32 @@
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttp.1.html">nghttp(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttpd.1.html">nghttpd(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttpx.1.html">nghttpx(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#files">FILES</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#signals">SIGNALS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="h2load.1.html">h2load(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
@ -130,8 +136,9 @@
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#specifying-additional-ca-certificate">Specifying additional CA certificate</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#read-write-rate-limit">Read/write rate limit</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#rewriting-location-header-field">Rewriting location header field</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#hot-deploy">Hot deploy</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#hot-swapping">Hot swapping</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#re-opening-log-files">Re-opening log files</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#multiple-http-1-backend-addresses">Multiple HTTP/1 backend addresses</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="h2load-howto.html">h2load - HTTP/2 benchmarking tool - HOW-TO</a><ul>
@ -165,9 +172,11 @@
<li class="toctree-l1"><a class="reference internal" href="asio_http2.h.html">asio_http2.h</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/tatsuhiro-t/nghttp2">Source</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/tatsuhiro-t/nghttp2/issues">Issues</a></li>
<li class="toctree-l1"><a class="reference external" href="https://nghttp2.org/">nghttp2.org</a></li>
</ul>
</div>
&nbsp;
</nav>
@ -211,6 +220,8 @@ version 2.</p>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#requirements">Requirements</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#build-from-git">Build from git</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#building-documentation">Building documentation</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#unit-tests">Unit tests</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#integration-tests">Integration tests</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#client-server-and-proxy-programs">Client, Server and Proxy programs</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#benchmarking-tool">Benchmarking tool</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#hpack-tools">HPACK tools</a></li>
@ -219,6 +230,10 @@ version 2.</p>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#contribution">Contribution</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="contribute.html">Contribution Guidelines</a><ul>
<li class="toctree-l2"><a class="reference internal" href="contribute.html#coding-style">Coding style</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="building-android-binary.html">Building Android binary</a></li>
<li class="toctree-l1"><a class="reference internal" href="tutorial-client.html">Tutorial: HTTP/2 client</a><ul>
<li class="toctree-l2"><a class="reference internal" href="tutorial-client.html#libevent-client-c">libevent-client.c</a></li>
@ -235,34 +250,32 @@ version 2.</p>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttp.1.html">nghttp(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttpd.1.html">nghttpd(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttpx.1.html">nghttpx(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#files">FILES</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#signals">SIGNALS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="h2load.1.html">h2load(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
@ -276,8 +289,9 @@ version 2.</p>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#specifying-additional-ca-certificate">Specifying additional CA certificate</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#read-write-rate-limit">Read/write rate limit</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#rewriting-location-header-field">Rewriting location header field</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#hot-deploy">Hot deploy</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#hot-swapping">Hot swapping</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#re-opening-log-files">Re-opening log files</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#multiple-http-1-backend-addresses">Multiple HTTP/1 backend addresses</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="h2load-howto.html">h2load - HTTP/2 benchmarking tool - HOW-TO</a><ul>
@ -311,6 +325,7 @@ version 2.</p>
<li class="toctree-l1"><a class="reference internal" href="asio_http2.h.html">asio_http2.h</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/tatsuhiro-t/nghttp2">Source</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/tatsuhiro-t/nghttp2/issues">Issues</a></li>
<li class="toctree-l1"><a class="reference external" href="https://nghttp2.org/">nghttp2.org</a></li>
</ul>
</div>
</div>
@ -322,7 +337,6 @@ version 2.</p>
<ul class="simple">
<li><a class="reference external" href="http://tools.ietf.org/html/draft-ietf-httpbis-http2-14">http://tools.ietf.org/html/draft-ietf-httpbis-http2-14</a></li>
<li><a class="reference external" href="http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-09">http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-09</a></li>
<li><a class="reference external" href="http://tools.ietf.org/html/draft-ietf-httpbis-alt-svc-02">http://tools.ietf.org/html/draft-ietf-httpbis-alt-svc-02</a></li>
</ul>
</div>
</div>
@ -343,11 +357,12 @@ version 2.</p>
<div role="contentinfo">
<p>
&copy; Copyright 2012, 2014, Tatsuhiro Tsujikawa.
&copy; Copyright 2012, 2015, Tatsuhiro Tsujikawa.
</p>
</div>
<a href="https://github.com/snide/sphinx_rtd_theme">Sphinx theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
@ -363,7 +378,7 @@ version 2.</p>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'0.6.3-DEV',
VERSION:'0.7.2-DEV',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: false

View File

@ -7,14 +7,14 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>libnghttp2_asio: High level HTTP/2 C++ library &mdash; nghttp2 0.6.3-DEV documentation</title>
<title>libnghttp2_asio: High level HTTP/2 C++ library &mdash; nghttp2 0.7.2-DEV documentation</title>
<link href='https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700&subset=latin,cyrillic' rel='stylesheet' type='text/css'>
@ -28,7 +28,7 @@
<link rel="top" title="nghttp2 0.6.3-DEV documentation" href="index.html"/>
<link rel="top" title="nghttp2 0.7.2-DEV documentation" href="index.html"/>
<link rel="next" title="Python API Reference" href="python-apiref.html"/>
<link rel="prev" title="API Reference" href="apiref.html"/>
@ -47,6 +47,7 @@
<a href="index.html" class="fa fa-home"> nghttp2</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
@ -59,6 +60,7 @@
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="package_README.html">nghttp2 - HTTP/2 C Library</a><ul>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#development-status">Development Status</a></li>
@ -66,6 +68,8 @@
<li class="toctree-l2"><a class="reference internal" href="package_README.html#requirements">Requirements</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#build-from-git">Build from git</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#building-documentation">Building documentation</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#unit-tests">Unit tests</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#integration-tests">Integration tests</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#client-server-and-proxy-programs">Client, Server and Proxy programs</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#benchmarking-tool">Benchmarking tool</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#hpack-tools">HPACK tools</a></li>
@ -74,6 +78,10 @@
<li class="toctree-l2"><a class="reference internal" href="package_README.html#contribution">Contribution</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="contribute.html">Contribution Guidelines</a><ul>
<li class="toctree-l2"><a class="reference internal" href="contribute.html#coding-style">Coding style</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="building-android-binary.html">Building Android binary</a></li>
<li class="toctree-l1"><a class="reference internal" href="tutorial-client.html">Tutorial: HTTP/2 client</a><ul>
<li class="toctree-l2"><a class="reference internal" href="tutorial-client.html#libevent-client-c">libevent-client.c</a></li>
@ -90,34 +98,32 @@
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttp.1.html">nghttp(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttpd.1.html">nghttpd(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttpx.1.html">nghttpx(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#files">FILES</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#signals">SIGNALS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="h2load.1.html">h2load(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
@ -131,8 +137,9 @@
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#specifying-additional-ca-certificate">Specifying additional CA certificate</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#read-write-rate-limit">Read/write rate limit</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#rewriting-location-header-field">Rewriting location header field</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#hot-deploy">Hot deploy</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#hot-swapping">Hot swapping</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#re-opening-log-files">Re-opening log files</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#multiple-http-1-backend-addresses">Multiple HTTP/1 backend addresses</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="h2load-howto.html">h2load - HTTP/2 benchmarking tool - HOW-TO</a><ul>
@ -166,9 +173,11 @@
<li class="toctree-l1"><a class="reference internal" href="asio_http2.h.html">asio_http2.h</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/tatsuhiro-t/nghttp2">Source</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/tatsuhiro-t/nghttp2/issues">Issues</a></li>
<li class="toctree-l1"><a class="reference external" href="https://nghttp2.org/">nghttp2.org</a></li>
</ul>
</div>
&nbsp;
</nav>
@ -227,14 +236,11 @@ HTTP/2 server looks like this:</p>
<span class="k">using</span> <span class="k">namespace</span> <span class="n">nghttp2</span><span class="o">::</span><span class="n">asio_http2</span><span class="p">;</span>
<span class="k">using</span> <span class="k">namespace</span> <span class="n">nghttp2</span><span class="o">::</span><span class="n">asio_http2</span><span class="o">::</span><span class="n">server</span><span class="p">;</span>
<span class="kt">int</span> <span class="nf">main</span><span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="kt">char</span><span class="o">*</span> <span class="n">argv</span><span class="p">[])</span>
<span class="p">{</span>
<span class="kt">int</span> <span class="nf">main</span><span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="kt">char</span> <span class="o">*</span><span class="n">argv</span><span class="p">[])</span> <span class="p">{</span>
<span class="n">http2</span> <span class="n">server</span><span class="p">;</span>
<span class="n">server</span><span class="p">.</span><span class="n">listen</span>
<span class="p">(</span><span class="s">&quot;*&quot;</span><span class="p">,</span> <span class="mi">3000</span><span class="p">,</span>
<span class="p">[](</span><span class="n">std</span><span class="o">::</span><span class="n">shared_ptr</span><span class="o">&lt;</span><span class="n">request</span><span class="o">&gt;</span> <span class="n">req</span><span class="p">,</span> <span class="n">std</span><span class="o">::</span><span class="n">shared_ptr</span><span class="o">&lt;</span><span class="n">response</span><span class="o">&gt;</span> <span class="n">res</span><span class="p">)</span>
<span class="p">{</span>
<span class="n">server</span><span class="p">.</span><span class="n">listen</span><span class="p">(</span><span class="s">&quot;*&quot;</span><span class="p">,</span> <span class="mi">3000</span><span class="p">,</span> <span class="p">[](</span><span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">shared_ptr</span><span class="o">&lt;</span><span class="n">request</span><span class="o">&gt;</span> <span class="o">&amp;</span><span class="n">req</span><span class="p">,</span>
<span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">shared_ptr</span><span class="o">&lt;</span><span class="n">response</span><span class="o">&gt;</span> <span class="o">&amp;</span><span class="n">res</span><span class="p">)</span> <span class="p">{</span>
<span class="n">res</span><span class="o">-&gt;</span><span class="n">write_head</span><span class="p">(</span><span class="mi">200</span><span class="p">);</span>
<span class="n">res</span><span class="o">-&gt;</span><span class="n">end</span><span class="p">(</span><span class="s">&quot;hello, world&quot;</span><span class="p">);</span>
<span class="p">});</span>
@ -243,8 +249,8 @@ HTTP/2 server looks like this:</p>
</div>
<p>First we instantiate <tt class="docutils literal"><span class="pre">nghttp2::asio_http2::server::http2</span></tt> object.
Then call <tt class="docutils literal"><span class="pre">nghttp2::asio_http2::server::http2::listen</span></tt> function with
address and port to listen to and callback function, namely &#8220;request
callback&#8221;, invoked when request arrives.</p>
address and port to listen to and callback function, namely &quot;request
callback&quot;, invoked when request arrives.</p>
<p>The <tt class="docutils literal"><span class="pre">req</span></tt> and <tt class="docutils literal"><span class="pre">res</span></tt> represent HTTP request and response
respectively. <tt class="docutils literal"><span class="pre">nghttp2::asio_http2_::server::response::write_head</span></tt>
constructs HTTP response header fields. The first argument is HTTP
@ -252,7 +258,7 @@ status code, in the above example, which is 200. The second argument,
which is omitted in the above example, is additional header fields to
send.</p>
<p><tt class="docutils literal"><span class="pre">nghttp2::asio_http2::server::response::end</span></tt> sends responde body.
In the above example, we send string &#8220;hello, world&#8221;.</p>
In the above example, we send string &quot;hello, world&quot;.</p>
<div class="section" id="serving-static-files-and-enabling-ssl-tls">
<h3>Serving static files and enabling SSL/TLS<a class="headerlink" href="#serving-static-files-and-enabling-ssl-tls" title="Permalink to this headline"></a></h3>
<p>In this example, we serve a couple of static files and also enable
@ -262,16 +268,13 @@ SSL/TLS.</p>
<span class="k">using</span> <span class="k">namespace</span> <span class="n">nghttp2</span><span class="o">::</span><span class="n">asio_http2</span><span class="p">;</span>
<span class="k">using</span> <span class="k">namespace</span> <span class="n">nghttp2</span><span class="o">::</span><span class="n">asio_http2</span><span class="o">::</span><span class="n">server</span><span class="p">;</span>
<span class="kt">int</span> <span class="nf">main</span><span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="kt">char</span><span class="o">*</span> <span class="n">argv</span><span class="p">[])</span>
<span class="p">{</span>
<span class="kt">int</span> <span class="nf">main</span><span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="kt">char</span> <span class="o">*</span><span class="n">argv</span><span class="p">[])</span> <span class="p">{</span>
<span class="n">http2</span> <span class="n">server</span><span class="p">;</span>
<span class="n">server</span><span class="p">.</span><span class="n">tls</span><span class="p">(</span><span class="s">&quot;server.key&quot;</span><span class="p">,</span> <span class="s">&quot;server.crt&quot;</span><span class="p">);</span>
<span class="n">server</span><span class="p">.</span><span class="n">listen</span>
<span class="p">(</span><span class="s">&quot;*&quot;</span><span class="p">,</span> <span class="mi">3000</span><span class="p">,</span>
<span class="p">[](</span><span class="n">std</span><span class="o">::</span><span class="n">shared_ptr</span><span class="o">&lt;</span><span class="n">request</span><span class="o">&gt;</span> <span class="n">req</span><span class="p">,</span> <span class="n">std</span><span class="o">::</span><span class="n">shared_ptr</span><span class="o">&lt;</span><span class="n">response</span><span class="o">&gt;</span> <span class="n">res</span><span class="p">)</span>
<span class="p">{</span>
<span class="n">server</span><span class="p">.</span><span class="n">listen</span><span class="p">(</span><span class="s">&quot;*&quot;</span><span class="p">,</span> <span class="mi">3000</span><span class="p">,</span> <span class="p">[](</span><span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">shared_ptr</span><span class="o">&lt;</span><span class="n">request</span><span class="o">&gt;</span> <span class="o">&amp;</span><span class="n">req</span><span class="p">,</span>
<span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">shared_ptr</span><span class="o">&lt;</span><span class="n">response</span><span class="o">&gt;</span> <span class="o">&amp;</span><span class="n">res</span><span class="p">)</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="n">req</span><span class="o">-&gt;</span><span class="n">path</span><span class="p">()</span> <span class="o">==</span> <span class="s">&quot;/&quot;</span> <span class="o">||</span> <span class="n">req</span><span class="o">-&gt;</span><span class="n">path</span><span class="p">()</span> <span class="o">==</span> <span class="s">&quot;/index.html&quot;</span><span class="p">)</span> <span class="p">{</span>
<span class="n">res</span><span class="o">-&gt;</span><span class="n">write_head</span><span class="p">(</span><span class="mi">200</span><span class="p">);</span>
<span class="n">res</span><span class="o">-&gt;</span><span class="n">end</span><span class="p">(</span><span class="n">file_reader</span><span class="p">(</span><span class="s">&quot;index.html&quot;</span><span class="p">));</span>
@ -287,7 +290,7 @@ SSL/TLS.</p>
<p>Specifying path to private key file and certificate file in
<tt class="docutils literal"><span class="pre">nghttp2::asio_http2::server::http2::tls</span></tt> will enable SSL/TLS. Both
files must be in PEM format.</p>
<p>In the above example, if request path is either &#8220;/&#8221; or &#8220;/index.html&#8221;,
<p>In the above example, if request path is either &quot;/&quot; or &quot;/index.html&quot;,
we serve index.html file in the current working directory.
<tt class="docutils literal"><span class="pre">nghttp2::asio_http2::server::response::end</span></tt> has overload to take
function of type <tt class="docutils literal"><span class="pre">nghttp2::asio_http2::read_cb</span></tt> and application pass
@ -303,16 +306,13 @@ function to generate function to server static file.</p>
<span class="k">using</span> <span class="k">namespace</span> <span class="n">nghttp2</span><span class="o">::</span><span class="n">asio_http2</span><span class="p">;</span>
<span class="k">using</span> <span class="k">namespace</span> <span class="n">nghttp2</span><span class="o">::</span><span class="n">asio_http2</span><span class="o">::</span><span class="n">server</span><span class="p">;</span>
<span class="kt">int</span> <span class="nf">main</span><span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="kt">char</span><span class="o">*</span> <span class="n">argv</span><span class="p">[])</span>
<span class="p">{</span>
<span class="kt">int</span> <span class="nf">main</span><span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="kt">char</span> <span class="o">*</span><span class="n">argv</span><span class="p">[])</span> <span class="p">{</span>
<span class="n">http2</span> <span class="n">server</span><span class="p">;</span>
<span class="n">server</span><span class="p">.</span><span class="n">tls</span><span class="p">(</span><span class="s">&quot;server.key&quot;</span><span class="p">,</span> <span class="s">&quot;server.crt&quot;</span><span class="p">);</span>
<span class="n">server</span><span class="p">.</span><span class="n">listen</span>
<span class="p">(</span><span class="s">&quot;*&quot;</span><span class="p">,</span> <span class="mi">3000</span><span class="p">,</span>
<span class="p">[](</span><span class="n">std</span><span class="o">::</span><span class="n">shared_ptr</span><span class="o">&lt;</span><span class="n">request</span><span class="o">&gt;</span> <span class="n">req</span><span class="p">,</span> <span class="n">std</span><span class="o">::</span><span class="n">shared_ptr</span><span class="o">&lt;</span><span class="n">response</span><span class="o">&gt;</span> <span class="n">res</span><span class="p">)</span>
<span class="p">{</span>
<span class="n">server</span><span class="p">.</span><span class="n">listen</span><span class="p">(</span><span class="s">&quot;*&quot;</span><span class="p">,</span> <span class="mi">3000</span><span class="p">,</span> <span class="p">[](</span><span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">shared_ptr</span><span class="o">&lt;</span><span class="n">request</span><span class="o">&gt;</span> <span class="o">&amp;</span><span class="n">req</span><span class="p">,</span>
<span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">shared_ptr</span><span class="o">&lt;</span><span class="n">response</span><span class="o">&gt;</span> <span class="o">&amp;</span><span class="n">res</span><span class="p">)</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="n">req</span><span class="o">-&gt;</span><span class="n">path</span><span class="p">()</span> <span class="o">==</span> <span class="s">&quot;/&quot;</span><span class="p">)</span> <span class="p">{</span>
<span class="n">req</span><span class="o">-&gt;</span><span class="n">push</span><span class="p">(</span><span class="s">&quot;GET&quot;</span><span class="p">,</span> <span class="s">&quot;/my.css&quot;</span><span class="p">);</span>
@ -336,10 +336,10 @@ function to generate function to server static file.</p>
<span class="p">}</span>
</pre></div>
</div>
<p>When client requested &#8220;/&#8221;, we push &#8220;/my.css&#8221;. To push resource, call
<p>When client requested &quot;/&quot;, we push &quot;/my.css&quot;. To push resource, call
<tt class="docutils literal"><span class="pre">nghttp2::asio_http2::server::request::push</span></tt> function with desired
method and path. Later, the callback will be called with the pushed
resource &#8220;/my.css&#8221;.</p>
resource &quot;/my.css&quot;.</p>
</div>
<div class="section" id="enable-multi-threading">
<h3>Enable multi-threading<a class="headerlink" href="#enable-multi-threading" title="Permalink to this headline"></a></h3>
@ -369,19 +369,14 @@ blocking task there. The example follows:</p>
<span class="k">using</span> <span class="k">namespace</span> <span class="n">nghttp2</span><span class="o">::</span><span class="n">asio_http2</span><span class="p">;</span>
<span class="k">using</span> <span class="k">namespace</span> <span class="n">nghttp2</span><span class="o">::</span><span class="n">asio_http2</span><span class="o">::</span><span class="n">server</span><span class="p">;</span>
<span class="kt">int</span> <span class="nf">main</span><span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="kt">char</span><span class="o">*</span> <span class="n">argv</span><span class="p">[])</span>
<span class="p">{</span>
<span class="kt">int</span> <span class="nf">main</span><span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="kt">char</span> <span class="o">*</span><span class="n">argv</span><span class="p">[])</span> <span class="p">{</span>
<span class="n">http2</span> <span class="n">server</span><span class="p">;</span>
<span class="n">server</span><span class="p">.</span><span class="n">num_concurrent_tasks</span><span class="p">(</span><span class="mi">16</span><span class="p">);</span>
<span class="n">server</span><span class="p">.</span><span class="n">listen</span>
<span class="p">(</span><span class="s">&quot;*&quot;</span><span class="p">,</span> <span class="mi">3000</span><span class="p">,</span>
<span class="p">[](</span><span class="n">std</span><span class="o">::</span><span class="n">shared_ptr</span><span class="o">&lt;</span><span class="n">request</span><span class="o">&gt;</span> <span class="n">req</span><span class="p">,</span> <span class="n">std</span><span class="o">::</span><span class="n">shared_ptr</span><span class="o">&lt;</span><span class="n">response</span><span class="o">&gt;</span> <span class="n">res</span><span class="p">)</span>
<span class="p">{</span>
<span class="n">req</span><span class="o">-&gt;</span><span class="n">run_task</span>
<span class="p">([</span><span class="n">res</span><span class="p">](</span><span class="n">channel</span><span class="o">&amp;</span> <span class="n">channel</span><span class="p">)</span>
<span class="p">{</span>
<span class="n">server</span><span class="p">.</span><span class="n">listen</span><span class="p">(</span><span class="s">&quot;*&quot;</span><span class="p">,</span> <span class="mi">3000</span><span class="p">,</span> <span class="p">[](</span><span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">shared_ptr</span><span class="o">&lt;</span><span class="n">request</span><span class="o">&gt;</span> <span class="o">&amp;</span><span class="n">req</span><span class="p">,</span>
<span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">shared_ptr</span><span class="o">&lt;</span><span class="n">response</span><span class="o">&gt;</span> <span class="o">&amp;</span><span class="n">res</span><span class="p">)</span> <span class="p">{</span>
<span class="n">req</span><span class="o">-&gt;</span><span class="n">run_task</span><span class="p">([</span><span class="n">res</span><span class="p">](</span><span class="n">channel</span> <span class="o">&amp;</span><span class="n">channel</span><span class="p">)</span> <span class="p">{</span>
<span class="c1">// executed in different thread than the thread where</span>
<span class="c1">// request callback was executed.</span>
@ -390,9 +385,7 @@ blocking task there. The example follows:</p>
<span class="n">sleep</span><span class="p">(</span><span class="mi">1</span><span class="p">);</span>
<span class="n">channel</span><span class="p">.</span><span class="n">post</span>
<span class="p">([</span><span class="n">res</span><span class="p">]()</span>
<span class="p">{</span>
<span class="n">channel</span><span class="p">.</span><span class="n">post</span><span class="p">([</span><span class="n">res</span><span class="p">]()</span> <span class="p">{</span>
<span class="c1">// executed in the same thread where request callback</span>
<span class="c1">// was executed.</span>
<span class="n">res</span><span class="o">-&gt;</span><span class="n">write_head</span><span class="p">(</span><span class="mi">200</span><span class="p">);</span>
@ -439,11 +432,12 @@ called.</p>
<div role="contentinfo">
<p>
&copy; Copyright 2012, 2014, Tatsuhiro Tsujikawa.
&copy; Copyright 2012, 2015, Tatsuhiro Tsujikawa.
</p>
</div>
<a href="https://github.com/snide/sphinx_rtd_theme">Sphinx theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
@ -459,7 +453,7 @@ called.</p>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'0.6.3-DEV',
VERSION:'0.7.2-DEV',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: false

View File

@ -7,14 +7,14 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>nghttp(1) &mdash; nghttp2 0.6.3-DEV documentation</title>
<title>nghttp(1) &mdash; nghttp2 0.7.2-DEV documentation</title>
<link href='https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700&subset=latin,cyrillic' rel='stylesheet' type='text/css'>
@ -28,7 +28,7 @@
<link rel="top" title="nghttp2 0.6.3-DEV documentation" href="index.html"/>
<link rel="top" title="nghttp2 0.7.2-DEV documentation" href="index.html"/>
<link rel="next" title="nghttpd(1)" href="nghttpd.1.html"/>
<link rel="prev" title="Tutorial: HPACK API" href="tutorial-hpack.html"/>
@ -47,6 +47,7 @@
<a href="index.html" class="fa fa-home"> nghttp2</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
@ -59,6 +60,7 @@
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="package_README.html">nghttp2 - HTTP/2 C Library</a><ul>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#development-status">Development Status</a></li>
@ -66,6 +68,8 @@
<li class="toctree-l2"><a class="reference internal" href="package_README.html#requirements">Requirements</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#build-from-git">Build from git</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#building-documentation">Building documentation</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#unit-tests">Unit tests</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#integration-tests">Integration tests</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#client-server-and-proxy-programs">Client, Server and Proxy programs</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#benchmarking-tool">Benchmarking tool</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#hpack-tools">HPACK tools</a></li>
@ -74,6 +78,10 @@
<li class="toctree-l2"><a class="reference internal" href="package_README.html#contribution">Contribution</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="contribute.html">Contribution Guidelines</a><ul>
<li class="toctree-l2"><a class="reference internal" href="contribute.html#coding-style">Coding style</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="building-android-binary.html">Building Android binary</a></li>
<li class="toctree-l1"><a class="reference internal" href="tutorial-client.html">Tutorial: HTTP/2 client</a><ul>
<li class="toctree-l2"><a class="reference internal" href="tutorial-client.html#libevent-client-c">libevent-client.c</a></li>
@ -90,34 +98,32 @@
</ul>
</li>
<li class="toctree-l1 current"><a class="current reference internal" href="">nghttp(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttpd.1.html">nghttpd(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttpx.1.html">nghttpx(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#files">FILES</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#signals">SIGNALS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="h2load.1.html">h2load(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
@ -131,8 +137,9 @@
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#specifying-additional-ca-certificate">Specifying additional CA certificate</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#read-write-rate-limit">Read/write rate limit</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#rewriting-location-header-field">Rewriting location header field</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#hot-deploy">Hot deploy</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#hot-swapping">Hot swapping</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#re-opening-log-files">Re-opening log files</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#multiple-http-1-backend-addresses">Multiple HTTP/1 backend addresses</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="h2load-howto.html">h2load - HTTP/2 benchmarking tool - HOW-TO</a><ul>
@ -166,9 +173,11 @@
<li class="toctree-l1"><a class="reference internal" href="asio_http2.h.html">asio_http2.h</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/tatsuhiro-t/nghttp2">Source</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/tatsuhiro-t/nghttp2/issues">Issues</a></li>
<li class="toctree-l1"><a class="reference external" href="https://nghttp2.org/">nghttp2.org</a></li>
</ul>
</div>
&nbsp;
</nav>
@ -200,10 +209,6 @@
<div class="section" id="nghttp-1">
<h1>nghttp(1)<a class="headerlink" href="#nghttp-1" title="Permalink to this headline"></a></h1>
<div class="section" id="name">
<h2>NAME<a class="headerlink" href="#name" title="Permalink to this headline"></a></h2>
<p>nghttp - HTTP/2 experimental client</p>
</div>
<div class="section" id="synopsis">
<h2>SYNOPSIS<a class="headerlink" href="#synopsis" title="Permalink to this headline"></a></h2>
<p><strong>nghttp</strong> [OPTIONS]... &lt;URI&gt;...</p>
@ -211,181 +216,201 @@
<div class="section" id="description">
<h2>DESCRIPTION<a class="headerlink" href="#description" title="Permalink to this headline"></a></h2>
<p>HTTP/2 experimental client</p>
<dl class="option">
<dt id="cmdoption-nghttp-arg-URI">
<tt class="descname">URI</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption-nghttp-arg-URI" title="Permalink to this definition"></a></dt>
<dl class="describe">
<dt>
<tt class="descname">&lt;URI&gt;</tt></dt>
<dd><p>Specify URI to access.</p>
</dd></dl>
</div>
<div class="section" id="options">
<h2>OPTIONS<a class="headerlink" href="#options" title="Permalink to this headline"></a></h2>
<h2>OPTIONS:<a class="headerlink" href="#options" title="Permalink to this headline"></a></h2>
<dl class="option">
<dt id="cmdoption-nghttp-v">
<span id="cmdoption-nghttp--verbose"></span><tt class="descname">-v</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--verbose</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption-nghttp-v" title="Permalink to this definition"></a></dt>
<dt id="cmdoption-v">
<span id="cmdoption--verbose"></span><tt class="descname">-v</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--verbose</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption-v" title="Permalink to this definition"></a></dt>
<dd><p>Print debug information such as reception and
transmission of frames and name/value pairs.</p>
transmission of frames and name/value pairs. Specifying
this option multiple times increases verbosity.</p>
</dd></dl>
<dl class="option">
<dt id="cmdoption-nghttp-n">
<span id="cmdoption-nghttp--null-out"></span><tt class="descname">-n</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--null-out</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption-nghttp-n" title="Permalink to this definition"></a></dt>
<dt id="cmdoption-n">
<span id="cmdoption--null-out"></span><tt class="descname">-n</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--null-out</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption-n" title="Permalink to this definition"></a></dt>
<dd><p>Discard downloaded data.</p>
</dd></dl>
<dl class="option">
<dt id="cmdoption-nghttp-O">
<span id="cmdoption-nghttp--remote-name"></span><tt class="descname">-O</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--remote-name</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption-nghttp-O" title="Permalink to this definition"></a></dt>
<dt id="cmdoption-O">
<span id="cmdoption--remote-name"></span><tt class="descname">-O</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--remote-name</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption-O" title="Permalink to this definition"></a></dt>
<dd><p>Save download data in the current directory. The
filename is dereived from URI. If URI ends with
&amp;&#8217;/&#8217;, &#8216;index.html&#8217; is used as a filename. Not
implemented yet.</p>
filename is dereived from URI. If URI ends with '<em>/</em>',
'index.html' is used as a filename. Not implemented
yet.</p>
</dd></dl>
<dl class="option">
<dt id="cmdoption-nghttp-t">
<span id="cmdoption-nghttp--timeout"></span><tt class="descname">-t</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--timeout</tt><tt class="descclassname">=&lt;N&gt;</tt><a class="headerlink" href="#cmdoption-nghttp-t" title="Permalink to this definition"></a></dt>
<dd><p>Timeout each request after &lt;N&gt; seconds.</p>
<dt id="cmdoption-t">
<span id="cmdoption--timeout"></span><tt class="descname">-t</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--timeout</tt><tt class="descclassname">=&lt;SEC&gt;</tt><a class="headerlink" href="#cmdoption-t" title="Permalink to this definition"></a></dt>
<dd><p>Timeout each request after &lt;SEC&gt; seconds.</p>
</dd></dl>
<dl class="option">
<dt id="cmdoption-nghttp-w">
<span id="cmdoption-nghttp--window-bits"></span><tt class="descname">-w</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--window-bits</tt><tt class="descclassname">=&lt;N&gt;</tt><a class="headerlink" href="#cmdoption-nghttp-w" title="Permalink to this definition"></a></dt>
<dd><p>Sets the stream level initial window size to
2**&lt;N&gt;-1.</p>
<dt id="cmdoption-w">
<span id="cmdoption--window-bits"></span><tt class="descname">-w</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--window-bits</tt><tt class="descclassname">=&lt;N&gt;</tt><a class="headerlink" href="#cmdoption-w" title="Permalink to this definition"></a></dt>
<dd><p>Sets the stream level initial window size to 2**&lt;N&gt;-1.</p>
</dd></dl>
<dl class="option">
<dt id="cmdoption-nghttp-W">
<span id="cmdoption-nghttp--connection-window-bits"></span><tt class="descname">-W</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--connection-window-bits</tt><tt class="descclassname">=&lt;N&gt;</tt><a class="headerlink" href="#cmdoption-nghttp-W" title="Permalink to this definition"></a></dt>
<dt id="cmdoption-W">
<span id="cmdoption--connection-window-bits"></span><tt class="descname">-W</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--connection-window-bits</tt><tt class="descclassname">=&lt;N&gt;</tt><a class="headerlink" href="#cmdoption-W" title="Permalink to this definition"></a></dt>
<dd><p>Sets the connection level initial window size to
2**&lt;N&gt;-1.</p>
</dd></dl>
<dl class="option">
<dt id="cmdoption-nghttp-a">
<span id="cmdoption-nghttp--get-assets"></span><tt class="descname">-a</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--get-assets</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption-nghttp-a" title="Permalink to this definition"></a></dt>
<dd><p>Download assets such as stylesheets, images and
script files linked from the downloaded resource.
Only links whose origins are the same with the
linking resource will be downloaded.</p>
<dt id="cmdoption-a">
<span id="cmdoption--get-assets"></span><tt class="descname">-a</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--get-assets</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption-a" title="Permalink to this definition"></a></dt>
<dd><p>Download assets such as stylesheets, images and script
files linked from the downloaded resource. Only links
whose origins are the same with the linking resource
will be downloaded. nghttp prioritizes resources using
HTTP/2 dependency based priority. The priority order,
from highest to lowest, is html itself, css, javascript
and images.</p>
</dd></dl>
<dl class="option">
<dt id="cmdoption-nghttp-s">
<span id="cmdoption-nghttp--stat"></span><tt class="descname">-s</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--stat</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption-nghttp-s" title="Permalink to this definition"></a></dt>
<dt id="cmdoption-s">
<span id="cmdoption--stat"></span><tt class="descname">-s</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--stat</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption-s" title="Permalink to this definition"></a></dt>
<dd><p>Print statistics.</p>
</dd></dl>
<dl class="option">
<dt id="cmdoption-nghttp-H">
<span id="cmdoption-nghttp--header"></span><tt class="descname">-H</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--header</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption-nghttp-H" title="Permalink to this definition"></a></dt>
<dd><p>Add a header to the requests.</p>
<dt id="cmdoption-H">
<span id="cmdoption--header"></span><tt class="descname">-H</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--header</tt><tt class="descclassname">=&lt;HEADER&gt;</tt><a class="headerlink" href="#cmdoption-H" title="Permalink to this definition"></a></dt>
<dd><p>Add a header to the requests. Example: <a class="reference internal" href="#cmdoption-H"><em class="xref std std-option">-H</em></a>':method: PUT'</p>
</dd></dl>
<dl class="option">
<dt id="cmdoption-nghttp--cert">
<tt class="descname">--cert</tt><tt class="descclassname">=&lt;CERT&gt;</tt><a class="headerlink" href="#cmdoption-nghttp--cert" title="Permalink to this definition"></a></dt>
<dd><p>Use the specified client certificate file. The
file must be in PEM format.</p>
<dt id="cmdoption--cert">
<tt class="descname">--cert</tt><tt class="descclassname">=&lt;CERT&gt;</tt><a class="headerlink" href="#cmdoption--cert" title="Permalink to this definition"></a></dt>
<dd><p>Use the specified client certificate file. The file
must be in PEM format.</p>
</dd></dl>
<dl class="option">
<dt id="cmdoption-nghttp--key">
<tt class="descname">--key</tt><tt class="descclassname">=&lt;KEY&gt;</tt><a class="headerlink" href="#cmdoption-nghttp--key" title="Permalink to this definition"></a></dt>
<dd><p>Use the client private key file. The file must
be in PEM format.</p>
<dt id="cmdoption--key">
<tt class="descname">--key</tt><tt class="descclassname">=&lt;KEY&gt;</tt><a class="headerlink" href="#cmdoption--key" title="Permalink to this definition"></a></dt>
<dd><p>Use the client private key file. The file must be in
PEM format.</p>
</dd></dl>
<dl class="option">
<dt id="cmdoption-nghttp-d">
<span id="cmdoption-nghttp--data"></span><tt class="descname">-d</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--data</tt><tt class="descclassname">=&lt;FILE&gt;</tt><a class="headerlink" href="#cmdoption-nghttp-d" title="Permalink to this definition"></a></dt>
<dd><p>Post FILE to server. If &#8216;-&#8216; is given, data will
be read from stdin.</p>
<dt id="cmdoption-d">
<span id="cmdoption--data"></span><tt class="descname">-d</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--data</tt><tt class="descclassname">=&lt;FILE&gt;</tt><a class="headerlink" href="#cmdoption-d" title="Permalink to this definition"></a></dt>
<dd><p>Post FILE to server. If '-' is given, data will be read
from stdin.</p>
</dd></dl>
<dl class="option">
<dt id="cmdoption-nghttp-m">
<span id="cmdoption-nghttp--multiply"></span><tt class="descname">-m</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--multiply</tt><tt class="descclassname">=&lt;N&gt;</tt><a class="headerlink" href="#cmdoption-nghttp-m" title="Permalink to this definition"></a></dt>
<dd><p>Request each URI &lt;N&gt; times.
By default, same URI
is not requested twice. This option disables it
too.</p>
<dt id="cmdoption-m">
<span id="cmdoption--multiply"></span><tt class="descname">-m</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--multiply</tt><tt class="descclassname">=&lt;N&gt;</tt><a class="headerlink" href="#cmdoption-m" title="Permalink to this definition"></a></dt>
<dd><p>Request each URI &lt;N&gt; times. By default, same URI is not
requested twice. This option disables it too.</p>
</dd></dl>
<dl class="option">
<dt id="cmdoption-nghttp-u">
<span id="cmdoption-nghttp--upgrade"></span><tt class="descname">-u</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--upgrade</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption-nghttp-u" title="Permalink to this definition"></a></dt>
<dd><p>Perform HTTP Upgrade for HTTP/2. This option is
ignored if the request URI has https scheme. If
<a class="reference internal" href="#cmdoption-nghttp-d"><em class="xref std std-option">-d</em></a> is used, the HTTP upgrade request is performed
with OPTIONS method.</p>
<dt id="cmdoption-u">
<span id="cmdoption--upgrade"></span><tt class="descname">-u</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--upgrade</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption-u" title="Permalink to this definition"></a></dt>
<dd><p>Perform HTTP Upgrade for HTTP/2. This option is ignored
if the request URI has https scheme. If <a class="reference internal" href="nghttpd.1.html#cmdoption-d"><em class="xref std std-option">-d</em></a> is used, the
HTTP upgrade request is performed with OPTIONS method.</p>
</dd></dl>
<dl class="option">
<dt id="cmdoption-nghttp-p">
<span id="cmdoption-nghttp--weight"></span><tt class="descname">-p</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--weight</tt><tt class="descclassname">=&lt;WEIGHT&gt;</tt><a class="headerlink" href="#cmdoption-nghttp-p" title="Permalink to this definition"></a></dt>
<dd><p>Sets priority group weight. The valid value
range is [1, 256], inclusive.
Default: 16</p>
<dt id="cmdoption-p">
<span id="cmdoption--weight"></span><tt class="descname">-p</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--weight</tt><tt class="descclassname">=&lt;WEIGHT&gt;</tt><a class="headerlink" href="#cmdoption-p" title="Permalink to this definition"></a></dt>
<dd><p>Sets priority group weight. The valid value range is
[1, 256], inclusive.</p>
<p>Default: <tt class="docutils literal"><span class="pre">16</span></tt></p>
</dd></dl>
<dl class="option">
<dt id="cmdoption-nghttp-M">
<span id="cmdoption-nghttp--peer-max-concurrent-streams"></span><tt class="descname">-M</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--peer-max-concurrent-streams</tt><tt class="descclassname">=&lt;N&gt;</tt><a class="headerlink" href="#cmdoption-nghttp-M" title="Permalink to this definition"></a></dt>
<dd><p>Use &lt;N&gt; as SETTINGS_MAX_CONCURRENT_STREAMS value
of remote endpoint as if it is received in
SETTINGS frame. The default is large enough as
it is seen as unlimited.</p>
<dt id="cmdoption-M">
<span id="cmdoption--peer-max-concurrent-streams"></span><tt class="descname">-M</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--peer-max-concurrent-streams</tt><tt class="descclassname">=&lt;N&gt;</tt><a class="headerlink" href="#cmdoption-M" title="Permalink to this definition"></a></dt>
<dd><p>Use &lt;N&gt; as SETTINGS_MAX_CONCURRENT_STREAMS value of
remote endpoint as if it is received in SETTINGS frame.
The default is large enough as it is seen as unlimited.</p>
</dd></dl>
<dl class="option">
<dt id="cmdoption-nghttp-c">
<span id="cmdoption-nghttp--header-table-size"></span><tt class="descname">-c</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--header-table-size</tt><tt class="descclassname">=&lt;N&gt;</tt><a class="headerlink" href="#cmdoption-nghttp-c" title="Permalink to this definition"></a></dt>
<dt id="cmdoption-c">
<span id="cmdoption--header-table-size"></span><tt class="descname">-c</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--header-table-size</tt><tt class="descclassname">=&lt;SIZE&gt;</tt><a class="headerlink" href="#cmdoption-c" title="Permalink to this definition"></a></dt>
<dd><p>Specify decoder header table size.</p>
</dd></dl>
<dl class="option">
<dt id="cmdoption-nghttp-b">
<span id="cmdoption-nghttp--padding"></span><tt class="descname">-b</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--padding</tt><tt class="descclassname">=&lt;N&gt;</tt><a class="headerlink" href="#cmdoption-nghttp-b" title="Permalink to this definition"></a></dt>
<dd><p>Add at most &lt;N&gt; bytes to a frame payload as
padding. Specify 0 to disable padding.</p>
<dt id="cmdoption-b">
<span id="cmdoption--padding"></span><tt class="descname">-b</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--padding</tt><tt class="descclassname">=&lt;N&gt;</tt><a class="headerlink" href="#cmdoption-b" title="Permalink to this definition"></a></dt>
<dd><p>Add at most &lt;N&gt; bytes to a frame payload as padding.
Specify 0 to disable padding.</p>
</dd></dl>
<dl class="option">
<dt id="cmdoption-nghttp--color">
<tt class="descname">--color</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption-nghttp--color" title="Permalink to this definition"></a></dt>
<dt id="cmdoption-r">
<span id="cmdoption--har"></span><tt class="descname">-r</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--har</tt><tt class="descclassname">=&lt;FILE&gt;</tt><a class="headerlink" href="#cmdoption-r" title="Permalink to this definition"></a></dt>
<dd><p>Output HTTP transactions &lt;FILE&gt; in HAR format. If '-'
is given, data is written to stdout.</p>
</dd></dl>
<dl class="option">
<dt id="cmdoption--color">
<tt class="descname">--color</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption--color" title="Permalink to this definition"></a></dt>
<dd><p>Force colored log output.</p>
</dd></dl>
<dl class="option">
<dt id="cmdoption-nghttp--continuation">
<tt class="descname">--continuation</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption-nghttp--continuation" title="Permalink to this definition"></a></dt>
<dt id="cmdoption--continuation">
<tt class="descname">--continuation</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption--continuation" title="Permalink to this definition"></a></dt>
<dd><p>Send large header to test CONTINUATION.</p>
</dd></dl>
<dl class="option">
<dt id="cmdoption-nghttp--no-content-length">
<tt class="descname">--no-content-length</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption-nghttp--no-content-length" title="Permalink to this definition"></a></dt>
<dd><p>Don&#8217;t send content-length header field.</p>
<dt id="cmdoption--no-content-length">
<tt class="descname">--no-content-length</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption--no-content-length" title="Permalink to this definition"></a></dt>
<dd><p>Don't send content-length header field.</p>
</dd></dl>
<dl class="option">
<dt id="cmdoption-nghttp--version">
<tt class="descname">--version</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption-nghttp--version" title="Permalink to this definition"></a></dt>
<dt id="cmdoption--no-dep">
<tt class="descname">--no-dep</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption--no-dep" title="Permalink to this definition"></a></dt>
<dd><p>Don't send dependency based priority hint to server.</p>
</dd></dl>
<dl class="option">
<dt id="cmdoption--dep-idle">
<tt class="descname">--dep-idle</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption--dep-idle" title="Permalink to this definition"></a></dt>
<dd><p>Use idle streams as anchor nodes to express priority.</p>
</dd></dl>
<dl class="option">
<dt id="cmdoption--version">
<tt class="descname">--version</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption--version" title="Permalink to this definition"></a></dt>
<dd><p>Display version information and exit.</p>
</dd></dl>
<dl class="option">
<dt id="cmdoption-nghttp-h">
<span id="cmdoption-nghttp--help"></span><tt class="descname">-h</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--help</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption-nghttp-h" title="Permalink to this definition"></a></dt>
<dt id="cmdoption-h">
<span id="cmdoption--help"></span><tt class="descname">-h</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--help</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption-h" title="Permalink to this definition"></a></dt>
<dd><p>Display this help and exit.</p>
</dd></dl>
<p>The &lt;SIZE&gt; argument is an integer and an optional unit (e.g., 10K is
10 * 1024). Units are K, M and G (powers of 1024).</p>
</div>
<div class="section" id="see-also">
<h2>SEE ALSO<a class="headerlink" href="#see-also" title="Permalink to this headline"></a></h2>
<p>nghttpd(1), nghttpx(1), h2load(1)</p>
<p><em class="manpage">nghttpd(1)</em>, <em class="manpage">nghttpx(1)</em>, <em class="manpage">h2load(1)</em></p>
</div>
</div>
@ -407,11 +432,12 @@ padding. Specify 0 to disable padding.</p>
<div role="contentinfo">
<p>
&copy; Copyright 2012, 2014, Tatsuhiro Tsujikawa.
&copy; Copyright 2012, 2015, Tatsuhiro Tsujikawa.
</p>
</div>
<a href="https://github.com/snide/sphinx_rtd_theme">Sphinx theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
@ -427,7 +453,7 @@ padding. Specify 0 to disable padding.</p>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'0.6.3-DEV',
VERSION:'0.7.2-DEV',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: false

File diff suppressed because it is too large Load Diff

View File

@ -7,14 +7,14 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>nghttp2ver.h &mdash; nghttp2 0.6.3-DEV documentation</title>
<title>nghttp2ver.h &mdash; nghttp2 0.7.2-DEV documentation</title>
<link href='https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700&subset=latin,cyrillic' rel='stylesheet' type='text/css'>
@ -28,7 +28,7 @@
<link rel="top" title="nghttp2 0.6.3-DEV documentation" href="index.html"/>
<link rel="top" title="nghttp2 0.7.2-DEV documentation" href="index.html"/>
<link rel="next" title="asio_http2.h" href="asio_http2.h.html"/>
<link rel="prev" title="nghttp2.h" href="nghttp2.h.html"/>
@ -47,6 +47,7 @@
<a href="index.html" class="fa fa-home"> nghttp2</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
@ -59,6 +60,7 @@
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="package_README.html">nghttp2 - HTTP/2 C Library</a><ul>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#development-status">Development Status</a></li>
@ -66,6 +68,8 @@
<li class="toctree-l2"><a class="reference internal" href="package_README.html#requirements">Requirements</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#build-from-git">Build from git</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#building-documentation">Building documentation</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#unit-tests">Unit tests</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#integration-tests">Integration tests</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#client-server-and-proxy-programs">Client, Server and Proxy programs</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#benchmarking-tool">Benchmarking tool</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#hpack-tools">HPACK tools</a></li>
@ -74,6 +78,10 @@
<li class="toctree-l2"><a class="reference internal" href="package_README.html#contribution">Contribution</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="contribute.html">Contribution Guidelines</a><ul>
<li class="toctree-l2"><a class="reference internal" href="contribute.html#coding-style">Coding style</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="building-android-binary.html">Building Android binary</a></li>
<li class="toctree-l1"><a class="reference internal" href="tutorial-client.html">Tutorial: HTTP/2 client</a><ul>
<li class="toctree-l2"><a class="reference internal" href="tutorial-client.html#libevent-client-c">libevent-client.c</a></li>
@ -90,34 +98,32 @@
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttp.1.html">nghttp(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttpd.1.html">nghttpd(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttpx.1.html">nghttpx(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#files">FILES</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#signals">SIGNALS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="h2load.1.html">h2load(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
@ -131,8 +137,9 @@
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#specifying-additional-ca-certificate">Specifying additional CA certificate</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#read-write-rate-limit">Read/write rate limit</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#rewriting-location-header-field">Rewriting location header field</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#hot-deploy">Hot deploy</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#hot-swapping">Hot swapping</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#re-opening-log-files">Re-opening log files</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#multiple-http-1-backend-addresses">Multiple HTTP/1 backend addresses</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="h2load-howto.html">h2load - HTTP/2 benchmarking tool - HOW-TO</a><ul>
@ -166,9 +173,11 @@
<li class="toctree-l1"><a class="reference internal" href="asio_http2.h.html">asio_http2.h</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/tatsuhiro-t/nghttp2">Source</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/tatsuhiro-t/nghttp2/issues">Issues</a></li>
<li class="toctree-l1"><a class="reference external" href="https://nghttp2.org/">nghttp2.org</a></li>
</ul>
</div>
&nbsp;
</nav>
@ -231,7 +240,7 @@
<span class="cm"> * @macro</span>
<span class="cm"> * Version number of the nghttp2 library release</span>
<span class="cm"> */</span>
<span class="cp">#define NGHTTP2_VERSION &quot;0.6.3-DEV&quot;</span>
<span class="cp">#define NGHTTP2_VERSION &quot;0.7.2-DEV&quot;</span>
<span class="cm">/**</span>
<span class="cm"> * @macro</span>
@ -239,7 +248,7 @@
<span class="cm"> * release. This is a 24 bit number with 8 bits for major number, 8 bits</span>
<span class="cm"> * for minor and 8 bits for patch. Version 1.2.3 becomes 0x010203.</span>
<span class="cm"> */</span>
<span class="cp">#define NGHTTP2_VERSION_NUM 0x000603</span>
<span class="cp">#define NGHTTP2_VERSION_NUM 0x000702</span>
<span class="cp">#endif </span><span class="cm">/* NGHTTP2VER_H */</span><span class="cp"></span>
</pre></div>
@ -264,11 +273,12 @@
<div role="contentinfo">
<p>
&copy; Copyright 2012, 2014, Tatsuhiro Tsujikawa.
&copy; Copyright 2012, 2015, Tatsuhiro Tsujikawa.
</p>
</div>
<a href="https://github.com/snide/sphinx_rtd_theme">Sphinx theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
@ -284,7 +294,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'0.6.3-DEV',
VERSION:'0.7.2-DEV',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: false

View File

@ -7,14 +7,14 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>nghttpd(1) &mdash; nghttp2 0.6.3-DEV documentation</title>
<title>nghttpd(1) &mdash; nghttp2 0.7.2-DEV documentation</title>
<link href='https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700&subset=latin,cyrillic' rel='stylesheet' type='text/css'>
@ -28,7 +28,7 @@
<link rel="top" title="nghttp2 0.6.3-DEV documentation" href="index.html"/>
<link rel="top" title="nghttp2 0.7.2-DEV documentation" href="index.html"/>
<link rel="next" title="nghttpx(1)" href="nghttpx.1.html"/>
<link rel="prev" title="nghttp(1)" href="nghttp.1.html"/>
@ -47,6 +47,7 @@
<a href="index.html" class="fa fa-home"> nghttp2</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
@ -59,6 +60,7 @@
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="package_README.html">nghttp2 - HTTP/2 C Library</a><ul>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#development-status">Development Status</a></li>
@ -66,6 +68,8 @@
<li class="toctree-l2"><a class="reference internal" href="package_README.html#requirements">Requirements</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#build-from-git">Build from git</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#building-documentation">Building documentation</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#unit-tests">Unit tests</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#integration-tests">Integration tests</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#client-server-and-proxy-programs">Client, Server and Proxy programs</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#benchmarking-tool">Benchmarking tool</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#hpack-tools">HPACK tools</a></li>
@ -74,6 +78,10 @@
<li class="toctree-l2"><a class="reference internal" href="package_README.html#contribution">Contribution</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="contribute.html">Contribution Guidelines</a><ul>
<li class="toctree-l2"><a class="reference internal" href="contribute.html#coding-style">Coding style</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="building-android-binary.html">Building Android binary</a></li>
<li class="toctree-l1"><a class="reference internal" href="tutorial-client.html">Tutorial: HTTP/2 client</a><ul>
<li class="toctree-l2"><a class="reference internal" href="tutorial-client.html#libevent-client-c">libevent-client.c</a></li>
@ -90,34 +98,32 @@
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttp.1.html">nghttp(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1 current"><a class="current reference internal" href="">nghttpd(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttpx.1.html">nghttpx(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#files">FILES</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#signals">SIGNALS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="h2load.1.html">h2load(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
@ -131,8 +137,9 @@
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#specifying-additional-ca-certificate">Specifying additional CA certificate</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#read-write-rate-limit">Read/write rate limit</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#rewriting-location-header-field">Rewriting location header field</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#hot-deploy">Hot deploy</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#hot-swapping">Hot swapping</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#re-opening-log-files">Re-opening log files</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#multiple-http-1-backend-addresses">Multiple HTTP/1 backend addresses</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="h2load-howto.html">h2load - HTTP/2 benchmarking tool - HOW-TO</a><ul>
@ -166,9 +173,11 @@
<li class="toctree-l1"><a class="reference internal" href="asio_http2.h.html">asio_http2.h</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/tatsuhiro-t/nghttp2">Source</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/tatsuhiro-t/nghttp2/issues">Issues</a></li>
<li class="toctree-l1"><a class="reference external" href="https://nghttp2.org/">nghttp2.org</a></li>
</ul>
</div>
&nbsp;
</nav>
@ -200,156 +209,148 @@
<div class="section" id="nghttpd-1">
<h1>nghttpd(1)<a class="headerlink" href="#nghttpd-1" title="Permalink to this headline"></a></h1>
<div class="section" id="name">
<h2>NAME<a class="headerlink" href="#name" title="Permalink to this headline"></a></h2>
<p>nghttpd - HTTP/2 experimental server</p>
</div>
<div class="section" id="synopsis">
<h2>SYNOPSIS<a class="headerlink" href="#synopsis" title="Permalink to this headline"></a></h2>
<p><strong>nghttpd</strong> [OPTION]... &lt;PORT&gt; &lt;PRIVATE_KEY&gt; &lt;CERT&gt;</p>
<p><strong>nghttpd</strong> &#8211;no-tls [OPTION]... &lt;PORT&gt;</p>
<p><strong>nghttpd</strong> [OPTION]... &lt;PORT&gt; [&lt;PRIVATE_KEY&gt; &lt;CERT&gt;]</p>
</div>
<div class="section" id="description">
<h2>DESCRIPTION<a class="headerlink" href="#description" title="Permalink to this headline"></a></h2>
<p>HTTP/2 experimental server</p>
<dl class="option">
<dt id="cmdoption-nghttpd-arg-PORT">
<tt class="descname">PORT</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption-nghttpd-arg-PORT" title="Permalink to this definition"></a></dt>
<dl class="describe">
<dt>
<tt class="descname">&lt;PORT&gt;</tt></dt>
<dd><p>Specify listening port number.</p>
</dd></dl>
<dl class="option">
<dt id="cmdoption-nghttpd-arg-PRIVATE_KEY">
<tt class="descname">PRIVATE_KEY</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption-nghttpd-arg-PRIVATE_KEY" title="Permalink to this definition"></a></dt>
<dd><p>Set path to server&#8217;s private key. Required
unless <a class="reference internal" href="#cmdoption-nghttpd--no-tls"><em class="xref std std-option">--no-tls</em></a> is specified.</p>
<dl class="describe">
<dt>
<tt class="descname">&lt;PRIVATE_KEY&gt;</tt></dt>
<dd><p>Set path to server's private key. Required unless
<a class="reference internal" href="#cmdoption--no-tls"><em class="xref std std-option">--no-tls</em></a> is specified.</p>
</dd></dl>
<dl class="option">
<dt id="cmdoption-nghttpd-arg-CERT">
<tt class="descname">CERT</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption-nghttpd-arg-CERT" title="Permalink to this definition"></a></dt>
<dd><p>Set path to server&#8217;s certificate. Required
unless <a class="reference internal" href="#cmdoption-nghttpd--no-tls"><em class="xref std std-option">--no-tls</em></a> is specified.</p>
<dl class="describe">
<dt>
<tt class="descname">&lt;CERT&gt;</tt></dt>
<dd><p>Set path to server's certificate. Required unless
<a class="reference internal" href="#cmdoption--no-tls"><em class="xref std std-option">--no-tls</em></a> is specified.</p>
</dd></dl>
</div>
<div class="section" id="options">
<h2>OPTIONS<a class="headerlink" href="#options" title="Permalink to this headline"></a></h2>
<h2>OPTIONS:<a class="headerlink" href="#options" title="Permalink to this headline"></a></h2>
<dl class="option">
<dt id="cmdoption-nghttpd-D">
<span id="cmdoption-nghttpd--daemon"></span><tt class="descname">-D</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--daemon</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption-nghttpd-D" title="Permalink to this definition"></a></dt>
<dd><p>Run in a background. If <a class="reference internal" href="#cmdoption-nghttpd-D"><em class="xref std std-option">-D</em></a> is used, the current
working directory is changed to &#8216;/&#8217;. Therefore
if this option is used, <a class="reference internal" href="#cmdoption-nghttpd-d"><em class="xref std std-option">-d</em></a> option must be
specified.</p>
<dt id="cmdoption-D">
<span id="cmdoption--daemon"></span><tt class="descname">-D</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--daemon</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption-D" title="Permalink to this definition"></a></dt>
<dd><p>Run in a background. If <a class="reference internal" href="nghttpx.1.html#cmdoption-D"><em class="xref std std-option">-D</em></a> is used, the current working
directory is changed to '<em>/</em>'. Therefore if this option
is used, <a class="reference internal" href="#cmdoption-d"><em class="xref std std-option">-d</em></a> option must be specified.</p>
</dd></dl>
<dl class="option">
<dt id="cmdoption-nghttpd-V">
<span id="cmdoption-nghttpd--verify-client"></span><tt class="descname">-V</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--verify-client</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption-nghttpd-V" title="Permalink to this definition"></a></dt>
<dd><p>The server sends a client certificate request.
If the client did not return a certificate, the
handshake is terminated. Currently, this option
just requests a client certificate and does not
verify it.</p>
<dt id="cmdoption-V">
<span id="cmdoption--verify-client"></span><tt class="descname">-V</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--verify-client</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption-V" title="Permalink to this definition"></a></dt>
<dd><p>The server sends a client certificate request. If the
client did not return a certificate, the handshake is
terminated. Currently, this option just requests a
client certificate and does not verify it.</p>
</dd></dl>
<dl class="option">
<dt id="cmdoption-nghttpd-d">
<span id="cmdoption-nghttpd--htdocs"></span><tt class="descname">-d</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--htdocs</tt><tt class="descclassname">=&lt;PATH&gt;</tt><a class="headerlink" href="#cmdoption-nghttpd-d" title="Permalink to this definition"></a></dt>
<dd><p>Specify document root. If this option is not
specified, the document root is the current
working directory.</p>
<dt id="cmdoption-d">
<span id="cmdoption--htdocs"></span><tt class="descname">-d</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--htdocs</tt><tt class="descclassname">=&lt;PATH&gt;</tt><a class="headerlink" href="#cmdoption-d" title="Permalink to this definition"></a></dt>
<dd><p>Specify document root. If this option is not specified,
the document root is the current working directory.</p>
</dd></dl>
<dl class="option">
<dt id="cmdoption-nghttpd-v">
<span id="cmdoption-nghttpd--verbose"></span><tt class="descname">-v</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--verbose</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption-nghttpd-v" title="Permalink to this definition"></a></dt>
<dd><p>Print debug information such as reception/
transmission of frames and name/value pairs.</p>
<dt id="cmdoption-v">
<span id="cmdoption--verbose"></span><tt class="descname">-v</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--verbose</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption-v" title="Permalink to this definition"></a></dt>
<dd><p>Print debug information such as reception/ transmission
of frames and name/value pairs.</p>
</dd></dl>
<dl class="option">
<dt id="cmdoption-nghttpd--no-tls">
<tt class="descname">--no-tls</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption-nghttpd--no-tls" title="Permalink to this definition"></a></dt>
<dt id="cmdoption--no-tls">
<tt class="descname">--no-tls</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption--no-tls" title="Permalink to this definition"></a></dt>
<dd><p>Disable SSL/TLS.</p>
</dd></dl>
<dl class="option">
<dt id="cmdoption-nghttpd-c">
<span id="cmdoption-nghttpd--header-table-size"></span><tt class="descname">-c</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--header-table-size</tt><tt class="descclassname">=&lt;N&gt;</tt><a class="headerlink" href="#cmdoption-nghttpd-c" title="Permalink to this definition"></a></dt>
<dt id="cmdoption-c">
<span id="cmdoption--header-table-size"></span><tt class="descname">-c</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--header-table-size</tt><tt class="descclassname">=&lt;SIZE&gt;</tt><a class="headerlink" href="#cmdoption-c" title="Permalink to this definition"></a></dt>
<dd><p>Specify decoder header table size.</p>
</dd></dl>
<dl class="option">
<dt id="cmdoption-nghttpd--color">
<tt class="descname">--color</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption-nghttpd--color" title="Permalink to this definition"></a></dt>
<dt id="cmdoption--color">
<tt class="descname">--color</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption--color" title="Permalink to this definition"></a></dt>
<dd><p>Force colored log output.</p>
</dd></dl>
<dl class="option">
<dt id="cmdoption-nghttpd-p">
<span id="cmdoption-nghttpd--push"></span><tt class="descname">-p</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--push</tt><tt class="descclassname">=&lt;PATH&gt;=&lt;PUSH_PATH,...&gt;</tt><a class="headerlink" href="#cmdoption-nghttpd-p" title="Permalink to this definition"></a></dt>
<dd><p>Push resources &lt;PUSH_PATH&gt;s when &lt;PATH&gt; is
requested. This option can be used repeatedly to
specify multiple push configurations. &lt;PATH&gt; and
&lt;PUSH_PATH&gt;s are relative to document root. See
<a class="reference internal" href="#cmdoption-nghttpd--htdocs"><em class="xref std std-option">--htdocs</em></a> option. Example: -p/=/foo.png
-p/doc=/bar.css</p>
<dt id="cmdoption-p">
<span id="cmdoption--push"></span><tt class="descname">-p</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--push</tt><tt class="descclassname">=&lt;PATH&gt;=&lt;PUSH_PATH,...&gt;</tt><a class="headerlink" href="#cmdoption-p" title="Permalink to this definition"></a></dt>
<dd><p>Push resources &lt;PUSH_PATH&gt;s when &lt;PATH&gt; is requested.
This option can be used repeatedly to specify multiple
push configurations. &lt;PATH&gt; and &lt;PUSH_PATH&gt;s are
relative to document root. See <a class="reference internal" href="#cmdoption--htdocs"><em class="xref std std-option">--htdocs</em></a> option.
Example: <a class="reference internal" href="nghttpx.1.html#cmdoption-p"><em class="xref std std-option">-p</em></a>/=/foo.png <a class="reference internal" href="nghttpx.1.html#cmdoption-p"><em class="xref std std-option">-p</em></a>/doc=/bar.css</p>
</dd></dl>
<dl class="option">
<dt id="cmdoption-nghttpd-b">
<span id="cmdoption-nghttpd--padding"></span><tt class="descname">-b</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--padding</tt><tt class="descclassname">=&lt;N&gt;</tt><a class="headerlink" href="#cmdoption-nghttpd-b" title="Permalink to this definition"></a></dt>
<dd><p>Add at most &lt;N&gt; bytes to a frame payload as
padding. Specify 0 to disable padding.</p>
<dt id="cmdoption-b">
<span id="cmdoption--padding"></span><tt class="descname">-b</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--padding</tt><tt class="descclassname">=&lt;N&gt;</tt><a class="headerlink" href="#cmdoption-b" title="Permalink to this definition"></a></dt>
<dd><p>Add at most &lt;N&gt; bytes to a frame payload as padding.
Specify 0 to disable padding.</p>
</dd></dl>
<dl class="option">
<dt id="cmdoption-nghttpd-n">
<span id="cmdoption-nghttpd--workers"></span><tt class="descname">-n</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--workers</tt><tt class="descclassname">=&lt;CORE&gt;</tt><a class="headerlink" href="#cmdoption-nghttpd-n" title="Permalink to this definition"></a></dt>
<dd><p>Set the number of worker threads.
Default: 1</p>
<dt id="cmdoption-n">
<span id="cmdoption--workers"></span><tt class="descname">-n</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--workers</tt><tt class="descclassname">=&lt;N&gt;</tt><a class="headerlink" href="#cmdoption-n" title="Permalink to this definition"></a></dt>
<dd><p>Set the number of worker threads.</p>
<p>Default: <tt class="docutils literal"><span class="pre">1</span></tt></p>
</dd></dl>
<dl class="option">
<dt id="cmdoption-nghttpd-e">
<span id="cmdoption-nghttpd--error-gzip"></span><tt class="descname">-e</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--error-gzip</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption-nghttpd-e" title="Permalink to this definition"></a></dt>
<dt id="cmdoption-e">
<span id="cmdoption--error-gzip"></span><tt class="descname">-e</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--error-gzip</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption-e" title="Permalink to this definition"></a></dt>
<dd><p>Make error response gzipped.</p>
</dd></dl>
<dl class="option">
<dt id="cmdoption-nghttpd--dh-param-file">
<tt class="descname">--dh-param-file</tt><tt class="descclassname">=&lt;PATH&gt;</tt><a class="headerlink" href="#cmdoption-nghttpd--dh-param-file" title="Permalink to this definition"></a></dt>
<dd><p>Path to file that contains DH parameters in PEM
format. Without this option, DHE cipher suites
are not available.</p>
<dt id="cmdoption--dh-param-file">
<tt class="descname">--dh-param-file</tt><tt class="descclassname">=&lt;PATH&gt;</tt><a class="headerlink" href="#cmdoption--dh-param-file" title="Permalink to this definition"></a></dt>
<dd><p>Path to file that contains DH parameters in PEM format.
Without this option, DHE cipher suites are not
available.</p>
</dd></dl>
<dl class="option">
<dt id="cmdoption-nghttpd--early-response">
<tt class="descname">--early-response</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption-nghttpd--early-response" title="Permalink to this definition"></a></dt>
<dd><p>Start sending response when request HEADERS is
received, rather than complete request is
received.</p>
<dt id="cmdoption--early-response">
<tt class="descname">--early-response</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption--early-response" title="Permalink to this definition"></a></dt>
<dd><p>Start sending response when request HEADERS is received,
rather than complete request is received.</p>
</dd></dl>
<dl class="option">
<dt id="cmdoption-nghttpd--version">
<tt class="descname">--version</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption-nghttpd--version" title="Permalink to this definition"></a></dt>
<dt id="cmdoption--version">
<tt class="descname">--version</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption--version" title="Permalink to this definition"></a></dt>
<dd><p>Display version information and exit.</p>
</dd></dl>
<dl class="option">
<dt id="cmdoption-nghttpd-h">
<span id="cmdoption-nghttpd--help"></span><tt class="descname">-h</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--help</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption-nghttpd-h" title="Permalink to this definition"></a></dt>
<dt id="cmdoption-h">
<span id="cmdoption--help"></span><tt class="descname">-h</tt><tt class="descclassname"></tt><tt class="descclassname">, </tt><tt class="descname">--help</tt><tt class="descclassname"></tt><a class="headerlink" href="#cmdoption-h" title="Permalink to this definition"></a></dt>
<dd><p>Display this help and exit.</p>
</dd></dl>
<p>The &lt;SIZE&gt; argument is an integer and an optional unit (e.g., 10K is
10 * 1024). Units are K, M and G (powers of 1024).</p>
</div>
<div class="section" id="see-also">
<h2>SEE ALSO<a class="headerlink" href="#see-also" title="Permalink to this headline"></a></h2>
<p>nghttp(1), nghttpx(1), h2load(1)</p>
<p><em class="manpage">nghttp(1)</em>, <em class="manpage">nghttpx(1)</em>, <em class="manpage">h2load(1)</em></p>
</div>
</div>
@ -371,11 +372,12 @@ received.</p>
<div role="contentinfo">
<p>
&copy; Copyright 2012, 2014, Tatsuhiro Tsujikawa.
&copy; Copyright 2012, 2015, Tatsuhiro Tsujikawa.
</p>
</div>
<a href="https://github.com/snide/sphinx_rtd_theme">Sphinx theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
@ -391,7 +393,7 @@ received.</p>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'0.6.3-DEV',
VERSION:'0.7.2-DEV',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: false

View File

@ -7,14 +7,14 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>nghttpx - HTTP/2 proxy - HOW-TO &mdash; nghttp2 0.6.3-DEV documentation</title>
<title>nghttpx - HTTP/2 proxy - HOW-TO &mdash; nghttp2 0.7.2-DEV documentation</title>
<link href='https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700&subset=latin,cyrillic' rel='stylesheet' type='text/css'>
@ -28,7 +28,7 @@
<link rel="top" title="nghttp2 0.6.3-DEV documentation" href="index.html"/>
<link rel="top" title="nghttp2 0.7.2-DEV documentation" href="index.html"/>
<link rel="next" title="h2load - HTTP/2 benchmarking tool - HOW-TO" href="h2load-howto.html"/>
<link rel="prev" title="h2load(1)" href="h2load.1.html"/>
@ -47,6 +47,7 @@
<a href="index.html" class="fa fa-home"> nghttp2</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
@ -59,6 +60,7 @@
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="package_README.html">nghttp2 - HTTP/2 C Library</a><ul>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#development-status">Development Status</a></li>
@ -66,6 +68,8 @@
<li class="toctree-l2"><a class="reference internal" href="package_README.html#requirements">Requirements</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#build-from-git">Build from git</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#building-documentation">Building documentation</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#unit-tests">Unit tests</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#integration-tests">Integration tests</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#client-server-and-proxy-programs">Client, Server and Proxy programs</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#benchmarking-tool">Benchmarking tool</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#hpack-tools">HPACK tools</a></li>
@ -74,6 +78,10 @@
<li class="toctree-l2"><a class="reference internal" href="package_README.html#contribution">Contribution</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="contribute.html">Contribution Guidelines</a><ul>
<li class="toctree-l2"><a class="reference internal" href="contribute.html#coding-style">Coding style</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="building-android-binary.html">Building Android binary</a></li>
<li class="toctree-l1"><a class="reference internal" href="tutorial-client.html">Tutorial: HTTP/2 client</a><ul>
<li class="toctree-l2"><a class="reference internal" href="tutorial-client.html#libevent-client-c">libevent-client.c</a></li>
@ -90,34 +98,32 @@
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttp.1.html">nghttp(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttpd.1.html">nghttpd(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttpx.1.html">nghttpx(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#files">FILES</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#signals">SIGNALS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="h2load.1.html">h2load(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
@ -131,8 +137,9 @@
<li class="toctree-l2"><a class="reference internal" href="#specifying-additional-ca-certificate">Specifying additional CA certificate</a></li>
<li class="toctree-l2"><a class="reference internal" href="#read-write-rate-limit">Read/write rate limit</a></li>
<li class="toctree-l2"><a class="reference internal" href="#rewriting-location-header-field">Rewriting location header field</a></li>
<li class="toctree-l2"><a class="reference internal" href="#hot-deploy">Hot deploy</a></li>
<li class="toctree-l2"><a class="reference internal" href="#hot-swapping">Hot swapping</a></li>
<li class="toctree-l2"><a class="reference internal" href="#re-opening-log-files">Re-opening log files</a></li>
<li class="toctree-l2"><a class="reference internal" href="#multiple-http-1-backend-addresses">Multiple HTTP/1 backend addresses</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="h2load-howto.html">h2load - HTTP/2 benchmarking tool - HOW-TO</a><ul>
@ -166,9 +173,11 @@
<li class="toctree-l1"><a class="reference internal" href="asio_http2.h.html">asio_http2.h</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/tatsuhiro-t/nghttp2">Source</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/tatsuhiro-t/nghttp2/issues">Issues</a></li>
<li class="toctree-l1"><a class="reference external" href="https://nghttp2.org/">nghttp2.org</a></li>
</ul>
</div>
&nbsp;
</nav>
@ -214,8 +223,8 @@ as reverse proxy (gateway) for HTTP/2 clients to HTTP/1 web server.
HTTP/1 requests are also supported in frontend as a fallback. If
nghttpx is linked with spdylay library and frontend connection is
SSL/TLS, the frontend also supports SPDY protocol.</p>
<p>By default, this mode&#8217;s frontend connection is encrypted using
SSL/TLS. So server&#8217;s private key and certificate must be supplied to
<p>By default, this mode's frontend connection is encrypted using
SSL/TLS. So server's private key and certificate must be supplied to
the command line (or through configuration file). In this case, the
fontend protocol selection will is done via ALPN or NPN.</p>
<p>With <tt class="docutils literal"><span class="pre">--frontend-no-tls</span></tt> option, user can turn off SSL/TLS in
@ -245,16 +254,16 @@ the same in <a class="reference internal" href="#default-mode">default mode</a>.
like forward proxy and assumes the backend is HTTP/1 proxy server
(e.g., squid, traffic server). So HTTP/1 request must include
absolute URI in request line.</p>
<p>By default, frontend connection is encrypted, this mode is also called
secure proxy. If nghttpx is linked with spdylay, it supports SPDY
protocols and it works as so called SPDY proxy.</p>
<p>By default, frontend connection is encrypted. So this mode is also
called secure proxy. If nghttpx is linked with spdylay, it supports
SPDY protocols and it works as so called SPDY proxy.</p>
<p>With <tt class="docutils literal"><span class="pre">--frontend-no-tls</span></tt> option, SSL/TLS is turned off in frontend
connection, so the connection gets insecure.</p>
<p>The backend must be HTTP/1 proxy server. nghttpx only supports 1
backend server address. It translates incoming requests to HTTP/1
request to backend server. The backend server performs real proxy
work for each request, for example, dispatching requests to the origin
server and caching contents.</p>
<p>The backend must be HTTP/1 proxy server. nghttpx only supports
multiple backend server addresses. It translates incoming requests to
HTTP/1 request to backend server. The backend server performs real
proxy work for each request, for example, dispatching requests to the
origin server and caching contents.</p>
<p>For example, to make nghttpx listen to encrypted HTTP/2 requests at
port 8443, and a backend HTTP/1 proxy server is configured to listen
to HTTP/1 request at port 8080 in the same host, run nghttpx
@ -274,21 +283,21 @@ proxy, user has to create proxy.pac script file like this:</p>
</div>
<p><tt class="docutils literal"><span class="pre">SERVERADDR</span></tt> and <tt class="docutils literal"><span class="pre">PORT</span></tt> is the hostname/address and port of the
machine nghttpx is running. Please note that both Firefox nightly and
Chromium requires valid certificate for secure proxy.</p>
Chromium require valid certificate for secure proxy.</p>
<p>For Firefox nightly, open Preference window and select Advanced then
click Network tab. Clicking Connection Settings button will show the
dialog. Select &#8220;Automatic proxy configuration URL&#8221; and enter the path
dialog. Select &quot;Automatic proxy configuration URL&quot; and enter the path
to proxy.pac file, something like this:</p>
<div class="highlight-c"><div class="highlight"><pre><span class="nl">file:</span><span class="c1">///path/to/proxy.pac</span>
<div class="highlight-c"><div class="highlight"><pre><span class="nl">file</span><span class="p">:</span><span class="c1">///path/to/proxy.pac</span>
</pre></div>
</div>
<p>For Chromium, use following command-line:</p>
<div class="highlight-c"><div class="highlight"><pre>$ google-chrome --proxy-pac-url=file:///path/to/proxy.pac --use-npn
</pre></div>
</div>
<p>Squid may work as out-of-box. Traffic server requires to be
configured as forward proxy. Here is the minimum configuration items
to edit:</p>
<p>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:</p>
<div class="highlight-c"><div class="highlight"><pre><span class="n">CONFIG</span> <span class="n">proxy</span><span class="p">.</span><span class="n">config</span><span class="p">.</span><span class="n">reverse_proxy</span><span class="p">.</span><span class="n">enabled</span> <span class="n">INT</span> <span class="mi">0</span>
<span class="n">CONFIG</span> <span class="n">proxy</span><span class="p">.</span><span class="n">config</span><span class="p">.</span><span class="n">url_remap</span><span class="p">.</span><span class="n">remap_required</span> <span class="n">INT</span> <span class="mi">0</span>
</pre></div>
@ -351,7 +360,7 @@ that server, invoke nghttpx like this:</p>
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">You may need <tt class="docutils literal"><span class="pre">-k</span></tt> option if HTTP/2 server&#8217;s certificate is
<p class="last">You may need <tt class="docutils literal"><span class="pre">-k</span></tt> option if HTTP/2 server's certificate is
self-signed. But please note that it is insecure.</p>
</div>
<p>Then you can use curl to issue HTTP request via HTTP/2 proxy:</p>
@ -395,7 +404,7 @@ depending on the system you use, this may fail or is not supported.
To specify CA certificate manually, use <tt class="docutils literal"><span class="pre">--cacert</span></tt> option. The
specified file must be PEM format and can contain multiple
certificates.</p>
<p>By default, nghttpx validates server&#8217;s certificate. If you want to
<p>By default, nghttpx validates server's certificate. If you want to
turn off this validation, knowing this is really insecure and what you
are doing, you can use <tt class="docutils literal"><span class="pre">-k</span></tt> option to disable certificate
validation.</p>
@ -403,11 +412,11 @@ validation.</p>
<div class="section" id="read-write-rate-limit">
<h2>Read/write rate limit<a class="headerlink" href="#read-write-rate-limit" title="Permalink to this headline"></a></h2>
<p>nghttpx supports transfer rate limiting on frontend connections. You
can do rate limit per worker (thread) for reading and writeing
can do rate limit per frontend connection for reading and writeing
individually.</p>
<p>To rate limit per worker (thread), use <tt class="docutils literal"><span class="pre">--worker-read-rate</span></tt> and
<tt class="docutils literal"><span class="pre">--worker-read-burst</span></tt> options. For writing, use
<tt class="docutils literal"><span class="pre">--worker-write-rate</span></tt> and <tt class="docutils literal"><span class="pre">--worker-write-burst</span></tt>.</p>
<p>To perform rate limit for reading, use <tt class="docutils literal"><span class="pre">--read-rate</span></tt> and
<tt class="docutils literal"><span class="pre">--read-burst</span></tt> options. For writing, use <tt class="docutils literal"><span class="pre">--write-rate</span></tt> and
<tt class="docutils literal"><span class="pre">--write-burst</span></tt>.</p>
<p>Please note that rate limit is performed on top of TCP and nothing to
do with HTTP/2 flow control.</p>
</div>
@ -428,9 +437,9 @@ 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.</p>
</div>
<div class="section" id="hot-deploy">
<h2>Hot deploy<a class="headerlink" href="#hot-deploy" title="Permalink to this headline"></a></h2>
<p>nghttpx supports hot deploy feature using signals. The hot deploy in
<div class="section" id="hot-swapping">
<h2>Hot swapping<a class="headerlink" href="#hot-swapping" title="Permalink to this headline"></a></h2>
<p>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. At this point, both
@ -448,6 +457,14 @@ re-open log files, send USR1 signal to nghttpx process. It will
re-open files specified by <tt class="docutils literal"><span class="pre">--accesslog-file</span></tt> and
<tt class="docutils literal"><span class="pre">--errorlog-file</span></tt> options.</p>
</div>
<div class="section" id="multiple-http-1-backend-addresses">
<h2>Multiple HTTP/1 backend addresses<a class="headerlink" href="#multiple-http-1-backend-addresses" title="Permalink to this headline"></a></h2>
<p>nghttpx supports multiple HTTP/1 backend addresses. To specify them,
just use <tt class="docutils literal"><span class="pre">-b</span></tt> option repeatedly. For example, to use backend1:8080
and backend2:8080, use command-line like this: <tt class="docutils literal"><span class="pre">-bbackend1,8080</span>
<span class="pre">-bbackend2,8080</span></tt>. Please note that HTTP/2 backend only supports 1
backend address.</p>
</div>
</div>
@ -468,11 +485,12 @@ re-open files specified by <tt class="docutils literal"><span class="pre">--acce
<div role="contentinfo">
<p>
&copy; Copyright 2012, 2014, Tatsuhiro Tsujikawa.
&copy; Copyright 2012, 2015, Tatsuhiro Tsujikawa.
</p>
</div>
<a href="https://github.com/snide/sphinx_rtd_theme">Sphinx theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
@ -488,7 +506,7 @@ re-open files specified by <tt class="docutils literal"><span class="pre">--acce
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'0.6.3-DEV',
VERSION:'0.7.2-DEV',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: false

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -7,14 +7,14 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>nghttp2 - HTTP/2 C Library &mdash; nghttp2 0.6.3-DEV documentation</title>
<title>nghttp2 - HTTP/2 C Library &mdash; nghttp2 0.7.2-DEV documentation</title>
<link href='https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700&subset=latin,cyrillic' rel='stylesheet' type='text/css'>
@ -28,8 +28,8 @@
<link rel="top" title="nghttp2 0.6.3-DEV documentation" href="index.html"/>
<link rel="next" title="Building Android binary" href="building-android-binary.html"/>
<link rel="top" title="nghttp2 0.7.2-DEV documentation" href="index.html"/>
<link rel="next" title="Contribution Guidelines" href="contribute.html"/>
<link rel="prev" title="nghttp2 - HTTP/2 C Library" href="index.html"/>
@ -47,6 +47,7 @@
<a href="index.html" class="fa fa-home"> nghttp2</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
@ -59,6 +60,7 @@
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul class="current">
<li class="toctree-l1 current"><a class="current reference internal" href="">nghttp2 - HTTP/2 C Library</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#development-status">Development Status</a></li>
@ -66,6 +68,8 @@
<li class="toctree-l2"><a class="reference internal" href="#requirements">Requirements</a></li>
<li class="toctree-l2"><a class="reference internal" href="#build-from-git">Build from git</a></li>
<li class="toctree-l2"><a class="reference internal" href="#building-documentation">Building documentation</a></li>
<li class="toctree-l2"><a class="reference internal" href="#unit-tests">Unit tests</a></li>
<li class="toctree-l2"><a class="reference internal" href="#integration-tests">Integration tests</a></li>
<li class="toctree-l2"><a class="reference internal" href="#client-server-and-proxy-programs">Client, Server and Proxy programs</a></li>
<li class="toctree-l2"><a class="reference internal" href="#benchmarking-tool">Benchmarking tool</a></li>
<li class="toctree-l2"><a class="reference internal" href="#hpack-tools">HPACK tools</a></li>
@ -74,6 +78,10 @@
<li class="toctree-l2"><a class="reference internal" href="#contribution">Contribution</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="contribute.html">Contribution Guidelines</a><ul>
<li class="toctree-l2"><a class="reference internal" href="contribute.html#coding-style">Coding style</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="building-android-binary.html">Building Android binary</a></li>
<li class="toctree-l1"><a class="reference internal" href="tutorial-client.html">Tutorial: HTTP/2 client</a><ul>
<li class="toctree-l2"><a class="reference internal" href="tutorial-client.html#libevent-client-c">libevent-client.c</a></li>
@ -90,34 +98,32 @@
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttp.1.html">nghttp(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttpd.1.html">nghttpd(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttpx.1.html">nghttpx(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#files">FILES</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#signals">SIGNALS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="h2load.1.html">h2load(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
@ -131,8 +137,9 @@
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#specifying-additional-ca-certificate">Specifying additional CA certificate</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#read-write-rate-limit">Read/write rate limit</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#rewriting-location-header-field">Rewriting location header field</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#hot-deploy">Hot deploy</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#hot-swapping">Hot swapping</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#re-opening-log-files">Re-opening log files</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#multiple-http-1-backend-addresses">Multiple HTTP/1 backend addresses</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="h2load-howto.html">h2load - HTTP/2 benchmarking tool - HOW-TO</a><ul>
@ -166,9 +173,11 @@
<li class="toctree-l1"><a class="reference internal" href="asio_http2.h.html">asio_http2.h</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/tatsuhiro-t/nghttp2">Source</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/tatsuhiro-t/nghttp2/issues">Issues</a></li>
<li class="toctree-l1"><a class="reference external" href="https://nghttp2.org/">nghttp2.org</a></li>
</ul>
</div>
&nbsp;
</nav>
@ -202,11 +211,11 @@
<h1>nghttp2 - HTTP/2 C Library<a class="headerlink" href="#nghttp2-http-2-c-library" title="Permalink to this headline"></a></h1>
<p>This is an implementation of Hypertext Transfer Protocol version 2
in C.</p>
<p>The framing layer of HTTP/2 is implemented as form of reusable C
<p>The framing layer of HTTP/2 is implemented as a form of reusable C
library. On top of that, we have implemented HTTP/2 client, server
and proxy. Also we have developed load test/benchmarking tool for
and proxy. We have also developed load test and benchmarking tool for
HTTP/2 and SPDY.</p>
<p>HPACK encoding and decoding are available as public API.</p>
<p>HPACK encoder and decoder are available as public API.</p>
<p>The experimental high level C++ library is also available.</p>
<p>We have Python binding of this libary, but we have not covered
everything yet.</p>
@ -215,9 +224,7 @@ everything yet.</p>
<p>We started to implement h2-14
(<a class="reference external" href="http://tools.ietf.org/html/draft-ietf-httpbis-http2-14">http://tools.ietf.org/html/draft-ietf-httpbis-http2-14</a>), the header
compression
(<a class="reference external" href="http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-09">http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-09</a>)
and HTTP Alternative Services
(<a class="reference external" href="http://tools.ietf.org/html/draft-ietf-httpbis-alt-svc-02">http://tools.ietf.org/html/draft-ietf-httpbis-alt-svc-02</a>).</p>
(<a class="reference external" href="http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-09">http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-09</a>).</p>
<p>The nghttp2 code base was forked from spdylay project.</p>
<table border="1" class="docutils">
<colgroup>
@ -239,9 +246,6 @@ and HTTP Alternative Services
<tr class="row-even"><td>Large header (CONTINUATION)</td>
<td>Yes</td>
</tr>
<tr class="row-odd"><td>ALTSVC extension</td>
<td>Yes</td>
</tr>
</tbody>
</table>
</div>
@ -252,13 +256,10 @@ implementation.</p>
<ul>
<li><p class="first"><a class="reference external" href="https://nghttp2.org/">https://nghttp2.org/</a> (TLS + ALPN/NPN)</p>
<p>NPN offer <tt class="docutils literal"><span class="pre">h2-14</span></tt>, <tt class="docutils literal"><span class="pre">spdy/3.1</span></tt> and <tt class="docutils literal"><span class="pre">http/1.1</span></tt>.</p>
<p>This endpoint requires TLSv1.2 and DHE or EDCHE with GCM cipher
suite for HTTP/2 connection.</p>
<p>This endpoint requires TLSv1.2 for HTTP/2 connection.</p>
</li>
<li><p class="first"><a class="reference external" href="http://nghttp2.org/">http://nghttp2.org/</a> (Upgrade / Direct)</p>
<p><tt class="docutils literal"><span class="pre">h2c-14</span></tt> and <tt class="docutils literal"><span class="pre">http/1.1</span></tt>. We configured this server to send
ALTSVC frame or Alt-Svc header field to announce that alternative
service is available at port 443.</p>
<p><tt class="docutils literal"><span class="pre">h2c-14</span></tt> and <tt class="docutils literal"><span class="pre">http/1.1</span></tt>.</p>
</li>
</ul>
</div>
@ -282,7 +283,7 @@ required:</p>
required:</p>
<ul class="simple">
<li>OpenSSL &gt;= 1.0.1</li>
<li>libevent-openssl &gt;= 2.0.8</li>
<li>libev &gt;= 4.15</li>
<li>zlib &gt;= 1.2.3</li>
</ul>
<p>ALPN support requires unreleased version OpenSSL &gt;= 1.0.2.</p>
@ -300,6 +301,10 @@ resource) in <tt class="docutils literal"><span class="pre">nghttp</span></tt>,
<ul class="simple">
<li>jansson &gt;= 2.5</li>
</ul>
<p>To build sources under examples directory, libevent is required:</p>
<ul class="simple">
<li>libevent-openssl &gt;= 2.0.8</li>
</ul>
<p>To mitigate heap fragmentation in long running server programs
(<tt class="docutils literal"><span class="pre">nghttpd</span></tt> and <tt class="docutils literal"><span class="pre">nghttpx</span></tt>), jemalloc is recommended:</p>
<ul class="simple">
@ -318,6 +323,8 @@ resource) in <tt class="docutils literal"><span class="pre">nghttp</span></tt>,
<p>If you are using Ubuntu 14.04 LTS, you need the following packages
installed:</p>
<ul class="simple">
<li>make</li>
<li>binutils</li>
<li>autoconf</li>
<li>automake</li>
<li>autotools-dev</li>
@ -327,6 +334,7 @@ installed:</p>
<li>libcunit1-dev</li>
<li>libssl-dev</li>
<li>libxml2-dev</li>
<li>libev-dev</li>
<li>libevent-dev</li>
<li>libjansson-dev</li>
<li>libjemalloc-dev</li>
@ -371,6 +379,32 @@ on Mac OS X platform.</p>
<p>The online documentation is available at
<a class="reference external" href="https://nghttp2.org/documentation/">https://nghttp2.org/documentation/</a></p>
</div>
<div class="section" id="unit-tests">
<h2>Unit tests<a class="headerlink" href="#unit-tests" title="Permalink to this headline"></a></h2>
<p>Unit tests are done by simply running <tt class="xref c c-func docutils literal"><span class="pre">make</span> <span class="pre">check()</span></tt>.</p>
</div>
<div class="section" id="integration-tests">
<h2>Integration tests<a class="headerlink" href="#integration-tests" title="Permalink to this headline"></a></h2>
<p>We have the integration tests for nghttpx proxy server. The tests are
written in <a class="reference external" href="http://golang.org/">Go programming language</a> and uses
its testing framework. We depend on the following libraries:</p>
<ul class="simple">
<li><a class="reference external" href="https://github.com/bradfitz/http2">https://github.com/bradfitz/http2</a></li>
<li><a class="reference external" href="https://github.com/tatsuhiro-t/go-nghttp2">https://github.com/tatsuhiro-t/go-nghttp2</a></li>
<li><a class="reference external" href="https://golang.org/x/net/spdy">https://golang.org/x/net/spdy</a></li>
</ul>
<p>To download the above packages, after settings <tt class="docutils literal"><span class="pre">GOPATH</span></tt>, run the
following command under <tt class="docutils literal"><span class="pre">integration-tests</span></tt> directory:</p>
<div class="highlight-c"><div class="highlight"><pre>$ make itprep
</pre></div>
</div>
<p>To run the tests, run the following command under
<tt class="docutils literal"><span class="pre">integration-tests</span></tt> directory:</p>
<div class="highlight-c"><div class="highlight"><pre>$ make it
</pre></div>
</div>
<p>Inside the tests, we use port 3009 to run test subject server.</p>
</div>
<div class="section" id="client-server-and-proxy-programs">
<h2>Client, Server and Proxy programs<a class="headerlink" href="#client-server-and-proxy-programs" title="Permalink to this headline"></a></h2>
<p>The src directory contains HTTP/2 client, server and proxy programs.</p>
@ -476,8 +510,6 @@ Upgrade: h2c-14
(niv=2)
[SETTINGS_MAX_CONCURRENT_STREAMS(3):100]
[SETTINGS_INITIAL_WINDOW_SIZE(4):65535]
[ 0.024] recv ALTSVC frame &lt;length=43, flags=0x00, stream_id=0&gt;
(max-age=86400, port=443, protocol_id=h2-14, host=nghttp2.org, origin=http://nghttp2.org)
[ 0.024] send SETTINGS frame &lt;length=0, flags=0x01, stream_id=0&gt;
; ACK
(niv=0)
@ -653,7 +685,7 @@ SPDY proxy):</p>
<span class="p">[</span><span class="n">secure</span> <span class="n">proxy</span><span class="p">]</span> <span class="p">(</span><span class="n">e</span><span class="p">.</span><span class="n">g</span><span class="p">.,</span> <span class="n">Squid</span><span class="p">,</span> <span class="n">ATS</span><span class="p">)</span>
</pre></div>
</div>
<p>The <tt class="docutils literal"><span class="pre">Client</span></tt> in the above is needs to be configured to use
<p>The <tt class="docutils literal"><span class="pre">Client</span></tt> in the above needs to be configured to use
<tt class="docutils literal"><span class="pre">nghttpx</span></tt> as secure proxy.</p>
<p>At the time of this writing, Chrome is the only browser which supports
secure proxy. The one way to configure Chrome to use secure proxy is
@ -740,7 +772,7 @@ With <tt class="docutils literal"><span class="pre">-t</span></tt> option, <tt c
avoid saturating single core on client side.</p>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p class="last"><strong>Don&#8217;t use this tool against publicly available servers.</strong> That is
<p class="last"><strong>Don't use this tool against publicly available servers.</strong> That is
considered a DOS attack. Please only use against your private
servers.</p>
</div>
@ -786,12 +818,12 @@ which includes exactly one name/value pair.</p>
<p>With <tt class="docutils literal"><span class="pre">-t</span></tt> option, the program can accept more familiar HTTP/1 style
header field block. Each header set is delimited by empty line:</p>
<p>Example:</p>
<div class="highlight-c"><div class="highlight"><pre><span class="o">:</span><span class="n">method</span><span class="o">:</span> <span class="n">GET</span>
<span class="o">:</span><span class="n">scheme</span><span class="o">:</span> <span class="n">https</span>
<span class="o">:</span><span class="n">path</span><span class="o">:</span> <span class="o">/</span>
<div class="highlight-c"><div class="highlight"><pre><span class="o">:</span><span class="nl">method</span><span class="p">:</span> <span class="nl">GET</span>
<span class="p">:</span><span class="nl">scheme</span><span class="p">:</span> <span class="nl">https</span>
<span class="p">:</span><span class="nl">path</span><span class="p">:</span> <span class="o">/</span>
<span class="o">:</span><span class="n">method</span><span class="o">:</span> <span class="n">POST</span>
<span class="n">user</span><span class="o">-</span><span class="n">agent</span><span class="o">:</span> <span class="n">nghttp2</span>
<span class="o">:</span><span class="nl">method</span><span class="p">:</span> <span class="n">POST</span>
<span class="n">user</span><span class="o">-</span><span class="nl">agent</span><span class="p">:</span> <span class="n">nghttp2</span>
</pre></div>
</div>
<p>The output is JSON object. It should include <tt class="docutils literal"><span class="pre">cases</span></tt> key and its
@ -1168,14 +1200,11 @@ HTTP/2 server looks like this:</p>
<span class="k">using</span> <span class="k">namespace</span> <span class="n">nghttp2</span><span class="o">::</span><span class="n">asio_http2</span><span class="p">;</span>
<span class="k">using</span> <span class="k">namespace</span> <span class="n">nghttp2</span><span class="o">::</span><span class="n">asio_http2</span><span class="o">::</span><span class="n">server</span><span class="p">;</span>
<span class="kt">int</span> <span class="nf">main</span><span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="kt">char</span><span class="o">*</span> <span class="n">argv</span><span class="p">[])</span>
<span class="p">{</span>
<span class="kt">int</span> <span class="nf">main</span><span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="kt">char</span> <span class="o">*</span><span class="n">argv</span><span class="p">[])</span> <span class="p">{</span>
<span class="n">http2</span> <span class="n">server</span><span class="p">;</span>
<span class="n">server</span><span class="p">.</span><span class="n">listen</span>
<span class="p">(</span><span class="s">&quot;*&quot;</span><span class="p">,</span> <span class="mi">3000</span><span class="p">,</span>
<span class="p">[](</span><span class="n">std</span><span class="o">::</span><span class="n">shared_ptr</span><span class="o">&lt;</span><span class="n">request</span><span class="o">&gt;</span> <span class="n">req</span><span class="p">,</span> <span class="n">std</span><span class="o">::</span><span class="n">shared_ptr</span><span class="o">&lt;</span><span class="n">response</span><span class="o">&gt;</span> <span class="n">res</span><span class="p">)</span>
<span class="p">{</span>
<span class="n">server</span><span class="p">.</span><span class="n">listen</span><span class="p">(</span><span class="s">&quot;*&quot;</span><span class="p">,</span> <span class="mi">3000</span><span class="p">,</span> <span class="p">[](</span><span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">shared_ptr</span><span class="o">&lt;</span><span class="n">request</span><span class="o">&gt;</span> <span class="o">&amp;</span><span class="n">req</span><span class="p">,</span>
<span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">shared_ptr</span><span class="o">&lt;</span><span class="n">response</span><span class="o">&gt;</span> <span class="o">&amp;</span><span class="n">res</span><span class="p">)</span> <span class="p">{</span>
<span class="n">res</span><span class="o">-&gt;</span><span class="n">write_head</span><span class="p">(</span><span class="mi">200</span><span class="p">);</span>
<span class="n">res</span><span class="o">-&gt;</span><span class="n">end</span><span class="p">(</span><span class="s">&quot;hello, world&quot;</span><span class="p">);</span>
<span class="p">});</span>
@ -1232,7 +1261,7 @@ used before <tt class="docutils literal"><span class="pre">send_response()</span
<dl class="docutils">
<dt>client_address</dt>
<dd>Contains a tuple of the form (host, port) referring to the
client&#8217;s address.</dd>
client's address.</dd>
<dt>stream_id</dt>
<dd>Stream ID of this stream.</dd>
<dt>scheme</dt>
@ -1297,6 +1326,8 @@ to hand over that patch/code to us. We will credit you for your
changes as far as possible, to give credit but also to keep a trace
back to who made what changes. Please always provide us with your
full real name when contributing!</p>
<p>See <a class="reference external" href="https://nghttp2.org/documentation/contribute.html">Contribution Guidelines</a> for more
details.</p>
</div>
</div>
@ -1306,7 +1337,7 @@ full real name when contributing!</p>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="building-android-binary.html" class="btn btn-neutral float-right" title="Building Android binary">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="contribute.html" class="btn btn-neutral float-right" title="Contribution Guidelines">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="index.html" class="btn btn-neutral" title="nghttp2 - HTTP/2 C Library"><span class="fa fa-arrow-circle-left"></span> Previous</a>
@ -1318,11 +1349,12 @@ full real name when contributing!</p>
<div role="contentinfo">
<p>
&copy; Copyright 2012, 2014, Tatsuhiro Tsujikawa.
&copy; Copyright 2012, 2015, Tatsuhiro Tsujikawa.
</p>
</div>
<a href="https://github.com/snide/sphinx_rtd_theme">Sphinx theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
@ -1338,7 +1370,7 @@ full real name when contributing!</p>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'0.6.3-DEV',
VERSION:'0.7.2-DEV',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: false

View File

@ -7,14 +7,14 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Python Module Index &mdash; nghttp2 0.6.3-DEV documentation</title>
<title>Python Module Index &mdash; nghttp2 0.7.2-DEV documentation</title>
<link href='https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700&subset=latin,cyrillic' rel='stylesheet' type='text/css'>
@ -28,7 +28,7 @@
<link rel="top" title="nghttp2 0.6.3-DEV documentation" href="index.html"/>
<link rel="top" title="nghttp2 0.7.2-DEV documentation" href="index.html"/>
<script type="text/javascript">
@ -52,6 +52,7 @@
<a href="index.html" class="fa fa-home"> nghttp2</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
@ -64,6 +65,7 @@
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul>
<li class="toctree-l1"><a class="reference internal" href="package_README.html">nghttp2 - HTTP/2 C Library</a><ul>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#development-status">Development Status</a></li>
@ -71,6 +73,8 @@
<li class="toctree-l2"><a class="reference internal" href="package_README.html#requirements">Requirements</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#build-from-git">Build from git</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#building-documentation">Building documentation</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#unit-tests">Unit tests</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#integration-tests">Integration tests</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#client-server-and-proxy-programs">Client, Server and Proxy programs</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#benchmarking-tool">Benchmarking tool</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#hpack-tools">HPACK tools</a></li>
@ -79,6 +83,10 @@
<li class="toctree-l2"><a class="reference internal" href="package_README.html#contribution">Contribution</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="contribute.html">Contribution Guidelines</a><ul>
<li class="toctree-l2"><a class="reference internal" href="contribute.html#coding-style">Coding style</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="building-android-binary.html">Building Android binary</a></li>
<li class="toctree-l1"><a class="reference internal" href="tutorial-client.html">Tutorial: HTTP/2 client</a><ul>
<li class="toctree-l2"><a class="reference internal" href="tutorial-client.html#libevent-client-c">libevent-client.c</a></li>
@ -95,34 +103,32 @@
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttp.1.html">nghttp(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttpd.1.html">nghttpd(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttpx.1.html">nghttpx(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#files">FILES</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#signals">SIGNALS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="h2load.1.html">h2load(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
@ -136,8 +142,9 @@
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#specifying-additional-ca-certificate">Specifying additional CA certificate</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#read-write-rate-limit">Read/write rate limit</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#rewriting-location-header-field">Rewriting location header field</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#hot-deploy">Hot deploy</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#hot-swapping">Hot swapping</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#re-opening-log-files">Re-opening log files</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#multiple-http-1-backend-addresses">Multiple HTTP/1 backend addresses</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="h2load-howto.html">h2load - HTTP/2 benchmarking tool - HOW-TO</a><ul>
@ -171,9 +178,11 @@
<li class="toctree-l1"><a class="reference internal" href="asio_http2.h.html">asio_http2.h</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/tatsuhiro-t/nghttp2">Source</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/tatsuhiro-t/nghttp2/issues">Issues</a></li>
<li class="toctree-l1"><a class="reference external" href="https://nghttp2.org/">nghttp2.org</a></li>
</ul>
</div>
&nbsp;
</nav>
@ -230,11 +239,12 @@
<div role="contentinfo">
<p>
&copy; Copyright 2012, 2014, Tatsuhiro Tsujikawa.
&copy; Copyright 2012, 2015, Tatsuhiro Tsujikawa.
</p>
</div>
<a href="https://github.com/snide/sphinx_rtd_theme">Sphinx theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
@ -250,7 +260,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'0.6.3-DEV',
VERSION:'0.7.2-DEV',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: false

View File

@ -7,14 +7,14 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Python API Reference &mdash; nghttp2 0.6.3-DEV documentation</title>
<title>Python API Reference &mdash; nghttp2 0.7.2-DEV documentation</title>
<link href='https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700&subset=latin,cyrillic' rel='stylesheet' type='text/css'>
@ -28,7 +28,7 @@
<link rel="top" title="nghttp2 0.6.3-DEV documentation" href="index.html"/>
<link rel="top" title="nghttp2 0.7.2-DEV documentation" href="index.html"/>
<link rel="next" title="nghttp2.h" href="nghttp2.h.html"/>
<link rel="prev" title="libnghttp2_asio: High level HTTP/2 C++ library" href="libnghttp2_asio.html"/>
@ -47,6 +47,7 @@
<a href="index.html" class="fa fa-home"> nghttp2</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
@ -59,6 +60,7 @@
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="package_README.html">nghttp2 - HTTP/2 C Library</a><ul>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#development-status">Development Status</a></li>
@ -66,6 +68,8 @@
<li class="toctree-l2"><a class="reference internal" href="package_README.html#requirements">Requirements</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#build-from-git">Build from git</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#building-documentation">Building documentation</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#unit-tests">Unit tests</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#integration-tests">Integration tests</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#client-server-and-proxy-programs">Client, Server and Proxy programs</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#benchmarking-tool">Benchmarking tool</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#hpack-tools">HPACK tools</a></li>
@ -74,6 +78,10 @@
<li class="toctree-l2"><a class="reference internal" href="package_README.html#contribution">Contribution</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="contribute.html">Contribution Guidelines</a><ul>
<li class="toctree-l2"><a class="reference internal" href="contribute.html#coding-style">Coding style</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="building-android-binary.html">Building Android binary</a></li>
<li class="toctree-l1"><a class="reference internal" href="tutorial-client.html">Tutorial: HTTP/2 client</a><ul>
<li class="toctree-l2"><a class="reference internal" href="tutorial-client.html#libevent-client-c">libevent-client.c</a></li>
@ -90,34 +98,32 @@
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttp.1.html">nghttp(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttpd.1.html">nghttpd(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttpx.1.html">nghttpx(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#files">FILES</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#signals">SIGNALS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="h2load.1.html">h2load(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
@ -131,8 +137,9 @@
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#specifying-additional-ca-certificate">Specifying additional CA certificate</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#read-write-rate-limit">Read/write rate limit</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#rewriting-location-header-field">Rewriting location header field</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#hot-deploy">Hot deploy</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#hot-swapping">Hot swapping</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#re-opening-log-files">Re-opening log files</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#multiple-http-1-backend-addresses">Multiple HTTP/1 backend addresses</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="h2load-howto.html">h2load - HTTP/2 benchmarking tool - HOW-TO</a><ul>
@ -166,9 +173,11 @@
<li class="toctree-l1"><a class="reference internal" href="asio_http2.h.html">asio_http2.h</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/tatsuhiro-t/nghttp2">Source</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/tatsuhiro-t/nghttp2/issues">Issues</a></li>
<li class="toctree-l1"><a class="reference external" href="https://nghttp2.org/">nghttp2.org</a></li>
</ul>
</div>
&nbsp;
</nav>
@ -398,7 +407,7 @@ variables:</p>
<dt id="nghttp2.BaseRequestHandler.client_address">
<tt class="descname">client_address</tt><a class="headerlink" href="#nghttp2.BaseRequestHandler.client_address" title="Permalink to this definition"></a></dt>
<dd><p>Contains a tuple of the form <tt class="docutils literal"><span class="pre">(host,</span> <span class="pre">port)</span></tt> referring to the
client&#8217;s address.</p>
client's address.</p>
</dd></dl>
<dl class="attribute">
@ -557,11 +566,12 @@ encoded using UTF-8.</p>
<div role="contentinfo">
<p>
&copy; Copyright 2012, 2014, Tatsuhiro Tsujikawa.
&copy; Copyright 2012, 2015, Tatsuhiro Tsujikawa.
</p>
</div>
<a href="https://github.com/snide/sphinx_rtd_theme">Sphinx theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
@ -577,7 +587,7 @@ encoded using UTF-8.</p>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'0.6.3-DEV',
VERSION:'0.7.2-DEV',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: false

View File

@ -7,14 +7,14 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Search &mdash; nghttp2 0.6.3-DEV documentation</title>
<title>Search &mdash; nghttp2 0.7.2-DEV documentation</title>
<link href='https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700&subset=latin,cyrillic' rel='stylesheet' type='text/css'>
@ -28,7 +28,7 @@
<link rel="top" title="nghttp2 0.6.3-DEV documentation" href="index.html"/>
<link rel="top" title="nghttp2 0.7.2-DEV documentation" href="index.html"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script>
@ -45,6 +45,7 @@
<a href="index.html" class="fa fa-home"> nghttp2</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="#" method="get">
<input type="text" name="q" placeholder="Search docs" />
@ -57,6 +58,7 @@
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul>
<li class="toctree-l1"><a class="reference internal" href="package_README.html">nghttp2 - HTTP/2 C Library</a><ul>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#development-status">Development Status</a></li>
@ -64,6 +66,8 @@
<li class="toctree-l2"><a class="reference internal" href="package_README.html#requirements">Requirements</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#build-from-git">Build from git</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#building-documentation">Building documentation</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#unit-tests">Unit tests</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#integration-tests">Integration tests</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#client-server-and-proxy-programs">Client, Server and Proxy programs</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#benchmarking-tool">Benchmarking tool</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#hpack-tools">HPACK tools</a></li>
@ -72,6 +76,10 @@
<li class="toctree-l2"><a class="reference internal" href="package_README.html#contribution">Contribution</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="contribute.html">Contribution Guidelines</a><ul>
<li class="toctree-l2"><a class="reference internal" href="contribute.html#coding-style">Coding style</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="building-android-binary.html">Building Android binary</a></li>
<li class="toctree-l1"><a class="reference internal" href="tutorial-client.html">Tutorial: HTTP/2 client</a><ul>
<li class="toctree-l2"><a class="reference internal" href="tutorial-client.html#libevent-client-c">libevent-client.c</a></li>
@ -88,34 +96,32 @@
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttp.1.html">nghttp(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttpd.1.html">nghttpd(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttpx.1.html">nghttpx(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#files">FILES</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#signals">SIGNALS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="h2load.1.html">h2load(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
@ -129,8 +135,9 @@
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#specifying-additional-ca-certificate">Specifying additional CA certificate</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#read-write-rate-limit">Read/write rate limit</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#rewriting-location-header-field">Rewriting location header field</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#hot-deploy">Hot deploy</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#hot-swapping">Hot swapping</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#re-opening-log-files">Re-opening log files</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#multiple-http-1-backend-addresses">Multiple HTTP/1 backend addresses</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="h2load-howto.html">h2load - HTTP/2 benchmarking tool - HOW-TO</a><ul>
@ -164,9 +171,11 @@
<li class="toctree-l1"><a class="reference internal" href="asio_http2.h.html">asio_http2.h</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/tatsuhiro-t/nghttp2">Source</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/tatsuhiro-t/nghttp2/issues">Issues</a></li>
<li class="toctree-l1"><a class="reference external" href="https://nghttp2.org/">nghttp2.org</a></li>
</ul>
</div>
&nbsp;
</nav>
@ -218,11 +227,12 @@
<div role="contentinfo">
<p>
&copy; Copyright 2012, 2014, Tatsuhiro Tsujikawa.
&copy; Copyright 2012, 2015, Tatsuhiro Tsujikawa.
</p>
</div>
<a href="https://github.com/snide/sphinx_rtd_theme">Sphinx theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
@ -238,7 +248,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'0.6.3-DEV',
VERSION:'0.7.2-DEV',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: false

File diff suppressed because one or more lines are too long

View File

@ -7,14 +7,14 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Tutorial: HTTP/2 client &mdash; nghttp2 0.6.3-DEV documentation</title>
<title>Tutorial: HTTP/2 client &mdash; nghttp2 0.7.2-DEV documentation</title>
<link href='https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700&subset=latin,cyrillic' rel='stylesheet' type='text/css'>
@ -28,7 +28,7 @@
<link rel="top" title="nghttp2 0.6.3-DEV documentation" href="index.html"/>
<link rel="top" title="nghttp2 0.7.2-DEV documentation" href="index.html"/>
<link rel="next" title="Tutorial: HTTP/2 server" href="tutorial-server.html"/>
<link rel="prev" title="Building Android binary" href="building-android-binary.html"/>
@ -47,6 +47,7 @@
<a href="index.html" class="fa fa-home"> nghttp2</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
@ -59,6 +60,7 @@
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="package_README.html">nghttp2 - HTTP/2 C Library</a><ul>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#development-status">Development Status</a></li>
@ -66,6 +68,8 @@
<li class="toctree-l2"><a class="reference internal" href="package_README.html#requirements">Requirements</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#build-from-git">Build from git</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#building-documentation">Building documentation</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#unit-tests">Unit tests</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#integration-tests">Integration tests</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#client-server-and-proxy-programs">Client, Server and Proxy programs</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#benchmarking-tool">Benchmarking tool</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#hpack-tools">HPACK tools</a></li>
@ -74,6 +78,10 @@
<li class="toctree-l2"><a class="reference internal" href="package_README.html#contribution">Contribution</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="contribute.html">Contribution Guidelines</a><ul>
<li class="toctree-l2"><a class="reference internal" href="contribute.html#coding-style">Coding style</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="building-android-binary.html">Building Android binary</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="">Tutorial: HTTP/2 client</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#libevent-client-c">libevent-client.c</a></li>
@ -90,34 +98,32 @@
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttp.1.html">nghttp(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttpd.1.html">nghttpd(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttpx.1.html">nghttpx(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#files">FILES</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#signals">SIGNALS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="h2load.1.html">h2load(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
@ -131,8 +137,9 @@
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#specifying-additional-ca-certificate">Specifying additional CA certificate</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#read-write-rate-limit">Read/write rate limit</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#rewriting-location-header-field">Rewriting location header field</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#hot-deploy">Hot deploy</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#hot-swapping">Hot swapping</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#re-opening-log-files">Re-opening log files</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#multiple-http-1-backend-addresses">Multiple HTTP/1 backend addresses</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="h2load-howto.html">h2load - HTTP/2 benchmarking tool - HOW-TO</a><ul>
@ -166,9 +173,11 @@
<li class="toctree-l1"><a class="reference internal" href="asio_http2.h.html">asio_http2.h</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/tatsuhiro-t/nghttp2">Source</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/tatsuhiro-t/nghttp2/issues">Issues</a></li>
<li class="toctree-l1"><a class="reference external" href="https://nghttp2.org/">nghttp2.org</a></li>
</ul>
</div>
&nbsp;
</nav>
@ -218,11 +227,9 @@ The NPN callback is used for the client to select the next application
protocol over the SSL/TLS transport. In this tutorial, we use
<a class="reference internal" href="apiref.html#c.nghttp2_select_next_protocol" title="nghttp2_select_next_protocol"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_select_next_protocol()</span></tt></a> function to select the HTTP/2
protocol the library supports:</p>
<div class="highlight-c"><div class="highlight"><pre><span class="k">static</span> <span class="kt">int</span> <span class="nf">select_next_proto_cb</span><span class="p">(</span><span class="n">SSL</span><span class="o">*</span> <span class="n">ssl</span><span class="p">,</span>
<span class="kt">unsigned</span> <span class="kt">char</span> <span class="o">**</span><span class="n">out</span><span class="p">,</span> <span class="kt">unsigned</span> <span class="kt">char</span> <span class="o">*</span><span class="n">outlen</span><span class="p">,</span>
<span class="k">const</span> <span class="kt">unsigned</span> <span class="kt">char</span> <span class="o">*</span><span class="n">in</span><span class="p">,</span> <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">inlen</span><span class="p">,</span>
<span class="kt">void</span> <span class="o">*</span><span class="n">arg</span><span class="p">)</span>
<span class="p">{</span>
<div class="highlight-c"><div class="highlight"><pre><span class="k">static</span> <span class="kt">int</span> <span class="nf">select_next_proto_cb</span><span class="p">(</span><span class="n">SSL</span> <span class="o">*</span><span class="n">ssl</span> <span class="n">_U_</span><span class="p">,</span> <span class="kt">unsigned</span> <span class="kt">char</span> <span class="o">**</span><span class="n">out</span><span class="p">,</span>
<span class="kt">unsigned</span> <span class="kt">char</span> <span class="o">*</span><span class="n">outlen</span><span class="p">,</span> <span class="k">const</span> <span class="kt">unsigned</span> <span class="kt">char</span> <span class="o">*</span><span class="n">in</span><span class="p">,</span>
<span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">inlen</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">arg</span> <span class="n">_U_</span><span class="p">)</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="n">nghttp2_select_next_protocol</span><span class="p">(</span><span class="n">out</span><span class="p">,</span> <span class="n">outlen</span><span class="p">,</span> <span class="n">in</span><span class="p">,</span> <span class="n">inlen</span><span class="p">)</span> <span class="o">&lt;=</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
<span class="n">errx</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Server did not advertise &quot;</span> <span class="n">NGHTTP2_PROTO_VERSION_ID</span><span class="p">);</span>
<span class="p">}</span>
@ -232,8 +239,7 @@ protocol the library supports:</p>
</div>
<p>The callback is set to the SSL_CTX object using
<tt class="docutils literal"><span class="pre">SSL_CTX_set_next_proto_select_cb()</span></tt> function:</p>
<div class="highlight-c"><div class="highlight"><pre><span class="k">static</span> <span class="n">SSL_CTX</span><span class="o">*</span> <span class="nf">create_ssl_ctx</span><span class="p">(</span><span class="kt">void</span><span class="p">)</span>
<span class="p">{</span>
<div class="highlight-c"><div class="highlight"><pre><span class="k">static</span> <span class="n">SSL_CTX</span> <span class="o">*</span><span class="nf">create_ssl_ctx</span><span class="p">(</span><span class="kt">void</span><span class="p">)</span> <span class="p">{</span>
<span class="n">SSL_CTX</span> <span class="o">*</span><span class="n">ssl_ctx</span><span class="p">;</span>
<span class="n">ssl_ctx</span> <span class="o">=</span> <span class="n">SSL_CTX_new</span><span class="p">(</span><span class="n">SSLv23_client_method</span><span class="p">());</span>
<span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">ssl_ctx</span><span class="p">)</span> <span class="p">{</span>
@ -241,7 +247,8 @@ protocol the library supports:</p>
<span class="n">ERR_error_string</span><span class="p">(</span><span class="n">ERR_get_error</span><span class="p">(),</span> <span class="nb">NULL</span><span class="p">));</span>
<span class="p">}</span>
<span class="n">SSL_CTX_set_options</span><span class="p">(</span><span class="n">ssl_ctx</span><span class="p">,</span>
<span class="n">SSL_OP_ALL</span> <span class="o">|</span> <span class="n">SSL_OP_NO_SSLv2</span> <span class="o">|</span> <span class="n">SSL_OP_NO_COMPRESSION</span> <span class="o">|</span>
<span class="n">SSL_OP_ALL</span> <span class="o">|</span> <span class="n">SSL_OP_NO_SSLv2</span> <span class="o">|</span> <span class="n">SSL_OP_NO_SSLv3</span> <span class="o">|</span>
<span class="n">SSL_OP_NO_COMPRESSION</span> <span class="o">|</span>
<span class="n">SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION</span><span class="p">);</span>
<span class="n">SSL_CTX_set_next_proto_select_cb</span><span class="p">(</span><span class="n">ssl_ctx</span><span class="p">,</span> <span class="n">select_next_proto_cb</span><span class="p">,</span> <span class="nb">NULL</span><span class="p">);</span>
<span class="k">return</span> <span class="n">ssl_ctx</span><span class="p">;</span>
@ -286,20 +293,17 @@ defined as follows:</p>
respectively.</p>
<p>Then we call function <tt class="docutils literal"><span class="pre">initiate_connection()</span></tt> to start connecting to
the remote server:</p>
<div class="highlight-c"><div class="highlight"><pre><span class="k">static</span> <span class="kt">void</span> <span class="nf">initiate_connection</span><span class="p">(</span><span class="k">struct</span> <span class="n">event_base</span> <span class="o">*</span><span class="n">evbase</span><span class="p">,</span>
<span class="n">SSL_CTX</span> <span class="o">*</span><span class="n">ssl_ctx</span><span class="p">,</span>
<div class="highlight-c"><div class="highlight"><pre><span class="k">static</span> <span class="kt">void</span> <span class="nf">initiate_connection</span><span class="p">(</span><span class="k">struct</span> <span class="n">event_base</span> <span class="o">*</span><span class="n">evbase</span><span class="p">,</span> <span class="n">SSL_CTX</span> <span class="o">*</span><span class="n">ssl_ctx</span><span class="p">,</span>
<span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">host</span><span class="p">,</span> <span class="kt">uint16_t</span> <span class="n">port</span><span class="p">,</span>
<span class="n">http2_session_data</span> <span class="o">*</span><span class="n">session_data</span><span class="p">)</span>
<span class="p">{</span>
<span class="n">http2_session_data</span> <span class="o">*</span><span class="n">session_data</span><span class="p">)</span> <span class="p">{</span>
<span class="kt">int</span> <span class="n">rv</span><span class="p">;</span>
<span class="k">struct</span> <span class="n">bufferevent</span> <span class="o">*</span><span class="n">bev</span><span class="p">;</span>
<span class="n">SSL</span> <span class="o">*</span><span class="n">ssl</span><span class="p">;</span>
<span class="n">ssl</span> <span class="o">=</span> <span class="n">create_ssl</span><span class="p">(</span><span class="n">ssl_ctx</span><span class="p">);</span>
<span class="n">bev</span> <span class="o">=</span> <span class="n">bufferevent_openssl_socket_new</span><span class="p">(</span><span class="n">evbase</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">ssl</span><span class="p">,</span>
<span class="n">BUFFEREVENT_SSL_CONNECTING</span><span class="p">,</span>
<span class="n">BEV_OPT_DEFER_CALLBACKS</span> <span class="o">|</span>
<span class="n">BEV_OPT_CLOSE_ON_FREE</span><span class="p">);</span>
<span class="n">bev</span> <span class="o">=</span> <span class="n">bufferevent_openssl_socket_new</span><span class="p">(</span>
<span class="n">evbase</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">ssl</span><span class="p">,</span> <span class="n">BUFFEREVENT_SSL_CONNECTING</span><span class="p">,</span>
<span class="n">BEV_OPT_DEFER_CALLBACKS</span> <span class="o">|</span> <span class="n">BEV_OPT_CLOSE_ON_FREE</span><span class="p">);</span>
<span class="n">bufferevent_setcb</span><span class="p">(</span><span class="n">bev</span><span class="p">,</span> <span class="n">readcb</span><span class="p">,</span> <span class="n">writecb</span><span class="p">,</span> <span class="n">eventcb</span><span class="p">,</span> <span class="n">session_data</span><span class="p">);</span>
<span class="n">rv</span> <span class="o">=</span> <span class="n">bufferevent_socket_connect_hostname</span><span class="p">(</span><span class="n">bev</span><span class="p">,</span> <span class="n">session_data</span><span class="o">-&gt;</span><span class="n">dnsbase</span><span class="p">,</span>
<span class="n">AF_UNSPEC</span><span class="p">,</span> <span class="n">host</span><span class="p">,</span> <span class="n">port</span><span class="p">);</span>
@ -316,8 +320,7 @@ the remote server:</p>
<p>The <tt class="docutils literal"><span class="pre">eventcb()</span></tt> is invoked by libevent event loop when an event
(e.g., connection has been established, timeout, etc) happens on the
underlying network socket:</p>
<div class="highlight-c"><div class="highlight"><pre><span class="k">static</span> <span class="kt">void</span> <span class="nf">eventcb</span><span class="p">(</span><span class="k">struct</span> <span class="n">bufferevent</span> <span class="o">*</span><span class="n">bev</span><span class="p">,</span> <span class="kt">short</span> <span class="n">events</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">ptr</span><span class="p">)</span>
<span class="p">{</span>
<div class="highlight-c"><div class="highlight"><pre><span class="k">static</span> <span class="kt">void</span> <span class="nf">eventcb</span><span class="p">(</span><span class="k">struct</span> <span class="n">bufferevent</span> <span class="o">*</span><span class="n">bev</span><span class="p">,</span> <span class="kt">short</span> <span class="n">events</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">ptr</span><span class="p">)</span> <span class="p">{</span>
<span class="n">http2_session_data</span> <span class="o">*</span><span class="n">session_data</span> <span class="o">=</span> <span class="p">(</span><span class="n">http2_session_data</span> <span class="o">*</span><span class="p">)</span><span class="n">ptr</span><span class="p">;</span>
<span class="k">if</span> <span class="p">(</span><span class="n">events</span> <span class="o">&amp;</span> <span class="n">BEV_EVENT_CONNECTED</span><span class="p">)</span> <span class="p">{</span>
<span class="kt">int</span> <span class="n">fd</span> <span class="o">=</span> <span class="n">bufferevent_getfd</span><span class="p">(</span><span class="n">bev</span><span class="p">);</span>
@ -348,28 +351,27 @@ event, we just simply tear down the connection. The
<tt class="docutils literal"><span class="pre">BEV_EVENT_CONNECTED</span></tt> event is invoked when SSL/TLS handshake is
finished successfully. We first initialize nghttp2 session object in
<tt class="docutils literal"><span class="pre">initialize_nghttp2_session()</span></tt> function:</p>
<div class="highlight-c"><div class="highlight"><pre><span class="k">static</span> <span class="kt">void</span> <span class="nf">initialize_nghttp2_session</span><span class="p">(</span><span class="n">http2_session_data</span> <span class="o">*</span><span class="n">session_data</span><span class="p">)</span>
<span class="p">{</span>
<div class="highlight-c"><div class="highlight"><pre><span class="k">static</span> <span class="kt">void</span> <span class="nf">initialize_nghttp2_session</span><span class="p">(</span><span class="n">http2_session_data</span> <span class="o">*</span><span class="n">session_data</span><span class="p">)</span> <span class="p">{</span>
<span class="n">nghttp2_session_callbacks</span> <span class="o">*</span><span class="n">callbacks</span><span class="p">;</span>
<span class="n">nghttp2_session_callbacks_new</span><span class="p">(</span><span class="o">&amp;</span><span class="n">callbacks</span><span class="p">);</span>
<span class="n">nghttp2_session_callbacks_set_send_callback</span><span class="p">(</span><span class="n">callbacks</span><span class="p">,</span> <span class="n">send_callback</span><span class="p">);</span>
<span class="n">nghttp2_session_callbacks_set_on_frame_recv_callback</span>
<span class="p">(</span><span class="n">callbacks</span><span class="p">,</span> <span class="n">on_frame_recv_callback</span><span class="p">);</span>
<span class="n">nghttp2_session_callbacks_set_on_frame_recv_callback</span><span class="p">(</span><span class="n">callbacks</span><span class="p">,</span>
<span class="n">on_frame_recv_callback</span><span class="p">);</span>
<span class="n">nghttp2_session_callbacks_set_on_data_chunk_recv_callback</span>
<span class="p">(</span><span class="n">callbacks</span><span class="p">,</span> <span class="n">on_data_chunk_recv_callback</span><span class="p">);</span>
<span class="n">nghttp2_session_callbacks_set_on_data_chunk_recv_callback</span><span class="p">(</span>
<span class="n">callbacks</span><span class="p">,</span> <span class="n">on_data_chunk_recv_callback</span><span class="p">);</span>
<span class="n">nghttp2_session_callbacks_set_on_stream_close_callback</span>
<span class="p">(</span><span class="n">callbacks</span><span class="p">,</span> <span class="n">on_stream_close_callback</span><span class="p">);</span>
<span class="n">nghttp2_session_callbacks_set_on_stream_close_callback</span><span class="p">(</span>
<span class="n">callbacks</span><span class="p">,</span> <span class="n">on_stream_close_callback</span><span class="p">);</span>
<span class="n">nghttp2_session_callbacks_set_on_header_callback</span>
<span class="p">(</span><span class="n">callbacks</span><span class="p">,</span> <span class="n">on_header_callback</span><span class="p">);</span>
<span class="n">nghttp2_session_callbacks_set_on_header_callback</span><span class="p">(</span><span class="n">callbacks</span><span class="p">,</span>
<span class="n">on_header_callback</span><span class="p">);</span>
<span class="n">nghttp2_session_callbacks_set_on_begin_headers_callback</span>
<span class="p">(</span><span class="n">callbacks</span><span class="p">,</span> <span class="n">on_begin_headers_callback</span><span class="p">);</span>
<span class="n">nghttp2_session_callbacks_set_on_begin_headers_callback</span><span class="p">(</span>
<span class="n">callbacks</span><span class="p">,</span> <span class="n">on_begin_headers_callback</span><span class="p">);</span>
<span class="n">nghttp2_session_client_new</span><span class="p">(</span><span class="o">&amp;</span><span class="n">session_data</span><span class="o">-&gt;</span><span class="n">session</span><span class="p">,</span> <span class="n">callbacks</span><span class="p">,</span> <span class="n">session_data</span><span class="p">);</span>
@ -379,7 +381,7 @@ finished successfully. We first initialize nghttp2 session object in
</div>
<p>Since we are creating client, we use <a class="reference internal" href="apiref.html#c.nghttp2_session_client_new" title="nghttp2_session_client_new"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_client_new()</span></tt></a> to
initialize nghttp2 session object. We setup 7 callbacks for the
nghttp2 session. We&#8217;ll explain these callbacks later.</p>
nghttp2 session. We'll explain these callbacks later.</p>
<p>The <tt class="xref c c-func docutils literal"><span class="pre">delete_http2_session_data()</span></tt> destroys <tt class="docutils literal"><span class="pre">session_data</span></tt> and frees
its bufferevent, so it closes underlying connection as well. It also
calls <a class="reference internal" href="apiref.html#c.nghttp2_session_del" title="nghttp2_session_del"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_del()</span></tt></a> to delete nghttp2 session object.</p>
@ -388,18 +390,15 @@ which is 24 bytes magic byte sequence
(<a class="reference internal" href="apiref.html#c.NGHTTP2_CLIENT_CONNECTION_PREFACE" title="NGHTTP2_CLIENT_CONNECTION_PREFACE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_CLIENT_CONNECTION_PREFACE</span></tt></a>) and SETTINGS frame. The
transmission of client connection header is done in
<tt class="docutils literal"><span class="pre">send_client_connection_header()</span></tt>:</p>
<div class="highlight-c"><div class="highlight"><pre><span class="k">static</span> <span class="kt">void</span> <span class="nf">send_client_connection_header</span><span class="p">(</span><span class="n">http2_session_data</span> <span class="o">*</span><span class="n">session_data</span><span class="p">)</span>
<span class="p">{</span>
<div class="highlight-c"><div class="highlight"><pre><span class="k">static</span> <span class="kt">void</span> <span class="nf">send_client_connection_header</span><span class="p">(</span><span class="n">http2_session_data</span> <span class="o">*</span><span class="n">session_data</span><span class="p">)</span> <span class="p">{</span>
<span class="n">nghttp2_settings_entry</span> <span class="n">iv</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span>
<span class="p">{</span> <span class="n">NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS</span><span class="p">,</span> <span class="mi">100</span> <span class="p">}</span>
<span class="p">};</span>
<span class="p">{</span><span class="n">NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS</span><span class="p">,</span> <span class="mi">100</span><span class="p">}};</span>
<span class="kt">int</span> <span class="n">rv</span><span class="p">;</span>
<span class="n">bufferevent_write</span><span class="p">(</span><span class="n">session_data</span><span class="o">-&gt;</span><span class="n">bev</span><span class="p">,</span>
<span class="n">NGHTTP2_CLIENT_CONNECTION_PREFACE</span><span class="p">,</span>
<span class="n">bufferevent_write</span><span class="p">(</span><span class="n">session_data</span><span class="o">-&gt;</span><span class="n">bev</span><span class="p">,</span> <span class="n">NGHTTP2_CLIENT_CONNECTION_PREFACE</span><span class="p">,</span>
<span class="n">NGHTTP2_CLIENT_CONNECTION_PREFACE_LEN</span><span class="p">);</span>
<span class="n">rv</span> <span class="o">=</span> <span class="n">nghttp2_submit_settings</span><span class="p">(</span><span class="n">session_data</span><span class="o">-&gt;</span><span class="n">session</span><span class="p">,</span> <span class="n">NGHTTP2_FLAG_NONE</span><span class="p">,</span>
<span class="n">iv</span><span class="p">,</span> <span class="n">ARRLEN</span><span class="p">(</span><span class="n">iv</span><span class="p">));</span>
<span class="n">rv</span> <span class="o">=</span> <span class="n">nghttp2_submit_settings</span><span class="p">(</span><span class="n">session_data</span><span class="o">-&gt;</span><span class="n">session</span><span class="p">,</span> <span class="n">NGHTTP2_FLAG_NONE</span><span class="p">,</span> <span class="n">iv</span><span class="p">,</span>
<span class="n">ARRLEN</span><span class="p">(</span><span class="n">iv</span><span class="p">));</span>
<span class="k">if</span> <span class="p">(</span><span class="n">rv</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
<span class="n">errx</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Could not submit SETTINGS: %s&quot;</span><span class="p">,</span> <span class="n">nghttp2_strerror</span><span class="p">(</span><span class="n">rv</span><span class="p">));</span>
<span class="p">}</span>
@ -416,23 +415,21 @@ this property. To actually send the frame, <a class="reference internal" href="a
used, which is described about later.</p>
<p>After the transmission of client connection header, we enqueue HTTP
request in <tt class="docutils literal"><span class="pre">submit_request()</span></tt> function:</p>
<div class="highlight-c"><div class="highlight"><pre><span class="k">static</span> <span class="kt">void</span> <span class="nf">submit_request</span><span class="p">(</span><span class="n">http2_session_data</span> <span class="o">*</span><span class="n">session_data</span><span class="p">)</span>
<span class="p">{</span>
<div class="highlight-c"><div class="highlight"><pre><span class="k">static</span> <span class="kt">void</span> <span class="nf">submit_request</span><span class="p">(</span><span class="n">http2_session_data</span> <span class="o">*</span><span class="n">session_data</span><span class="p">)</span> <span class="p">{</span>
<span class="kt">int32_t</span> <span class="n">stream_id</span><span class="p">;</span>
<span class="n">http2_stream_data</span> <span class="o">*</span><span class="n">stream_data</span> <span class="o">=</span> <span class="n">session_data</span><span class="o">-&gt;</span><span class="n">stream_data</span><span class="p">;</span>
<span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">uri</span> <span class="o">=</span> <span class="n">stream_data</span><span class="o">-&gt;</span><span class="n">uri</span><span class="p">;</span>
<span class="k">const</span> <span class="k">struct</span> <span class="n">http_parser_url</span> <span class="o">*</span><span class="n">u</span> <span class="o">=</span> <span class="n">stream_data</span><span class="o">-&gt;</span><span class="n">u</span><span class="p">;</span>
<span class="n">nghttp2_nv</span> <span class="n">hdrs</span><span class="p">[]</span> <span class="o">=</span> <span class="p">{</span>
<span class="n">MAKE_NV2</span><span class="p">(</span><span class="s">&quot;:method&quot;</span><span class="p">,</span> <span class="s">&quot;GET&quot;</span><span class="p">),</span>
<span class="n">MAKE_NV</span><span class="p">(</span><span class="s">&quot;:scheme&quot;</span><span class="p">,</span>
<span class="o">&amp;</span><span class="n">uri</span><span class="p">[</span><span class="n">u</span><span class="o">-&gt;</span><span class="n">field_data</span><span class="p">[</span><span class="n">UF_SCHEMA</span><span class="p">].</span><span class="n">off</span><span class="p">],</span> <span class="n">u</span><span class="o">-&gt;</span><span class="n">field_data</span><span class="p">[</span><span class="n">UF_SCHEMA</span><span class="p">].</span><span class="n">len</span><span class="p">),</span>
<span class="n">MAKE_NV</span><span class="p">(</span><span class="s">&quot;:scheme&quot;</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">uri</span><span class="p">[</span><span class="n">u</span><span class="o">-&gt;</span><span class="n">field_data</span><span class="p">[</span><span class="n">UF_SCHEMA</span><span class="p">].</span><span class="n">off</span><span class="p">],</span>
<span class="n">u</span><span class="o">-&gt;</span><span class="n">field_data</span><span class="p">[</span><span class="n">UF_SCHEMA</span><span class="p">].</span><span class="n">len</span><span class="p">),</span>
<span class="n">MAKE_NV</span><span class="p">(</span><span class="s">&quot;:authority&quot;</span><span class="p">,</span> <span class="n">stream_data</span><span class="o">-&gt;</span><span class="n">authority</span><span class="p">,</span> <span class="n">stream_data</span><span class="o">-&gt;</span><span class="n">authoritylen</span><span class="p">),</span>
<span class="n">MAKE_NV</span><span class="p">(</span><span class="s">&quot;:path&quot;</span><span class="p">,</span> <span class="n">stream_data</span><span class="o">-&gt;</span><span class="n">path</span><span class="p">,</span> <span class="n">stream_data</span><span class="o">-&gt;</span><span class="n">pathlen</span><span class="p">)</span>
<span class="p">};</span>
<span class="n">MAKE_NV</span><span class="p">(</span><span class="s">&quot;:path&quot;</span><span class="p">,</span> <span class="n">stream_data</span><span class="o">-&gt;</span><span class="n">path</span><span class="p">,</span> <span class="n">stream_data</span><span class="o">-&gt;</span><span class="n">pathlen</span><span class="p">)};</span>
<span class="n">fprintf</span><span class="p">(</span><span class="n">stderr</span><span class="p">,</span> <span class="s">&quot;Request headers:</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">);</span>
<span class="n">print_headers</span><span class="p">(</span><span class="n">stderr</span><span class="p">,</span> <span class="n">hdrs</span><span class="p">,</span> <span class="n">ARRLEN</span><span class="p">(</span><span class="n">hdrs</span><span class="p">));</span>
<span class="n">stream_id</span> <span class="o">=</span> <span class="n">nghttp2_submit_request</span><span class="p">(</span><span class="n">session_data</span><span class="o">-&gt;</span><span class="n">session</span><span class="p">,</span> <span class="nb">NULL</span><span class="p">,</span>
<span class="n">hdrs</span><span class="p">,</span> <span class="n">ARRLEN</span><span class="p">(</span><span class="n">hdrs</span><span class="p">),</span> <span class="nb">NULL</span><span class="p">,</span> <span class="n">stream_data</span><span class="p">);</span>
<span class="n">stream_id</span> <span class="o">=</span> <span class="n">nghttp2_submit_request</span><span class="p">(</span><span class="n">session_data</span><span class="o">-&gt;</span><span class="n">session</span><span class="p">,</span> <span class="nb">NULL</span><span class="p">,</span> <span class="n">hdrs</span><span class="p">,</span>
<span class="n">ARRLEN</span><span class="p">(</span><span class="n">hdrs</span><span class="p">),</span> <span class="nb">NULL</span><span class="p">,</span> <span class="n">stream_data</span><span class="p">);</span>
<span class="k">if</span> <span class="p">(</span><span class="n">stream_id</span> <span class="o">&lt;</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
<span class="n">errx</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Could not submit HTTP request: %s&quot;</span><span class="p">,</span> <span class="n">nghttp2_strerror</span><span class="p">(</span><span class="n">stream_id</span><span class="p">));</span>
<span class="p">}</span>
@ -446,13 +443,12 @@ request in <tt class="docutils literal"><span class="pre">submit_request()</span
<tt class="docutils literal"><span class="pre">:scheme</span></tt>, <tt class="docutils literal"><span class="pre">:authority</span></tt> and <tt class="docutils literal"><span class="pre">:path</span></tt>. To queue this HTTP request,
we use <a class="reference internal" href="apiref.html#c.nghttp2_submit_request" title="nghttp2_submit_request"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_submit_request()</span></tt></a> function. The <tt class="xref c c-func docutils literal"><span class="pre">stream_data()</span></tt> is
passed in <em>stream_user_data</em> parameter. It is used in nghttp2
callbacks which we&#8217;ll describe about later.
callbacks which we'll describe about later.
<a class="reference internal" href="apiref.html#c.nghttp2_submit_request" title="nghttp2_submit_request"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_submit_request()</span></tt></a> returns the newly assigned stream ID for
this request.</p>
<p>The next bufferevent callback is <tt class="docutils literal"><span class="pre">readcb()</span></tt>, which is invoked when
data is available to read in the bufferevent input buffer:</p>
<div class="highlight-c"><div class="highlight"><pre><span class="k">static</span> <span class="kt">void</span> <span class="nf">readcb</span><span class="p">(</span><span class="k">struct</span> <span class="n">bufferevent</span> <span class="o">*</span><span class="n">bev</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">ptr</span><span class="p">)</span>
<span class="p">{</span>
<div class="highlight-c"><div class="highlight"><pre><span class="k">static</span> <span class="kt">void</span> <span class="nf">readcb</span><span class="p">(</span><span class="k">struct</span> <span class="n">bufferevent</span> <span class="o">*</span><span class="n">bev</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">ptr</span><span class="p">)</span> <span class="p">{</span>
<span class="n">http2_session_data</span> <span class="o">*</span><span class="n">session_data</span> <span class="o">=</span> <span class="p">(</span><span class="n">http2_session_data</span> <span class="o">*</span><span class="p">)</span><span class="n">ptr</span><span class="p">;</span>
<span class="kt">ssize_t</span> <span class="n">readlen</span><span class="p">;</span>
<span class="k">struct</span> <span class="n">evbuffer</span> <span class="o">*</span><span class="n">input</span> <span class="o">=</span> <span class="n">bufferevent_get_input</span><span class="p">(</span><span class="n">bev</span><span class="p">);</span>
@ -483,8 +479,7 @@ session object using <a class="reference internal" href="apiref.html#c.nghttp2_s
invoke nghttp2 callbacks and also queue frames. Since there may be
pending frames, we call <tt class="docutils literal"><span class="pre">session_send()</span></tt> function to send those
frames. The <tt class="docutils literal"><span class="pre">session_send()</span></tt> function is defined as follows:</p>
<div class="highlight-c"><div class="highlight"><pre><span class="k">static</span> <span class="kt">int</span> <span class="nf">session_send</span><span class="p">(</span><span class="n">http2_session_data</span> <span class="o">*</span><span class="n">session_data</span><span class="p">)</span>
<span class="p">{</span>
<div class="highlight-c"><div class="highlight"><pre><span class="k">static</span> <span class="kt">int</span> <span class="nf">session_send</span><span class="p">(</span><span class="n">http2_session_data</span> <span class="o">*</span><span class="n">session_data</span><span class="p">)</span> <span class="p">{</span>
<span class="kt">int</span> <span class="n">rv</span><span class="p">;</span>
<span class="n">rv</span> <span class="o">=</span> <span class="n">nghttp2_session_send</span><span class="p">(</span><span class="n">session_data</span><span class="o">-&gt;</span><span class="n">session</span><span class="p">);</span>
@ -500,10 +495,8 @@ frames. The <tt class="docutils literal"><span class="pre">session_send()</span>
format and call <tt class="docutils literal"><span class="pre">send_callback()</span></tt> function of type
<a class="reference internal" href="apiref.html#c.nghttp2_send_callback" title="nghttp2_send_callback"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_send_callback</span></tt></a>. The <tt class="docutils literal"><span class="pre">send_callback()</span></tt> is defined as
follows:</p>
<div class="highlight-c"><div class="highlight"><pre><span class="k">static</span> <span class="kt">ssize_t</span> <span class="nf">send_callback</span><span class="p">(</span><span class="n">nghttp2_session</span> <span class="o">*</span><span class="n">session</span><span class="p">,</span>
<span class="k">const</span> <span class="kt">uint8_t</span> <span class="o">*</span><span class="n">data</span><span class="p">,</span> <span class="kt">size_t</span> <span class="n">length</span><span class="p">,</span>
<span class="kt">int</span> <span class="n">flags</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">user_data</span><span class="p">)</span>
<span class="p">{</span>
<div class="highlight-c"><div class="highlight"><pre><span class="k">static</span> <span class="kt">ssize_t</span> <span class="nf">send_callback</span><span class="p">(</span><span class="n">nghttp2_session</span> <span class="o">*</span><span class="n">session</span> <span class="n">_U_</span><span class="p">,</span> <span class="k">const</span> <span class="kt">uint8_t</span> <span class="o">*</span><span class="n">data</span><span class="p">,</span>
<span class="kt">size_t</span> <span class="n">length</span><span class="p">,</span> <span class="kt">int</span> <span class="n">flags</span> <span class="n">_U_</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">user_data</span><span class="p">)</span> <span class="p">{</span>
<span class="n">http2_session_data</span> <span class="o">*</span><span class="n">session_data</span> <span class="o">=</span> <span class="p">(</span><span class="n">http2_session_data</span> <span class="o">*</span><span class="p">)</span><span class="n">user_data</span><span class="p">;</span>
<span class="k">struct</span> <span class="n">bufferevent</span> <span class="o">*</span><span class="n">bev</span> <span class="o">=</span> <span class="n">session_data</span><span class="o">-&gt;</span><span class="n">bev</span><span class="p">;</span>
<span class="n">bufferevent_write</span><span class="p">(</span><span class="n">bev</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="n">length</span><span class="p">);</span>
@ -525,8 +518,7 @@ client, we do not limit anything. To see how to regulate the amount of
buffered data, see the <tt class="docutils literal"><span class="pre">send_callback()</span></tt> in the server tutorial.</p>
<p>The third bufferevent callback is <tt class="docutils literal"><span class="pre">writecb()</span></tt>, which is invoked when
all data written in the bufferevent output buffer have been sent:</p>
<div class="highlight-c"><div class="highlight"><pre><span class="k">static</span> <span class="kt">void</span> <span class="nf">writecb</span><span class="p">(</span><span class="k">struct</span> <span class="n">bufferevent</span> <span class="o">*</span><span class="n">bev</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">ptr</span><span class="p">)</span>
<span class="p">{</span>
<div class="highlight-c"><div class="highlight"><pre><span class="k">static</span> <span class="kt">void</span> <span class="nf">writecb</span><span class="p">(</span><span class="k">struct</span> <span class="n">bufferevent</span> <span class="o">*</span><span class="n">bev</span> <span class="n">_U_</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">ptr</span><span class="p">)</span> <span class="p">{</span>
<span class="n">http2_session_data</span> <span class="o">*</span><span class="n">session_data</span> <span class="o">=</span> <span class="p">(</span><span class="n">http2_session_data</span> <span class="o">*</span><span class="p">)</span><span class="n">ptr</span><span class="p">;</span>
<span class="k">if</span> <span class="p">(</span><span class="n">nghttp2_session_want_read</span><span class="p">(</span><span class="n">session_data</span><span class="o">-&gt;</span><span class="n">session</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span> <span class="o">&amp;&amp;</span>
<span class="n">nghttp2_session_want_write</span><span class="p">(</span><span class="n">session_data</span><span class="o">-&gt;</span><span class="n">session</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span> <span class="o">&amp;&amp;</span>
@ -550,20 +542,18 @@ data when the <tt class="docutils literal"><span class="pre">writecb()</span></t
also check whether the output buffer is empty or not. If these
conditions are met, we drop connection.</p>
<p>We have already described about nghttp2 callback <tt class="docutils literal"><span class="pre">send_callback()</span></tt>.
Let&#8217;s describe remaining nghttp2 callbacks we setup in
Let's describe remaining nghttp2 callbacks we setup in
<tt class="docutils literal"><span class="pre">initialize_nghttp2_setup()</span></tt> function.</p>
<p>Each request header name/value pair is emitted via
<tt class="docutils literal"><span class="pre">on_header_callback</span></tt> function:</p>
<div class="highlight-c"><div class="highlight"><pre><span class="k">static</span> <span class="kt">int</span> <span class="nf">on_header_callback</span><span class="p">(</span><span class="n">nghttp2_session</span> <span class="o">*</span><span class="n">session</span><span class="p">,</span>
<span class="k">const</span> <span class="n">nghttp2_frame</span> <span class="o">*</span><span class="n">frame</span><span class="p">,</span>
<span class="k">const</span> <span class="kt">uint8_t</span> <span class="o">*</span><span class="n">name</span><span class="p">,</span> <span class="kt">size_t</span> <span class="n">namelen</span><span class="p">,</span>
<span class="k">const</span> <span class="kt">uint8_t</span> <span class="o">*</span><span class="n">value</span><span class="p">,</span> <span class="kt">size_t</span> <span class="n">valuelen</span><span class="p">,</span>
<span class="kt">uint8_t</span> <span class="n">flags</span><span class="p">,</span>
<span class="kt">void</span> <span class="o">*</span><span class="n">user_data</span><span class="p">)</span>
<span class="p">{</span>
<div class="highlight-c"><div class="highlight"><pre><span class="k">static</span> <span class="kt">int</span> <span class="nf">on_header_callback</span><span class="p">(</span><span class="n">nghttp2_session</span> <span class="o">*</span><span class="n">session</span> <span class="n">_U_</span><span class="p">,</span>
<span class="k">const</span> <span class="n">nghttp2_frame</span> <span class="o">*</span><span class="n">frame</span><span class="p">,</span> <span class="k">const</span> <span class="kt">uint8_t</span> <span class="o">*</span><span class="n">name</span><span class="p">,</span>
<span class="kt">size_t</span> <span class="n">namelen</span><span class="p">,</span> <span class="k">const</span> <span class="kt">uint8_t</span> <span class="o">*</span><span class="n">value</span><span class="p">,</span>
<span class="kt">size_t</span> <span class="n">valuelen</span><span class="p">,</span> <span class="kt">uint8_t</span> <span class="n">flags</span> <span class="n">_U_</span><span class="p">,</span>
<span class="kt">void</span> <span class="o">*</span><span class="n">user_data</span><span class="p">)</span> <span class="p">{</span>
<span class="n">http2_session_data</span> <span class="o">*</span><span class="n">session_data</span> <span class="o">=</span> <span class="p">(</span><span class="n">http2_session_data</span> <span class="o">*</span><span class="p">)</span><span class="n">user_data</span><span class="p">;</span>
<span class="k">switch</span> <span class="p">(</span><span class="n">frame</span><span class="o">-&gt;</span><span class="n">hd</span><span class="p">.</span><span class="n">type</span><span class="p">)</span> <span class="p">{</span>
<span class="k">case</span> <span class="n">NGHTTP2_HEADERS</span>:
<span class="k">case</span> <span class="nl">NGHTTP2_HEADERS</span><span class="p">:</span>
<span class="k">if</span> <span class="p">(</span><span class="n">frame</span><span class="o">-&gt;</span><span class="n">headers</span><span class="p">.</span><span class="n">cat</span> <span class="o">==</span> <span class="n">NGHTTP2_HCAT_RESPONSE</span> <span class="o">&amp;&amp;</span>
<span class="n">session_data</span><span class="o">-&gt;</span><span class="n">stream_data</span><span class="o">-&gt;</span><span class="n">stream_id</span> <span class="o">==</span> <span class="n">frame</span><span class="o">-&gt;</span><span class="n">hd</span><span class="p">.</span><span class="n">stream_id</span><span class="p">)</span> <span class="p">{</span>
<span class="cm">/* Print response headers for the initiated request. */</span>
@ -575,15 +565,14 @@ Let&#8217;s describe remaining nghttp2 callbacks we setup in
<span class="p">}</span>
</pre></div>
</div>
<p>In this turotial, we just print the name/value pair.</p>
<p>In this tutorial, we just print the name/value pair.</p>
<p>After all name/value pairs are emitted for a frame,
<tt class="docutils literal"><span class="pre">on_frame_recv_callback</span></tt> function is called:</p>
<div class="highlight-c"><div class="highlight"><pre><span class="k">static</span> <span class="kt">int</span> <span class="nf">on_frame_recv_callback</span><span class="p">(</span><span class="n">nghttp2_session</span> <span class="o">*</span><span class="n">session</span><span class="p">,</span>
<span class="k">const</span> <span class="n">nghttp2_frame</span> <span class="o">*</span><span class="n">frame</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">user_data</span><span class="p">)</span>
<span class="p">{</span>
<div class="highlight-c"><div class="highlight"><pre><span class="k">static</span> <span class="kt">int</span> <span class="nf">on_frame_recv_callback</span><span class="p">(</span><span class="n">nghttp2_session</span> <span class="o">*</span><span class="n">session</span> <span class="n">_U_</span><span class="p">,</span>
<span class="k">const</span> <span class="n">nghttp2_frame</span> <span class="o">*</span><span class="n">frame</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">user_data</span><span class="p">)</span> <span class="p">{</span>
<span class="n">http2_session_data</span> <span class="o">*</span><span class="n">session_data</span> <span class="o">=</span> <span class="p">(</span><span class="n">http2_session_data</span> <span class="o">*</span><span class="p">)</span><span class="n">user_data</span><span class="p">;</span>
<span class="k">switch</span> <span class="p">(</span><span class="n">frame</span><span class="o">-&gt;</span><span class="n">hd</span><span class="p">.</span><span class="n">type</span><span class="p">)</span> <span class="p">{</span>
<span class="k">case</span> <span class="n">NGHTTP2_HEADERS</span>:
<span class="k">case</span> <span class="nl">NGHTTP2_HEADERS</span><span class="p">:</span>
<span class="k">if</span> <span class="p">(</span><span class="n">frame</span><span class="o">-&gt;</span><span class="n">headers</span><span class="p">.</span><span class="n">cat</span> <span class="o">==</span> <span class="n">NGHTTP2_HCAT_RESPONSE</span> <span class="o">&amp;&amp;</span>
<span class="n">session_data</span><span class="o">-&gt;</span><span class="n">stream_data</span><span class="o">-&gt;</span><span class="n">stream_id</span> <span class="o">==</span> <span class="n">frame</span><span class="o">-&gt;</span><span class="n">hd</span><span class="p">.</span><span class="n">stream_id</span><span class="p">)</span> <span class="p">{</span>
<span class="n">fprintf</span><span class="p">(</span><span class="n">stderr</span><span class="p">,</span> <span class="s">&quot;All headers received</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">);</span>
@ -600,11 +589,10 @@ HEADERS. We check te frame type and its category (it should be
its stream ID.</p>
<p>The <tt class="docutils literal"><span class="pre">on_data_chunk_recv_callback()</span></tt> function is invoked when a chunk
of data is received from the remote peer:</p>
<div class="highlight-c"><div class="highlight"><pre><span class="k">static</span> <span class="kt">int</span> <span class="nf">on_data_chunk_recv_callback</span><span class="p">(</span><span class="n">nghttp2_session</span> <span class="o">*</span><span class="n">session</span><span class="p">,</span> <span class="kt">uint8_t</span> <span class="n">flags</span><span class="p">,</span>
<span class="kt">int32_t</span> <span class="n">stream_id</span><span class="p">,</span>
<div class="highlight-c"><div class="highlight"><pre><span class="k">static</span> <span class="kt">int</span> <span class="nf">on_data_chunk_recv_callback</span><span class="p">(</span><span class="n">nghttp2_session</span> <span class="o">*</span><span class="n">session</span> <span class="n">_U_</span><span class="p">,</span>
<span class="kt">uint8_t</span> <span class="n">flags</span> <span class="n">_U_</span><span class="p">,</span> <span class="kt">int32_t</span> <span class="n">stream_id</span><span class="p">,</span>
<span class="k">const</span> <span class="kt">uint8_t</span> <span class="o">*</span><span class="n">data</span><span class="p">,</span> <span class="kt">size_t</span> <span class="n">len</span><span class="p">,</span>
<span class="kt">void</span> <span class="o">*</span><span class="n">user_data</span><span class="p">)</span>
<span class="p">{</span>
<span class="kt">void</span> <span class="o">*</span><span class="n">user_data</span><span class="p">)</span> <span class="p">{</span>
<span class="n">http2_session_data</span> <span class="o">*</span><span class="n">session_data</span> <span class="o">=</span> <span class="p">(</span><span class="n">http2_session_data</span> <span class="o">*</span><span class="p">)</span><span class="n">user_data</span><span class="p">;</span>
<span class="k">if</span> <span class="p">(</span><span class="n">session_data</span><span class="o">-&gt;</span><span class="n">stream_data</span><span class="o">-&gt;</span><span class="n">stream_id</span> <span class="o">==</span> <span class="n">stream_id</span><span class="p">)</span> <span class="p">{</span>
<span class="n">fwrite</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="n">len</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="n">stdout</span><span class="p">);</span>
@ -619,17 +607,15 @@ output in the terminal may be corrupted if the response body contains
some binary data.</p>
<p>The <tt class="docutils literal"><span class="pre">on_stream_close_callback()</span></tt> function is invoked when the stream
is about to close:</p>
<div class="highlight-c"><div class="highlight"><pre><span class="k">static</span> <span class="kt">int</span> <span class="nf">on_stream_close_callback</span><span class="p">(</span><span class="n">nghttp2_session</span> <span class="o">*</span><span class="n">session</span><span class="p">,</span>
<span class="kt">int32_t</span> <span class="n">stream_id</span><span class="p">,</span>
<div class="highlight-c"><div class="highlight"><pre><span class="k">static</span> <span class="kt">int</span> <span class="nf">on_stream_close_callback</span><span class="p">(</span><span class="n">nghttp2_session</span> <span class="o">*</span><span class="n">session</span><span class="p">,</span> <span class="kt">int32_t</span> <span class="n">stream_id</span><span class="p">,</span>
<span class="n">nghttp2_error_code</span> <span class="n">error_code</span><span class="p">,</span>
<span class="kt">void</span> <span class="o">*</span><span class="n">user_data</span><span class="p">)</span>
<span class="p">{</span>
<span class="kt">void</span> <span class="o">*</span><span class="n">user_data</span><span class="p">)</span> <span class="p">{</span>
<span class="n">http2_session_data</span> <span class="o">*</span><span class="n">session_data</span> <span class="o">=</span> <span class="p">(</span><span class="n">http2_session_data</span> <span class="o">*</span><span class="p">)</span><span class="n">user_data</span><span class="p">;</span>
<span class="kt">int</span> <span class="n">rv</span><span class="p">;</span>
<span class="k">if</span> <span class="p">(</span><span class="n">session_data</span><span class="o">-&gt;</span><span class="n">stream_data</span><span class="o">-&gt;</span><span class="n">stream_id</span> <span class="o">==</span> <span class="n">stream_id</span><span class="p">)</span> <span class="p">{</span>
<span class="n">fprintf</span><span class="p">(</span><span class="n">stderr</span><span class="p">,</span> <span class="s">&quot;Stream %d closed with error_code=%d</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">,</span>
<span class="n">stream_id</span><span class="p">,</span> <span class="n">error_code</span><span class="p">);</span>
<span class="n">fprintf</span><span class="p">(</span><span class="n">stderr</span><span class="p">,</span> <span class="s">&quot;Stream %d closed with error_code=%d</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">,</span> <span class="n">stream_id</span><span class="p">,</span>
<span class="n">error_code</span><span class="p">);</span>
<span class="n">rv</span> <span class="o">=</span> <span class="n">nghttp2_session_terminate_session</span><span class="p">(</span><span class="n">session</span><span class="p">,</span> <span class="n">NGHTTP2_NO_ERROR</span><span class="p">);</span>
<span class="k">if</span> <span class="p">(</span><span class="n">rv</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
<span class="k">return</span> <span class="n">NGHTTP2_ERR_CALLBACK_FAILURE</span><span class="p">;</span>
@ -672,6 +658,10 @@ here.</p>
<span class="cm"> * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION</span>
<span class="cm"> * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</span>
<span class="cm"> */</span>
<span class="cp">#ifdef HAVE_CONFIG_H</span>
<span class="cp">#include &lt;config.h&gt;</span>
<span class="cp">#endif </span><span class="cm">/* !HAVE_CONFIG_H */</span><span class="cp"></span>
<span class="cp">#include &lt;sys/types.h&gt;</span>
<span class="cp">#include &lt;unistd.h&gt;</span>
<span class="cp">#include &lt;sys/socket.h&gt;</span>
@ -721,8 +711,7 @@ here.</p>
<span class="p">}</span> <span class="n">http2_session_data</span><span class="p">;</span>
<span class="k">static</span> <span class="n">http2_stream_data</span> <span class="o">*</span><span class="nf">create_http2_stream_data</span><span class="p">(</span><span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">uri</span><span class="p">,</span>
<span class="k">struct</span> <span class="n">http_parser_url</span> <span class="o">*</span><span class="n">u</span><span class="p">)</span>
<span class="p">{</span>
<span class="k">struct</span> <span class="n">http_parser_url</span> <span class="o">*</span><span class="n">u</span><span class="p">)</span> <span class="p">{</span>
<span class="cm">/* MAX 5 digits (max 65535) + 1 &#39;:&#39; + 1 NULL (because of snprintf) */</span>
<span class="kt">size_t</span> <span class="n">extra</span> <span class="o">=</span> <span class="mi">7</span><span class="p">;</span>
<span class="n">http2_stream_data</span> <span class="o">*</span><span class="n">stream_data</span> <span class="o">=</span> <span class="n">malloc</span><span class="p">(</span><span class="k">sizeof</span><span class="p">(</span><span class="n">http2_stream_data</span><span class="p">));</span>
@ -733,8 +722,8 @@ here.</p>
<span class="n">stream_data</span><span class="o">-&gt;</span><span class="n">authoritylen</span> <span class="o">=</span> <span class="n">u</span><span class="o">-&gt;</span><span class="n">field_data</span><span class="p">[</span><span class="n">UF_HOST</span><span class="p">].</span><span class="n">len</span><span class="p">;</span>
<span class="n">stream_data</span><span class="o">-&gt;</span><span class="n">authority</span> <span class="o">=</span> <span class="n">malloc</span><span class="p">(</span><span class="n">stream_data</span><span class="o">-&gt;</span><span class="n">authoritylen</span> <span class="o">+</span> <span class="n">extra</span><span class="p">);</span>
<span class="n">memcpy</span><span class="p">(</span><span class="n">stream_data</span><span class="o">-&gt;</span><span class="n">authority</span><span class="p">,</span>
<span class="o">&amp;</span><span class="n">uri</span><span class="p">[</span><span class="n">u</span><span class="o">-&gt;</span><span class="n">field_data</span><span class="p">[</span><span class="n">UF_HOST</span><span class="p">].</span><span class="n">off</span><span class="p">],</span> <span class="n">u</span><span class="o">-&gt;</span><span class="n">field_data</span><span class="p">[</span><span class="n">UF_HOST</span><span class="p">].</span><span class="n">len</span><span class="p">);</span>
<span class="n">memcpy</span><span class="p">(</span><span class="n">stream_data</span><span class="o">-&gt;</span><span class="n">authority</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">uri</span><span class="p">[</span><span class="n">u</span><span class="o">-&gt;</span><span class="n">field_data</span><span class="p">[</span><span class="n">UF_HOST</span><span class="p">].</span><span class="n">off</span><span class="p">],</span>
<span class="n">u</span><span class="o">-&gt;</span><span class="n">field_data</span><span class="p">[</span><span class="n">UF_HOST</span><span class="p">].</span><span class="n">len</span><span class="p">);</span>
<span class="k">if</span> <span class="p">(</span><span class="n">u</span><span class="o">-&gt;</span><span class="n">field_set</span> <span class="o">&amp;</span> <span class="p">(</span><span class="mi">1</span> <span class="o">&lt;&lt;</span> <span class="n">UF_PORT</span><span class="p">))</span> <span class="p">{</span>
<span class="n">stream_data</span><span class="o">-&gt;</span><span class="n">authoritylen</span> <span class="o">+=</span>
<span class="n">snprintf</span><span class="p">(</span><span class="n">stream_data</span><span class="o">-&gt;</span><span class="n">authority</span> <span class="o">+</span> <span class="n">u</span><span class="o">-&gt;</span><span class="n">field_data</span><span class="p">[</span><span class="n">UF_HOST</span><span class="p">].</span><span class="n">len</span><span class="p">,</span> <span class="n">extra</span><span class="p">,</span>
@ -752,8 +741,8 @@ here.</p>
<span class="k">if</span> <span class="p">(</span><span class="n">stream_data</span><span class="o">-&gt;</span><span class="n">pathlen</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
<span class="n">stream_data</span><span class="o">-&gt;</span><span class="n">path</span> <span class="o">=</span> <span class="n">malloc</span><span class="p">(</span><span class="n">stream_data</span><span class="o">-&gt;</span><span class="n">pathlen</span><span class="p">);</span>
<span class="k">if</span> <span class="p">(</span><span class="n">u</span><span class="o">-&gt;</span><span class="n">field_set</span> <span class="o">&amp;</span> <span class="p">(</span><span class="mi">1</span> <span class="o">&lt;&lt;</span> <span class="n">UF_PATH</span><span class="p">))</span> <span class="p">{</span>
<span class="n">memcpy</span><span class="p">(</span><span class="n">stream_data</span><span class="o">-&gt;</span><span class="n">path</span><span class="p">,</span>
<span class="o">&amp;</span><span class="n">uri</span><span class="p">[</span><span class="n">u</span><span class="o">-&gt;</span><span class="n">field_data</span><span class="p">[</span><span class="n">UF_PATH</span><span class="p">].</span><span class="n">off</span><span class="p">],</span> <span class="n">u</span><span class="o">-&gt;</span><span class="n">field_data</span><span class="p">[</span><span class="n">UF_PATH</span><span class="p">].</span><span class="n">len</span><span class="p">);</span>
<span class="n">memcpy</span><span class="p">(</span><span class="n">stream_data</span><span class="o">-&gt;</span><span class="n">path</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">uri</span><span class="p">[</span><span class="n">u</span><span class="o">-&gt;</span><span class="n">field_data</span><span class="p">[</span><span class="n">UF_PATH</span><span class="p">].</span><span class="n">off</span><span class="p">],</span>
<span class="n">u</span><span class="o">-&gt;</span><span class="n">field_data</span><span class="p">[</span><span class="n">UF_PATH</span><span class="p">].</span><span class="n">len</span><span class="p">);</span>
<span class="p">}</span>
<span class="k">if</span> <span class="p">(</span><span class="n">u</span><span class="o">-&gt;</span><span class="n">field_set</span> <span class="o">&amp;</span> <span class="p">(</span><span class="mi">1</span> <span class="o">&lt;&lt;</span> <span class="n">UF_QUERY</span><span class="p">))</span> <span class="p">{</span>
<span class="n">memcpy</span><span class="p">(</span><span class="n">stream_data</span><span class="o">-&gt;</span><span class="n">path</span> <span class="o">+</span> <span class="n">u</span><span class="o">-&gt;</span><span class="n">field_data</span><span class="p">[</span><span class="n">UF_PATH</span><span class="p">].</span><span class="n">len</span> <span class="o">+</span> <span class="mi">1</span><span class="p">,</span>
@ -765,16 +754,15 @@ here.</p>
<span class="k">return</span> <span class="n">stream_data</span><span class="p">;</span>
<span class="p">}</span>
<span class="k">static</span> <span class="kt">void</span> <span class="nf">delete_http2_stream_data</span><span class="p">(</span><span class="n">http2_stream_data</span> <span class="o">*</span><span class="n">stream_data</span><span class="p">)</span>
<span class="p">{</span>
<span class="k">static</span> <span class="kt">void</span> <span class="nf">delete_http2_stream_data</span><span class="p">(</span><span class="n">http2_stream_data</span> <span class="o">*</span><span class="n">stream_data</span><span class="p">)</span> <span class="p">{</span>
<span class="n">free</span><span class="p">(</span><span class="n">stream_data</span><span class="o">-&gt;</span><span class="n">path</span><span class="p">);</span>
<span class="n">free</span><span class="p">(</span><span class="n">stream_data</span><span class="o">-&gt;</span><span class="n">authority</span><span class="p">);</span>
<span class="n">free</span><span class="p">(</span><span class="n">stream_data</span><span class="p">);</span>
<span class="p">}</span>
<span class="cm">/* Initializes |session_data| */</span>
<span class="k">static</span> <span class="n">http2_session_data</span> <span class="o">*</span><span class="nf">create_http2_session_data</span><span class="p">(</span><span class="k">struct</span> <span class="n">event_base</span> <span class="o">*</span><span class="n">evbase</span><span class="p">)</span>
<span class="p">{</span>
<span class="k">static</span> <span class="n">http2_session_data</span> <span class="o">*</span>
<span class="nf">create_http2_session_data</span><span class="p">(</span><span class="k">struct</span> <span class="n">event_base</span> <span class="o">*</span><span class="n">evbase</span><span class="p">)</span> <span class="p">{</span>
<span class="n">http2_session_data</span> <span class="o">*</span><span class="n">session_data</span> <span class="o">=</span> <span class="n">malloc</span><span class="p">(</span><span class="k">sizeof</span><span class="p">(</span><span class="n">http2_session_data</span><span class="p">));</span>
<span class="n">memset</span><span class="p">(</span><span class="n">session_data</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="k">sizeof</span><span class="p">(</span><span class="n">http2_session_data</span><span class="p">));</span>
@ -782,8 +770,7 @@ here.</p>
<span class="k">return</span> <span class="n">session_data</span><span class="p">;</span>
<span class="p">}</span>
<span class="k">static</span> <span class="kt">void</span> <span class="nf">delete_http2_session_data</span><span class="p">(</span><span class="n">http2_session_data</span> <span class="o">*</span><span class="n">session_data</span><span class="p">)</span>
<span class="p">{</span>
<span class="k">static</span> <span class="kt">void</span> <span class="nf">delete_http2_session_data</span><span class="p">(</span><span class="n">http2_session_data</span> <span class="o">*</span><span class="n">session_data</span><span class="p">)</span> <span class="p">{</span>
<span class="n">SSL</span> <span class="o">*</span><span class="n">ssl</span> <span class="o">=</span> <span class="n">bufferevent_openssl_get_ssl</span><span class="p">(</span><span class="n">session_data</span><span class="o">-&gt;</span><span class="n">bev</span><span class="p">);</span>
<span class="k">if</span> <span class="p">(</span><span class="n">ssl</span><span class="p">)</span> <span class="p">{</span>
@ -802,10 +789,8 @@ here.</p>
<span class="n">free</span><span class="p">(</span><span class="n">session_data</span><span class="p">);</span>
<span class="p">}</span>
<span class="k">static</span> <span class="kt">void</span> <span class="nf">print_header</span><span class="p">(</span><span class="kt">FILE</span> <span class="o">*</span><span class="n">f</span><span class="p">,</span>
<span class="k">const</span> <span class="kt">uint8_t</span> <span class="o">*</span><span class="n">name</span><span class="p">,</span> <span class="kt">size_t</span> <span class="n">namelen</span><span class="p">,</span>
<span class="k">const</span> <span class="kt">uint8_t</span> <span class="o">*</span><span class="n">value</span><span class="p">,</span> <span class="kt">size_t</span> <span class="n">valuelen</span><span class="p">)</span>
<span class="p">{</span>
<span class="k">static</span> <span class="kt">void</span> <span class="nf">print_header</span><span class="p">(</span><span class="kt">FILE</span> <span class="o">*</span><span class="n">f</span><span class="p">,</span> <span class="k">const</span> <span class="kt">uint8_t</span> <span class="o">*</span><span class="n">name</span><span class="p">,</span> <span class="kt">size_t</span> <span class="n">namelen</span><span class="p">,</span>
<span class="k">const</span> <span class="kt">uint8_t</span> <span class="o">*</span><span class="n">value</span><span class="p">,</span> <span class="kt">size_t</span> <span class="n">valuelen</span><span class="p">)</span> <span class="p">{</span>
<span class="n">fwrite</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">namelen</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="n">f</span><span class="p">);</span>
<span class="n">fprintf</span><span class="p">(</span><span class="n">f</span><span class="p">,</span> <span class="s">&quot;: &quot;</span><span class="p">);</span>
<span class="n">fwrite</span><span class="p">(</span><span class="n">value</span><span class="p">,</span> <span class="n">valuelen</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="n">f</span><span class="p">);</span>
@ -815,13 +800,10 @@ here.</p>
<span class="cm">/* Print HTTP headers to |f|. Please note that this function does not</span>
<span class="cm"> take into account that header name and value are sequence of</span>
<span class="cm"> octets, therefore they may contain non-printable characters. */</span>
<span class="k">static</span> <span class="kt">void</span> <span class="nf">print_headers</span><span class="p">(</span><span class="kt">FILE</span> <span class="o">*</span><span class="n">f</span><span class="p">,</span> <span class="n">nghttp2_nv</span> <span class="o">*</span><span class="n">nva</span><span class="p">,</span> <span class="kt">size_t</span> <span class="n">nvlen</span><span class="p">)</span>
<span class="p">{</span>
<span class="k">static</span> <span class="kt">void</span> <span class="nf">print_headers</span><span class="p">(</span><span class="kt">FILE</span> <span class="o">*</span><span class="n">f</span><span class="p">,</span> <span class="n">nghttp2_nv</span> <span class="o">*</span><span class="n">nva</span><span class="p">,</span> <span class="kt">size_t</span> <span class="n">nvlen</span><span class="p">)</span> <span class="p">{</span>
<span class="kt">size_t</span> <span class="n">i</span><span class="p">;</span>
<span class="k">for</span> <span class="p">(</span><span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">i</span> <span class="o">&lt;</span> <span class="n">nvlen</span><span class="p">;</span> <span class="o">++</span><span class="n">i</span><span class="p">)</span> <span class="p">{</span>
<span class="n">print_header</span><span class="p">(</span><span class="n">f</span><span class="p">,</span>
<span class="n">nva</span><span class="p">[</span><span class="n">i</span><span class="p">].</span><span class="n">name</span><span class="p">,</span> <span class="n">nva</span><span class="p">[</span><span class="n">i</span><span class="p">].</span><span class="n">namelen</span><span class="p">,</span>
<span class="n">nva</span><span class="p">[</span><span class="n">i</span><span class="p">].</span><span class="n">value</span><span class="p">,</span> <span class="n">nva</span><span class="p">[</span><span class="n">i</span><span class="p">].</span><span class="n">valuelen</span><span class="p">);</span>
<span class="n">print_header</span><span class="p">(</span><span class="n">f</span><span class="p">,</span> <span class="n">nva</span><span class="p">[</span><span class="n">i</span><span class="p">].</span><span class="n">name</span><span class="p">,</span> <span class="n">nva</span><span class="p">[</span><span class="n">i</span><span class="p">].</span><span class="n">namelen</span><span class="p">,</span> <span class="n">nva</span><span class="p">[</span><span class="n">i</span><span class="p">].</span><span class="n">value</span><span class="p">,</span> <span class="n">nva</span><span class="p">[</span><span class="n">i</span><span class="p">].</span><span class="n">valuelen</span><span class="p">);</span>
<span class="p">}</span>
<span class="n">fprintf</span><span class="p">(</span><span class="n">f</span><span class="p">,</span> <span class="s">&quot;</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">);</span>
<span class="p">}</span>
@ -829,10 +811,8 @@ here.</p>
<span class="cm">/* nghttp2_send_callback. Here we transmit the |data|, |length| bytes,</span>
<span class="cm"> to the network. Because we are using libevent bufferevent, we just</span>
<span class="cm"> write those bytes into bufferevent buffer. */</span>
<span class="k">static</span> <span class="kt">ssize_t</span> <span class="nf">send_callback</span><span class="p">(</span><span class="n">nghttp2_session</span> <span class="o">*</span><span class="n">session</span><span class="p">,</span>
<span class="k">const</span> <span class="kt">uint8_t</span> <span class="o">*</span><span class="n">data</span><span class="p">,</span> <span class="kt">size_t</span> <span class="n">length</span><span class="p">,</span>
<span class="kt">int</span> <span class="n">flags</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">user_data</span><span class="p">)</span>
<span class="p">{</span>
<span class="k">static</span> <span class="kt">ssize_t</span> <span class="nf">send_callback</span><span class="p">(</span><span class="n">nghttp2_session</span> <span class="o">*</span><span class="n">session</span> <span class="n">_U_</span><span class="p">,</span> <span class="k">const</span> <span class="kt">uint8_t</span> <span class="o">*</span><span class="n">data</span><span class="p">,</span>
<span class="kt">size_t</span> <span class="n">length</span><span class="p">,</span> <span class="kt">int</span> <span class="n">flags</span> <span class="n">_U_</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">user_data</span><span class="p">)</span> <span class="p">{</span>
<span class="n">http2_session_data</span> <span class="o">*</span><span class="n">session_data</span> <span class="o">=</span> <span class="p">(</span><span class="n">http2_session_data</span> <span class="o">*</span><span class="p">)</span><span class="n">user_data</span><span class="p">;</span>
<span class="k">struct</span> <span class="n">bufferevent</span> <span class="o">*</span><span class="n">bev</span> <span class="o">=</span> <span class="n">session_data</span><span class="o">-&gt;</span><span class="n">bev</span><span class="p">;</span>
<span class="n">bufferevent_write</span><span class="p">(</span><span class="n">bev</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="n">length</span><span class="p">);</span>
@ -841,16 +821,14 @@ here.</p>
<span class="cm">/* nghttp2_on_header_callback: Called when nghttp2 library emits</span>
<span class="cm"> single header name/value pair. */</span>
<span class="k">static</span> <span class="kt">int</span> <span class="nf">on_header_callback</span><span class="p">(</span><span class="n">nghttp2_session</span> <span class="o">*</span><span class="n">session</span><span class="p">,</span>
<span class="k">const</span> <span class="n">nghttp2_frame</span> <span class="o">*</span><span class="n">frame</span><span class="p">,</span>
<span class="k">const</span> <span class="kt">uint8_t</span> <span class="o">*</span><span class="n">name</span><span class="p">,</span> <span class="kt">size_t</span> <span class="n">namelen</span><span class="p">,</span>
<span class="k">const</span> <span class="kt">uint8_t</span> <span class="o">*</span><span class="n">value</span><span class="p">,</span> <span class="kt">size_t</span> <span class="n">valuelen</span><span class="p">,</span>
<span class="kt">uint8_t</span> <span class="n">flags</span><span class="p">,</span>
<span class="kt">void</span> <span class="o">*</span><span class="n">user_data</span><span class="p">)</span>
<span class="p">{</span>
<span class="k">static</span> <span class="kt">int</span> <span class="nf">on_header_callback</span><span class="p">(</span><span class="n">nghttp2_session</span> <span class="o">*</span><span class="n">session</span> <span class="n">_U_</span><span class="p">,</span>
<span class="k">const</span> <span class="n">nghttp2_frame</span> <span class="o">*</span><span class="n">frame</span><span class="p">,</span> <span class="k">const</span> <span class="kt">uint8_t</span> <span class="o">*</span><span class="n">name</span><span class="p">,</span>
<span class="kt">size_t</span> <span class="n">namelen</span><span class="p">,</span> <span class="k">const</span> <span class="kt">uint8_t</span> <span class="o">*</span><span class="n">value</span><span class="p">,</span>
<span class="kt">size_t</span> <span class="n">valuelen</span><span class="p">,</span> <span class="kt">uint8_t</span> <span class="n">flags</span> <span class="n">_U_</span><span class="p">,</span>
<span class="kt">void</span> <span class="o">*</span><span class="n">user_data</span><span class="p">)</span> <span class="p">{</span>
<span class="n">http2_session_data</span> <span class="o">*</span><span class="n">session_data</span> <span class="o">=</span> <span class="p">(</span><span class="n">http2_session_data</span> <span class="o">*</span><span class="p">)</span><span class="n">user_data</span><span class="p">;</span>
<span class="k">switch</span> <span class="p">(</span><span class="n">frame</span><span class="o">-&gt;</span><span class="n">hd</span><span class="p">.</span><span class="n">type</span><span class="p">)</span> <span class="p">{</span>
<span class="k">case</span> <span class="n">NGHTTP2_HEADERS</span>:
<span class="k">case</span> <span class="nl">NGHTTP2_HEADERS</span><span class="p">:</span>
<span class="k">if</span> <span class="p">(</span><span class="n">frame</span><span class="o">-&gt;</span><span class="n">headers</span><span class="p">.</span><span class="n">cat</span> <span class="o">==</span> <span class="n">NGHTTP2_HCAT_RESPONSE</span> <span class="o">&amp;&amp;</span>
<span class="n">session_data</span><span class="o">-&gt;</span><span class="n">stream_data</span><span class="o">-&gt;</span><span class="n">stream_id</span> <span class="o">==</span> <span class="n">frame</span><span class="o">-&gt;</span><span class="n">hd</span><span class="p">.</span><span class="n">stream_id</span><span class="p">)</span> <span class="p">{</span>
<span class="cm">/* Print response headers for the initiated request. */</span>
@ -863,13 +841,12 @@ here.</p>
<span class="cm">/* nghttp2_on_begin_headers_callback: Called when nghttp2 library gets</span>
<span class="cm"> started to receive header block. */</span>
<span class="k">static</span> <span class="kt">int</span> <span class="nf">on_begin_headers_callback</span><span class="p">(</span><span class="n">nghttp2_session</span> <span class="o">*</span><span class="n">session</span><span class="p">,</span>
<span class="k">static</span> <span class="kt">int</span> <span class="nf">on_begin_headers_callback</span><span class="p">(</span><span class="n">nghttp2_session</span> <span class="o">*</span><span class="n">session</span> <span class="n">_U_</span><span class="p">,</span>
<span class="k">const</span> <span class="n">nghttp2_frame</span> <span class="o">*</span><span class="n">frame</span><span class="p">,</span>
<span class="kt">void</span> <span class="o">*</span><span class="n">user_data</span><span class="p">)</span>
<span class="p">{</span>
<span class="kt">void</span> <span class="o">*</span><span class="n">user_data</span><span class="p">)</span> <span class="p">{</span>
<span class="n">http2_session_data</span> <span class="o">*</span><span class="n">session_data</span> <span class="o">=</span> <span class="p">(</span><span class="n">http2_session_data</span> <span class="o">*</span><span class="p">)</span><span class="n">user_data</span><span class="p">;</span>
<span class="k">switch</span> <span class="p">(</span><span class="n">frame</span><span class="o">-&gt;</span><span class="n">hd</span><span class="p">.</span><span class="n">type</span><span class="p">)</span> <span class="p">{</span>
<span class="k">case</span> <span class="n">NGHTTP2_HEADERS</span>:
<span class="k">case</span> <span class="nl">NGHTTP2_HEADERS</span><span class="p">:</span>
<span class="k">if</span> <span class="p">(</span><span class="n">frame</span><span class="o">-&gt;</span><span class="n">headers</span><span class="p">.</span><span class="n">cat</span> <span class="o">==</span> <span class="n">NGHTTP2_HCAT_RESPONSE</span> <span class="o">&amp;&amp;</span>
<span class="n">session_data</span><span class="o">-&gt;</span><span class="n">stream_data</span><span class="o">-&gt;</span><span class="n">stream_id</span> <span class="o">==</span> <span class="n">frame</span><span class="o">-&gt;</span><span class="n">hd</span><span class="p">.</span><span class="n">stream_id</span><span class="p">)</span> <span class="p">{</span>
<span class="n">fprintf</span><span class="p">(</span><span class="n">stderr</span><span class="p">,</span> <span class="s">&quot;Response headers for stream ID=%d:</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">,</span>
@ -882,12 +859,11 @@ here.</p>
<span class="cm">/* nghttp2_on_frame_recv_callback: Called when nghttp2 library</span>
<span class="cm"> received a complete frame from the remote peer. */</span>
<span class="k">static</span> <span class="kt">int</span> <span class="nf">on_frame_recv_callback</span><span class="p">(</span><span class="n">nghttp2_session</span> <span class="o">*</span><span class="n">session</span><span class="p">,</span>
<span class="k">const</span> <span class="n">nghttp2_frame</span> <span class="o">*</span><span class="n">frame</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">user_data</span><span class="p">)</span>
<span class="p">{</span>
<span class="k">static</span> <span class="kt">int</span> <span class="nf">on_frame_recv_callback</span><span class="p">(</span><span class="n">nghttp2_session</span> <span class="o">*</span><span class="n">session</span> <span class="n">_U_</span><span class="p">,</span>
<span class="k">const</span> <span class="n">nghttp2_frame</span> <span class="o">*</span><span class="n">frame</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">user_data</span><span class="p">)</span> <span class="p">{</span>
<span class="n">http2_session_data</span> <span class="o">*</span><span class="n">session_data</span> <span class="o">=</span> <span class="p">(</span><span class="n">http2_session_data</span> <span class="o">*</span><span class="p">)</span><span class="n">user_data</span><span class="p">;</span>
<span class="k">switch</span> <span class="p">(</span><span class="n">frame</span><span class="o">-&gt;</span><span class="n">hd</span><span class="p">.</span><span class="n">type</span><span class="p">)</span> <span class="p">{</span>
<span class="k">case</span> <span class="n">NGHTTP2_HEADERS</span>:
<span class="k">case</span> <span class="nl">NGHTTP2_HEADERS</span><span class="p">:</span>
<span class="k">if</span> <span class="p">(</span><span class="n">frame</span><span class="o">-&gt;</span><span class="n">headers</span><span class="p">.</span><span class="n">cat</span> <span class="o">==</span> <span class="n">NGHTTP2_HCAT_RESPONSE</span> <span class="o">&amp;&amp;</span>
<span class="n">session_data</span><span class="o">-&gt;</span><span class="n">stream_data</span><span class="o">-&gt;</span><span class="n">stream_id</span> <span class="o">==</span> <span class="n">frame</span><span class="o">-&gt;</span><span class="n">hd</span><span class="p">.</span><span class="n">stream_id</span><span class="p">)</span> <span class="p">{</span>
<span class="n">fprintf</span><span class="p">(</span><span class="n">stderr</span><span class="p">,</span> <span class="s">&quot;All headers received</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">);</span>
@ -902,11 +878,10 @@ here.</p>
<span class="cm"> is meant to the stream we initiated, print the received data in</span>
<span class="cm"> stdout, so that the user can redirect its output to the file</span>
<span class="cm"> easily. */</span>
<span class="k">static</span> <span class="kt">int</span> <span class="nf">on_data_chunk_recv_callback</span><span class="p">(</span><span class="n">nghttp2_session</span> <span class="o">*</span><span class="n">session</span><span class="p">,</span> <span class="kt">uint8_t</span> <span class="n">flags</span><span class="p">,</span>
<span class="kt">int32_t</span> <span class="n">stream_id</span><span class="p">,</span>
<span class="k">static</span> <span class="kt">int</span> <span class="nf">on_data_chunk_recv_callback</span><span class="p">(</span><span class="n">nghttp2_session</span> <span class="o">*</span><span class="n">session</span> <span class="n">_U_</span><span class="p">,</span>
<span class="kt">uint8_t</span> <span class="n">flags</span> <span class="n">_U_</span><span class="p">,</span> <span class="kt">int32_t</span> <span class="n">stream_id</span><span class="p">,</span>
<span class="k">const</span> <span class="kt">uint8_t</span> <span class="o">*</span><span class="n">data</span><span class="p">,</span> <span class="kt">size_t</span> <span class="n">len</span><span class="p">,</span>
<span class="kt">void</span> <span class="o">*</span><span class="n">user_data</span><span class="p">)</span>
<span class="p">{</span>
<span class="kt">void</span> <span class="o">*</span><span class="n">user_data</span><span class="p">)</span> <span class="p">{</span>
<span class="n">http2_session_data</span> <span class="o">*</span><span class="n">session_data</span> <span class="o">=</span> <span class="p">(</span><span class="n">http2_session_data</span> <span class="o">*</span><span class="p">)</span><span class="n">user_data</span><span class="p">;</span>
<span class="k">if</span> <span class="p">(</span><span class="n">session_data</span><span class="o">-&gt;</span><span class="n">stream_data</span><span class="o">-&gt;</span><span class="n">stream_id</span> <span class="o">==</span> <span class="n">stream_id</span><span class="p">)</span> <span class="p">{</span>
<span class="n">fwrite</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="n">len</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="n">stdout</span><span class="p">);</span>
@ -918,17 +893,15 @@ here.</p>
<span class="cm"> closed. This example program only deals with 1 HTTP request (1</span>
<span class="cm"> stream), if it is closed, we send GOAWAY and tear down the</span>
<span class="cm"> session */</span>
<span class="k">static</span> <span class="kt">int</span> <span class="nf">on_stream_close_callback</span><span class="p">(</span><span class="n">nghttp2_session</span> <span class="o">*</span><span class="n">session</span><span class="p">,</span>
<span class="kt">int32_t</span> <span class="n">stream_id</span><span class="p">,</span>
<span class="n">nghttp2_error_code</span> <span class="n">error_code</span><span class="p">,</span>
<span class="kt">void</span> <span class="o">*</span><span class="n">user_data</span><span class="p">)</span>
<span class="p">{</span>
<span class="k">static</span> <span class="kt">int</span> <span class="nf">on_stream_close_callback</span><span class="p">(</span><span class="n">nghttp2_session</span> <span class="o">*</span><span class="n">session</span><span class="p">,</span> <span class="kt">int32_t</span> <span class="n">stream_id</span><span class="p">,</span>
<span class="kt">uint32_t</span> <span class="n">error_code</span><span class="p">,</span>
<span class="kt">void</span> <span class="o">*</span><span class="n">user_data</span><span class="p">)</span> <span class="p">{</span>
<span class="n">http2_session_data</span> <span class="o">*</span><span class="n">session_data</span> <span class="o">=</span> <span class="p">(</span><span class="n">http2_session_data</span> <span class="o">*</span><span class="p">)</span><span class="n">user_data</span><span class="p">;</span>
<span class="kt">int</span> <span class="n">rv</span><span class="p">;</span>
<span class="k">if</span> <span class="p">(</span><span class="n">session_data</span><span class="o">-&gt;</span><span class="n">stream_data</span><span class="o">-&gt;</span><span class="n">stream_id</span> <span class="o">==</span> <span class="n">stream_id</span><span class="p">)</span> <span class="p">{</span>
<span class="n">fprintf</span><span class="p">(</span><span class="n">stderr</span><span class="p">,</span> <span class="s">&quot;Stream %d closed with error_code=%d</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">,</span>
<span class="n">stream_id</span><span class="p">,</span> <span class="n">error_code</span><span class="p">);</span>
<span class="n">fprintf</span><span class="p">(</span><span class="n">stderr</span><span class="p">,</span> <span class="s">&quot;Stream %d closed with error_code=%d</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">,</span> <span class="n">stream_id</span><span class="p">,</span>
<span class="n">error_code</span><span class="p">);</span>
<span class="n">rv</span> <span class="o">=</span> <span class="n">nghttp2_session_terminate_session</span><span class="p">(</span><span class="n">session</span><span class="p">,</span> <span class="n">NGHTTP2_NO_ERROR</span><span class="p">);</span>
<span class="k">if</span> <span class="p">(</span><span class="n">rv</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
<span class="k">return</span> <span class="n">NGHTTP2_ERR_CALLBACK_FAILURE</span><span class="p">;</span>
@ -940,11 +913,9 @@ here.</p>
<span class="cm">/* NPN TLS extension client callback. We check that server advertised</span>
<span class="cm"> the HTTP/2 protocol the nghttp2 library supports. If not, exit</span>
<span class="cm"> the program. */</span>
<span class="k">static</span> <span class="kt">int</span> <span class="nf">select_next_proto_cb</span><span class="p">(</span><span class="n">SSL</span><span class="o">*</span> <span class="n">ssl</span><span class="p">,</span>
<span class="kt">unsigned</span> <span class="kt">char</span> <span class="o">**</span><span class="n">out</span><span class="p">,</span> <span class="kt">unsigned</span> <span class="kt">char</span> <span class="o">*</span><span class="n">outlen</span><span class="p">,</span>
<span class="k">const</span> <span class="kt">unsigned</span> <span class="kt">char</span> <span class="o">*</span><span class="n">in</span><span class="p">,</span> <span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">inlen</span><span class="p">,</span>
<span class="kt">void</span> <span class="o">*</span><span class="n">arg</span><span class="p">)</span>
<span class="p">{</span>
<span class="k">static</span> <span class="kt">int</span> <span class="nf">select_next_proto_cb</span><span class="p">(</span><span class="n">SSL</span> <span class="o">*</span><span class="n">ssl</span> <span class="n">_U_</span><span class="p">,</span> <span class="kt">unsigned</span> <span class="kt">char</span> <span class="o">**</span><span class="n">out</span><span class="p">,</span>
<span class="kt">unsigned</span> <span class="kt">char</span> <span class="o">*</span><span class="n">outlen</span><span class="p">,</span> <span class="k">const</span> <span class="kt">unsigned</span> <span class="kt">char</span> <span class="o">*</span><span class="n">in</span><span class="p">,</span>
<span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">inlen</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">arg</span> <span class="n">_U_</span><span class="p">)</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="n">nghttp2_select_next_protocol</span><span class="p">(</span><span class="n">out</span><span class="p">,</span> <span class="n">outlen</span><span class="p">,</span> <span class="n">in</span><span class="p">,</span> <span class="n">inlen</span><span class="p">)</span> <span class="o">&lt;=</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
<span class="n">errx</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Server did not advertise &quot;</span> <span class="n">NGHTTP2_PROTO_VERSION_ID</span><span class="p">);</span>
<span class="p">}</span>
@ -952,8 +923,7 @@ here.</p>
<span class="p">}</span>
<span class="cm">/* Create SSL_CTX. */</span>
<span class="k">static</span> <span class="n">SSL_CTX</span><span class="o">*</span> <span class="nf">create_ssl_ctx</span><span class="p">(</span><span class="kt">void</span><span class="p">)</span>
<span class="p">{</span>
<span class="k">static</span> <span class="n">SSL_CTX</span> <span class="o">*</span><span class="nf">create_ssl_ctx</span><span class="p">(</span><span class="kt">void</span><span class="p">)</span> <span class="p">{</span>
<span class="n">SSL_CTX</span> <span class="o">*</span><span class="n">ssl_ctx</span><span class="p">;</span>
<span class="n">ssl_ctx</span> <span class="o">=</span> <span class="n">SSL_CTX_new</span><span class="p">(</span><span class="n">SSLv23_client_method</span><span class="p">());</span>
<span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">ssl_ctx</span><span class="p">)</span> <span class="p">{</span>
@ -961,15 +931,15 @@ here.</p>
<span class="n">ERR_error_string</span><span class="p">(</span><span class="n">ERR_get_error</span><span class="p">(),</span> <span class="nb">NULL</span><span class="p">));</span>
<span class="p">}</span>
<span class="n">SSL_CTX_set_options</span><span class="p">(</span><span class="n">ssl_ctx</span><span class="p">,</span>
<span class="n">SSL_OP_ALL</span> <span class="o">|</span> <span class="n">SSL_OP_NO_SSLv2</span> <span class="o">|</span> <span class="n">SSL_OP_NO_COMPRESSION</span> <span class="o">|</span>
<span class="n">SSL_OP_ALL</span> <span class="o">|</span> <span class="n">SSL_OP_NO_SSLv2</span> <span class="o">|</span> <span class="n">SSL_OP_NO_SSLv3</span> <span class="o">|</span>
<span class="n">SSL_OP_NO_COMPRESSION</span> <span class="o">|</span>
<span class="n">SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION</span><span class="p">);</span>
<span class="n">SSL_CTX_set_next_proto_select_cb</span><span class="p">(</span><span class="n">ssl_ctx</span><span class="p">,</span> <span class="n">select_next_proto_cb</span><span class="p">,</span> <span class="nb">NULL</span><span class="p">);</span>
<span class="k">return</span> <span class="n">ssl_ctx</span><span class="p">;</span>
<span class="p">}</span>
<span class="cm">/* Create SSL object */</span>
<span class="k">static</span> <span class="n">SSL</span><span class="o">*</span> <span class="nf">create_ssl</span><span class="p">(</span><span class="n">SSL_CTX</span> <span class="o">*</span><span class="n">ssl_ctx</span><span class="p">)</span>
<span class="p">{</span>
<span class="k">static</span> <span class="n">SSL</span> <span class="o">*</span><span class="nf">create_ssl</span><span class="p">(</span><span class="n">SSL_CTX</span> <span class="o">*</span><span class="n">ssl_ctx</span><span class="p">)</span> <span class="p">{</span>
<span class="n">SSL</span> <span class="o">*</span><span class="n">ssl</span><span class="p">;</span>
<span class="n">ssl</span> <span class="o">=</span> <span class="n">SSL_new</span><span class="p">(</span><span class="n">ssl_ctx</span><span class="p">);</span>
<span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">ssl</span><span class="p">)</span> <span class="p">{</span>
@ -979,77 +949,75 @@ here.</p>
<span class="k">return</span> <span class="n">ssl</span><span class="p">;</span>
<span class="p">}</span>
<span class="k">static</span> <span class="kt">void</span> <span class="nf">initialize_nghttp2_session</span><span class="p">(</span><span class="n">http2_session_data</span> <span class="o">*</span><span class="n">session_data</span><span class="p">)</span>
<span class="p">{</span>
<span class="k">static</span> <span class="kt">void</span> <span class="nf">initialize_nghttp2_session</span><span class="p">(</span><span class="n">http2_session_data</span> <span class="o">*</span><span class="n">session_data</span><span class="p">)</span> <span class="p">{</span>
<span class="n">nghttp2_session_callbacks</span> <span class="o">*</span><span class="n">callbacks</span><span class="p">;</span>
<span class="n">nghttp2_session_callbacks_new</span><span class="p">(</span><span class="o">&amp;</span><span class="n">callbacks</span><span class="p">);</span>
<span class="n">nghttp2_session_callbacks_set_send_callback</span><span class="p">(</span><span class="n">callbacks</span><span class="p">,</span> <span class="n">send_callback</span><span class="p">);</span>
<span class="n">nghttp2_session_callbacks_set_on_frame_recv_callback</span>
<span class="p">(</span><span class="n">callbacks</span><span class="p">,</span> <span class="n">on_frame_recv_callback</span><span class="p">);</span>
<span class="n">nghttp2_session_callbacks_set_on_frame_recv_callback</span><span class="p">(</span><span class="n">callbacks</span><span class="p">,</span>
<span class="n">on_frame_recv_callback</span><span class="p">);</span>
<span class="n">nghttp2_session_callbacks_set_on_data_chunk_recv_callback</span>
<span class="p">(</span><span class="n">callbacks</span><span class="p">,</span> <span class="n">on_data_chunk_recv_callback</span><span class="p">);</span>
<span class="n">nghttp2_session_callbacks_set_on_data_chunk_recv_callback</span><span class="p">(</span>
<span class="n">callbacks</span><span class="p">,</span> <span class="n">on_data_chunk_recv_callback</span><span class="p">);</span>
<span class="n">nghttp2_session_callbacks_set_on_stream_close_callback</span>
<span class="p">(</span><span class="n">callbacks</span><span class="p">,</span> <span class="n">on_stream_close_callback</span><span class="p">);</span>
<span class="n">nghttp2_session_callbacks_set_on_stream_close_callback</span><span class="p">(</span>
<span class="n">callbacks</span><span class="p">,</span> <span class="n">on_stream_close_callback</span><span class="p">);</span>
<span class="n">nghttp2_session_callbacks_set_on_header_callback</span>
<span class="p">(</span><span class="n">callbacks</span><span class="p">,</span> <span class="n">on_header_callback</span><span class="p">);</span>
<span class="n">nghttp2_session_callbacks_set_on_header_callback</span><span class="p">(</span><span class="n">callbacks</span><span class="p">,</span>
<span class="n">on_header_callback</span><span class="p">);</span>
<span class="n">nghttp2_session_callbacks_set_on_begin_headers_callback</span>
<span class="p">(</span><span class="n">callbacks</span><span class="p">,</span> <span class="n">on_begin_headers_callback</span><span class="p">);</span>
<span class="n">nghttp2_session_callbacks_set_on_begin_headers_callback</span><span class="p">(</span>
<span class="n">callbacks</span><span class="p">,</span> <span class="n">on_begin_headers_callback</span><span class="p">);</span>
<span class="n">nghttp2_session_client_new</span><span class="p">(</span><span class="o">&amp;</span><span class="n">session_data</span><span class="o">-&gt;</span><span class="n">session</span><span class="p">,</span> <span class="n">callbacks</span><span class="p">,</span> <span class="n">session_data</span><span class="p">);</span>
<span class="n">nghttp2_session_callbacks_del</span><span class="p">(</span><span class="n">callbacks</span><span class="p">);</span>
<span class="p">}</span>
<span class="k">static</span> <span class="kt">void</span> <span class="nf">send_client_connection_header</span><span class="p">(</span><span class="n">http2_session_data</span> <span class="o">*</span><span class="n">session_data</span><span class="p">)</span>
<span class="p">{</span>
<span class="k">static</span> <span class="kt">void</span> <span class="nf">send_client_connection_header</span><span class="p">(</span><span class="n">http2_session_data</span> <span class="o">*</span><span class="n">session_data</span><span class="p">)</span> <span class="p">{</span>
<span class="n">nghttp2_settings_entry</span> <span class="n">iv</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span>
<span class="p">{</span> <span class="n">NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS</span><span class="p">,</span> <span class="mi">100</span> <span class="p">}</span>
<span class="p">};</span>
<span class="p">{</span><span class="n">NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS</span><span class="p">,</span> <span class="mi">100</span><span class="p">}};</span>
<span class="kt">int</span> <span class="n">rv</span><span class="p">;</span>
<span class="n">bufferevent_write</span><span class="p">(</span><span class="n">session_data</span><span class="o">-&gt;</span><span class="n">bev</span><span class="p">,</span>
<span class="n">NGHTTP2_CLIENT_CONNECTION_PREFACE</span><span class="p">,</span>
<span class="n">bufferevent_write</span><span class="p">(</span><span class="n">session_data</span><span class="o">-&gt;</span><span class="n">bev</span><span class="p">,</span> <span class="n">NGHTTP2_CLIENT_CONNECTION_PREFACE</span><span class="p">,</span>
<span class="n">NGHTTP2_CLIENT_CONNECTION_PREFACE_LEN</span><span class="p">);</span>
<span class="n">rv</span> <span class="o">=</span> <span class="n">nghttp2_submit_settings</span><span class="p">(</span><span class="n">session_data</span><span class="o">-&gt;</span><span class="n">session</span><span class="p">,</span> <span class="n">NGHTTP2_FLAG_NONE</span><span class="p">,</span>
<span class="n">iv</span><span class="p">,</span> <span class="n">ARRLEN</span><span class="p">(</span><span class="n">iv</span><span class="p">));</span>
<span class="n">rv</span> <span class="o">=</span> <span class="n">nghttp2_submit_settings</span><span class="p">(</span><span class="n">session_data</span><span class="o">-&gt;</span><span class="n">session</span><span class="p">,</span> <span class="n">NGHTTP2_FLAG_NONE</span><span class="p">,</span> <span class="n">iv</span><span class="p">,</span>
<span class="n">ARRLEN</span><span class="p">(</span><span class="n">iv</span><span class="p">));</span>
<span class="k">if</span> <span class="p">(</span><span class="n">rv</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
<span class="n">errx</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Could not submit SETTINGS: %s&quot;</span><span class="p">,</span> <span class="n">nghttp2_strerror</span><span class="p">(</span><span class="n">rv</span><span class="p">));</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="cp">#define MAKE_NV(NAME, VALUE, VALUELEN) \</span>
<span class="cp"> { (uint8_t*)NAME, (uint8_t*)VALUE, sizeof(NAME) - 1, VALUELEN, \</span>
<span class="cp"> NGHTTP2_NV_FLAG_NONE }</span>
<span class="cp"> { \</span>
<span class="cp"> (uint8_t *) NAME, (uint8_t *)VALUE, sizeof(NAME) - 1, VALUELEN, \</span>
<span class="cp"> NGHTTP2_NV_FLAG_NONE \</span>
<span class="cp"> }</span>
<span class="cp">#define MAKE_NV2(NAME, VALUE) \</span>
<span class="cp"> { (uint8_t*)NAME, (uint8_t*)VALUE, sizeof(NAME) - 1, sizeof(VALUE) - 1, \</span>
<span class="cp"> NGHTTP2_NV_FLAG_NONE }</span>
<span class="cp"> { \</span>
<span class="cp"> (uint8_t *) NAME, (uint8_t *)VALUE, sizeof(NAME) - 1, sizeof(VALUE) - 1, \</span>
<span class="cp"> NGHTTP2_NV_FLAG_NONE \</span>
<span class="cp"> }</span>
<span class="cm">/* Send HTTP request to the remote peer */</span>
<span class="k">static</span> <span class="kt">void</span> <span class="nf">submit_request</span><span class="p">(</span><span class="n">http2_session_data</span> <span class="o">*</span><span class="n">session_data</span><span class="p">)</span>
<span class="p">{</span>
<span class="k">static</span> <span class="kt">void</span> <span class="nf">submit_request</span><span class="p">(</span><span class="n">http2_session_data</span> <span class="o">*</span><span class="n">session_data</span><span class="p">)</span> <span class="p">{</span>
<span class="kt">int32_t</span> <span class="n">stream_id</span><span class="p">;</span>
<span class="n">http2_stream_data</span> <span class="o">*</span><span class="n">stream_data</span> <span class="o">=</span> <span class="n">session_data</span><span class="o">-&gt;</span><span class="n">stream_data</span><span class="p">;</span>
<span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">uri</span> <span class="o">=</span> <span class="n">stream_data</span><span class="o">-&gt;</span><span class="n">uri</span><span class="p">;</span>
<span class="k">const</span> <span class="k">struct</span> <span class="n">http_parser_url</span> <span class="o">*</span><span class="n">u</span> <span class="o">=</span> <span class="n">stream_data</span><span class="o">-&gt;</span><span class="n">u</span><span class="p">;</span>
<span class="n">nghttp2_nv</span> <span class="n">hdrs</span><span class="p">[]</span> <span class="o">=</span> <span class="p">{</span>
<span class="n">MAKE_NV2</span><span class="p">(</span><span class="s">&quot;:method&quot;</span><span class="p">,</span> <span class="s">&quot;GET&quot;</span><span class="p">),</span>
<span class="n">MAKE_NV</span><span class="p">(</span><span class="s">&quot;:scheme&quot;</span><span class="p">,</span>
<span class="o">&amp;</span><span class="n">uri</span><span class="p">[</span><span class="n">u</span><span class="o">-&gt;</span><span class="n">field_data</span><span class="p">[</span><span class="n">UF_SCHEMA</span><span class="p">].</span><span class="n">off</span><span class="p">],</span> <span class="n">u</span><span class="o">-&gt;</span><span class="n">field_data</span><span class="p">[</span><span class="n">UF_SCHEMA</span><span class="p">].</span><span class="n">len</span><span class="p">),</span>
<span class="n">MAKE_NV</span><span class="p">(</span><span class="s">&quot;:scheme&quot;</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">uri</span><span class="p">[</span><span class="n">u</span><span class="o">-&gt;</span><span class="n">field_data</span><span class="p">[</span><span class="n">UF_SCHEMA</span><span class="p">].</span><span class="n">off</span><span class="p">],</span>
<span class="n">u</span><span class="o">-&gt;</span><span class="n">field_data</span><span class="p">[</span><span class="n">UF_SCHEMA</span><span class="p">].</span><span class="n">len</span><span class="p">),</span>
<span class="n">MAKE_NV</span><span class="p">(</span><span class="s">&quot;:authority&quot;</span><span class="p">,</span> <span class="n">stream_data</span><span class="o">-&gt;</span><span class="n">authority</span><span class="p">,</span> <span class="n">stream_data</span><span class="o">-&gt;</span><span class="n">authoritylen</span><span class="p">),</span>
<span class="n">MAKE_NV</span><span class="p">(</span><span class="s">&quot;:path&quot;</span><span class="p">,</span> <span class="n">stream_data</span><span class="o">-&gt;</span><span class="n">path</span><span class="p">,</span> <span class="n">stream_data</span><span class="o">-&gt;</span><span class="n">pathlen</span><span class="p">)</span>
<span class="p">};</span>
<span class="n">MAKE_NV</span><span class="p">(</span><span class="s">&quot;:path&quot;</span><span class="p">,</span> <span class="n">stream_data</span><span class="o">-&gt;</span><span class="n">path</span><span class="p">,</span> <span class="n">stream_data</span><span class="o">-&gt;</span><span class="n">pathlen</span><span class="p">)};</span>
<span class="n">fprintf</span><span class="p">(</span><span class="n">stderr</span><span class="p">,</span> <span class="s">&quot;Request headers:</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">);</span>
<span class="n">print_headers</span><span class="p">(</span><span class="n">stderr</span><span class="p">,</span> <span class="n">hdrs</span><span class="p">,</span> <span class="n">ARRLEN</span><span class="p">(</span><span class="n">hdrs</span><span class="p">));</span>
<span class="n">stream_id</span> <span class="o">=</span> <span class="n">nghttp2_submit_request</span><span class="p">(</span><span class="n">session_data</span><span class="o">-&gt;</span><span class="n">session</span><span class="p">,</span> <span class="nb">NULL</span><span class="p">,</span>
<span class="n">hdrs</span><span class="p">,</span> <span class="n">ARRLEN</span><span class="p">(</span><span class="n">hdrs</span><span class="p">),</span> <span class="nb">NULL</span><span class="p">,</span> <span class="n">stream_data</span><span class="p">);</span>
<span class="n">stream_id</span> <span class="o">=</span> <span class="n">nghttp2_submit_request</span><span class="p">(</span><span class="n">session_data</span><span class="o">-&gt;</span><span class="n">session</span><span class="p">,</span> <span class="nb">NULL</span><span class="p">,</span> <span class="n">hdrs</span><span class="p">,</span>
<span class="n">ARRLEN</span><span class="p">(</span><span class="n">hdrs</span><span class="p">),</span> <span class="nb">NULL</span><span class="p">,</span> <span class="n">stream_data</span><span class="p">);</span>
<span class="k">if</span> <span class="p">(</span><span class="n">stream_id</span> <span class="o">&lt;</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
<span class="n">errx</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="s">&quot;Could not submit HTTP request: %s&quot;</span><span class="p">,</span> <span class="n">nghttp2_strerror</span><span class="p">(</span><span class="n">stream_id</span><span class="p">));</span>
<span class="p">}</span>
@ -1059,8 +1027,7 @@ here.</p>
<span class="cm">/* Serialize the frame and send (or buffer) the data to</span>
<span class="cm"> bufferevent. */</span>
<span class="k">static</span> <span class="kt">int</span> <span class="nf">session_send</span><span class="p">(</span><span class="n">http2_session_data</span> <span class="o">*</span><span class="n">session_data</span><span class="p">)</span>
<span class="p">{</span>
<span class="k">static</span> <span class="kt">int</span> <span class="nf">session_send</span><span class="p">(</span><span class="n">http2_session_data</span> <span class="o">*</span><span class="n">session_data</span><span class="p">)</span> <span class="p">{</span>
<span class="kt">int</span> <span class="n">rv</span><span class="p">;</span>
<span class="n">rv</span> <span class="o">=</span> <span class="n">nghttp2_session_send</span><span class="p">(</span><span class="n">session_data</span><span class="o">-&gt;</span><span class="n">session</span><span class="p">);</span>
@ -1075,8 +1042,7 @@ here.</p>
<span class="cm"> of bufferevent and feed them to nghttp2 library. This may invoke</span>
<span class="cm"> nghttp2 callbacks. It may also queues the frame in nghttp2 session</span>
<span class="cm"> context. To send them, we call session_send() in the end. */</span>
<span class="k">static</span> <span class="kt">void</span> <span class="nf">readcb</span><span class="p">(</span><span class="k">struct</span> <span class="n">bufferevent</span> <span class="o">*</span><span class="n">bev</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">ptr</span><span class="p">)</span>
<span class="p">{</span>
<span class="k">static</span> <span class="kt">void</span> <span class="nf">readcb</span><span class="p">(</span><span class="k">struct</span> <span class="n">bufferevent</span> <span class="o">*</span><span class="n">bev</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">ptr</span><span class="p">)</span> <span class="p">{</span>
<span class="n">http2_session_data</span> <span class="o">*</span><span class="n">session_data</span> <span class="o">=</span> <span class="p">(</span><span class="n">http2_session_data</span> <span class="o">*</span><span class="p">)</span><span class="n">ptr</span><span class="p">;</span>
<span class="kt">ssize_t</span> <span class="n">readlen</span><span class="p">;</span>
<span class="k">struct</span> <span class="n">evbuffer</span> <span class="o">*</span><span class="n">input</span> <span class="o">=</span> <span class="n">bufferevent_get_input</span><span class="p">(</span><span class="n">bev</span><span class="p">);</span>
@ -1104,8 +1070,7 @@ here.</p>
<span class="cm"> receiving GOAWAY, we check the some conditions on the nghttp2</span>
<span class="cm"> library and output buffer of bufferevent. If it indicates we have</span>
<span class="cm"> no business to this session, tear down the connection. */</span>
<span class="k">static</span> <span class="kt">void</span> <span class="nf">writecb</span><span class="p">(</span><span class="k">struct</span> <span class="n">bufferevent</span> <span class="o">*</span><span class="n">bev</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">ptr</span><span class="p">)</span>
<span class="p">{</span>
<span class="k">static</span> <span class="kt">void</span> <span class="nf">writecb</span><span class="p">(</span><span class="k">struct</span> <span class="n">bufferevent</span> <span class="o">*</span><span class="n">bev</span> <span class="n">_U_</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">ptr</span><span class="p">)</span> <span class="p">{</span>
<span class="n">http2_session_data</span> <span class="o">*</span><span class="n">session_data</span> <span class="o">=</span> <span class="p">(</span><span class="n">http2_session_data</span> <span class="o">*</span><span class="p">)</span><span class="n">ptr</span><span class="p">;</span>
<span class="k">if</span> <span class="p">(</span><span class="n">nghttp2_session_want_read</span><span class="p">(</span><span class="n">session_data</span><span class="o">-&gt;</span><span class="n">session</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span> <span class="o">&amp;&amp;</span>
<span class="n">nghttp2_session_want_write</span><span class="p">(</span><span class="n">session_data</span><span class="o">-&gt;</span><span class="n">session</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span> <span class="o">&amp;&amp;</span>
@ -1119,8 +1084,7 @@ here.</p>
<span class="cm"> peer verification. After SSL/TLS handshake is over, initialize</span>
<span class="cm"> nghttp2 library session, and send client connection header. Then</span>
<span class="cm"> send HTTP request. */</span>
<span class="k">static</span> <span class="kt">void</span> <span class="nf">eventcb</span><span class="p">(</span><span class="k">struct</span> <span class="n">bufferevent</span> <span class="o">*</span><span class="n">bev</span><span class="p">,</span> <span class="kt">short</span> <span class="n">events</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">ptr</span><span class="p">)</span>
<span class="p">{</span>
<span class="k">static</span> <span class="kt">void</span> <span class="nf">eventcb</span><span class="p">(</span><span class="k">struct</span> <span class="n">bufferevent</span> <span class="o">*</span><span class="n">bev</span><span class="p">,</span> <span class="kt">short</span> <span class="n">events</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">ptr</span><span class="p">)</span> <span class="p">{</span>
<span class="n">http2_session_data</span> <span class="o">*</span><span class="n">session_data</span> <span class="o">=</span> <span class="p">(</span><span class="n">http2_session_data</span> <span class="o">*</span><span class="p">)</span><span class="n">ptr</span><span class="p">;</span>
<span class="k">if</span> <span class="p">(</span><span class="n">events</span> <span class="o">&amp;</span> <span class="n">BEV_EVENT_CONNECTED</span><span class="p">)</span> <span class="p">{</span>
<span class="kt">int</span> <span class="n">fd</span> <span class="o">=</span> <span class="n">bufferevent_getfd</span><span class="p">(</span><span class="n">bev</span><span class="p">);</span>
@ -1146,20 +1110,17 @@ here.</p>
<span class="p">}</span>
<span class="cm">/* Start connecting to the remote peer |host:port| */</span>
<span class="k">static</span> <span class="kt">void</span> <span class="nf">initiate_connection</span><span class="p">(</span><span class="k">struct</span> <span class="n">event_base</span> <span class="o">*</span><span class="n">evbase</span><span class="p">,</span>
<span class="n">SSL_CTX</span> <span class="o">*</span><span class="n">ssl_ctx</span><span class="p">,</span>
<span class="k">static</span> <span class="kt">void</span> <span class="nf">initiate_connection</span><span class="p">(</span><span class="k">struct</span> <span class="n">event_base</span> <span class="o">*</span><span class="n">evbase</span><span class="p">,</span> <span class="n">SSL_CTX</span> <span class="o">*</span><span class="n">ssl_ctx</span><span class="p">,</span>
<span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">host</span><span class="p">,</span> <span class="kt">uint16_t</span> <span class="n">port</span><span class="p">,</span>
<span class="n">http2_session_data</span> <span class="o">*</span><span class="n">session_data</span><span class="p">)</span>
<span class="p">{</span>
<span class="n">http2_session_data</span> <span class="o">*</span><span class="n">session_data</span><span class="p">)</span> <span class="p">{</span>
<span class="kt">int</span> <span class="n">rv</span><span class="p">;</span>
<span class="k">struct</span> <span class="n">bufferevent</span> <span class="o">*</span><span class="n">bev</span><span class="p">;</span>
<span class="n">SSL</span> <span class="o">*</span><span class="n">ssl</span><span class="p">;</span>
<span class="n">ssl</span> <span class="o">=</span> <span class="n">create_ssl</span><span class="p">(</span><span class="n">ssl_ctx</span><span class="p">);</span>
<span class="n">bev</span> <span class="o">=</span> <span class="n">bufferevent_openssl_socket_new</span><span class="p">(</span><span class="n">evbase</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">ssl</span><span class="p">,</span>
<span class="n">BUFFEREVENT_SSL_CONNECTING</span><span class="p">,</span>
<span class="n">BEV_OPT_DEFER_CALLBACKS</span> <span class="o">|</span>
<span class="n">BEV_OPT_CLOSE_ON_FREE</span><span class="p">);</span>
<span class="n">bev</span> <span class="o">=</span> <span class="n">bufferevent_openssl_socket_new</span><span class="p">(</span>
<span class="n">evbase</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">ssl</span><span class="p">,</span> <span class="n">BUFFEREVENT_SSL_CONNECTING</span><span class="p">,</span>
<span class="n">BEV_OPT_DEFER_CALLBACKS</span> <span class="o">|</span> <span class="n">BEV_OPT_CLOSE_ON_FREE</span><span class="p">);</span>
<span class="n">bufferevent_setcb</span><span class="p">(</span><span class="n">bev</span><span class="p">,</span> <span class="n">readcb</span><span class="p">,</span> <span class="n">writecb</span><span class="p">,</span> <span class="n">eventcb</span><span class="p">,</span> <span class="n">session_data</span><span class="p">);</span>
<span class="n">rv</span> <span class="o">=</span> <span class="n">bufferevent_socket_connect_hostname</span><span class="p">(</span><span class="n">bev</span><span class="p">,</span> <span class="n">session_data</span><span class="o">-&gt;</span><span class="n">dnsbase</span><span class="p">,</span>
<span class="n">AF_UNSPEC</span><span class="p">,</span> <span class="n">host</span><span class="p">,</span> <span class="n">port</span><span class="p">);</span>
@ -1172,8 +1133,7 @@ here.</p>
<span class="cm">/* Get resource denoted by the |uri|. The debug and error messages are</span>
<span class="cm"> printed in stderr, while the response body is printed in stdout. */</span>
<span class="k">static</span> <span class="kt">void</span> <span class="nf">run</span><span class="p">(</span><span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">uri</span><span class="p">)</span>
<span class="p">{</span>
<span class="k">static</span> <span class="kt">void</span> <span class="nf">run</span><span class="p">(</span><span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">uri</span><span class="p">)</span> <span class="p">{</span>
<span class="k">struct</span> <span class="n">http_parser_url</span> <span class="n">u</span><span class="p">;</span>
<span class="kt">char</span> <span class="o">*</span><span class="n">host</span><span class="p">;</span>
<span class="kt">uint16_t</span> <span class="n">port</span><span class="p">;</span>
@ -1211,8 +1171,7 @@ here.</p>
<span class="n">SSL_CTX_free</span><span class="p">(</span><span class="n">ssl_ctx</span><span class="p">);</span>
<span class="p">}</span>
<span class="kt">int</span> <span class="nf">main</span><span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="kt">char</span> <span class="o">**</span><span class="n">argv</span><span class="p">)</span>
<span class="p">{</span>
<span class="kt">int</span> <span class="nf">main</span><span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="kt">char</span> <span class="o">**</span><span class="n">argv</span><span class="p">)</span> <span class="p">{</span>
<span class="k">struct</span> <span class="n">sigaction</span> <span class="n">act</span><span class="p">;</span>
<span class="k">if</span> <span class="p">(</span><span class="n">argc</span> <span class="o">&lt;</span> <span class="mi">2</span><span class="p">)</span> <span class="p">{</span>
@ -1255,11 +1214,12 @@ here.</p>
<div role="contentinfo">
<p>
&copy; Copyright 2012, 2014, Tatsuhiro Tsujikawa.
&copy; Copyright 2012, 2015, Tatsuhiro Tsujikawa.
</p>
</div>
<a href="https://github.com/snide/sphinx_rtd_theme">Sphinx theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
@ -1275,7 +1235,7 @@ here.</p>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'0.6.3-DEV',
VERSION:'0.7.2-DEV',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: false

View File

@ -7,14 +7,14 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Tutorial: HPACK API &mdash; nghttp2 0.6.3-DEV documentation</title>
<title>Tutorial: HPACK API &mdash; nghttp2 0.7.2-DEV documentation</title>
<link href='https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700&subset=latin,cyrillic' rel='stylesheet' type='text/css'>
@ -28,7 +28,7 @@
<link rel="top" title="nghttp2 0.6.3-DEV documentation" href="index.html"/>
<link rel="top" title="nghttp2 0.7.2-DEV documentation" href="index.html"/>
<link rel="next" title="nghttp(1)" href="nghttp.1.html"/>
<link rel="prev" title="Tutorial: HTTP/2 server" href="tutorial-server.html"/>
@ -47,6 +47,7 @@
<a href="index.html" class="fa fa-home"> nghttp2</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
@ -59,6 +60,7 @@
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="package_README.html">nghttp2 - HTTP/2 C Library</a><ul>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#development-status">Development Status</a></li>
@ -66,6 +68,8 @@
<li class="toctree-l2"><a class="reference internal" href="package_README.html#requirements">Requirements</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#build-from-git">Build from git</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#building-documentation">Building documentation</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#unit-tests">Unit tests</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#integration-tests">Integration tests</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#client-server-and-proxy-programs">Client, Server and Proxy programs</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#benchmarking-tool">Benchmarking tool</a></li>
<li class="toctree-l2"><a class="reference internal" href="package_README.html#hpack-tools">HPACK tools</a></li>
@ -74,6 +78,10 @@
<li class="toctree-l2"><a class="reference internal" href="package_README.html#contribution">Contribution</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="contribute.html">Contribution Guidelines</a><ul>
<li class="toctree-l2"><a class="reference internal" href="contribute.html#coding-style">Coding style</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="building-android-binary.html">Building Android binary</a></li>
<li class="toctree-l1"><a class="reference internal" href="tutorial-client.html">Tutorial: HTTP/2 client</a><ul>
<li class="toctree-l2"><a class="reference internal" href="tutorial-client.html#libevent-client-c">libevent-client.c</a></li>
@ -90,34 +98,32 @@
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttp.1.html">nghttp(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttp.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttpd.1.html">nghttpd(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpd.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="nghttpx.1.html">nghttpx(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#files">FILES</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#signals">SIGNALS</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="h2load.1.html">h2load(1)</a><ul>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#name">NAME</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#synopsis">SYNOPSIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#description">DESCRIPTION</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#options">OPTIONS</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#options">OPTIONS:</a></li>
<li class="toctree-l2"><a class="reference internal" href="h2load.1.html#see-also">SEE ALSO</a></li>
</ul>
</li>
@ -131,8 +137,9 @@
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#specifying-additional-ca-certificate">Specifying additional CA certificate</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#read-write-rate-limit">Read/write rate limit</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#rewriting-location-header-field">Rewriting location header field</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#hot-deploy">Hot deploy</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#hot-swapping">Hot swapping</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#re-opening-log-files">Re-opening log files</a></li>
<li class="toctree-l2"><a class="reference internal" href="nghttpx-howto.html#multiple-http-1-backend-addresses">Multiple HTTP/1 backend addresses</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="h2load-howto.html">h2load - HTTP/2 benchmarking tool - HOW-TO</a><ul>
@ -166,9 +173,11 @@
<li class="toctree-l1"><a class="reference internal" href="asio_http2.h.html">asio_http2.h</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/tatsuhiro-t/nghttp2">Source</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/tatsuhiro-t/nghttp2/issues">Issues</a></li>
<li class="toctree-l1"><a class="reference external" href="https://nghttp2.org/">nghttp2.org</a></li>
</ul>
</div>
&nbsp;
</nav>
@ -256,18 +265,6 @@ important to use <a class="reference internal" href="apiref.html#c.nghttp2_hd_de
size of buffer.</p>
<p>To delete <a class="reference internal" href="apiref.html#c.nghttp2_hd_deflater" title="nghttp2_hd_deflater"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_hd_deflater</span></tt></a> object, use <a class="reference internal" href="apiref.html#c.nghttp2_hd_deflate_del" title="nghttp2_hd_deflate_del"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_hd_deflate_del()</span></tt></a>
function.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Generally, the order of header fields passed to
<a class="reference internal" href="apiref.html#c.nghttp2_hd_deflate_hd" title="nghttp2_hd_deflate_hd"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_hd_deflate_hd()</span></tt></a> function is not preserved. It is known
that the relative ordering of header fields which do not share the
same name is insignificant. But some header fields sharing the
same name require the explicit ordering. To preserve this
ordering, those header values are concatenated into single header
field value using NULL (0x00) as delimiter. This is transparent to
HPACK API. Therefore, the application should examine the inflated
header values and split into multiple header field values by NULL.</p>
</div>
</div>
<div class="section" id="inflating-decoding-headers">
<h2>Inflating (decoding) headers<a class="headerlink" href="#inflating-decoding-headers" title="Permalink to this headline"></a></h2>
@ -339,44 +336,44 @@ function.</p>
<span class="cm"> * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION</span>
<span class="cm"> * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</span>
<span class="cm"> */</span>
<span class="cp">#ifdef HAVE_CONFIG_H</span>
<span class="cp">#include &lt;config.h&gt;</span>
<span class="cp">#endif </span><span class="cm">/* !HAVE_CONFIG_H */</span><span class="cp"></span>
<span class="cp">#include &lt;stdio.h&gt;</span>
<span class="cp">#include &lt;string.h&gt;</span>
<span class="cp">#include &lt;nghttp2/nghttp2.h&gt;</span>
<span class="cp">#define MAKE_NV(K, V) \</span>
<span class="cp"> { (uint8_t*)K, (uint8_t*)V, sizeof(K) - 1, sizeof(V) - 1, \</span>
<span class="cp"> NGHTTP2_NV_FLAG_NONE }</span>
<span class="cp"> { \</span>
<span class="cp"> (uint8_t *) K, (uint8_t *)V, sizeof(K) - 1, sizeof(V) - 1, \</span>
<span class="cp"> NGHTTP2_NV_FLAG_NONE \</span>
<span class="cp"> }</span>
<span class="k">static</span> <span class="kt">void</span> <span class="nf">deflate</span><span class="p">(</span><span class="n">nghttp2_hd_deflater</span> <span class="o">*</span><span class="n">deflater</span><span class="p">,</span>
<span class="n">nghttp2_hd_inflater</span> <span class="o">*</span><span class="n">inflater</span><span class="p">,</span>
<span class="k">const</span> <span class="n">nghttp2_nv</span> <span class="o">*</span> <span class="k">const</span> <span class="n">nva</span><span class="p">,</span> <span class="kt">size_t</span> <span class="n">nvlen</span><span class="p">);</span>
<span class="n">nghttp2_hd_inflater</span> <span class="o">*</span><span class="n">inflater</span><span class="p">,</span> <span class="k">const</span> <span class="n">nghttp2_nv</span> <span class="o">*</span><span class="k">const</span> <span class="n">nva</span><span class="p">,</span>
<span class="kt">size_t</span> <span class="n">nvlen</span><span class="p">);</span>
<span class="k">static</span> <span class="kt">int</span> <span class="nf">inflate_header_block</span><span class="p">(</span><span class="n">nghttp2_hd_inflater</span> <span class="o">*</span><span class="n">inflater</span><span class="p">,</span>
<span class="kt">uint8_t</span> <span class="o">*</span><span class="n">in</span><span class="p">,</span> <span class="kt">size_t</span> <span class="n">inlen</span><span class="p">,</span> <span class="kt">int</span> <span class="n">final</span><span class="p">);</span>
<span class="k">static</span> <span class="kt">int</span> <span class="nf">inflate_header_block</span><span class="p">(</span><span class="n">nghttp2_hd_inflater</span> <span class="o">*</span><span class="n">inflater</span><span class="p">,</span> <span class="kt">uint8_t</span> <span class="o">*</span><span class="n">in</span><span class="p">,</span>
<span class="kt">size_t</span> <span class="n">inlen</span><span class="p">,</span> <span class="kt">int</span> <span class="n">final</span><span class="p">);</span>
<span class="kt">int</span> <span class="nf">main</span><span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="kt">char</span> <span class="o">**</span><span class="n">argv</span><span class="p">)</span>
<span class="p">{</span>
<span class="kt">int</span> <span class="nf">main</span><span class="p">(</span><span class="kt">int</span> <span class="n">argc</span> <span class="n">_U_</span><span class="p">,</span> <span class="kt">char</span> <span class="o">**</span><span class="n">argv</span> <span class="n">_U_</span><span class="p">)</span> <span class="p">{</span>
<span class="kt">int</span> <span class="n">rv</span><span class="p">;</span>
<span class="n">nghttp2_hd_deflater</span> <span class="o">*</span><span class="n">deflater</span><span class="p">;</span>
<span class="n">nghttp2_hd_inflater</span> <span class="o">*</span><span class="n">inflater</span><span class="p">;</span>
<span class="cm">/* Define 1st header set. This is looks like a HTTP request. */</span>
<span class="n">nghttp2_nv</span> <span class="n">nva1</span><span class="p">[]</span> <span class="o">=</span> <span class="p">{</span>
<span class="n">MAKE_NV</span><span class="p">(</span><span class="s">&quot;:scheme&quot;</span><span class="p">,</span> <span class="s">&quot;https&quot;</span><span class="p">),</span>
<span class="n">MAKE_NV</span><span class="p">(</span><span class="s">&quot;:authority&quot;</span><span class="p">,</span> <span class="s">&quot;example.org&quot;</span><span class="p">),</span>
<span class="n">MAKE_NV</span><span class="p">(</span><span class="s">&quot;:path&quot;</span><span class="p">,</span> <span class="s">&quot;/&quot;</span><span class="p">),</span>
<span class="n">MAKE_NV</span><span class="p">(</span><span class="s">&quot;user-agent&quot;</span><span class="p">,</span> <span class="s">&quot;libnghttp2&quot;</span><span class="p">),</span>
<span class="n">MAKE_NV</span><span class="p">(</span><span class="s">&quot;accept-encoding&quot;</span><span class="p">,</span> <span class="s">&quot;gzip, deflate&quot;</span><span class="p">)</span>
<span class="p">};</span>
<span class="n">MAKE_NV</span><span class="p">(</span><span class="s">&quot;:scheme&quot;</span><span class="p">,</span> <span class="s">&quot;https&quot;</span><span class="p">),</span> <span class="n">MAKE_NV</span><span class="p">(</span><span class="s">&quot;:authority&quot;</span><span class="p">,</span> <span class="s">&quot;example.org&quot;</span><span class="p">),</span>
<span class="n">MAKE_NV</span><span class="p">(</span><span class="s">&quot;:path&quot;</span><span class="p">,</span> <span class="s">&quot;/&quot;</span><span class="p">),</span> <span class="n">MAKE_NV</span><span class="p">(</span><span class="s">&quot;user-agent&quot;</span><span class="p">,</span> <span class="s">&quot;libnghttp2&quot;</span><span class="p">),</span>
<span class="n">MAKE_NV</span><span class="p">(</span><span class="s">&quot;accept-encoding&quot;</span><span class="p">,</span> <span class="s">&quot;gzip, deflate&quot;</span><span class="p">)};</span>
<span class="cm">/* Define 2nd header set */</span>
<span class="n">nghttp2_nv</span> <span class="n">nva2</span><span class="p">[]</span> <span class="o">=</span> <span class="p">{</span>
<span class="n">MAKE_NV</span><span class="p">(</span><span class="s">&quot;:scheme&quot;</span><span class="p">,</span> <span class="s">&quot;https&quot;</span><span class="p">),</span>
<span class="n">nghttp2_nv</span> <span class="n">nva2</span><span class="p">[]</span> <span class="o">=</span> <span class="p">{</span><span class="n">MAKE_NV</span><span class="p">(</span><span class="s">&quot;:scheme&quot;</span><span class="p">,</span> <span class="s">&quot;https&quot;</span><span class="p">),</span>
<span class="n">MAKE_NV</span><span class="p">(</span><span class="s">&quot;:authority&quot;</span><span class="p">,</span> <span class="s">&quot;example.org&quot;</span><span class="p">),</span>
<span class="n">MAKE_NV</span><span class="p">(</span><span class="s">&quot;:path&quot;</span><span class="p">,</span> <span class="s">&quot;/stylesheet/style.css&quot;</span><span class="p">),</span>
<span class="n">MAKE_NV</span><span class="p">(</span><span class="s">&quot;user-agent&quot;</span><span class="p">,</span> <span class="s">&quot;libnghttp2&quot;</span><span class="p">),</span>
<span class="n">MAKE_NV</span><span class="p">(</span><span class="s">&quot;accept-encoding&quot;</span><span class="p">,</span> <span class="s">&quot;gzip, deflate&quot;</span><span class="p">),</span>
<span class="n">MAKE_NV</span><span class="p">(</span><span class="s">&quot;referer&quot;</span><span class="p">,</span> <span class="s">&quot;https://example.org&quot;</span><span class="p">)</span>
<span class="p">};</span>
<span class="n">MAKE_NV</span><span class="p">(</span><span class="s">&quot;referer&quot;</span><span class="p">,</span> <span class="s">&quot;https://example.org&quot;</span><span class="p">)};</span>
<span class="n">rv</span> <span class="o">=</span> <span class="n">nghttp2_hd_deflate_new</span><span class="p">(</span><span class="o">&amp;</span><span class="n">deflater</span><span class="p">,</span> <span class="mi">4096</span><span class="p">);</span>
@ -408,9 +405,8 @@ function.</p>
<span class="p">}</span>
<span class="k">static</span> <span class="kt">void</span> <span class="nf">deflate</span><span class="p">(</span><span class="n">nghttp2_hd_deflater</span> <span class="o">*</span><span class="n">deflater</span><span class="p">,</span>
<span class="n">nghttp2_hd_inflater</span> <span class="o">*</span><span class="n">inflater</span><span class="p">,</span>
<span class="k">const</span> <span class="n">nghttp2_nv</span> <span class="o">*</span> <span class="k">const</span> <span class="n">nva</span><span class="p">,</span> <span class="kt">size_t</span> <span class="n">nvlen</span><span class="p">)</span>
<span class="p">{</span>
<span class="n">nghttp2_hd_inflater</span> <span class="o">*</span><span class="n">inflater</span><span class="p">,</span> <span class="k">const</span> <span class="n">nghttp2_nv</span> <span class="o">*</span><span class="k">const</span> <span class="n">nva</span><span class="p">,</span>
<span class="kt">size_t</span> <span class="n">nvlen</span><span class="p">)</span> <span class="p">{</span>
<span class="kt">ssize_t</span> <span class="n">rv</span><span class="p">;</span>
<span class="kt">uint8_t</span> <span class="o">*</span><span class="n">buf</span><span class="p">;</span>
<span class="kt">size_t</span> <span class="n">buflen</span><span class="p">;</span>
@ -449,8 +445,8 @@ function.</p>
<span class="n">outlen</span> <span class="o">=</span> <span class="n">rv</span><span class="p">;</span>
<span class="n">printf</span><span class="p">(</span><span class="s">&quot;</span><span class="se">\n</span><span class="s">Deflate (%zu byte(s), ratio %.02f):</span><span class="se">\n\n</span><span class="s">&quot;</span><span class="p">,</span>
<span class="n">outlen</span><span class="p">,</span> <span class="n">sum</span> <span class="o">==</span> <span class="mi">0</span> <span class="o">?</span> <span class="mi">0</span> <span class="o">:</span> <span class="p">(</span><span class="kt">double</span><span class="p">)</span><span class="n">outlen</span> <span class="o">/</span> <span class="n">sum</span><span class="p">);</span>
<span class="n">printf</span><span class="p">(</span><span class="s">&quot;</span><span class="se">\n</span><span class="s">Deflate (%zu byte(s), ratio %.02f):</span><span class="se">\n\n</span><span class="s">&quot;</span><span class="p">,</span> <span class="n">outlen</span><span class="p">,</span>
<span class="n">sum</span> <span class="o">==</span> <span class="mi">0</span> <span class="o">?</span> <span class="mi">0</span> <span class="o">:</span> <span class="p">(</span><span class="kt">double</span><span class="p">)</span><span class="n">outlen</span> <span class="o">/</span> <span class="n">sum</span><span class="p">);</span>
<span class="k">for</span> <span class="p">(</span><span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">i</span> <span class="o">&lt;</span> <span class="n">outlen</span><span class="p">;</span> <span class="o">++</span><span class="n">i</span><span class="p">)</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">((</span><span class="n">i</span> <span class="o">&amp;</span> <span class="mh">0x0fu</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
@ -482,9 +478,8 @@ function.</p>
<span class="n">free</span><span class="p">(</span><span class="n">buf</span><span class="p">);</span>
<span class="p">}</span>
<span class="kt">int</span> <span class="nf">inflate_header_block</span><span class="p">(</span><span class="n">nghttp2_hd_inflater</span> <span class="o">*</span><span class="n">inflater</span><span class="p">,</span>
<span class="kt">uint8_t</span> <span class="o">*</span><span class="n">in</span><span class="p">,</span> <span class="kt">size_t</span> <span class="n">inlen</span><span class="p">,</span> <span class="kt">int</span> <span class="n">final</span><span class="p">)</span>
<span class="p">{</span>
<span class="kt">int</span> <span class="nf">inflate_header_block</span><span class="p">(</span><span class="n">nghttp2_hd_inflater</span> <span class="o">*</span><span class="n">inflater</span><span class="p">,</span> <span class="kt">uint8_t</span> <span class="o">*</span><span class="n">in</span><span class="p">,</span>
<span class="kt">size_t</span> <span class="n">inlen</span><span class="p">,</span> <span class="kt">int</span> <span class="n">final</span><span class="p">)</span> <span class="p">{</span>
<span class="kt">ssize_t</span> <span class="n">rv</span><span class="p">;</span>
<span class="k">for</span> <span class="p">(;;)</span> <span class="p">{</span>
@ -492,8 +487,7 @@ function.</p>
<span class="kt">int</span> <span class="n">inflate_flags</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
<span class="kt">size_t</span> <span class="n">proclen</span><span class="p">;</span>
<span class="n">rv</span> <span class="o">=</span> <span class="n">nghttp2_hd_inflate_hd</span><span class="p">(</span><span class="n">inflater</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">nv</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">inflate_flags</span><span class="p">,</span>
<span class="n">in</span><span class="p">,</span> <span class="n">inlen</span><span class="p">,</span> <span class="n">final</span><span class="p">);</span>
<span class="n">rv</span> <span class="o">=</span> <span class="n">nghttp2_hd_inflate_hd</span><span class="p">(</span><span class="n">inflater</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">nv</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">inflate_flags</span><span class="p">,</span> <span class="n">in</span><span class="p">,</span> <span class="n">inlen</span><span class="p">,</span> <span class="n">final</span><span class="p">);</span>
<span class="k">if</span> <span class="p">(</span><span class="n">rv</span> <span class="o">&lt;</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
<span class="n">fprintf</span><span class="p">(</span><span class="n">stderr</span><span class="p">,</span> <span class="s">&quot;inflate failed with error code %zd&quot;</span><span class="p">,</span> <span class="n">rv</span><span class="p">);</span>
@ -517,8 +511,7 @@ function.</p>
<span class="k">break</span><span class="p">;</span>
<span class="p">}</span>
<span class="k">if</span><span class="p">((</span><span class="n">inflate_flags</span> <span class="o">&amp;</span> <span class="n">NGHTTP2_HD_INFLATE_EMIT</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span> <span class="o">&amp;&amp;</span>
<span class="n">inlen</span> <span class="o">==</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">((</span><span class="n">inflate_flags</span> <span class="o">&amp;</span> <span class="n">NGHTTP2_HD_INFLATE_EMIT</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span> <span class="o">&amp;&amp;</span> <span class="n">inlen</span> <span class="o">==</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
<span class="k">break</span><span class="p">;</span>
<span class="p">}</span>
<span class="p">}</span>
@ -548,11 +541,12 @@ function.</p>
<div role="contentinfo">
<p>
&copy; Copyright 2012, 2014, Tatsuhiro Tsujikawa.
&copy; Copyright 2012, 2015, Tatsuhiro Tsujikawa.
</p>
</div>
<a href="https://github.com/snide/sphinx_rtd_theme">Sphinx theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
@ -568,7 +562,7 @@ function.</p>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'0.6.3-DEV',
VERSION:'0.7.2-DEV',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: false

File diff suppressed because it is too large Load Diff