Update doc
This commit is contained in:
parent
09cc36d291
commit
6ad91aa46c
100
apiref.html
100
apiref.html
|
@ -7,7 +7,7 @@
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
|
||||||
<title>API Reference — nghttp2 0.5.1-DEV documentation</title>
|
<title>API Reference — nghttp2 0.5.2-DEV documentation</title>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<link rel="top" title="nghttp2 0.5.1-DEV documentation" href="index.html"/>
|
<link rel="top" title="nghttp2 0.5.2-DEV documentation" href="index.html"/>
|
||||||
<link rel="next" title="Python API Reference" href="python-apiref.html"/>
|
<link rel="next" title="Python API Reference" href="python-apiref.html"/>
|
||||||
<link rel="prev" title="h2load - HTTP/2 benchmarking tool - HOW-TO" href="h2load-howto.html"/>
|
<link rel="prev" title="h2load - HTTP/2 benchmarking tool - HOW-TO" href="h2load-howto.html"/>
|
||||||
|
|
||||||
|
@ -729,13 +729,6 @@ The END_HEADERS flag.</p>
|
||||||
The ACK flag.</p>
|
The ACK flag.</p>
|
||||||
</dd></dl>
|
</dd></dl>
|
||||||
|
|
||||||
<dl class="macro">
|
|
||||||
<dt id="c.NGHTTP2_FLAG_END_SEGMENT">
|
|
||||||
<tt class="descname">NGHTTP2_FLAG_END_SEGMENT</tt><a class="headerlink" href="#c.NGHTTP2_FLAG_END_SEGMENT" title="Permalink to this definition">¶</a></dt>
|
|
||||||
<dd><p>(<tt class="docutils literal"><span class="pre">0x02</span></tt>)
|
|
||||||
The END_SEGMENT flag.</p>
|
|
||||||
</dd></dl>
|
|
||||||
|
|
||||||
<dl class="macro">
|
<dl class="macro">
|
||||||
<dt id="c.NGHTTP2_FLAG_PADDED">
|
<dt id="c.NGHTTP2_FLAG_PADDED">
|
||||||
<tt class="descname">NGHTTP2_FLAG_PADDED</tt><a class="headerlink" href="#c.NGHTTP2_FLAG_PADDED" title="Permalink to this definition">¶</a></dt>
|
<tt class="descname">NGHTTP2_FLAG_PADDED</tt><a class="headerlink" href="#c.NGHTTP2_FLAG_PADDED" title="Permalink to this definition">¶</a></dt>
|
||||||
|
@ -784,6 +777,20 @@ SETTINGS_MAX_CONCURRENT_STREAMS</p>
|
||||||
SETTINGS_INITIAL_WINDOW_SIZE</p>
|
SETTINGS_INITIAL_WINDOW_SIZE</p>
|
||||||
</dd></dl>
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="macro">
|
||||||
|
<dt id="c.NGHTTP2_SETTINGS_MAX_FRAME_SIZE">
|
||||||
|
<tt class="descname">NGHTTP2_SETTINGS_MAX_FRAME_SIZE</tt><a class="headerlink" href="#c.NGHTTP2_SETTINGS_MAX_FRAME_SIZE" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><p>(<tt class="docutils literal"><span class="pre">0x05</span></tt>)
|
||||||
|
SETTINGS_MAX_FRAME_SIZE</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
<dl class="macro">
|
||||||
|
<dt id="c.NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE">
|
||||||
|
<tt class="descname">NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE</tt><a class="headerlink" href="#c.NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><p>(<tt class="docutils literal"><span class="pre">0x06</span></tt>)
|
||||||
|
SETTINGS_MAX_HEADER_LIST_SIZE</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
</dd></dl>
|
</dd></dl>
|
||||||
|
|
||||||
<dl class="type">
|
<dl class="type">
|
||||||
|
@ -941,7 +948,9 @@ stream.</p>
|
||||||
<tt class="descname">NGHTTP2_HCAT_HEADERS</tt><a class="headerlink" href="#c.NGHTTP2_HCAT_HEADERS" title="Permalink to this definition">¶</a></dt>
|
<tt class="descname">NGHTTP2_HCAT_HEADERS</tt><a class="headerlink" href="#c.NGHTTP2_HCAT_HEADERS" title="Permalink to this definition">¶</a></dt>
|
||||||
<dd><p>(<tt class="docutils literal"><span class="pre">3</span></tt>)
|
<dd><p>(<tt class="docutils literal"><span class="pre">3</span></tt>)
|
||||||
The HEADERS frame which does not apply for the above categories,
|
The HEADERS frame which does not apply for the above categories,
|
||||||
which is analogous to HEADERS in SPDY.</p>
|
which is analogous to HEADERS in SPDY. If non-final response
|
||||||
|
(e.g., status 1xx) is used, final response HEADERS frame will be
|
||||||
|
categorized here.</p>
|
||||||
</dd></dl>
|
</dd></dl>
|
||||||
|
|
||||||
</dd></dl>
|
</dd></dl>
|
||||||
|
@ -1980,25 +1989,14 @@ void <tt class="descname">nghttp2_option_del</tt><big>(</big><a class="reference
|
||||||
</dd></dl>
|
</dd></dl>
|
||||||
|
|
||||||
<dl class="function">
|
<dl class="function">
|
||||||
<dt id="c.nghttp2_option_set_no_auto_stream_window_update">
|
<dt id="c.nghttp2_option_set_no_auto_window_update">
|
||||||
void <tt class="descname">nghttp2_option_set_no_auto_stream_window_update</tt><big>(</big><a class="reference internal" href="#c.nghttp2_option" title="nghttp2_option">nghttp2_option</a><em> *option</em>, int<em> val</em><big>)</big><a class="headerlink" href="#c.nghttp2_option_set_no_auto_stream_window_update" title="Permalink to this definition">¶</a></dt>
|
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> *option</em>, int<em> 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
|
|
||||||
stream automatically. If this option is set to nonzero, the
|
|
||||||
library won’t send WINDOW_UPDATE for a stream and the application
|
|
||||||
is responsible for sending WINDOW_UPDATE using
|
|
||||||
<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>. By default, this option is set to
|
|
||||||
zero.</p>
|
|
||||||
</dd></dl>
|
|
||||||
|
|
||||||
<dl class="function">
|
|
||||||
<dt id="c.nghttp2_option_set_no_auto_connection_window_update">
|
|
||||||
void <tt class="descname">nghttp2_option_set_no_auto_connection_window_update</tt><big>(</big><a class="reference internal" href="#c.nghttp2_option" title="nghttp2_option">nghttp2_option</a><em> *option</em>, int<em> val</em><big>)</big><a class="headerlink" href="#c.nghttp2_option_set_no_auto_connection_window_update" title="Permalink to this definition">¶</a></dt>
|
|
||||||
<dd><p>This option prevents the library from sending WINDOW_UPDATE for a
|
<dd><p>This option prevents the library from sending WINDOW_UPDATE for a
|
||||||
connection automatically. If this option is set to nonzero, the
|
connection automatically. If this option is set to nonzero, the
|
||||||
library won’t send WINDOW_UPDATE for a connection and the
|
library won’t send WINDOW_UPDATE for DATA until application calls
|
||||||
application is responsible for sending WINDOW_UPDATE with stream ID
|
<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
|
||||||
0 using <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>. By default, this option is
|
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.
|
||||||
set to zero.</p>
|
By default, this option is set to zero.</p>
|
||||||
</dd></dl>
|
</dd></dl>
|
||||||
|
|
||||||
<dl class="function">
|
<dl class="function">
|
||||||
|
@ -2453,6 +2451,26 @@ 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>
|
<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>
|
</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> *session</em>, int32_t<em> stream_id</em>, size_t<em> size</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_consume" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><p>Tells the <em>session</em> that <em>size</em> bytes for a stream denoted by
|
||||||
|
<em>stream_id</em> were consumed by application and are ready to
|
||||||
|
WINDOW_UPDATE. This function is intended to be used without
|
||||||
|
automatic window update (see
|
||||||
|
<a class="reference internal" href="#c.nghttp2_option_set_no_auto_window_update" title="nghttp2_option_set_no_auto_window_update"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_option_set_no_auto_window_update()</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_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>stream_id</em> is 0.</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>Automatic WINDOW_UPDATE is not disabled.</dd>
|
||||||
|
</dl>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
<dl class="function">
|
<dl class="function">
|
||||||
<dt id="c.nghttp2_session_upgrade">
|
<dt id="c.nghttp2_session_upgrade">
|
||||||
int <tt class="descname">nghttp2_session_upgrade</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em> *session</em>, const uint8_t<em> *settings_payload</em>, size_t<em> settings_payloadlen</em>, void<em> *stream_user_data</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_upgrade" title="Permalink to this definition">¶</a></dt>
|
int <tt class="descname">nghttp2_session_upgrade</tt><big>(</big><a class="reference internal" href="#c.nghttp2_session" title="nghttp2_session">nghttp2_session</a><em> *session</em>, const uint8_t<em> *settings_payload</em>, size_t<em> settings_payloadlen</em>, void<em> *stream_user_data</em><big>)</big><a class="headerlink" href="#c.nghttp2_session_upgrade" title="Permalink to this definition">¶</a></dt>
|
||||||
|
@ -2699,8 +2717,7 @@ int <tt class="descname">nghttp2_submit_data</tt><big>(</big><a class="reference
|
||||||
<dd><p>Submits one or more DATA frames to the stream <em>stream_id</em>. The
|
<dd><p>Submits one or more DATA frames to the stream <em>stream_id</em>. The
|
||||||
data to be sent are provided by <em>data_prd</em>. If <em>flags</em> contains
|
data to be sent are provided by <em>data_prd</em>. If <em>flags</em> contains
|
||||||
<a class="reference internal" href="#c.NGHTTP2_FLAG_END_STREAM" title="NGHTTP2_FLAG_END_STREAM"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_FLAG_END_STREAM</span></tt></a>, the last DATA frame has END_STREAM
|
<a class="reference internal" href="#c.NGHTTP2_FLAG_END_STREAM" title="NGHTTP2_FLAG_END_STREAM"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_FLAG_END_STREAM</span></tt></a>, the last DATA frame has END_STREAM
|
||||||
flag set. If <em>flags</em> contains <a class="reference internal" href="#c.NGHTTP2_FLAG_END_SEGMENT" title="NGHTTP2_FLAG_END_SEGMENT"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_FLAG_END_SEGMENT</span></tt></a>,
|
flag set.</p>
|
||||||
the last DATA frame has END_SEGMENT flag set.</p>
|
|
||||||
<p>This function does not take ownership of the <em>data_prd</em>. The
|
<p>This function does not take ownership of the <em>data_prd</em>. The
|
||||||
function copies the members of the <em>data_prd</em>.</p>
|
function copies the members of the <em>data_prd</em>.</p>
|
||||||
<p>This function returns 0 if it succeeds, or one of the following
|
<p>This function returns 0 if it succeeds, or one of the following
|
||||||
|
@ -2896,12 +2913,11 @@ that value as window_size_increment is queued. If the
|
||||||
remote endpoint, the local window size is increased by that
|
remote endpoint, the local window size is increased by that
|
||||||
difference.</p>
|
difference.</p>
|
||||||
<p>If the <em>window_size_increment</em> is negative, the local window size
|
<p>If the <em>window_size_increment</em> is negative, the local window size
|
||||||
is decreased by -<em>window_size_increment</em>. If
|
is decreased by -<em>window_size_increment</em>. If automatic
|
||||||
<tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_OPT_NO_AUTO_STREAM_WINDOW_UPDATE</span></tt> (or
|
WINDOW_UPDATE is enabled
|
||||||
<tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_OPT_NO_AUTO_CONNECTION_WINDOW_UPDATE</span></tt> if <em>stream_id</em>
|
(<a class="reference internal" href="#c.nghttp2_option_set_no_auto_window_update" title="nghttp2_option_set_no_auto_window_update"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_option_set_no_auto_window_update()</span></tt></a>), and the library
|
||||||
is 0) is not set and the library decided that the WINDOW_UPDATE
|
decided that the WINDOW_UPDATE should be submitted, then
|
||||||
should be submitted, then WINDOW_UPDATE is queued with the current
|
WINDOW_UPDATE is queued with the current received bytes count.</p>
|
||||||
received bytes count.</p>
|
|
||||||
<p>If the <em>window_size_increment</em> is 0, the function does nothing and
|
<p>If the <em>window_size_increment</em> is 0, the function does nothing and
|
||||||
returns 0.</p>
|
returns 0.</p>
|
||||||
<p>This function returns 0 if it succeeds, or one of the following
|
<p>This function returns 0 if it succeeds, or one of the following
|
||||||
|
@ -2922,7 +2938,7 @@ int <tt class="descname">nghttp2_submit_altsvc</tt><big>(</big><a class="referen
|
||||||
<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>
|
<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
|
<p>Only the server can send the ALTSVC frame. If <em>session</em> is
|
||||||
initialized as client, this function fails and returns
|
initialized as client, this function fails and 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>
|
<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>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>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>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>
|
||||||
|
@ -3061,16 +3077,6 @@ void <tt class="descname">nghttp2_hd_deflate_del</tt><big>(</big><a class="refer
|
||||||
<dd><p>Deallocates any resources allocated for <em>deflater</em>.</p>
|
<dd><p>Deallocates any resources allocated for <em>deflater</em>.</p>
|
||||||
</dd></dl>
|
</dd></dl>
|
||||||
|
|
||||||
<dl class="function">
|
|
||||||
<dt id="c.nghttp2_hd_deflate_set_no_refset">
|
|
||||||
void <tt class="descname">nghttp2_hd_deflate_set_no_refset</tt><big>(</big><a class="reference internal" href="#c.nghttp2_hd_deflater" title="nghttp2_hd_deflater">nghttp2_hd_deflater</a><em> *deflater</em>, uint8_t<em> no_refset</em><big>)</big><a class="headerlink" href="#c.nghttp2_hd_deflate_set_no_refset" title="Permalink to this definition">¶</a></dt>
|
|
||||||
<dd><p>Sets the availability of reference set in the <em>deflater</em>. If
|
|
||||||
<em>no_refset</em> is nonzero, the deflater will first emit “Reference Set
|
|
||||||
Emptying” in the each subsequent invocation of
|
|
||||||
<a class="reference internal" href="#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> to clear up reference set. By default,
|
|
||||||
the deflater uses reference set.</p>
|
|
||||||
</dd></dl>
|
|
||||||
|
|
||||||
<dl class="function">
|
<dl class="function">
|
||||||
<dt id="c.nghttp2_hd_deflate_change_table_size">
|
<dt id="c.nghttp2_hd_deflate_change_table_size">
|
||||||
int <tt class="descname">nghttp2_hd_deflate_change_table_size</tt><big>(</big><a class="reference internal" href="#c.nghttp2_hd_deflater" title="nghttp2_hd_deflater">nghttp2_hd_deflater</a><em> *deflater</em>, size_t<em> settings_hd_table_bufsize_max</em><big>)</big><a class="headerlink" href="#c.nghttp2_hd_deflate_change_table_size" title="Permalink to this definition">¶</a></dt>
|
int <tt class="descname">nghttp2_hd_deflate_change_table_size</tt><big>(</big><a class="reference internal" href="#c.nghttp2_hd_deflater" title="nghttp2_hd_deflater">nghttp2_hd_deflater</a><em> *deflater</em>, size_t<em> settings_hd_table_bufsize_max</em><big>)</big><a class="headerlink" href="#c.nghttp2_hd_deflate_change_table_size" title="Permalink to this definition">¶</a></dt>
|
||||||
|
@ -3282,7 +3288,7 @@ always succeeds.</p>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var DOCUMENTATION_OPTIONS = {
|
var DOCUMENTATION_OPTIONS = {
|
||||||
URL_ROOT:'./',
|
URL_ROOT:'./',
|
||||||
VERSION:'0.5.1-DEV',
|
VERSION:'0.5.2-DEV',
|
||||||
COLLAPSE_INDEX:false,
|
COLLAPSE_INDEX:false,
|
||||||
FILE_SUFFIX:'.html',
|
FILE_SUFFIX:'.html',
|
||||||
HAS_SOURCE: false
|
HAS_SOURCE: false
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
|
||||||
<title>Index — nghttp2 0.5.1-DEV documentation</title>
|
<title>Index — nghttp2 0.5.2-DEV documentation</title>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<link rel="top" title="nghttp2 0.5.1-DEV documentation" href="index.html"/>
|
<link rel="top" title="nghttp2 0.5.2-DEV documentation" href="index.html"/>
|
||||||
|
|
||||||
|
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script>
|
||||||
|
@ -1940,10 +1940,6 @@
|
||||||
</dt>
|
</dt>
|
||||||
|
|
||||||
|
|
||||||
<dt><a href="apiref.html#c.NGHTTP2_FLAG_END_SEGMENT">NGHTTP2_FLAG_END_SEGMENT (C macro)</a>
|
|
||||||
</dt>
|
|
||||||
|
|
||||||
|
|
||||||
<dt><a href="apiref.html#c.NGHTTP2_FLAG_END_STREAM">NGHTTP2_FLAG_END_STREAM (C macro)</a>
|
<dt><a href="apiref.html#c.NGHTTP2_FLAG_END_STREAM">NGHTTP2_FLAG_END_STREAM (C macro)</a>
|
||||||
</dt>
|
</dt>
|
||||||
|
|
||||||
|
@ -2104,10 +2100,6 @@
|
||||||
</dt>
|
</dt>
|
||||||
|
|
||||||
|
|
||||||
<dt><a href="apiref.html#c.nghttp2_hd_deflate_set_no_refset">nghttp2_hd_deflate_set_no_refset (C function)</a>
|
|
||||||
</dt>
|
|
||||||
|
|
||||||
|
|
||||||
<dt><a href="apiref.html#c.nghttp2_hd_deflater">nghttp2_hd_deflater (C type)</a>
|
<dt><a href="apiref.html#c.nghttp2_hd_deflater">nghttp2_hd_deflater (C type)</a>
|
||||||
</dt>
|
</dt>
|
||||||
|
|
||||||
|
@ -2207,8 +2199,6 @@
|
||||||
<dt><a href="apiref.html#c.nghttp2_info.version_num">nghttp2_info.version_num (C member)</a>
|
<dt><a href="apiref.html#c.nghttp2_info.version_num">nghttp2_info.version_num (C member)</a>
|
||||||
</dt>
|
</dt>
|
||||||
|
|
||||||
</dl></td>
|
|
||||||
<td style="width: 33%" valign="top"><dl>
|
|
||||||
|
|
||||||
<dt><a href="apiref.html#c.nghttp2_info.version_str">nghttp2_info.version_str (C member)</a>
|
<dt><a href="apiref.html#c.nghttp2_info.version_str">nghttp2_info.version_str (C member)</a>
|
||||||
</dt>
|
</dt>
|
||||||
|
@ -2217,6 +2207,8 @@
|
||||||
<dt><a href="apiref.html#c.NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE">NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE (C macro)</a>
|
<dt><a href="apiref.html#c.NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE">NGHTTP2_INITIAL_CONNECTION_WINDOW_SIZE (C macro)</a>
|
||||||
</dt>
|
</dt>
|
||||||
|
|
||||||
|
</dl></td>
|
||||||
|
<td style="width: 33%" valign="top"><dl>
|
||||||
|
|
||||||
<dt><a href="apiref.html#c.NGHTTP2_INITIAL_MAX_CONCURRENT_STREAMS">NGHTTP2_INITIAL_MAX_CONCURRENT_STREAMS (C macro)</a>
|
<dt><a href="apiref.html#c.NGHTTP2_INITIAL_MAX_CONCURRENT_STREAMS">NGHTTP2_INITIAL_MAX_CONCURRENT_STREAMS (C macro)</a>
|
||||||
</dt>
|
</dt>
|
||||||
|
@ -2338,11 +2330,7 @@
|
||||||
</dt>
|
</dt>
|
||||||
|
|
||||||
|
|
||||||
<dt><a href="apiref.html#c.nghttp2_option_set_no_auto_connection_window_update">nghttp2_option_set_no_auto_connection_window_update (C function)</a>
|
<dt><a href="apiref.html#c.nghttp2_option_set_no_auto_window_update">nghttp2_option_set_no_auto_window_update (C function)</a>
|
||||||
</dt>
|
|
||||||
|
|
||||||
|
|
||||||
<dt><a href="apiref.html#c.nghttp2_option_set_no_auto_stream_window_update">nghttp2_option_set_no_auto_stream_window_update (C function)</a>
|
|
||||||
</dt>
|
</dt>
|
||||||
|
|
||||||
|
|
||||||
|
@ -2554,6 +2542,10 @@
|
||||||
</dt>
|
</dt>
|
||||||
|
|
||||||
|
|
||||||
|
<dt><a href="apiref.html#c.nghttp2_session_consume">nghttp2_session_consume (C function)</a>
|
||||||
|
</dt>
|
||||||
|
|
||||||
|
|
||||||
<dt><a href="apiref.html#c.nghttp2_session_del">nghttp2_session_del (C function)</a>
|
<dt><a href="apiref.html#c.nghttp2_session_del">nghttp2_session_del (C function)</a>
|
||||||
</dt>
|
</dt>
|
||||||
|
|
||||||
|
@ -2702,6 +2694,14 @@
|
||||||
</dt>
|
</dt>
|
||||||
|
|
||||||
|
|
||||||
|
<dt><a href="apiref.html#c.NGHTTP2_SETTINGS_MAX_FRAME_SIZE">NGHTTP2_SETTINGS_MAX_FRAME_SIZE (C macro)</a>
|
||||||
|
</dt>
|
||||||
|
|
||||||
|
|
||||||
|
<dt><a href="apiref.html#c.NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE">NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE (C macro)</a>
|
||||||
|
</dt>
|
||||||
|
|
||||||
|
|
||||||
<dt><a href="apiref.html#c.NGHTTP2_SETTINGS_TIMEOUT">NGHTTP2_SETTINGS_TIMEOUT (C macro)</a>
|
<dt><a href="apiref.html#c.NGHTTP2_SETTINGS_TIMEOUT">NGHTTP2_SETTINGS_TIMEOUT (C macro)</a>
|
||||||
</dt>
|
</dt>
|
||||||
|
|
||||||
|
@ -3291,7 +3291,7 @@
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var DOCUMENTATION_OPTIONS = {
|
var DOCUMENTATION_OPTIONS = {
|
||||||
URL_ROOT:'./',
|
URL_ROOT:'./',
|
||||||
VERSION:'0.5.1-DEV',
|
VERSION:'0.5.2-DEV',
|
||||||
COLLAPSE_INDEX:false,
|
COLLAPSE_INDEX:false,
|
||||||
FILE_SUFFIX:'.html',
|
FILE_SUFFIX:'.html',
|
||||||
HAS_SOURCE: false
|
HAS_SOURCE: false
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
|
||||||
<title>h2load - HTTP/2 benchmarking tool - HOW-TO — nghttp2 0.5.1-DEV documentation</title>
|
<title>h2load - HTTP/2 benchmarking tool - HOW-TO — nghttp2 0.5.2-DEV documentation</title>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<link rel="top" title="nghttp2 0.5.1-DEV documentation" href="index.html"/>
|
<link rel="top" title="nghttp2 0.5.2-DEV documentation" href="index.html"/>
|
||||||
<link rel="next" title="API Reference" href="apiref.html"/>
|
<link rel="next" title="API Reference" href="apiref.html"/>
|
||||||
<link rel="prev" title="nghttpx - HTTP/2 proxy - HOW-TO" href="nghttpx-howto.html"/>
|
<link rel="prev" title="nghttpx - HTTP/2 proxy - HOW-TO" href="nghttpx-howto.html"/>
|
||||||
|
|
||||||
|
@ -308,7 +308,7 @@ and ignores those parts in the rest of the URIs.</p>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var DOCUMENTATION_OPTIONS = {
|
var DOCUMENTATION_OPTIONS = {
|
||||||
URL_ROOT:'./',
|
URL_ROOT:'./',
|
||||||
VERSION:'0.5.1-DEV',
|
VERSION:'0.5.2-DEV',
|
||||||
COLLAPSE_INDEX:false,
|
COLLAPSE_INDEX:false,
|
||||||
FILE_SUFFIX:'.html',
|
FILE_SUFFIX:'.html',
|
||||||
HAS_SOURCE: false
|
HAS_SOURCE: false
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
|
||||||
<title>h2load(1) — nghttp2 0.5.1-DEV documentation</title>
|
<title>h2load(1) — nghttp2 0.5.2-DEV documentation</title>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<link rel="top" title="nghttp2 0.5.1-DEV documentation" href="index.html"/>
|
<link rel="top" title="nghttp2 0.5.2-DEV documentation" href="index.html"/>
|
||||||
<link rel="next" title="nghttpx - HTTP/2 proxy - HOW-TO" href="nghttpx-howto.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"/>
|
<link rel="prev" title="nghttpx(1)" href="nghttpx.1.html"/>
|
||||||
|
|
||||||
|
@ -329,7 +329,7 @@ Default: h2c-13</p>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var DOCUMENTATION_OPTIONS = {
|
var DOCUMENTATION_OPTIONS = {
|
||||||
URL_ROOT:'./',
|
URL_ROOT:'./',
|
||||||
VERSION:'0.5.1-DEV',
|
VERSION:'0.5.2-DEV',
|
||||||
COLLAPSE_INDEX:false,
|
COLLAPSE_INDEX:false,
|
||||||
FILE_SUFFIX:'.html',
|
FILE_SUFFIX:'.html',
|
||||||
HAS_SOURCE: false
|
HAS_SOURCE: false
|
||||||
|
|
11
index.html
11
index.html
|
@ -7,7 +7,7 @@
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
|
||||||
<title>nghttp2 - HTTP/2 C Library — nghttp2 0.5.1-DEV documentation</title>
|
<title>nghttp2 - HTTP/2 C Library — nghttp2 0.5.2-DEV documentation</title>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<link rel="top" title="nghttp2 0.5.1-DEV documentation" href="#"/>
|
<link rel="top" title="nghttp2 0.5.2-DEV documentation" href="#"/>
|
||||||
<link rel="next" title="nghttp2 - HTTP/2 C Library" href="package_README.html"/>
|
<link rel="next" title="nghttp2 - HTTP/2 C Library" href="package_README.html"/>
|
||||||
|
|
||||||
|
|
||||||
|
@ -304,8 +304,9 @@ version 2.</p>
|
||||||
<div class="section" id="resources">
|
<div class="section" id="resources">
|
||||||
<h2>Resources<a class="headerlink" href="#resources" title="Permalink to this headline">¶</a></h2>
|
<h2>Resources<a class="headerlink" href="#resources" title="Permalink to this headline">¶</a></h2>
|
||||||
<ul class="simple">
|
<ul class="simple">
|
||||||
<li><a class="reference external" href="http://tools.ietf.org/html/draft-ietf-httpbis-http2-13">http://tools.ietf.org/html/draft-ietf-httpbis-http2-13</a></li>
|
<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-08">http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-08</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>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -346,7 +347,7 @@ version 2.</p>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var DOCUMENTATION_OPTIONS = {
|
var DOCUMENTATION_OPTIONS = {
|
||||||
URL_ROOT:'./',
|
URL_ROOT:'./',
|
||||||
VERSION:'0.5.1-DEV',
|
VERSION:'0.5.2-DEV',
|
||||||
COLLAPSE_INDEX:false,
|
COLLAPSE_INDEX:false,
|
||||||
FILE_SUFFIX:'.html',
|
FILE_SUFFIX:'.html',
|
||||||
HAS_SOURCE: false
|
HAS_SOURCE: false
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
|
||||||
<title>nghttp(1) — nghttp2 0.5.1-DEV documentation</title>
|
<title>nghttp(1) — nghttp2 0.5.2-DEV documentation</title>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<link rel="top" title="nghttp2 0.5.1-DEV documentation" href="index.html"/>
|
<link rel="top" title="nghttp2 0.5.2-DEV documentation" href="index.html"/>
|
||||||
<link rel="next" title="nghttpd(1)" href="nghttpd.1.html"/>
|
<link rel="next" title="nghttpd(1)" href="nghttpd.1.html"/>
|
||||||
<link rel="prev" title="Tutorial: HPACK API" href="tutorial-hpack.html"/>
|
<link rel="prev" title="Tutorial: HPACK API" href="tutorial-hpack.html"/>
|
||||||
|
|
||||||
|
@ -415,7 +415,7 @@ padding. Specify 0 to disable padding.</p>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var DOCUMENTATION_OPTIONS = {
|
var DOCUMENTATION_OPTIONS = {
|
||||||
URL_ROOT:'./',
|
URL_ROOT:'./',
|
||||||
VERSION:'0.5.1-DEV',
|
VERSION:'0.5.2-DEV',
|
||||||
COLLAPSE_INDEX:false,
|
COLLAPSE_INDEX:false,
|
||||||
FILE_SUFFIX:'.html',
|
FILE_SUFFIX:'.html',
|
||||||
HAS_SOURCE: false
|
HAS_SOURCE: false
|
||||||
|
|
102
nghttp2.h.html
102
nghttp2.h.html
|
@ -7,7 +7,7 @@
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
|
||||||
<title>nghttp2.h — nghttp2 0.5.1-DEV documentation</title>
|
<title>nghttp2.h — nghttp2 0.5.2-DEV documentation</title>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<link rel="top" title="nghttp2 0.5.1-DEV documentation" href="index.html"/>
|
<link rel="top" title="nghttp2 0.5.2-DEV documentation" href="index.html"/>
|
||||||
<link rel="next" title="nghttp2ver.h" href="nghttp2ver.h.html"/>
|
<link rel="next" title="nghttp2ver.h" href="nghttp2ver.h.html"/>
|
||||||
<link rel="prev" title="Python API Reference" href="python-apiref.html"/>
|
<link rel="prev" title="Python API Reference" href="python-apiref.html"/>
|
||||||
|
|
||||||
|
@ -231,7 +231,7 @@
|
||||||
<span class="cm"> * The protocol version identification string of this library</span>
|
<span class="cm"> * The protocol version identification string of this library</span>
|
||||||
<span class="cm"> * supports. This identifier is used if HTTP/2 is used over TLS.</span>
|
<span class="cm"> * supports. This identifier is used if HTTP/2 is used over TLS.</span>
|
||||||
<span class="cm"> */</span>
|
<span class="cm"> */</span>
|
||||||
<span class="cp">#define NGHTTP2_PROTO_VERSION_ID "h2-13"</span>
|
<span class="cp">#define NGHTTP2_PROTO_VERSION_ID "h2-14"</span>
|
||||||
<span class="cm">/**</span>
|
<span class="cm">/**</span>
|
||||||
<span class="cm"> * @macro</span>
|
<span class="cm"> * @macro</span>
|
||||||
<span class="cm"> *</span>
|
<span class="cm"> *</span>
|
||||||
|
@ -246,7 +246,7 @@
|
||||||
<span class="cm"> * supports. This identifier is used if HTTP/2 is used over cleartext</span>
|
<span class="cm"> * supports. This identifier is used if HTTP/2 is used over cleartext</span>
|
||||||
<span class="cm"> * TCP.</span>
|
<span class="cm"> * TCP.</span>
|
||||||
<span class="cm"> */</span>
|
<span class="cm"> */</span>
|
||||||
<span class="cp">#define NGHTTP2_CLEARTEXT_PROTO_VERSION_ID "h2c-13"</span>
|
<span class="cp">#define NGHTTP2_CLEARTEXT_PROTO_VERSION_ID "h2c-14"</span>
|
||||||
|
|
||||||
<span class="cm">/**</span>
|
<span class="cm">/**</span>
|
||||||
<span class="cm"> * @macro</span>
|
<span class="cm"> * @macro</span>
|
||||||
|
@ -667,10 +667,6 @@
|
||||||
<span class="cm"> */</span>
|
<span class="cm"> */</span>
|
||||||
<span class="n">NGHTTP2_FLAG_ACK</span> <span class="o">=</span> <span class="mh">0x01</span><span class="p">,</span>
|
<span class="n">NGHTTP2_FLAG_ACK</span> <span class="o">=</span> <span class="mh">0x01</span><span class="p">,</span>
|
||||||
<span class="cm">/**</span>
|
<span class="cm">/**</span>
|
||||||
<span class="cm"> * The END_SEGMENT flag.</span>
|
|
||||||
<span class="cm"> */</span>
|
|
||||||
<span class="n">NGHTTP2_FLAG_END_SEGMENT</span> <span class="o">=</span> <span class="mh">0x02</span><span class="p">,</span>
|
|
||||||
<span class="cm">/**</span>
|
|
||||||
<span class="cm"> * The PADDED flag.</span>
|
<span class="cm"> * The PADDED flag.</span>
|
||||||
<span class="cm"> */</span>
|
<span class="cm"> */</span>
|
||||||
<span class="n">NGHTTP2_FLAG_PADDED</span> <span class="o">=</span> <span class="mh">0x08</span><span class="p">,</span>
|
<span class="n">NGHTTP2_FLAG_PADDED</span> <span class="o">=</span> <span class="mh">0x08</span><span class="p">,</span>
|
||||||
|
@ -700,7 +696,15 @@
|
||||||
<span class="cm">/**</span>
|
<span class="cm">/**</span>
|
||||||
<span class="cm"> * SETTINGS_INITIAL_WINDOW_SIZE</span>
|
<span class="cm"> * SETTINGS_INITIAL_WINDOW_SIZE</span>
|
||||||
<span class="cm"> */</span>
|
<span class="cm"> */</span>
|
||||||
<span class="n">NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE</span> <span class="o">=</span> <span class="mh">0x04</span>
|
<span class="n">NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE</span> <span class="o">=</span> <span class="mh">0x04</span><span class="p">,</span>
|
||||||
|
<span class="cm">/**</span>
|
||||||
|
<span class="cm"> * SETTINGS_MAX_FRAME_SIZE</span>
|
||||||
|
<span class="cm"> */</span>
|
||||||
|
<span class="n">NGHTTP2_SETTINGS_MAX_FRAME_SIZE</span> <span class="o">=</span> <span class="mh">0x05</span><span class="p">,</span>
|
||||||
|
<span class="cm">/**</span>
|
||||||
|
<span class="cm"> * SETTINGS_MAX_HEADER_LIST_SIZE</span>
|
||||||
|
<span class="cm"> */</span>
|
||||||
|
<span class="n">NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE</span> <span class="o">=</span> <span class="mh">0x06</span>
|
||||||
<span class="p">}</span> <span class="n">nghttp2_settings_id</span><span class="p">;</span>
|
<span class="p">}</span> <span class="n">nghttp2_settings_id</span><span class="p">;</span>
|
||||||
<span class="cm">/* Note: If we add SETTINGS, update the capacity of</span>
|
<span class="cm">/* Note: If we add SETTINGS, update the capacity of</span>
|
||||||
<span class="cm"> NGHTTP2_INBOUND_NUM_IV as well */</span>
|
<span class="cm"> NGHTTP2_INBOUND_NUM_IV as well */</span>
|
||||||
|
@ -914,7 +918,9 @@
|
||||||
<span class="n">NGHTTP2_HCAT_PUSH_RESPONSE</span> <span class="o">=</span> <span class="mi">2</span><span class="p">,</span>
|
<span class="n">NGHTTP2_HCAT_PUSH_RESPONSE</span> <span class="o">=</span> <span class="mi">2</span><span class="p">,</span>
|
||||||
<span class="cm">/**</span>
|
<span class="cm">/**</span>
|
||||||
<span class="cm"> * The HEADERS frame which does not apply for the above categories,</span>
|
<span class="cm"> * The HEADERS frame which does not apply for the above categories,</span>
|
||||||
<span class="cm"> * which is analogous to HEADERS in SPDY.</span>
|
<span class="cm"> * which is analogous to HEADERS in SPDY. If non-final response</span>
|
||||||
|
<span class="cm"> * (e.g., status 1xx) is used, final response HEADERS frame will be</span>
|
||||||
|
<span class="cm"> * categorized here.</span>
|
||||||
<span class="cm"> */</span>
|
<span class="cm"> */</span>
|
||||||
<span class="n">NGHTTP2_HCAT_HEADERS</span> <span class="o">=</span> <span class="mi">3</span>
|
<span class="n">NGHTTP2_HCAT_HEADERS</span> <span class="o">=</span> <span class="mi">3</span>
|
||||||
<span class="p">}</span> <span class="n">nghttp2_headers_category</span><span class="p">;</span>
|
<span class="p">}</span> <span class="n">nghttp2_headers_category</span><span class="p">;</span>
|
||||||
|
@ -1695,31 +1701,17 @@
|
||||||
<span class="cm"> */</span>
|
<span class="cm"> */</span>
|
||||||
<span class="kt">void</span> <span class="nf">nghttp2_option_del</span><span class="p">(</span><span class="n">nghttp2_option</span> <span class="o">*</span><span class="n">option</span><span class="p">);</span>
|
<span class="kt">void</span> <span class="nf">nghttp2_option_del</span><span class="p">(</span><span class="n">nghttp2_option</span> <span class="o">*</span><span class="n">option</span><span class="p">);</span>
|
||||||
|
|
||||||
<span class="cm">/**</span>
|
|
||||||
<span class="cm"> * @function</span>
|
|
||||||
<span class="cm"> *</span>
|
|
||||||
<span class="cm"> * This option prevents the library from sending WINDOW_UPDATE for a</span>
|
|
||||||
<span class="cm"> * stream automatically. If this option is set to nonzero, the</span>
|
|
||||||
<span class="cm"> * library won't send WINDOW_UPDATE for a stream and the application</span>
|
|
||||||
<span class="cm"> * is responsible for sending WINDOW_UPDATE using</span>
|
|
||||||
<span class="cm"> * `nghttp2_submit_window_update`. By default, this option is set to</span>
|
|
||||||
<span class="cm"> * zero.</span>
|
|
||||||
<span class="cm"> */</span>
|
|
||||||
<span class="kt">void</span> <span class="nf">nghttp2_option_set_no_auto_stream_window_update</span><span class="p">(</span><span class="n">nghttp2_option</span> <span class="o">*</span><span class="n">option</span><span class="p">,</span>
|
|
||||||
<span class="kt">int</span> <span class="n">val</span><span class="p">);</span>
|
|
||||||
|
|
||||||
<span class="cm">/**</span>
|
<span class="cm">/**</span>
|
||||||
<span class="cm"> * @function</span>
|
<span class="cm"> * @function</span>
|
||||||
<span class="cm"> *</span>
|
<span class="cm"> *</span>
|
||||||
<span class="cm"> * This option prevents the library from sending WINDOW_UPDATE for a</span>
|
<span class="cm"> * This option prevents the library from sending WINDOW_UPDATE for a</span>
|
||||||
<span class="cm"> * connection automatically. If this option is set to nonzero, the</span>
|
<span class="cm"> * connection automatically. If this option is set to nonzero, the</span>
|
||||||
<span class="cm"> * library won't send WINDOW_UPDATE for a connection and the</span>
|
<span class="cm"> * library won't send WINDOW_UPDATE for DATA until application calls</span>
|
||||||
<span class="cm"> * application is responsible for sending WINDOW_UPDATE with stream ID</span>
|
<span class="cm"> * `nghttp2_session_consume()` to indicate the consumed amount of</span>
|
||||||
<span class="cm"> * 0 using `nghttp2_submit_window_update`. By default, this option is</span>
|
<span class="cm"> * data. Don't use `nghttp2_submit_window_update()` for this purpose.</span>
|
||||||
<span class="cm"> * set to zero.</span>
|
<span class="cm"> * By default, this option is set to zero.</span>
|
||||||
<span class="cm"> */</span>
|
<span class="cm"> */</span>
|
||||||
<span class="kt">void</span> <span class="nf">nghttp2_option_set_no_auto_connection_window_update</span>
|
<span class="kt">void</span> <span class="nf">nghttp2_option_set_no_auto_window_update</span><span class="p">(</span><span class="n">nghttp2_option</span> <span class="o">*</span><span class="n">option</span><span class="p">,</span> <span class="kt">int</span> <span class="n">val</span><span class="p">);</span>
|
||||||
<span class="p">(</span><span class="n">nghttp2_option</span> <span class="o">*</span><span class="n">option</span><span class="p">,</span> <span class="kt">int</span> <span class="n">val</span><span class="p">);</span>
|
|
||||||
|
|
||||||
<span class="cm">/**</span>
|
<span class="cm">/**</span>
|
||||||
<span class="cm"> * @function</span>
|
<span class="cm"> * @function</span>
|
||||||
|
@ -2257,6 +2249,28 @@
|
||||||
<span class="kt">uint32_t</span> <span class="nf">nghttp2_session_get_remote_settings</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">uint32_t</span> <span class="nf">nghttp2_session_get_remote_settings</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_settings_id</span> <span class="n">id</span><span class="p">);</span>
|
<span class="n">nghttp2_settings_id</span> <span class="n">id</span><span class="p">);</span>
|
||||||
|
|
||||||
|
<span class="cm">/**</span>
|
||||||
|
<span class="cm"> * @function</span>
|
||||||
|
<span class="cm"> *</span>
|
||||||
|
<span class="cm"> * Tells the |session| that |size| bytes for a stream denoted by</span>
|
||||||
|
<span class="cm"> * |stream_id| were consumed by application and are ready to</span>
|
||||||
|
<span class="cm"> * WINDOW_UPDATE. This function is intended to be used without</span>
|
||||||
|
<span class="cm"> * automatic window update (see</span>
|
||||||
|
<span class="cm"> * `nghttp2_option_set_no_auto_window_update()`).</span>
|
||||||
|
<span class="cm"> *</span>
|
||||||
|
<span class="cm"> * This function returns 0 if it succeeds, or one of the following</span>
|
||||||
|
<span class="cm"> * negative error codes:</span>
|
||||||
|
<span class="cm"> *</span>
|
||||||
|
<span class="cm"> * :enum:`NGHTTP2_ERR_NOMEM`</span>
|
||||||
|
<span class="cm"> * Out of memory.</span>
|
||||||
|
<span class="cm"> * :enum:`NGHTTP2_ERR_INVALID_ARGUMENT`</span>
|
||||||
|
<span class="cm"> * The |stream_id| is 0.</span>
|
||||||
|
<span class="cm"> * :enum:`NGHTTP2_ERR_INVALID_STATE`</span>
|
||||||
|
<span class="cm"> * Automatic WINDOW_UPDATE is not disabled.</span>
|
||||||
|
<span class="cm"> */</span>
|
||||||
|
<span class="kt">int</span> <span class="nf">nghttp2_session_consume</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">size_t</span> <span class="n">size</span><span class="p">);</span>
|
||||||
|
|
||||||
<span class="cm">/**</span>
|
<span class="cm">/**</span>
|
||||||
<span class="cm"> * @function</span>
|
<span class="cm"> * @function</span>
|
||||||
<span class="cm"> *</span>
|
<span class="cm"> *</span>
|
||||||
|
@ -2556,8 +2570,7 @@
|
||||||
<span class="cm"> * Submits one or more DATA frames to the stream |stream_id|. The</span>
|
<span class="cm"> * Submits one or more DATA frames to the stream |stream_id|. The</span>
|
||||||
<span class="cm"> * data to be sent are provided by |data_prd|. If |flags| contains</span>
|
<span class="cm"> * data to be sent are provided by |data_prd|. If |flags| contains</span>
|
||||||
<span class="cm"> * :enum:`NGHTTP2_FLAG_END_STREAM`, the last DATA frame has END_STREAM</span>
|
<span class="cm"> * :enum:`NGHTTP2_FLAG_END_STREAM`, the last DATA frame has END_STREAM</span>
|
||||||
<span class="cm"> * flag set. If |flags| contains :enum:`NGHTTP2_FLAG_END_SEGMENT`,</span>
|
<span class="cm"> * flag set.</span>
|
||||||
<span class="cm"> * the last DATA frame has END_SEGMENT flag set.</span>
|
|
||||||
<span class="cm"> *</span>
|
<span class="cm"> *</span>
|
||||||
<span class="cm"> * This function does not take ownership of the |data_prd|. The</span>
|
<span class="cm"> * This function does not take ownership of the |data_prd|. The</span>
|
||||||
<span class="cm"> * function copies the members of the |data_prd|.</span>
|
<span class="cm"> * function copies the members of the |data_prd|.</span>
|
||||||
|
@ -2799,12 +2812,11 @@
|
||||||
<span class="cm"> * difference.</span>
|
<span class="cm"> * difference.</span>
|
||||||
<span class="cm"> *</span>
|
<span class="cm"> *</span>
|
||||||
<span class="cm"> * If the |window_size_increment| is negative, the local window size</span>
|
<span class="cm"> * If the |window_size_increment| is negative, the local window size</span>
|
||||||
<span class="cm"> * is decreased by -|window_size_increment|. If</span>
|
<span class="cm"> * is decreased by -|window_size_increment|. If automatic</span>
|
||||||
<span class="cm"> * :enum:`NGHTTP2_OPT_NO_AUTO_STREAM_WINDOW_UPDATE` (or</span>
|
<span class="cm"> * WINDOW_UPDATE is enabled</span>
|
||||||
<span class="cm"> * :enum:`NGHTTP2_OPT_NO_AUTO_CONNECTION_WINDOW_UPDATE` if |stream_id|</span>
|
<span class="cm"> * (`nghttp2_option_set_no_auto_window_update()`), and the library</span>
|
||||||
<span class="cm"> * is 0) is not set and the library decided that the WINDOW_UPDATE</span>
|
<span class="cm"> * decided that the WINDOW_UPDATE should be submitted, then</span>
|
||||||
<span class="cm"> * should be submitted, then WINDOW_UPDATE is queued with the current</span>
|
<span class="cm"> * WINDOW_UPDATE is queued with the current received bytes count.</span>
|
||||||
<span class="cm"> * received bytes count.</span>
|
|
||||||
<span class="cm"> *</span>
|
<span class="cm"> *</span>
|
||||||
<span class="cm"> * If the |window_size_increment| is 0, the function does nothing and</span>
|
<span class="cm"> * If the |window_size_increment| is 0, the function does nothing and</span>
|
||||||
<span class="cm"> * returns 0.</span>
|
<span class="cm"> * returns 0.</span>
|
||||||
|
@ -2831,7 +2843,7 @@
|
||||||
<span class="cm"> *</span>
|
<span class="cm"> *</span>
|
||||||
<span class="cm"> * Only the server can send the ALTSVC frame. If |session| is</span>
|
<span class="cm"> * Only the server can send the ALTSVC frame. If |session| is</span>
|
||||||
<span class="cm"> * initialized as client, this function fails and returns</span>
|
<span class="cm"> * initialized as client, this function fails and returns</span>
|
||||||
<span class="cm"> * :enum:`NGHTTP2_ERR_INVALID_STATE`.</span>
|
<span class="cm"> * :enum:`NGHTTP2_ERR_PROTO`.</span>
|
||||||
<span class="cm"> *</span>
|
<span class="cm"> *</span>
|
||||||
<span class="cm"> * If the |protocol_id_len| is 0, the |protocol_id| could be ``NULL``.</span>
|
<span class="cm"> * If the |protocol_id_len| is 0, the |protocol_id| could be ``NULL``.</span>
|
||||||
<span class="cm"> *</span>
|
<span class="cm"> *</span>
|
||||||
|
@ -3009,18 +3021,6 @@
|
||||||
<span class="cm"> */</span>
|
<span class="cm"> */</span>
|
||||||
<span class="kt">void</span> <span class="nf">nghttp2_hd_deflate_del</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="kt">void</span> <span class="nf">nghttp2_hd_deflate_del</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="cm">/**</span>
|
|
||||||
<span class="cm"> * @function</span>
|
|
||||||
<span class="cm"> *</span>
|
|
||||||
<span class="cm"> * Sets the availability of reference set in the |deflater|. If</span>
|
|
||||||
<span class="cm"> * |no_refset| is nonzero, the deflater will first emit "Reference Set</span>
|
|
||||||
<span class="cm"> * Emptying" in the each subsequent invocation of</span>
|
|
||||||
<span class="cm"> * `nghttp2_hd_deflate_hd()` to clear up reference set. By default,</span>
|
|
||||||
<span class="cm"> * the deflater uses reference set.</span>
|
|
||||||
<span class="cm"> */</span>
|
|
||||||
<span class="kt">void</span> <span class="nf">nghttp2_hd_deflate_set_no_refset</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="kt">uint8_t</span> <span class="n">no_refset</span><span class="p">);</span>
|
|
||||||
|
|
||||||
<span class="cm">/**</span>
|
<span class="cm">/**</span>
|
||||||
<span class="cm"> * @function</span>
|
<span class="cm"> * @function</span>
|
||||||
<span class="cm"> *</span>
|
<span class="cm"> *</span>
|
||||||
|
@ -3294,7 +3294,7 @@
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var DOCUMENTATION_OPTIONS = {
|
var DOCUMENTATION_OPTIONS = {
|
||||||
URL_ROOT:'./',
|
URL_ROOT:'./',
|
||||||
VERSION:'0.5.1-DEV',
|
VERSION:'0.5.2-DEV',
|
||||||
COLLAPSE_INDEX:false,
|
COLLAPSE_INDEX:false,
|
||||||
FILE_SUFFIX:'.html',
|
FILE_SUFFIX:'.html',
|
||||||
HAS_SOURCE: false
|
HAS_SOURCE: false
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
|
||||||
<title>nghttp2ver.h — nghttp2 0.5.1-DEV documentation</title>
|
<title>nghttp2ver.h — nghttp2 0.5.2-DEV documentation</title>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<link rel="top" title="nghttp2 0.5.1-DEV documentation" href="index.html"/>
|
<link rel="top" title="nghttp2 0.5.2-DEV documentation" href="index.html"/>
|
||||||
<link rel="prev" title="nghttp2.h" href="nghttp2.h.html"/>
|
<link rel="prev" title="nghttp2.h" href="nghttp2.h.html"/>
|
||||||
|
|
||||||
|
|
||||||
|
@ -218,7 +218,7 @@
|
||||||
<span class="cm"> * @macro</span>
|
<span class="cm"> * @macro</span>
|
||||||
<span class="cm"> * Version number of the nghttp2 library release</span>
|
<span class="cm"> * Version number of the nghttp2 library release</span>
|
||||||
<span class="cm"> */</span>
|
<span class="cm"> */</span>
|
||||||
<span class="cp">#define NGHTTP2_VERSION "0.5.1-DEV"</span>
|
<span class="cp">#define NGHTTP2_VERSION "0.5.2-DEV"</span>
|
||||||
|
|
||||||
<span class="cm">/**</span>
|
<span class="cm">/**</span>
|
||||||
<span class="cm"> * @macro</span>
|
<span class="cm"> * @macro</span>
|
||||||
|
@ -226,7 +226,7 @@
|
||||||
<span class="cm"> * release. This is a 24 bit number with 8 bits for major number, 8 bits</span>
|
<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"> * for minor and 8 bits for patch. Version 1.2.3 becomes 0x010203.</span>
|
||||||
<span class="cm"> */</span>
|
<span class="cm"> */</span>
|
||||||
<span class="cp">#define NGHTTP2_VERSION_NUM 0x000501</span>
|
<span class="cp">#define NGHTTP2_VERSION_NUM 0x000502</span>
|
||||||
|
|
||||||
<span class="cp">#endif </span><span class="cm">/* NGHTTP2VER_H */</span><span class="cp"></span>
|
<span class="cp">#endif </span><span class="cm">/* NGHTTP2VER_H */</span><span class="cp"></span>
|
||||||
</pre></div>
|
</pre></div>
|
||||||
|
@ -269,7 +269,7 @@
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var DOCUMENTATION_OPTIONS = {
|
var DOCUMENTATION_OPTIONS = {
|
||||||
URL_ROOT:'./',
|
URL_ROOT:'./',
|
||||||
VERSION:'0.5.1-DEV',
|
VERSION:'0.5.2-DEV',
|
||||||
COLLAPSE_INDEX:false,
|
COLLAPSE_INDEX:false,
|
||||||
FILE_SUFFIX:'.html',
|
FILE_SUFFIX:'.html',
|
||||||
HAS_SOURCE: false
|
HAS_SOURCE: false
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
|
||||||
<title>nghttpd(1) — nghttp2 0.5.1-DEV documentation</title>
|
<title>nghttpd(1) — nghttp2 0.5.2-DEV documentation</title>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<link rel="top" title="nghttp2 0.5.1-DEV documentation" href="index.html"/>
|
<link rel="top" title="nghttp2 0.5.2-DEV documentation" href="index.html"/>
|
||||||
<link rel="next" title="nghttpx(1)" href="nghttpx.1.html"/>
|
<link rel="next" title="nghttpx(1)" href="nghttpx.1.html"/>
|
||||||
<link rel="prev" title="nghttp(1)" href="nghttp.1.html"/>
|
<link rel="prev" title="nghttp(1)" href="nghttp.1.html"/>
|
||||||
|
|
||||||
|
@ -379,7 +379,7 @@ received.</p>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var DOCUMENTATION_OPTIONS = {
|
var DOCUMENTATION_OPTIONS = {
|
||||||
URL_ROOT:'./',
|
URL_ROOT:'./',
|
||||||
VERSION:'0.5.1-DEV',
|
VERSION:'0.5.2-DEV',
|
||||||
COLLAPSE_INDEX:false,
|
COLLAPSE_INDEX:false,
|
||||||
FILE_SUFFIX:'.html',
|
FILE_SUFFIX:'.html',
|
||||||
HAS_SOURCE: false
|
HAS_SOURCE: false
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
|
||||||
<title>nghttpx - HTTP/2 proxy - HOW-TO — nghttp2 0.5.1-DEV documentation</title>
|
<title>nghttpx - HTTP/2 proxy - HOW-TO — nghttp2 0.5.2-DEV documentation</title>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<link rel="top" title="nghttp2 0.5.1-DEV documentation" href="index.html"/>
|
<link rel="top" title="nghttp2 0.5.2-DEV documentation" href="index.html"/>
|
||||||
<link rel="next" title="h2load - HTTP/2 benchmarking tool - HOW-TO" href="h2load-howto.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"/>
|
<link rel="prev" title="h2load(1)" href="h2load.1.html"/>
|
||||||
|
|
||||||
|
@ -461,7 +461,7 @@ header field.</p>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var DOCUMENTATION_OPTIONS = {
|
var DOCUMENTATION_OPTIONS = {
|
||||||
URL_ROOT:'./',
|
URL_ROOT:'./',
|
||||||
VERSION:'0.5.1-DEV',
|
VERSION:'0.5.2-DEV',
|
||||||
COLLAPSE_INDEX:false,
|
COLLAPSE_INDEX:false,
|
||||||
FILE_SUFFIX:'.html',
|
FILE_SUFFIX:'.html',
|
||||||
HAS_SOURCE: false
|
HAS_SOURCE: false
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
|
||||||
<title>nghttpx(1) — nghttp2 0.5.1-DEV documentation</title>
|
<title>nghttpx(1) — nghttp2 0.5.2-DEV documentation</title>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<link rel="top" title="nghttp2 0.5.1-DEV documentation" href="index.html"/>
|
<link rel="top" title="nghttp2 0.5.2-DEV documentation" href="index.html"/>
|
||||||
<link rel="next" title="h2load(1)" href="h2load.1.html"/>
|
<link rel="next" title="h2load(1)" href="h2load.1.html"/>
|
||||||
<link rel="prev" title="nghttpd(1)" href="nghttpd.1.html"/>
|
<link rel="prev" title="nghttpd(1)" href="nghttpd.1.html"/>
|
||||||
|
|
||||||
|
@ -821,7 +821,7 @@ Default: /etc/nghttpx/nghttpx.conf</p>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var DOCUMENTATION_OPTIONS = {
|
var DOCUMENTATION_OPTIONS = {
|
||||||
URL_ROOT:'./',
|
URL_ROOT:'./',
|
||||||
VERSION:'0.5.1-DEV',
|
VERSION:'0.5.2-DEV',
|
||||||
COLLAPSE_INDEX:false,
|
COLLAPSE_INDEX:false,
|
||||||
FILE_SUFFIX:'.html',
|
FILE_SUFFIX:'.html',
|
||||||
HAS_SOURCE: false
|
HAS_SOURCE: false
|
||||||
|
|
BIN
objects.inv
BIN
objects.inv
Binary file not shown.
|
@ -7,7 +7,7 @@
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
|
||||||
<title>nghttp2 - HTTP/2 C Library — nghttp2 0.5.1-DEV documentation</title>
|
<title>nghttp2 - HTTP/2 C Library — nghttp2 0.5.2-DEV documentation</title>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<link rel="top" title="nghttp2 0.5.1-DEV documentation" href="index.html"/>
|
<link rel="top" title="nghttp2 0.5.2-DEV documentation" href="index.html"/>
|
||||||
<link rel="next" title="Tutorial: HTTP/2 client" href="tutorial-client.html"/>
|
<link rel="next" title="Tutorial: HTTP/2 client" href="tutorial-client.html"/>
|
||||||
<link rel="prev" title="nghttp2 - HTTP/2 C Library" href="index.html"/>
|
<link rel="prev" title="nghttp2 - HTTP/2 C Library" href="index.html"/>
|
||||||
|
|
||||||
|
@ -199,10 +199,12 @@ HTTP/2 and SPDY.</p>
|
||||||
everything yet.</p>
|
everything yet.</p>
|
||||||
<div class="section" id="development-status">
|
<div class="section" id="development-status">
|
||||||
<h2>Development Status<a class="headerlink" href="#development-status" title="Permalink to this headline">¶</a></h2>
|
<h2>Development Status<a class="headerlink" href="#development-status" title="Permalink to this headline">¶</a></h2>
|
||||||
<p>We started to implement h2-13
|
<p>We started to implement h2-14
|
||||||
(<a class="reference external" href="http://tools.ietf.org/html/draft-ietf-httpbis-http2-13">http://tools.ietf.org/html/draft-ietf-httpbis-http2-13</a>) and the
|
(<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
|
||||||
header compression
|
compression
|
||||||
(<a class="reference external" href="http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-08">http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-08</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>)
|
||||||
|
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>
|
||||||
<p>The nghttp2 code base was forked from spdylay project.</p>
|
<p>The nghttp2 code base was forked from spdylay project.</p>
|
||||||
<table border="1" class="docutils">
|
<table border="1" class="docutils">
|
||||||
<colgroup>
|
<colgroup>
|
||||||
|
@ -225,16 +227,10 @@ header compression
|
||||||
<td>Yes</td>
|
<td>Yes</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="row-odd"><td>ALTSVC extension</td>
|
<tr class="row-odd"><td>ALTSVC extension</td>
|
||||||
<td>Yes *1</td>
|
<td>Yes</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<ul class="simple">
|
|
||||||
<li>*1 As described in draft-12, but reserved byte was removed. ALTSVC
|
|
||||||
may be removed from nghttp2 public API since it is not stabilized
|
|
||||||
yet.</li>
|
|
||||||
</ul>
|
|
||||||
<p>BLOCKED frame, which once existed in h2-12, was removed in h2-13.</p>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="public-test-server">
|
<div class="section" id="public-test-server">
|
||||||
<h2>Public Test Server<a class="headerlink" href="#public-test-server" title="Permalink to this headline">¶</a></h2>
|
<h2>Public Test Server<a class="headerlink" href="#public-test-server" title="Permalink to this headline">¶</a></h2>
|
||||||
|
@ -242,7 +238,7 @@ yet.</li>
|
||||||
implementation.</p>
|
implementation.</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li><p class="first"><a class="reference external" href="https://nghttp2.org/">https://nghttp2.org/</a> (TLS + NPN)</p>
|
<li><p class="first"><a class="reference external" href="https://nghttp2.org/">https://nghttp2.org/</a> (TLS + NPN)</p>
|
||||||
<p>NPN offer <tt class="docutils literal"><span class="pre">h2-13</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>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>.
|
||||||
ALPN is currently disabled.</p>
|
ALPN is currently disabled.</p>
|
||||||
<p>This endpoint requires TLSv1.2 and DHE or EDCHE with GCM cipher
|
<p>This endpoint requires TLSv1.2 and DHE or EDCHE with GCM cipher
|
||||||
suite for HTTP/2 connection.</p>
|
suite for HTTP/2 connection.</p>
|
||||||
|
@ -369,10 +365,10 @@ with prior knowledge, HTTP Upgrade and NPN/ALPN TLS extension.</p>
|
||||||
output from <tt class="docutils literal"><span class="pre">nghttp</span></tt> client:</p>
|
output from <tt class="docutils literal"><span class="pre">nghttp</span></tt> client:</p>
|
||||||
<div class="highlight-c"><div class="highlight"><pre>$ src/nghttp -nv https://nghttp2.org
|
<div class="highlight-c"><div class="highlight"><pre>$ src/nghttp -nv https://nghttp2.org
|
||||||
[ 0.033][NPN] server offers:
|
[ 0.033][NPN] server offers:
|
||||||
* h2-13
|
* h2-14
|
||||||
* spdy/3.1
|
* spdy/3.1
|
||||||
* http/1.1
|
* http/1.1
|
||||||
The negotiated protocol: h2-13
|
The negotiated protocol: h2-14
|
||||||
[ 0.068] send SETTINGS frame <length=15, flags=0x00, stream_id=0>
|
[ 0.068] send SETTINGS frame <length=15, flags=0x00, stream_id=0>
|
||||||
(niv=3)
|
(niv=3)
|
||||||
[SETTINGS_MAX_CONCURRENT_STREAMS(3):100]
|
[SETTINGS_MAX_CONCURRENT_STREAMS(3):100]
|
||||||
|
@ -464,7 +460,7 @@ Upgrade: h2c-13
|
||||||
[SETTINGS_MAX_CONCURRENT_STREAMS(3):100]
|
[SETTINGS_MAX_CONCURRENT_STREAMS(3):100]
|
||||||
[SETTINGS_INITIAL_WINDOW_SIZE(4):65535]
|
[SETTINGS_INITIAL_WINDOW_SIZE(4):65535]
|
||||||
[ 0.024] recv ALTSVC frame <length=43, flags=0x00, stream_id=0>
|
[ 0.024] recv ALTSVC frame <length=43, flags=0x00, stream_id=0>
|
||||||
(max-age=86400, port=443, protocol_id=h2-13, host=nghttp2.org, origin=http://nghttp2.org)
|
(max-age=86400, port=443, protocol_id=h2-14, host=nghttp2.org, origin=http://nghttp2.org)
|
||||||
[ 0.024] send SETTINGS frame <length=0, flags=0x01, stream_id=0>
|
[ 0.024] send SETTINGS frame <length=0, flags=0x01, stream_id=0>
|
||||||
; ACK
|
; ACK
|
||||||
(niv=0)
|
(niv=0)
|
||||||
|
@ -569,7 +565,7 @@ IPv6: listen on port 8080
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="nghttpx-proxy">
|
<div class="section" id="nghttpx-proxy">
|
||||||
<h3>nghttpx - proxy<a class="headerlink" href="#nghttpx-proxy" title="Permalink to this headline">¶</a></h3>
|
<h3>nghttpx - proxy<a class="headerlink" href="#nghttpx-proxy" title="Permalink to this headline">¶</a></h3>
|
||||||
<p><tt class="docutils literal"><span class="pre">nghttpx</span></tt> is a multi-threaded reverse proxy for <tt class="docutils literal"><span class="pre">h2-13</span></tt>, SPDY and
|
<p><tt class="docutils literal"><span class="pre">nghttpx</span></tt> is a multi-threaded reverse proxy for <tt class="docutils literal"><span class="pre">h2-14</span></tt>, SPDY and
|
||||||
HTTP/1.1 and powers nghttp2.org site. It has several operation modes:</p>
|
HTTP/1.1 and powers nghttp2.org site. It has several operation modes:</p>
|
||||||
<table border="1" class="docutils">
|
<table border="1" class="docutils">
|
||||||
<colgroup>
|
<colgroup>
|
||||||
|
@ -614,7 +610,7 @@ HTTP/1.1 and powers nghttp2.org site. It has several operation modes:</p>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<p>The interesting mode at the moment is the default mode. It works like
|
<p>The interesting mode at the moment is the default mode. It works like
|
||||||
a reverse proxy and listens for <tt class="docutils literal"><span class="pre">h2-13</span></tt>, SPDY and HTTP/1.1 and can
|
a reverse proxy and listens for <tt class="docutils literal"><span class="pre">h2-14</span></tt>, SPDY and HTTP/1.1 and can
|
||||||
be deployed SSL/TLS terminator for existing web server.</p>
|
be deployed SSL/TLS terminator for existing web server.</p>
|
||||||
<p>The default mode, <tt class="docutils literal"><span class="pre">--http2-proxy</span></tt> and <tt class="docutils literal"><span class="pre">--http2-bridge</span></tt> modes use
|
<p>The default mode, <tt class="docutils literal"><span class="pre">--http2-proxy</span></tt> and <tt class="docutils literal"><span class="pre">--http2-bridge</span></tt> modes use
|
||||||
SSL/TLS in the frontend connection by default. To disable SSL/TLS,
|
SSL/TLS in the frontend connection by default. To disable SSL/TLS,
|
||||||
|
@ -1269,7 +1265,7 @@ BaseRequestHandler usage:</p>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var DOCUMENTATION_OPTIONS = {
|
var DOCUMENTATION_OPTIONS = {
|
||||||
URL_ROOT:'./',
|
URL_ROOT:'./',
|
||||||
VERSION:'0.5.1-DEV',
|
VERSION:'0.5.2-DEV',
|
||||||
COLLAPSE_INDEX:false,
|
COLLAPSE_INDEX:false,
|
||||||
FILE_SUFFIX:'.html',
|
FILE_SUFFIX:'.html',
|
||||||
HAS_SOURCE: false
|
HAS_SOURCE: false
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
|
||||||
<title>Python Module Index — nghttp2 0.5.1-DEV documentation</title>
|
<title>Python Module Index — nghttp2 0.5.2-DEV documentation</title>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<link rel="top" title="nghttp2 0.5.1-DEV documentation" href="index.html"/>
|
<link rel="top" title="nghttp2 0.5.2-DEV documentation" href="index.html"/>
|
||||||
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
@ -238,7 +238,7 @@
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var DOCUMENTATION_OPTIONS = {
|
var DOCUMENTATION_OPTIONS = {
|
||||||
URL_ROOT:'./',
|
URL_ROOT:'./',
|
||||||
VERSION:'0.5.1-DEV',
|
VERSION:'0.5.2-DEV',
|
||||||
COLLAPSE_INDEX:false,
|
COLLAPSE_INDEX:false,
|
||||||
FILE_SUFFIX:'.html',
|
FILE_SUFFIX:'.html',
|
||||||
HAS_SOURCE: false
|
HAS_SOURCE: false
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
|
||||||
<title>Python API Reference — nghttp2 0.5.1-DEV documentation</title>
|
<title>Python API Reference — nghttp2 0.5.2-DEV documentation</title>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<link rel="top" title="nghttp2 0.5.1-DEV documentation" href="index.html"/>
|
<link rel="top" title="nghttp2 0.5.2-DEV documentation" href="index.html"/>
|
||||||
<link rel="next" title="nghttp2.h" href="nghttp2.h.html"/>
|
<link rel="next" title="nghttp2.h" href="nghttp2.h.html"/>
|
||||||
<link rel="prev" title="API Reference" href="apiref.html"/>
|
<link rel="prev" title="API Reference" href="apiref.html"/>
|
||||||
|
|
||||||
|
@ -565,7 +565,7 @@ encoded using UTF-8.</p>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var DOCUMENTATION_OPTIONS = {
|
var DOCUMENTATION_OPTIONS = {
|
||||||
URL_ROOT:'./',
|
URL_ROOT:'./',
|
||||||
VERSION:'0.5.1-DEV',
|
VERSION:'0.5.2-DEV',
|
||||||
COLLAPSE_INDEX:false,
|
COLLAPSE_INDEX:false,
|
||||||
FILE_SUFFIX:'.html',
|
FILE_SUFFIX:'.html',
|
||||||
HAS_SOURCE: false
|
HAS_SOURCE: false
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
|
||||||
<title>Search — nghttp2 0.5.1-DEV documentation</title>
|
<title>Search — nghttp2 0.5.2-DEV documentation</title>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<link rel="top" title="nghttp2 0.5.1-DEV documentation" href="index.html"/>
|
<link rel="top" title="nghttp2 0.5.2-DEV documentation" href="index.html"/>
|
||||||
|
|
||||||
|
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script>
|
||||||
|
@ -226,7 +226,7 @@
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var DOCUMENTATION_OPTIONS = {
|
var DOCUMENTATION_OPTIONS = {
|
||||||
URL_ROOT:'./',
|
URL_ROOT:'./',
|
||||||
VERSION:'0.5.1-DEV',
|
VERSION:'0.5.2-DEV',
|
||||||
COLLAPSE_INDEX:false,
|
COLLAPSE_INDEX:false,
|
||||||
FILE_SUFFIX:'.html',
|
FILE_SUFFIX:'.html',
|
||||||
HAS_SOURCE: false
|
HAS_SOURCE: false
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -7,7 +7,7 @@
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
|
||||||
<title>Tutorial: HTTP/2 client — nghttp2 0.5.1-DEV documentation</title>
|
<title>Tutorial: HTTP/2 client — nghttp2 0.5.2-DEV documentation</title>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<link rel="top" title="nghttp2 0.5.1-DEV documentation" href="index.html"/>
|
<link rel="top" title="nghttp2 0.5.2-DEV documentation" href="index.html"/>
|
||||||
<link rel="next" title="Tutorial: HTTP/2 server" href="tutorial-server.html"/>
|
<link rel="next" title="Tutorial: HTTP/2 server" href="tutorial-server.html"/>
|
||||||
<link rel="prev" title="nghttp2 - HTTP/2 C Library" href="package_README.html"/>
|
<link rel="prev" title="nghttp2 - HTTP/2 C Library" href="package_README.html"/>
|
||||||
|
|
||||||
|
@ -1235,7 +1235,7 @@ here.</p>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var DOCUMENTATION_OPTIONS = {
|
var DOCUMENTATION_OPTIONS = {
|
||||||
URL_ROOT:'./',
|
URL_ROOT:'./',
|
||||||
VERSION:'0.5.1-DEV',
|
VERSION:'0.5.2-DEV',
|
||||||
COLLAPSE_INDEX:false,
|
COLLAPSE_INDEX:false,
|
||||||
FILE_SUFFIX:'.html',
|
FILE_SUFFIX:'.html',
|
||||||
HAS_SOURCE: false
|
HAS_SOURCE: false
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
|
||||||
<title>Tutorial: HPACK API — nghttp2 0.5.1-DEV documentation</title>
|
<title>Tutorial: HPACK API — nghttp2 0.5.2-DEV documentation</title>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<link rel="top" title="nghttp2 0.5.1-DEV documentation" href="index.html"/>
|
<link rel="top" title="nghttp2 0.5.2-DEV documentation" href="index.html"/>
|
||||||
<link rel="next" title="nghttp(1)" href="nghttp.1.html"/>
|
<link rel="next" title="nghttp(1)" href="nghttp.1.html"/>
|
||||||
<link rel="prev" title="Tutorial: HTTP/2 server" href="tutorial-server.html"/>
|
<link rel="prev" title="Tutorial: HTTP/2 server" href="tutorial-server.html"/>
|
||||||
|
|
||||||
|
@ -556,7 +556,7 @@ function.</p>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var DOCUMENTATION_OPTIONS = {
|
var DOCUMENTATION_OPTIONS = {
|
||||||
URL_ROOT:'./',
|
URL_ROOT:'./',
|
||||||
VERSION:'0.5.1-DEV',
|
VERSION:'0.5.2-DEV',
|
||||||
COLLAPSE_INDEX:false,
|
COLLAPSE_INDEX:false,
|
||||||
FILE_SUFFIX:'.html',
|
FILE_SUFFIX:'.html',
|
||||||
HAS_SOURCE: false
|
HAS_SOURCE: false
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
|
||||||
<title>Tutorial: HTTP/2 server — nghttp2 0.5.1-DEV documentation</title>
|
<title>Tutorial: HTTP/2 server — nghttp2 0.5.2-DEV documentation</title>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<link rel="top" title="nghttp2 0.5.1-DEV documentation" href="index.html"/>
|
<link rel="top" title="nghttp2 0.5.2-DEV documentation" href="index.html"/>
|
||||||
<link rel="next" title="Tutorial: HPACK API" href="tutorial-hpack.html"/>
|
<link rel="next" title="Tutorial: HPACK API" href="tutorial-hpack.html"/>
|
||||||
<link rel="prev" title="Tutorial: HTTP/2 client" href="tutorial-client.html"/>
|
<link rel="prev" title="Tutorial: HTTP/2 client" href="tutorial-client.html"/>
|
||||||
|
|
||||||
|
@ -190,27 +190,26 @@
|
||||||
<h1>Tutorial: HTTP/2 server<a class="headerlink" href="#tutorial-http-2-server" title="Permalink to this headline">¶</a></h1>
|
<h1>Tutorial: HTTP/2 server<a class="headerlink" href="#tutorial-http-2-server" title="Permalink to this headline">¶</a></h1>
|
||||||
<p>In this tutorial, we are going to write single-threaded, event-based
|
<p>In this tutorial, we are going to write single-threaded, event-based
|
||||||
HTTP/2 web server, which supports HTTPS only. It can handle
|
HTTP/2 web server, which supports HTTPS only. It can handle
|
||||||
concurrent multiple requests, but only GET method is supported. The
|
concurrent multiple requests, but only the GET method is supported. The
|
||||||
complete source code, <a class="reference internal" href="#libevent-server-c">libevent-server.c</a>, is attached at the end of
|
complete source code, <a class="reference internal" href="#libevent-server-c">libevent-server.c</a>, is attached at the end of
|
||||||
this page. It also resides in examples directory in the archive or
|
this page. It also resides in examples directory in the archive or
|
||||||
repository.</p>
|
repository.</p>
|
||||||
<p>This simple server takes 3 arguments, a port number to listen to, a
|
<p>This simple server takes 3 arguments, a port number to listen to, a path to
|
||||||
path to SSL/TLS private key file and certificate file. Its synopsis
|
your SSL/TLS private key file and a path to your certificate file. Its
|
||||||
is like this:</p>
|
synopsis is like this:</p>
|
||||||
<div class="highlight-c"><div class="highlight"><pre>$ libevent-server PORT /path/to/server.key /path/to/server.crt
|
<div class="highlight-c"><div class="highlight"><pre>$ libevent-server PORT /path/to/server.key /path/to/server.crt
|
||||||
</pre></div>
|
</pre></div>
|
||||||
</div>
|
</div>
|
||||||
<p>We use libevent in this tutorial to handle networking I/O. Please
|
<p>We use libevent in this tutorial to handle networking I/O. Please
|
||||||
note that nghttp2 itself does not depend on libevent.</p>
|
note that nghttp2 itself does not depend on libevent.</p>
|
||||||
<p>First we do some setup routine for libevent and OpenSSL library in
|
<p>First we create a setup routine for libevent and OpenSSL in the functions
|
||||||
function <tt class="docutils literal"><span class="pre">main()</span></tt> and <tt class="docutils literal"><span class="pre">run()</span></tt>, which is not so relevant to nghttp2
|
<tt class="docutils literal"><span class="pre">main()</span></tt> and <tt class="docutils literal"><span class="pre">run()</span></tt>. One thing in there you should look at, is the setup
|
||||||
library use. The one thing you should look at is setup NPN callback.
|
of the NPN callback. The NPN callback is used for the server to advertise
|
||||||
The NPN callback is used for the server to advertise the application
|
which application protocols the server supports to a client. In this example
|
||||||
protocols the server supports to a client. In this example program,
|
program, when creating <tt class="docutils literal"><span class="pre">SSL_CTX</span></tt> object, we store the application protocol
|
||||||
when creating <tt class="docutils literal"><span class="pre">SSL_CTX</span></tt> object, we stores the application protocol
|
name in the wire format of NPN in a statically allocated buffer. This is safe
|
||||||
name in the wire format of NPN in statically allocated buffer. This is
|
because we only create one <tt class="docutils literal"><span class="pre">SSL_CTX</span></tt> object in the program’s entire life
|
||||||
safe because we only create 1 <tt class="docutils literal"><span class="pre">SSL_CTX</span></tt> object in the entire program
|
time:</p>
|
||||||
life time:</p>
|
|
||||||
<div class="highlight-c"><div class="highlight"><pre><span class="k">static</span> <span class="kt">unsigned</span> <span class="kt">char</span> <span class="n">next_proto_list</span><span class="p">[</span><span class="mi">256</span><span class="p">];</span>
|
<div class="highlight-c"><div class="highlight"><pre><span class="k">static</span> <span class="kt">unsigned</span> <span class="kt">char</span> <span class="n">next_proto_list</span><span class="p">[</span><span class="mi">256</span><span class="p">];</span>
|
||||||
<span class="k">static</span> <span class="kt">size_t</span> <span class="n">next_proto_list_len</span><span class="p">;</span>
|
<span class="k">static</span> <span class="kt">size_t</span> <span class="n">next_proto_list_len</span><span class="p">;</span>
|
||||||
|
|
||||||
|
@ -239,24 +238,24 @@ life time:</p>
|
||||||
<span class="p">}</span>
|
<span class="p">}</span>
|
||||||
</pre></div>
|
</pre></div>
|
||||||
</div>
|
</div>
|
||||||
<p>The wire format of NPN is a sequence of length prefixed string. The
|
<p>The wire format of NPN is a sequence of length prefixed string. Exactly one
|
||||||
exactly one byte is used to specify the length of each protocol
|
byte is used to specify the length of each protocol identifier. In this
|
||||||
identifier. In this tutorial, we advertise the HTTP/2 protocol the
|
tutorial, we advertise the specific HTTP/2 protocol version the current
|
||||||
nghttp2 library supports. The nghttp2 library exports its identifier
|
nghttp2 library supports. The nghttp2 library exports its identifier in
|
||||||
in <a class="reference internal" href="apiref.html#c.NGHTTP2_PROTO_VERSION_ID" title="NGHTTP2_PROTO_VERSION_ID"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_PROTO_VERSION_ID</span></tt></a>. The <tt class="docutils literal"><span class="pre">next_proto_cb()</span></tt> function
|
<a class="reference internal" href="apiref.html#c.NGHTTP2_PROTO_VERSION_ID" title="NGHTTP2_PROTO_VERSION_ID"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_PROTO_VERSION_ID</span></tt></a>. The <tt class="docutils literal"><span class="pre">next_proto_cb()</span></tt> function is the
|
||||||
is the server-side NPN callback. In OpenSSL implementation, we just
|
server-side NPN callback. In the OpenSSL implementation, we just assign the
|
||||||
assign the pointer to the NPN buffers we filled earlier. The NPN
|
pointer to the NPN buffers we filled in earlier. The NPN callback function is
|
||||||
callback function is set to <tt class="docutils literal"><span class="pre">SSL_CTX</span></tt> object using
|
set to the <tt class="docutils literal"><span class="pre">SSL_CTX</span></tt> object using
|
||||||
<tt class="docutils literal"><span class="pre">SSL_CTX_set_next_protos_advertised_cb()</span></tt>.</p>
|
<tt class="docutils literal"><span class="pre">SSL_CTX_set_next_protos_advertised_cb()</span></tt>.</p>
|
||||||
<p>We use <tt class="docutils literal"><span class="pre">app_content</span></tt> structure to store the application-wide data:</p>
|
<p>We use the <tt class="docutils literal"><span class="pre">app_content</span></tt> structure to store application-wide data:</p>
|
||||||
<div class="highlight-c"><div class="highlight"><pre><span class="k">struct</span> <span class="n">app_context</span> <span class="p">{</span>
|
<div class="highlight-c"><div class="highlight"><pre><span class="k">struct</span> <span class="n">app_context</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</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="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="p">};</span>
|
||||||
</pre></div>
|
</pre></div>
|
||||||
</div>
|
</div>
|
||||||
<p>We use <tt class="docutils literal"><span class="pre">http2_session_data</span></tt> structure to store the session-level
|
<p>We use the <tt class="docutils literal"><span class="pre">http2_session_data</span></tt> structure to store session-level
|
||||||
(which corresponds to 1 HTTP/2 connection) data:</p>
|
(which corresponds to one HTTP/2 connection) data:</p>
|
||||||
<div class="highlight-c"><div class="highlight"><pre><span class="k">typedef</span> <span class="k">struct</span> <span class="n">http2_session_data</span> <span class="p">{</span>
|
<div class="highlight-c"><div class="highlight"><pre><span class="k">typedef</span> <span class="k">struct</span> <span class="n">http2_session_data</span> <span class="p">{</span>
|
||||||
<span class="k">struct</span> <span class="n">http2_stream_data</span> <span class="n">root</span><span class="p">;</span>
|
<span class="k">struct</span> <span class="n">http2_stream_data</span> <span class="n">root</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="k">struct</span> <span class="n">bufferevent</span> <span class="o">*</span><span class="n">bev</span><span class="p">;</span>
|
||||||
|
@ -267,8 +266,7 @@ callback function is set to <tt class="docutils literal"><span class="pre">SSL_C
|
||||||
<span class="p">}</span> <span class="n">http2_session_data</span><span class="p">;</span>
|
<span class="p">}</span> <span class="n">http2_session_data</span><span class="p">;</span>
|
||||||
</pre></div>
|
</pre></div>
|
||||||
</div>
|
</div>
|
||||||
<p>We use <tt class="docutils literal"><span class="pre">http2_stream_data</span></tt> structure to store the stream-level
|
<p>We use the <tt class="docutils literal"><span class="pre">http2_stream_data</span></tt> structure to store stream-level data:</p>
|
||||||
data:</p>
|
|
||||||
<div class="highlight-c"><div class="highlight"><pre><span class="k">typedef</span> <span class="k">struct</span> <span class="n">http2_stream_data</span> <span class="p">{</span>
|
<div class="highlight-c"><div class="highlight"><pre><span class="k">typedef</span> <span class="k">struct</span> <span class="n">http2_stream_data</span> <span class="p">{</span>
|
||||||
<span class="k">struct</span> <span class="n">http2_stream_data</span> <span class="o">*</span><span class="n">prev</span><span class="p">,</span> <span class="o">*</span><span class="n">next</span><span class="p">;</span>
|
<span class="k">struct</span> <span class="n">http2_stream_data</span> <span class="o">*</span><span class="n">prev</span><span class="p">,</span> <span class="o">*</span><span class="n">next</span><span class="p">;</span>
|
||||||
<span class="kt">char</span> <span class="o">*</span><span class="n">request_path</span><span class="p">;</span>
|
<span class="kt">char</span> <span class="o">*</span><span class="n">request_path</span><span class="p">;</span>
|
||||||
|
@ -277,22 +275,19 @@ data:</p>
|
||||||
<span class="p">}</span> <span class="n">http2_stream_data</span><span class="p">;</span>
|
<span class="p">}</span> <span class="n">http2_stream_data</span><span class="p">;</span>
|
||||||
</pre></div>
|
</pre></div>
|
||||||
</div>
|
</div>
|
||||||
<p>1 HTTP/2 session can have multiple streams. We manage these multiple
|
<p>A single HTTP/2 session can have multiple streams. We manage these multiple
|
||||||
streams by intrusive doubly linked list to add and remove the object
|
streams with a doubly linked list. The first element of this list is pointed
|
||||||
in O(1). The first element of this list is pointed by the
|
to by the <tt class="docutils literal"><span class="pre">root->next</span></tt> in <tt class="docutils literal"><span class="pre">http2_session_data</span></tt>. Initially, <tt class="docutils literal"><span class="pre">root->next</span></tt>
|
||||||
<tt class="docutils literal"><span class="pre">root->next</span></tt> in <tt class="docutils literal"><span class="pre">http2_session_data</span></tt>. Initially, <tt class="docutils literal"><span class="pre">root->next</span></tt>
|
is <tt class="docutils literal"><span class="pre">NULL</span></tt>. The <tt class="docutils literal"><span class="pre">handshake_leftlen</span></tt> member of <tt class="docutils literal"><span class="pre">http2_session_data</span></tt> is
|
||||||
is <tt class="docutils literal"><span class="pre">NULL</span></tt>. The <tt class="docutils literal"><span class="pre">handshake_leftlen</span></tt> member of
|
used to track the number of bytes remaining when receiving the first client
|
||||||
<tt class="docutils literal"><span class="pre">http2_session_data</span></tt> is used to track the number of bytes remaining
|
connection preface (<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>), which is a 24
|
||||||
when receiving first client connection preface
|
bytes long magic string from the client. We use libevent’s bufferevent
|
||||||
(<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>), which is 24 bytes magic
|
structure to perform network I/O. Note that the bufferevent object is kept in
|
||||||
byte string, from the client. We use libevent’s bufferevent structure
|
<tt class="docutils literal"><span class="pre">http2_session_data</span></tt> and not in <tt class="docutils literal"><span class="pre">http2_stream_data</span></tt>. This is because
|
||||||
to perform network I/O. Notice that bufferevent object is in
|
<tt class="docutils literal"><span class="pre">http2_stream_data</span></tt> is just a logical stream multiplexed over the single
|
||||||
<tt class="docutils literal"><span class="pre">http2_session_data</span></tt> and not in <tt class="docutils literal"><span class="pre">http2_stream_data</span></tt>. This is
|
connection managed by bufferevent in <tt class="docutils literal"><span class="pre">http2_session_data</span></tt>.</p>
|
||||||
because <tt class="docutils literal"><span class="pre">http2_stream_data</span></tt> is just a logical stream multiplexed
|
<p>We first create a listener object to accept incoming connections. We use
|
||||||
over the single connection managed by bufferevent in
|
libevent’s <tt class="docutils literal"><span class="pre">struct</span> <span class="pre">evconnlistener</span></tt> for this purpose:</p>
|
||||||
<tt class="docutils literal"><span class="pre">http2_session_data</span></tt>.</p>
|
|
||||||
<p>We first create listener object to accept incoming connections.
|
|
||||||
We use libevent’s <tt class="docutils literal"><span class="pre">struct</span> <span class="pre">evconnlistener</span></tt> for this purpose:</p>
|
|
||||||
<div class="highlight-c"><div class="highlight"><pre><span class="k">static</span> <span class="kt">void</span> <span class="nf">start_listen</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="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">service</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">start_listen</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="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">service</span><span class="p">,</span>
|
||||||
<span class="n">app_context</span> <span class="o">*</span><span class="n">app_ctx</span><span class="p">)</span>
|
<span class="n">app_context</span> <span class="o">*</span><span class="n">app_ctx</span><span class="p">)</span>
|
||||||
<span class="p">{</span>
|
<span class="p">{</span>
|
||||||
|
@ -326,8 +321,8 @@ We use libevent’s <tt class="docutils literal"><span class="pre">struct</s
|
||||||
<span class="p">}</span>
|
<span class="p">}</span>
|
||||||
</pre></div>
|
</pre></div>
|
||||||
</div>
|
</div>
|
||||||
<p>We specify <tt class="docutils literal"><span class="pre">acceptcb</span></tt> callback which is called when a new connection
|
<p>We specify the <tt class="docutils literal"><span class="pre">acceptcb</span></tt> callback which is called when a new connection is
|
||||||
is accepted:</p>
|
accepted:</p>
|
||||||
<div class="highlight-c"><div class="highlight"><pre><span class="k">static</span> <span class="kt">void</span> <span class="nf">acceptcb</span><span class="p">(</span><span class="k">struct</span> <span class="n">evconnlistener</span> <span class="o">*</span><span class="n">listener</span><span class="p">,</span> <span class="kt">int</span> <span class="n">fd</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">acceptcb</span><span class="p">(</span><span class="k">struct</span> <span class="n">evconnlistener</span> <span class="o">*</span><span class="n">listener</span><span class="p">,</span> <span class="kt">int</span> <span class="n">fd</span><span class="p">,</span>
|
||||||
<span class="k">struct</span> <span class="n">sockaddr</span> <span class="o">*</span><span class="n">addr</span><span class="p">,</span> <span class="kt">int</span> <span class="n">addrlen</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="k">struct</span> <span class="n">sockaddr</span> <span class="o">*</span><span class="n">addr</span><span class="p">,</span> <span class="kt">int</span> <span class="n">addrlen</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="p">{</span>
|
||||||
|
@ -340,10 +335,10 @@ is accepted:</p>
|
||||||
<span class="p">}</span>
|
<span class="p">}</span>
|
||||||
</pre></div>
|
</pre></div>
|
||||||
</div>
|
</div>
|
||||||
<p>Here we create <tt class="docutils literal"><span class="pre">http2_session_data</span></tt> object. The bufferevent for this
|
<p>Here we create the <tt class="docutils literal"><span class="pre">http2_session_data</span></tt> object. The bufferevent for this
|
||||||
connection is also initialized at this time. We specify 2 callbacks
|
connection is also initialized at this time. We specify two callbacks for the
|
||||||
for the bufferevent: <tt class="docutils literal"><span class="pre">handshake_readcb</span></tt> and <tt class="docutils literal"><span class="pre">eventcb</span></tt>.</p>
|
bufferevent: <tt class="docutils literal"><span class="pre">handshake_readcb</span></tt> and <tt class="docutils literal"><span class="pre">eventcb</span></tt>.</p>
|
||||||
<p>The <tt class="docutils literal"><span class="pre">eventcb()</span></tt> is invoked by libevent event loop when an event
|
<p>The <tt class="docutils literal"><span class="pre">eventcb()</span></tt> callback is invoked by the libevent event loop when an event
|
||||||
(e.g., connection has been established, timeout, etc) happens on the
|
(e.g., connection has been established, timeout, etc) happens on the
|
||||||
underlying network socket:</p>
|
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>
|
<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>
|
||||||
|
@ -364,16 +359,14 @@ underlying network socket:</p>
|
||||||
<span class="p">}</span>
|
<span class="p">}</span>
|
||||||
</pre></div>
|
</pre></div>
|
||||||
</div>
|
</div>
|
||||||
<p>For <tt class="docutils literal"><span class="pre">BEV_EVENT_EOF</span></tt>, <tt class="docutils literal"><span class="pre">BEV_EVENT_ERROR</span></tt> and <tt class="docutils literal"><span class="pre">BEV_EVENT_TIMEOUT</span></tt>
|
<p>For the <tt class="docutils literal"><span class="pre">BEV_EVENT_EOF</span></tt>, <tt class="docutils literal"><span class="pre">BEV_EVENT_ERROR</span></tt> and <tt class="docutils literal"><span class="pre">BEV_EVENT_TIMEOUT</span></tt>
|
||||||
event, we just simply tear down the connection. The
|
events, we just simply tear down the connection. The
|
||||||
<tt class="docutils literal"><span class="pre">delete_http2_session_data()</span></tt> function destroys
|
<tt class="docutils literal"><span class="pre">delete_http2_session_data()</span></tt> function destroys the <tt class="docutils literal"><span class="pre">http2_session_data</span></tt>
|
||||||
<tt class="docutils literal"><span class="pre">http2_session_data</span></tt> object and thus its bufferevent member. As a
|
object and thus also its bufferevent member. As a result, the underlying
|
||||||
result, the underlying connection is closed. The
|
connection is closed. The <tt class="docutils literal"><span class="pre">BEV_EVENT_CONNECTED</span></tt> event is invoked when
|
||||||
<tt class="docutils literal"><span class="pre">BEV_EVENT_CONNECTED</span></tt> event is invoked when SSL/TLS handshake is
|
SSL/TLS handshake is finished successfully.</p>
|
||||||
finished successfully.</p>
|
<p><tt class="docutils literal"><span class="pre">handshake_readcb()</span></tt> is a callback function to handle a 24 bytes magic byte
|
||||||
<p>The <tt class="docutils literal"><span class="pre">handshake_readcb()</span></tt> is a callback function to handle 24 bytes
|
string coming from a client, since the nghttp2 library does not handle it:</p>
|
||||||
magic byte string from a client, since nghttp2 library does not handle
|
|
||||||
it:</p>
|
|
||||||
<div class="highlight-c"><div class="highlight"><pre><span class="k">static</span> <span class="kt">void</span> <span class="nf">handshake_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>
|
<div class="highlight-c"><div class="highlight"><pre><span class="k">static</span> <span class="kt">void</span> <span class="nf">handshake_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="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="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>
|
||||||
|
@ -406,13 +399,12 @@ it:</p>
|
||||||
</pre></div>
|
</pre></div>
|
||||||
</div>
|
</div>
|
||||||
<p>We check that the received byte string matches
|
<p>We check that the received byte string matches
|
||||||
<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>. When they match, the
|
<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>. When they match, the connection
|
||||||
connection state is ready for starting HTTP/2 communication. First
|
state is ready to start the HTTP/2 communication. First we change the callback
|
||||||
we change the callback functions for the bufferevent object. We use
|
functions for the bufferevent object. We use the same <tt class="docutils literal"><span class="pre">eventcb</span></tt> callback as
|
||||||
same <tt class="docutils literal"><span class="pre">eventcb</span></tt> as before. But we specify new <tt class="docutils literal"><span class="pre">readcb</span></tt> and
|
before, but we specify new <tt class="docutils literal"><span class="pre">readcb</span></tt> and <tt class="docutils literal"><span class="pre">writecb</span></tt> functions to handle the
|
||||||
<tt class="docutils literal"><span class="pre">writecb</span></tt> function to handle HTTP/2 communication. We describe
|
HTTP/2 communication. These two functions are described later.</p>
|
||||||
these 2 functions later.</p>
|
<p>We initialize a nghttp2 session object which is done in
|
||||||
<p>We initialize nghttp2 session object which is done in
|
|
||||||
<tt class="docutils literal"><span class="pre">initialize_nghttp2_session()</span></tt>:</p>
|
<tt class="docutils literal"><span class="pre">initialize_nghttp2_session()</span></tt>:</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>
|
<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="p">{</span>
|
||||||
|
@ -427,11 +419,11 @@ these 2 functions later.</p>
|
||||||
<span class="p">}</span>
|
<span class="p">}</span>
|
||||||
</pre></div>
|
</pre></div>
|
||||||
</div>
|
</div>
|
||||||
<p>Since we are creating server, nghttp2 session object is created using
|
<p>Since we are creating a server, the nghttp2 session object is created using
|
||||||
<a class="reference internal" href="apiref.html#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> function. We registers 5 callbacks to
|
<a class="reference internal" href="apiref.html#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> function. We registers five callbacks for
|
||||||
nghttp2 session object. We’ll talk about these callbacks later.</p>
|
nghttp2 session object. We’ll talk about these callbacks later.</p>
|
||||||
<p>After initialization of nghttp2 session object, we are going to send
|
<p>After initialization of the nghttp2 session object, we are going to send
|
||||||
server connection header in <tt class="docutils literal"><span class="pre">send_server_connection_header()</span></tt>:</p>
|
a server connection header in <tt class="docutils literal"><span class="pre">send_server_connection_header()</span></tt>:</p>
|
||||||
<div class="highlight-c"><div class="highlight"><pre><span class="k">static</span> <span class="kt">int</span> <span class="nf">send_server_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>
|
<div class="highlight-c"><div class="highlight"><pre><span class="k">static</span> <span class="kt">int</span> <span class="nf">send_server_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="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="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>
|
||||||
|
@ -449,17 +441,17 @@ server connection header in <tt class="docutils literal"><span class="pre">send_
|
||||||
<span class="p">}</span>
|
<span class="p">}</span>
|
||||||
</pre></div>
|
</pre></div>
|
||||||
</div>
|
</div>
|
||||||
<p>The server connection header is SETTINGS frame. We specify
|
<p>The server connection header is a SETTINGS frame. We specify
|
||||||
SETTINGS_MAX_CONCURRENT_STREAMS to 100 in SETTINGS frame. To queue
|
SETTINGS_MAX_CONCURRENT_STREAMS to 100 in the SETTINGS frame. To queue
|
||||||
the SETTINGS frame for the transmission, we use
|
the SETTINGS frame for the transmission, we use
|
||||||
<a class="reference internal" href="apiref.html#c.nghttp2_submit_settings" title="nghttp2_submit_settings"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_submit_settings()</span></tt></a>. Note that <a class="reference internal" href="apiref.html#c.nghttp2_submit_settings" title="nghttp2_submit_settings"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_submit_settings()</span></tt></a>
|
<a class="reference internal" href="apiref.html#c.nghttp2_submit_settings" title="nghttp2_submit_settings"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_submit_settings()</span></tt></a>. Note that <a class="reference internal" href="apiref.html#c.nghttp2_submit_settings" title="nghttp2_submit_settings"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_submit_settings()</span></tt></a>
|
||||||
function only queues the frame and not actually send it. All
|
function only queues the frame and it does not actually send it. All
|
||||||
<tt class="docutils literal"><span class="pre">nghttp2_submit_*()</span></tt> family functions have this property. To
|
functions in the <tt class="docutils literal"><span class="pre">nghttp2_submit_*()</span></tt> family have this property. To
|
||||||
actually send the frame, <a class="reference internal" href="apiref.html#c.nghttp2_session_send" title="nghttp2_session_send"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_send()</span></tt></a> is used, which is
|
actually send the frame, <a class="reference internal" href="apiref.html#c.nghttp2_session_send" title="nghttp2_session_send"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_send()</span></tt></a> should be used, as
|
||||||
described about later.</p>
|
described later.</p>
|
||||||
<p>Since bufferevent may buffer more than first 24 bytes from the client,
|
<p>Since bufferevent may buffer more than the first 24 bytes from the client, we
|
||||||
we have to process them here since libevent won’t invoke callback
|
have to process them here since libevent won’t invoke callback functions for
|
||||||
functions for these pending data. To process received data, we call
|
this pending data. To process the received data, we call the
|
||||||
<tt class="docutils literal"><span class="pre">session_recv()</span></tt> function:</p>
|
<tt class="docutils literal"><span class="pre">session_recv()</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">session_recv</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>
|
<div class="highlight-c"><div class="highlight"><pre><span class="k">static</span> <span class="kt">int</span> <span class="nf">session_recv</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="p">{</span>
|
||||||
|
@ -484,12 +476,12 @@ functions for these pending data. To process received data, we call
|
||||||
<span class="p">}</span>
|
<span class="p">}</span>
|
||||||
</pre></div>
|
</pre></div>
|
||||||
</div>
|
</div>
|
||||||
<p>In this function, we feed all unprocessed, received data to nghttp2
|
<p>In this function, we feed all unprocessed but already received data to the
|
||||||
session object using <a class="reference internal" href="apiref.html#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> function. The
|
nghttp2 session object using the <a class="reference internal" href="apiref.html#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> function. The
|
||||||
<a class="reference internal" href="apiref.html#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> processes the received data and may
|
<a class="reference internal" href="apiref.html#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> function processes the data and may invoke the
|
||||||
invoke nghttp2 callbacks and also queue outgoing frames. Since there
|
nghttp2 callbacks and also queue outgoing frames. Since there may be pending
|
||||||
may be pending frames, we call <tt class="docutils literal"><span class="pre">session_send()</span></tt> function to send
|
outgoing frames, we call <tt class="docutils literal"><span class="pre">session_send()</span></tt> function to send off those
|
||||||
those frames. The <tt class="docutils literal"><span class="pre">session_send()</span></tt> function is defined as follows:</p>
|
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>
|
<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="p">{</span>
|
||||||
<span class="kt">int</span> <span class="n">rv</span><span class="p">;</span>
|
<span class="kt">int</span> <span class="n">rv</span><span class="p">;</span>
|
||||||
|
@ -503,8 +495,8 @@ those frames. The <tt class="docutils literal"><span class="pre">session_send()<
|
||||||
</pre></div>
|
</pre></div>
|
||||||
</div>
|
</div>
|
||||||
<p>The <a class="reference internal" href="apiref.html#c.nghttp2_session_send" title="nghttp2_session_send"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_send()</span></tt></a> function serializes the frame into wire
|
<p>The <a class="reference internal" href="apiref.html#c.nghttp2_session_send" title="nghttp2_session_send"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_send()</span></tt></a> function serializes the frame into wire
|
||||||
format and call <a class="reference internal" href="apiref.html#c.nghttp2_session_callbacks.send_callback" title="nghttp2_session_callbacks.send_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.send_callback</span></tt></a> with
|
format and calls <a class="reference internal" href="apiref.html#c.nghttp2_session_callbacks.send_callback" title="nghttp2_session_callbacks.send_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.send_callback</span></tt></a> with
|
||||||
it. We set <tt class="docutils literal"><span class="pre">send_callback()</span></tt> function to
|
it. We set the <tt class="docutils literal"><span class="pre">send_callback()</span></tt> function to
|
||||||
<a class="reference internal" href="apiref.html#c.nghttp2_session_callbacks.send_callback" title="nghttp2_session_callbacks.send_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.send_callback</span></tt></a> in
|
<a class="reference internal" href="apiref.html#c.nghttp2_session_callbacks.send_callback" title="nghttp2_session_callbacks.send_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.send_callback</span></tt></a> in
|
||||||
<tt class="docutils literal"><span class="pre">initialize_nghttp2_session()</span></tt> function described earlier. It is
|
<tt class="docutils literal"><span class="pre">initialize_nghttp2_session()</span></tt> function described earlier. It is
|
||||||
defined as follows:</p>
|
defined as follows:</p>
|
||||||
|
@ -524,18 +516,17 @@ defined as follows:</p>
|
||||||
<span class="p">}</span>
|
<span class="p">}</span>
|
||||||
</pre></div>
|
</pre></div>
|
||||||
</div>
|
</div>
|
||||||
<p>Since we use bufferevent to abstract network I/O, we just write the
|
<p>Since we use bufferevent to abstract network I/O, we just write the data to
|
||||||
data to the bufferevent object. Note that <a class="reference internal" href="apiref.html#c.nghttp2_session_send" title="nghttp2_session_send"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_send()</span></tt></a>
|
the bufferevent object. Note that <a class="reference internal" href="apiref.html#c.nghttp2_session_send" title="nghttp2_session_send"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_send()</span></tt></a> continues to write
|
||||||
continues to write all frames queued so far. If we were writing the
|
all frames queued so far. If we were writing the data to a non-blocking socket
|
||||||
data to the non-blocking socket directly using <tt class="docutils literal"><span class="pre">write()</span></tt> system call
|
directly using <tt class="docutils literal"><span class="pre">write()</span></tt> system call in the
|
||||||
in the <a class="reference internal" href="apiref.html#c.nghttp2_session_callbacks.send_callback" title="nghttp2_session_callbacks.send_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.send_callback</span></tt></a>, we will
|
<a class="reference internal" href="apiref.html#c.nghttp2_session_callbacks.send_callback" title="nghttp2_session_callbacks.send_callback"><tt class="xref c c-member docutils literal"><span class="pre">nghttp2_session_callbacks.send_callback</span></tt></a>, we would surely get
|
||||||
surely get <tt class="docutils literal"><span class="pre">EAGAIN</span></tt> or <tt class="docutils literal"><span class="pre">EWOULDBLOCK</span></tt> since the socket has limited
|
<tt class="docutils literal"><span class="pre">EAGAIN</span></tt> or <tt class="docutils literal"><span class="pre">EWOULDBLOCK</span></tt> back since the socket has limited send
|
||||||
send buffer. If that happens, we can return
|
buffer. If that happens, we can return <a class="reference internal" href="apiref.html#c.NGHTTP2_ERR_WOULDBLOCK" title="NGHTTP2_ERR_WOULDBLOCK"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_WOULDBLOCK</span></tt></a> to
|
||||||
<a class="reference internal" href="apiref.html#c.NGHTTP2_ERR_WOULDBLOCK" title="NGHTTP2_ERR_WOULDBLOCK"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_WOULDBLOCK</span></tt></a> to signal the nghttp2 library to stop
|
signal the nghttp2 library to stop sending further data. But when writing to
|
||||||
sending further data. But writing to the bufferevent, we have to
|
the bufferevent, we have to regulate the amount data to get buffered ourselves
|
||||||
regulate the amount data to be buffered by ourselves to avoid possible
|
to avoid using huge amounts of memory. To achieve this, we check the size of
|
||||||
huge memory consumption. To achieve this, we check the size of output
|
the output buffer and if it reaches more than or equal to
|
||||||
buffer and if it is more than or equal to
|
|
||||||
<tt class="docutils literal"><span class="pre">OUTPUT_WOULDBLOCK_THRESHOLD</span></tt> bytes, we stop writing data and return
|
<tt class="docutils literal"><span class="pre">OUTPUT_WOULDBLOCK_THRESHOLD</span></tt> bytes, we stop writing data and return
|
||||||
<a class="reference internal" href="apiref.html#c.NGHTTP2_ERR_WOULDBLOCK" title="NGHTTP2_ERR_WOULDBLOCK"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_WOULDBLOCK</span></tt></a> to tell the library to stop calling
|
<a class="reference internal" href="apiref.html#c.NGHTTP2_ERR_WOULDBLOCK" title="NGHTTP2_ERR_WOULDBLOCK"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_WOULDBLOCK</span></tt></a> to tell the library to stop calling
|
||||||
send_callback.</p>
|
send_callback.</p>
|
||||||
|
@ -553,8 +544,8 @@ data is available to read in the bufferevent input buffer:</p>
|
||||||
</div>
|
</div>
|
||||||
<p>In this function, we just call <tt class="docutils literal"><span class="pre">session_recv()</span></tt> to process incoming
|
<p>In this function, we just call <tt class="docutils literal"><span class="pre">session_recv()</span></tt> to process incoming
|
||||||
data.</p>
|
data.</p>
|
||||||
<p>The third bufferevent callback is <tt class="docutils literal"><span class="pre">writecb()</span></tt>, which is invoked when
|
<p>The third bufferevent callback is <tt class="docutils literal"><span class="pre">writecb()</span></tt>, which is invoked when all
|
||||||
all data written in the bufferevent output buffer have been sent:</p>
|
data in the bufferevent output buffer has 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>
|
<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>
|
<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="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>
|
||||||
|
@ -573,26 +564,25 @@ all data written in the bufferevent output buffer have been sent:</p>
|
||||||
<span class="p">}</span>
|
<span class="p">}</span>
|
||||||
</pre></div>
|
</pre></div>
|
||||||
</div>
|
</div>
|
||||||
<p>First we check whether we should drop connection or not. The nghttp2
|
<p>First we check whether we should drop the connection or not. The nghttp2
|
||||||
session object keeps track of reception and transmission of GOAWAY
|
session object keeps track of reception and transmission of GOAWAY frames and
|
||||||
frame and other error conditions as well. Using these information,
|
other error conditions as well. Using this information, the nghttp2 session
|
||||||
nghttp2 session object will tell whether the connection should be
|
object will tell whether the connection should be dropped or not. More
|
||||||
dropped or not. More specifically, both <a class="reference internal" href="apiref.html#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>
|
specifically, if both <a class="reference internal" href="apiref.html#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
|
||||||
and <a class="reference internal" href="apiref.html#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, we have no business in
|
<a class="reference internal" href="apiref.html#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, we have no business left in the
|
||||||
the connection. But since we are using bufferevent and its deferred
|
connection. But since we are using bufferevent and its deferred callback
|
||||||
callback option, the bufferevent output buffer may contain the pending
|
option, the bufferevent output buffer may contain pending data when the
|
||||||
data when the <tt class="docutils literal"><span class="pre">writecb()</span></tt> is called. To handle this situation, we
|
<tt class="docutils literal"><span class="pre">writecb()</span></tt> is called. To handle this, we check whether the output buffer is
|
||||||
also check whether the output buffer is empty or not. If these
|
empty or not. If all these conditions are met, we drop connection.</p>
|
||||||
conditions are met, we drop connection.</p>
|
<p>Otherwise, we call <tt class="docutils literal"><span class="pre">session_send()</span></tt> to process the pending output
|
||||||
<p>Otherwise, we call <tt class="docutils literal"><span class="pre">session_send()</span></tt> to process pending output
|
data. Remember that in <tt class="docutils literal"><span class="pre">send_callback()</span></tt>, we must not write all data to
|
||||||
data. Remember that in <tt class="docutils literal"><span class="pre">send_callback()</span></tt>, we may not write all data
|
bufferevent to avoid excessive buffering. We continue processing pending data
|
||||||
to bufferevent to avoid excessive buffering. We continue process
|
when the output buffer becomes empty.</p>
|
||||||
pending data when output buffer becomes empty.</p>
|
<p>We have already described the nghttp2 callback <tt class="docutils literal"><span class="pre">send_callback()</span></tt>. Let’s
|
||||||
<p>We have already described about nghttp2 callback <tt class="docutils literal"><span class="pre">send_callback()</span></tt>.
|
learn about the 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>
|
<tt class="docutils literal"><span class="pre">initialize_nghttp2_setup()</span></tt> function.</p>
|
||||||
<p>The <tt class="docutils literal"><span class="pre">on_begin_headers_callback()</span></tt> function is invoked when reception
|
<p>The <tt class="docutils literal"><span class="pre">on_begin_headers_callback()</span></tt> function is invoked when the reception of
|
||||||
of header block in HEADERS or PUSH_PROMISE frame is started:</p>
|
a header block in HEADERS or PUSH_PROMISE frame is started:</p>
|
||||||
<div class="highlight-c"><div class="highlight"><pre><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>
|
<div class="highlight-c"><div class="highlight"><pre><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">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="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="kt">void</span> <span class="o">*</span><span class="n">user_data</span><span class="p">)</span>
|
||||||
|
@ -611,16 +601,16 @@ of header block in HEADERS or PUSH_PROMISE frame is started:</p>
|
||||||
<span class="p">}</span>
|
<span class="p">}</span>
|
||||||
</pre></div>
|
</pre></div>
|
||||||
</div>
|
</div>
|
||||||
<p>We only interested in HEADERS frame in this function. Since HEADERS
|
<p>We are only interested in the HEADERS frame in this function. Since the
|
||||||
frame has several roles in HTTP/2 protocol, we check that it is a
|
HEADERS frame has several roles in the HTTP/2 protocol, we check that it is a
|
||||||
request HEADERS, which opens new stream. If frame is request HEADERS,
|
request HEADERS, which opens new stream. If the frame is a request HEADERS, we
|
||||||
then we create <tt class="docutils literal"><span class="pre">http2_stream_data</span></tt> object to store stream related
|
create a <tt class="docutils literal"><span class="pre">http2_stream_data</span></tt> object to store the stream related data. We
|
||||||
data. We associate created <tt class="docutils literal"><span class="pre">http2_stream_data</span></tt> object to the stream
|
associate the created <tt class="docutils literal"><span class="pre">http2_stream_data</span></tt> object with the stream in the
|
||||||
in nghttp2 session object using <tt class="xref c c-func docutils literal"><span class="pre">nghttp2_set_stream_user_data()</span></tt> in
|
nghttp2 session object using <tt class="xref c c-func docutils literal"><span class="pre">nghttp2_set_stream_user_data()</span></tt> to get the
|
||||||
order to get the object without searching through doubly linked list.</p>
|
object without searching through the doubly linked list.</p>
|
||||||
<p>In this example server, we want to serve files relative to the current
|
<p>In this example server, we want to serve files relative to the current working
|
||||||
working directory the program was invoked. Each header name/value pair
|
directory in which the program was invoked. Each header name/value pair is
|
||||||
is emitted via <tt class="docutils literal"><span class="pre">on_header_callback</span></tt> function, which is called after
|
emitted via <tt class="docutils literal"><span class="pre">on_header_callback</span></tt> function, which is called after
|
||||||
<tt class="docutils literal"><span class="pre">on_begin_headers_callback()</span></tt>:</p>
|
<tt class="docutils literal"><span class="pre">on_begin_headers_callback()</span></tt>:</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>
|
<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="n">nghttp2_frame</span> <span class="o">*</span><span class="n">frame</span><span class="p">,</span>
|
||||||
|
@ -651,10 +641,10 @@ is emitted via <tt class="docutils literal"><span class="pre">on_header_callback
|
||||||
<span class="p">}</span>
|
<span class="p">}</span>
|
||||||
</pre></div>
|
</pre></div>
|
||||||
</div>
|
</div>
|
||||||
<p>We search <tt class="docutils literal"><span class="pre">:path</span></tt> header field in request headers and keep the
|
<p>We search for the <tt class="docutils literal"><span class="pre">:path</span></tt> header field among the request headers and store
|
||||||
requested path in <tt class="docutils literal"><span class="pre">http2_stream_data</span></tt> object. In this example
|
the requested path in the <tt class="docutils literal"><span class="pre">http2_stream_data</span></tt> object. In this example
|
||||||
program, we ignore <tt class="docutils literal"><span class="pre">:method</span></tt> header field and always treat the
|
program, we ignore <tt class="docutils literal"><span class="pre">:method</span></tt> header field and always treat the request as a
|
||||||
request as GET request.</p>
|
GET request.</p>
|
||||||
<p>The <tt class="docutils literal"><span class="pre">on_frame_recv_callback()</span></tt> function is invoked when a frame is
|
<p>The <tt class="docutils literal"><span class="pre">on_frame_recv_callback()</span></tt> function is invoked when a frame is
|
||||||
fully received:</p>
|
fully received:</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>
|
<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>
|
||||||
|
@ -684,14 +674,14 @@ fully received:</p>
|
||||||
<span class="p">}</span>
|
<span class="p">}</span>
|
||||||
</pre></div>
|
</pre></div>
|
||||||
</div>
|
</div>
|
||||||
<p>First we retrieve <tt class="docutils literal"><span class="pre">http2_stream_data</span></tt> object associated to the
|
<p>First we retrieve the <tt class="docutils literal"><span class="pre">http2_stream_data</span></tt> object associated with the stream
|
||||||
stream in <tt class="docutils literal"><span class="pre">on_begin_headers_callback()</span></tt>. It is done using
|
in <tt class="docutils literal"><span class="pre">on_begin_headers_callback()</span></tt>. It is done using
|
||||||
<a class="reference internal" href="apiref.html#c.nghttp2_session_get_stream_user_data" title="nghttp2_session_get_stream_user_data"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_get_stream_user_data()</span></tt></a>. If the requested path cannot
|
<a class="reference internal" href="apiref.html#c.nghttp2_session_get_stream_user_data" title="nghttp2_session_get_stream_user_data"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_session_get_stream_user_data()</span></tt></a>. If the requested path cannot be
|
||||||
be served for some reasons (e.g., file is not found), we send 404
|
served for some reason (e.g., file is not found), we send a 404 response,
|
||||||
response, which is done in <tt class="docutils literal"><span class="pre">error_reply()</span></tt>. Otherwise, we open
|
which is done in <tt class="docutils literal"><span class="pre">error_reply()</span></tt>. Otherwise, we open the requested file and
|
||||||
requested file and send its content. We send 1 header field
|
send its content. We send the header field <tt class="docutils literal"><span class="pre">:status</span></tt> as a single response
|
||||||
<tt class="docutils literal"><span class="pre">:status</span></tt> as a response header.</p>
|
header.</p>
|
||||||
<p>Sending content of a file is done in <tt class="docutils literal"><span class="pre">send_response()</span></tt> function:</p>
|
<p>Sending the content of the file is done in <tt class="docutils literal"><span class="pre">send_response()</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">send_response</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">send_response</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_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="kt">int</span> <span class="n">fd</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="kt">int</span> <span class="n">fd</span><span class="p">)</span>
|
||||||
<span class="p">{</span>
|
<span class="p">{</span>
|
||||||
|
@ -709,12 +699,12 @@ requested file and send its content. We send 1 header field
|
||||||
<span class="p">}</span>
|
<span class="p">}</span>
|
||||||
</pre></div>
|
</pre></div>
|
||||||
</div>
|
</div>
|
||||||
<p>The nghttp2 library uses <a class="reference internal" href="apiref.html#c.nghttp2_data_provider" title="nghttp2_data_provider"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_data_provider</span></tt></a> structure to
|
<p>The nghttp2 library uses the <a class="reference internal" href="apiref.html#c.nghttp2_data_provider" title="nghttp2_data_provider"><tt class="xref c c-type docutils literal"><span class="pre">nghttp2_data_provider</span></tt></a> structure to
|
||||||
send entity body to the remote peer. The <tt class="docutils literal"><span class="pre">source</span></tt> member of this
|
send entity body to the remote peer. The <tt class="docutils literal"><span class="pre">source</span></tt> member of this
|
||||||
structure is a union and it can be either void pointer or int which is
|
structure is a union and it can be either void pointer or int which is
|
||||||
intended to be used as file descriptor. In this example server, we use
|
intended to be used as file descriptor. In this example server, we use
|
||||||
file descriptor. We also set <tt class="docutils literal"><span class="pre">file_read_callback()</span></tt> callback
|
the file descriptor. We also set the <tt class="docutils literal"><span class="pre">file_read_callback()</span></tt> callback
|
||||||
function to read content of the file:</p>
|
function to read the contents of the file:</p>
|
||||||
<div class="highlight-c"><div class="highlight"><pre><span class="k">static</span> <span class="kt">ssize_t</span> <span class="nf">file_read_callback</span>
|
<div class="highlight-c"><div class="highlight"><pre><span class="k">static</span> <span class="kt">ssize_t</span> <span class="nf">file_read_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="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">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">length</span><span class="p">,</span> <span class="kt">uint32_t</span> <span class="o">*</span><span class="n">data_flags</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">length</span><span class="p">,</span> <span class="kt">uint32_t</span> <span class="o">*</span><span class="n">data_flags</span><span class="p">,</span>
|
||||||
|
@ -733,13 +723,13 @@ function to read content of the file:</p>
|
||||||
<span class="p">}</span>
|
<span class="p">}</span>
|
||||||
</pre></div>
|
</pre></div>
|
||||||
</div>
|
</div>
|
||||||
<p>If error happens while reading file, we return
|
<p>If an error happens while reading the file, we return
|
||||||
<a class="reference internal" href="apiref.html#c.NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE" title="NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE</span></tt></a>. This tells the
|
<a class="reference internal" href="apiref.html#c.NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE" title="NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE</span></tt></a>. This tells the
|
||||||
library to send RST_STREAM to the stream. When all data are read, set
|
library to send RST_STREAM to the stream. When all data has been read, set
|
||||||
<a class="reference internal" href="apiref.html#c.NGHTTP2_DATA_FLAG_EOF" title="NGHTTP2_DATA_FLAG_EOF"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_DATA_FLAG_EOF</span></tt></a> flag to <tt class="docutils literal"><span class="pre">*data_flags</span></tt> to tell the
|
the <a class="reference internal" href="apiref.html#c.NGHTTP2_DATA_FLAG_EOF" title="NGHTTP2_DATA_FLAG_EOF"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_DATA_FLAG_EOF</span></tt></a> flag to <tt class="docutils literal"><span class="pre">*data_flags</span></tt> to tell the
|
||||||
nghttp2 library that we have finished reading file.</p>
|
nghttp2 library that we have finished reading the file.</p>
|
||||||
<p>The <a class="reference internal" href="apiref.html#c.nghttp2_submit_response" title="nghttp2_submit_response"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_submit_response()</span></tt></a> is used to send response to the remote
|
<p>The <a class="reference internal" href="apiref.html#c.nghttp2_submit_response" title="nghttp2_submit_response"><tt class="xref c c-func docutils literal"><span class="pre">nghttp2_submit_response()</span></tt></a> function is used to send the response to the
|
||||||
peer.</p>
|
remote peer.</p>
|
||||||
<p>The <tt class="docutils literal"><span class="pre">on_stream_close_callback()</span></tt> function is invoked when the stream
|
<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>
|
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>
|
<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>
|
||||||
|
@ -760,8 +750,8 @@ is about to close:</p>
|
||||||
<span class="p">}</span>
|
<span class="p">}</span>
|
||||||
</pre></div>
|
</pre></div>
|
||||||
</div>
|
</div>
|
||||||
<p>We destroy <tt class="docutils literal"><span class="pre">http2_stream_data</span></tt> object in this function since the
|
<p>We destroy the <tt class="docutils literal"><span class="pre">http2_stream_data</span></tt> object in this function since the stream
|
||||||
stream is about to close and we no longer use that object.</p>
|
is about to close and we no longer use that object.</p>
|
||||||
<div class="section" id="libevent-server-c">
|
<div class="section" id="libevent-server-c">
|
||||||
<h2>libevent-server.c<a class="headerlink" href="#libevent-server-c" title="Permalink to this headline">¶</a></h2>
|
<h2>libevent-server.c<a class="headerlink" href="#libevent-server-c" title="Permalink to this headline">¶</a></h2>
|
||||||
<div class="highlight-c"><div class="highlight"><pre><span class="cm">/*</span>
|
<div class="highlight-c"><div class="highlight"><pre><span class="cm">/*</span>
|
||||||
|
@ -1570,7 +1560,7 @@ stream is about to close and we no longer use that object.</p>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var DOCUMENTATION_OPTIONS = {
|
var DOCUMENTATION_OPTIONS = {
|
||||||
URL_ROOT:'./',
|
URL_ROOT:'./',
|
||||||
VERSION:'0.5.1-DEV',
|
VERSION:'0.5.2-DEV',
|
||||||
COLLAPSE_INDEX:false,
|
COLLAPSE_INDEX:false,
|
||||||
FILE_SUFFIX:'.html',
|
FILE_SUFFIX:'.html',
|
||||||
HAS_SOURCE: false
|
HAS_SOURCE: false
|
||||||
|
|
Loading…
Reference in New Issue