int <ttclass="descname">nghttp2_session_upgrade</tt><big>(</big><aclass="reference internal"href="#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><aclass="headerlink"href="#nghttp2_session_upgrade"title="Permalink to this definition">¶</a></dt>
<dd><p>Performs post-process of HTTP Upgrade request. This function can be
called from both client and server, but the behavior is very
different in each other.</p>
<p>If called from client side, the <em>settings_payload</em> must be the
value sent in HTTP2-Settings header field and must be decoded by
base64url decoder. The <em>settings_payloadlen</em> is the length of
<em>settings_payload</em>. The <em>settings_payload</em> is unpacked and its
setting values will be submitted using
nghttp2_submit_settings(). This means that the client application
code does not need to submit SETTINGS by itself. The stream with
stream ID=1 is opened and the <em>stream_user_data</em> is used for its
stream_user_data. The opened stream becomes half-closed (local)
state.</p>
<p>If called from server side, the <em>settings_payload</em> must be the
value received in HTTP2-Settings header field and must be decoded
by base64url decoder. The <em>settings_payloadlen</em> is the length of
<em>settings_payload</em>. It is treated as if the SETTINGS frame with
that payload is received. Thus, callback functions for the
reception of SETTINGS frame will be invoked. The stream with stream
ID=1 is opened. The <em>stream_user_data</em> is ignored. The opened
stream becomes half-closed (remote).</p>
<p>This function returns 0 if it succeeds, or one of the following
negative error codes:</p>
<dlclass="docutils">
<dt><aclass="reference internal"href="#NGHTTP2_ERR_NOMEM"title="NGHTTP2_ERR_NOMEM"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_NOMEM</span></tt></a></dt>
<dd>Out of memory.</dd>
<dt><aclass="reference internal"href="#NGHTTP2_ERR_INVALID_ARGUMENT"title="NGHTTP2_ERR_INVALID_ARGUMENT"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_INVALID_ARGUMENT</span></tt></a></dt>
<dd>The <em>settings_payload</em> is badly formed.</dd>
<dt><aclass="reference internal"href="#NGHTTP2_ERR_PROTO"title="NGHTTP2_ERR_PROTO"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_PROTO</span></tt></a></dt>
<dd>The stream ID 1 is already used or closed; or is not available;
or the <em>settings_payload</em> does not include both
NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS and
NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE.</dd>
</dl>
</dd></dl>
<dlclass="function">
<dtid="nghttp2_pack_settings_payload">
ssize_t <ttclass="descname">nghttp2_pack_settings_payload</tt><big>(</big>uint8_t<em> *buf</em>, <aclass="reference internal"href="#nghttp2_settings_entry"title="nghttp2_settings_entry">nghttp2_settings_entry</a><em> *iv</em>, size_t<em> niv</em><big>)</big><aclass="headerlink"href="#nghttp2_pack_settings_payload"title="Permalink to this definition">¶</a></dt>
<dd><p>Serializes the SETTINGS values <em>iv</em> in the <em>buf</em>. The number of
entry pointed by <em>iv</em> array is given by the <em>niv</em>. This function
may reorder the pointers in <em>iv</em>. The <em>buf</em> must have enough region
to hold serialized data. The required space for the <em>niv</em> entries
are 8**niv* bytes. This function is used mainly for creating
SETTINGS payload to be sent with HTTP2-Settings header field in
HTTP Upgrade request. The data written in <em>buf</em> is not still
base64url encoded and the application is responsible to do that.</p>
<p>This function returns the number of bytes written in <em>buf</em>, or one
of the following negative error codes:</p>
<dlclass="docutils">
<dt><aclass="reference internal"href="#NGHTTP2_ERR_INVALID_ARGUMENT"title="NGHTTP2_ERR_INVALID_ARGUMENT"><ttclass="xref c c-macro docutils literal"><spanclass="pre">NGHTTP2_ERR_INVALID_ARGUMENT</span></tt></a></dt>
<dd>The <em>iv</em> contains duplicate settings ID or invalid value.</dd>
</dl>
</dd></dl>
<dlclass="function">
<dlclass="function">
<dtid="nghttp2_strerror">
<dtid="nghttp2_strerror">
const char* <ttclass="descname">nghttp2_strerror</tt><big>(</big>int<em> lib_error_code</em><big>)</big><aclass="headerlink"href="#nghttp2_strerror"title="Permalink to this definition">¶</a></dt>
const char* <ttclass="descname">nghttp2_strerror</tt><big>(</big>int<em> lib_error_code</em><big>)</big><aclass="headerlink"href="#nghttp2_strerror"title="Permalink to this definition">¶</a></dt>
<h2>Development Status<aclass="headerlink"href="#development-status"title="Permalink to this headline">¶</a></h2>
<h2>Development Status<aclass="headerlink"href="#development-status"title="Permalink to this headline">¶</a></h2>
<p>We started to implement HTTP-defat-04/2.0
<p>We started to implement HTTP-defat-04/2.0
(<aclass="reference external"href="http://tools.ietf.org/html/draft-ietf-httpbis-http2-04">http://tools.ietf.org/html/draft-ietf-httpbis-http2-04</a>) based on
(<aclass="reference external"href="http://tools.ietf.org/html/draft-ietf-httpbis-http2-04">http://tools.ietf.org/html/draft-ietf-httpbis-http2-04</a>) based on
spdylay code base.</p>
spdylay code base. The header compression is based on
<p>The following features are not implemented:</p>
<p>Currently, the library lacks the following features:</p>
<ulclass="simple">
<ulclass="simple">
<li>Header continuation</li>
<li>Header continuation</li>
<li>ALPN: instead, NPN is used</li>
<li>ALPN: instead, NPN is used</li>
<li>HTTP Upgrade dance</li>
</ul>
</ul>
</div>
</div>
<divclass="section"id="requirements">
<divclass="section"id="requirements">
...
@@ -137,6 +137,8 @@ $ make</pre>
...
@@ -137,6 +137,8 @@ $ make</pre>
</div>
</div>
<p>The documents will be generated under <ttclass="docutils literal"><spanclass="pre">doc/manual/html/</span></tt>.</p>
<p>The documents will be generated under <ttclass="docutils literal"><spanclass="pre">doc/manual/html/</span></tt>.</p>
<p>The generated documents will not be installed with <ttclass="docutils literal"><spanclass="pre">make</span><spanclass="pre">install</span></tt>.</p>
<p>The generated documents will not be installed with <ttclass="docutils literal"><spanclass="pre">make</span><spanclass="pre">install</span></tt>.</p>
<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 HTTP-draft-04/2.0 as well as SPDY and
a reverse proxy and listens HTTP-draft-04/2.0, SPDY and HTTP/1.1 and
HTTPS and can be deployed SSL/TLS terminator for existing web server.</p>
can be deployed SSL/TLS terminator for existing web server.</p>
<p>By default, it uses SSL/TLS connection for HTTP/2.0 and SPDY. Use
<p>The default mode, <ttclass="docutils literal"><spanclass="pre">--spdy</span></tt> and <ttclass="docutils literal"><spanclass="pre">--spdy-bridge</span></tt> modes use SSL/TLS
<ttclass="docutils literal"><spanclass="pre">--frontend-spdy--no-tls</span></tt> to disable it in frontend
in the frontend connection by default. To disable SSL/TLS, use
connection. Likewise, use <ttclass="docutils literal"><spanclass="pre">--backend-spdy-no-tls</span></tt> option to disable
<ttclass="docutils literal"><spanclass="pre">--frontend-no-tls</span></tt> option. If that option is used, SPDY is disabled
it in backend connection.</p>
in the frontend and incoming HTTP/1.1 connection can be upgraded to
HTTP/2.0 through HTTP Upgrade.</p>
<p>The <ttclass="docutils literal"><spanclass="pre">--spdy-bridge</span></tt>, <ttclass="docutils literal"><spanclass="pre">--client</span></tt> and <ttclass="docutils literal"><spanclass="pre">--client-proxy</span></tt> modes use
SSL/TLS in the backend connection by deafult. To disable SSL/TLS, use
<p>The <ttclass="docutils literal"><spanclass="pre">nghttpx</span></tt> is ported from <ttclass="docutils literal"><spanclass="pre">shrpx</span></tt> in spdylay project, and it
<p>The <ttclass="docutils literal"><spanclass="pre">nghttpx</span></tt> is ported from <ttclass="docutils literal"><spanclass="pre">shrpx</span></tt> in spdylay project, and it
still has SPDY color in option names. They will be fixed as the
still has SPDY color in option names. They will be fixed as the
development goes.</p>
development goes.</p>
<p>Without any of <ttclass="docutils literal"><spanclass="pre">-s</span></tt>, <ttclass="docutils literal"><spanclass="pre">--spdy-bridge</span></tt>, <ttclass="docutils literal"><spanclass="pre">-p</span></tt> and <ttclass="docutils literal"><spanclass="pre">--client</span></tt>
<p>In the default mode, (without any of <ttclass="docutils literal"><spanclass="pre">--spdy</span></tt>, <ttclass="docutils literal"><spanclass="pre">--spdy-bridge</span></tt>,
options, <ttclass="docutils literal"><spanclass="pre">nghttpx</span></tt> works as reverse proxy to the backend server:</p>
<ttclass="docutils literal"><spanclass="pre">--client-proxy</span></tt> and <ttclass="docutils literal"><spanclass="pre">--client</span></tt> options), <ttclass="docutils literal"><spanclass="pre">nghttpx</span></tt> works as
@@ -321,39 +380,41 @@ proxy is create proxy.pac script like this:</p>
...
@@ -321,39 +380,41 @@ proxy is create proxy.pac script like this:</p>
</div>
</div>
<p><ttclass="docutils literal"><spanclass="pre">SERVERADDR</span></tt> and <ttclass="docutils literal"><spanclass="pre">PORT</span></tt> is the hostname/address and port of the
<p><ttclass="docutils literal"><spanclass="pre">SERVERADDR</span></tt> and <ttclass="docutils literal"><spanclass="pre">PORT</span></tt> is the hostname/address and port of the
machine nghttpx is running. Please note that Chrome requires valid
machine nghttpx is running. Please note that Chrome requires valid
certificate for secure SPDY proxy.</p>
certificate for secure proxy.</p>
<p>Then run chrome with the following arguments:</p>
<p>Then run chrome with the following arguments:</p>
<ttclass="docutils literal"><spanclass="pre">--spdy-bridge</span></tt> and <ttclass="docutils literal"><spanclass="pre">--backend-http-proxy-uri</span></tt> option to talk to