Update doc
This commit is contained in:
parent
9c7cbfaac3
commit
35a2e8fff7
|
@ -1126,6 +1126,64 @@ Functions
|
|||
:macro:`NGHTTP2_ERR_NOMEM`
|
||||
Out of memory.
|
||||
|
||||
.. function:: int nghttp2_session_upgrade(nghttp2_session *session, const uint8_t *settings_payload, size_t settings_payloadlen, void *stream_user_data)
|
||||
|
||||
|
||||
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.
|
||||
|
||||
If called from client side, the *settings_payload* must be the
|
||||
value sent in HTTP2-Settings header field and must be decoded by
|
||||
base64url decoder. The *settings_payloadlen* is the length of
|
||||
*settings_payload*. The *settings_payload* 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 *stream_user_data* is used for its
|
||||
stream_user_data. The opened stream becomes half-closed (local)
|
||||
state.
|
||||
|
||||
If called from server side, the *settings_payload* must be the
|
||||
value received in HTTP2-Settings header field and must be decoded
|
||||
by base64url decoder. The *settings_payloadlen* is the length of
|
||||
*settings_payload*. 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 *stream_user_data* is ignored. The opened
|
||||
stream becomes half-closed (remote).
|
||||
|
||||
This function returns 0 if it succeeds, or one of the following
|
||||
negative error codes:
|
||||
|
||||
:macro:`NGHTTP2_ERR_NOMEM`
|
||||
Out of memory.
|
||||
:macro:`NGHTTP2_ERR_INVALID_ARGUMENT`
|
||||
The *settings_payload* is badly formed.
|
||||
:macro:`NGHTTP2_ERR_PROTO`
|
||||
The stream ID 1 is already used or closed; or is not available;
|
||||
or the *settings_payload* does not include both
|
||||
NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS and
|
||||
NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE.
|
||||
|
||||
.. function:: ssize_t nghttp2_pack_settings_payload(uint8_t *buf, nghttp2_settings_entry *iv, size_t niv)
|
||||
|
||||
|
||||
Serializes the SETTINGS values *iv* in the *buf*. The number of
|
||||
entry pointed by *iv* array is given by the *niv*. This function
|
||||
may reorder the pointers in *iv*. The *buf* must have enough region
|
||||
to hold serialized data. The required space for the *niv* 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 *buf* is not still
|
||||
base64url encoded and the application is responsible to do that.
|
||||
|
||||
This function returns the number of bytes written in *buf*, or one
|
||||
of the following negative error codes:
|
||||
|
||||
:macro:`NGHTTP2_ERR_INVALID_ARGUMENT`
|
||||
The *iv* contains duplicate settings ID or invalid value.
|
||||
|
||||
.. function:: const char* nghttp2_strerror(int lib_error_code)
|
||||
|
||||
|
||||
|
|
58
apiref.html
58
apiref.html
|
@ -1566,6 +1566,64 @@ negative error codes:</p>
|
|||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="function">
|
||||
<dt id="nghttp2_session_upgrade">
|
||||
int <tt class="descname">nghttp2_session_upgrade</tt><big>(</big><a class="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><a class="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>
|
||||
<dl class="docutils">
|
||||
<dt><a class="reference internal" href="#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="#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>settings_payload</em> is badly formed.</dd>
|
||||
<dt><a class="reference internal" href="#NGHTTP2_ERR_PROTO" title="NGHTTP2_ERR_PROTO"><tt class="xref c c-macro docutils literal"><span class="pre">NGHTTP2_ERR_PROTO</span></tt></a></dt>
|
||||
<dd>The 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>
|
||||
|
||||
<dl class="function">
|
||||
<dt id="nghttp2_pack_settings_payload">
|
||||
ssize_t <tt class="descname">nghttp2_pack_settings_payload</tt><big>(</big>uint8_t<em> *buf</em>, <a class="reference internal" href="#nghttp2_settings_entry" title="nghttp2_settings_entry">nghttp2_settings_entry</a><em> *iv</em>, size_t<em> niv</em><big>)</big><a class="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>
|
||||
<dl class="docutils">
|
||||
<dt><a class="reference internal" href="#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>iv</em> contains duplicate settings ID or invalid value.</dd>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="function">
|
||||
<dt id="nghttp2_strerror">
|
||||
const char* <tt class="descname">nghttp2_strerror</tt><big>(</big>int<em> lib_error_code</em><big>)</big><a class="headerlink" href="#nghttp2_strerror" title="Permalink to this definition">¶</a></dt>
|
||||
|
|
|
@ -456,12 +456,12 @@
|
|||
<dt><a href="apiref.html#nghttp2_nv.value">nghttp2_nv.value (C member)</a>
|
||||
</dt>
|
||||
|
||||
</dl></td>
|
||||
<td style="width: 33%" valign="top"><dl>
|
||||
|
||||
<dt><a href="apiref.html#nghttp2_nv.valuelen">nghttp2_nv.valuelen (C member)</a>
|
||||
</dt>
|
||||
|
||||
</dl></td>
|
||||
<td style="width: 33%" valign="top"><dl>
|
||||
|
||||
<dt><a href="apiref.html#nghttp2_on_data_chunk_recv_callback">nghttp2_on_data_chunk_recv_callback (C type)</a>
|
||||
</dt>
|
||||
|
@ -515,6 +515,10 @@
|
|||
</dt>
|
||||
|
||||
|
||||
<dt><a href="apiref.html#nghttp2_pack_settings_payload">nghttp2_pack_settings_payload (C function)</a>
|
||||
</dt>
|
||||
|
||||
|
||||
<dt><a href="apiref.html#NGHTTP2_PING">NGHTTP2_PING (C macro)</a>
|
||||
</dt>
|
||||
|
||||
|
@ -727,6 +731,10 @@
|
|||
</dt>
|
||||
|
||||
|
||||
<dt><a href="apiref.html#nghttp2_session_upgrade">nghttp2_session_upgrade (C function)</a>
|
||||
</dt>
|
||||
|
||||
|
||||
<dt><a href="apiref.html#nghttp2_session_want_read">nghttp2_session_want_read (C function)</a>
|
||||
</dt>
|
||||
|
||||
|
|
BIN
objects.inv
BIN
objects.inv
Binary file not shown.
|
@ -60,12 +60,12 @@ version 2.0.</p>
|
|||
<h2>Development Status<a class="headerlink" href="#development-status" title="Permalink to this headline">¶</a></h2>
|
||||
<p>We started to implement HTTP-defat-04/2.0
|
||||
(<a class="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>
|
||||
<p>The following features are not implemented:</p>
|
||||
spdylay code base. The header compression is based on
|
||||
<a class="reference external" href="http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-01">http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-01</a></p>
|
||||
<p>Currently, the library lacks the following features:</p>
|
||||
<ul class="simple">
|
||||
<li>Header continuation</li>
|
||||
<li>ALPN: instead, NPN is used</li>
|
||||
<li>HTTP Upgrade dance</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="requirements">
|
||||
|
@ -137,6 +137,8 @@ $ make</pre>
|
|||
</div>
|
||||
<p>The documents will be generated under <tt class="docutils literal"><span class="pre">doc/manual/html/</span></tt>.</p>
|
||||
<p>The generated documents will not be installed with <tt class="docutils literal"><span class="pre">make</span> <span class="pre">install</span></tt>.</p>
|
||||
<p>The online documentation is available at
|
||||
<a class="reference external" href="http://tatsuhiro-t.github.io/nghttp2/">http://tatsuhiro-t.github.io/nghttp2/</a></p>
|
||||
</div>
|
||||
<div class="section" id="client-server-and-proxy-programs">
|
||||
<h2>Client, Server and Proxy programs<a class="headerlink" href="#client-server-and-proxy-programs" title="Permalink to this headline">¶</a></h2>
|
||||
|
@ -144,8 +146,8 @@ $ make</pre>
|
|||
<div class="section" id="nghttp-client">
|
||||
<h3>nghttp - client<a class="headerlink" href="#nghttp-client" title="Permalink to this headline">¶</a></h3>
|
||||
<p><tt class="docutils literal"><span class="pre">nghttp</span></tt> is HTTP-default04/2.0 client. It can connect to the
|
||||
HTTP/2.0 server with prior knowledge (without HTTP Upgrade) and NPN in
|
||||
TLS extension.</p>
|
||||
HTTP/2.0 server with prior knowledge, HTTP Upgrade and NPN TLS
|
||||
extension.</p>
|
||||
<p>By default, it uses SSL/TLS connection. Use <tt class="docutils literal"><span class="pre">--no-tls</span></tt> option to
|
||||
disable it.</p>
|
||||
<p>It has verbose output mode for framing information. Here is sample
|
||||
|
@ -195,6 +197,55 @@ output from <tt class="docutils literal"><span class="pre">nghttp</span></tt> cl
|
|||
[ 0.006] send GOAWAY frame <length=8, flags=0, stream_id=0>
|
||||
(last_stream_id=0, error_code=NO_ERROR(0), opaque_data=)</pre>
|
||||
</div>
|
||||
<p>The HTTP Upgrade is performed like this:</p>
|
||||
<div class="highlight-c"><pre>$ src/nghttp --no-tls -nvu http://localhost:3000/
|
||||
[ 0.000] HTTP Upgrade request
|
||||
GET / HTTP/1.1
|
||||
Host: localhost:3000
|
||||
Connection: Upgrade, HTTP2-Settings
|
||||
Upgrade: HTTP-draft-04/2.0
|
||||
HTTP2-Settings: AAAABAAAAGQAAAAHAAD__w
|
||||
Accept: */*
|
||||
User-Agent: nghttp2/0.1.0-DEV
|
||||
|
||||
|
||||
[ 0.183] HTTP Upgrade response
|
||||
HTTP/1.1 101 Switching Protocols
|
||||
Connection: Upgrade
|
||||
Upgrade: HTTP/2.0
|
||||
|
||||
|
||||
[ 0.183] HTTP Upgrade success
|
||||
[ 0.183] send SETTINGS frame <length=16, flags=0x00, stream_id=0>
|
||||
(niv=2)
|
||||
[4:100]
|
||||
[7:65535]
|
||||
[ 0.202] recv SETTINGS frame <length=16, flags=0x00, stream_id=0>
|
||||
(niv=2)
|
||||
[4:100]
|
||||
[7:65536]
|
||||
[ 0.202] recv WINDOW_UPDATE frame <length=4, flags=0x01, stream_id=0>
|
||||
; END_FLOW_CONTROL
|
||||
(window_size_increment=0)
|
||||
[ 0.275] recv HEADERS frame <length=198, flags=0x04, stream_id=1>
|
||||
; END_HEADERS
|
||||
; First response header
|
||||
:status: 200 OK
|
||||
accept-ranges: bytes
|
||||
content-length: 45
|
||||
content-type: text/html
|
||||
date: Sat, 03 Aug 2013 10:21:20 GMT
|
||||
etag: "cf405c-2d-45adabdf282c0"
|
||||
last-modified: Tue, 04 Nov 2008 10:44:03 GMT
|
||||
server: Apache/2.2.22 (Debian)
|
||||
vary: Accept-Encoding
|
||||
via: 1.1 nghttpx
|
||||
x-pad: avoid browser bug
|
||||
[ 0.275] recv DATA frame (length=45, flags=0, stream_id=1)
|
||||
[ 0.275] recv DATA frame (length=0, flags=1, stream_id=1)
|
||||
[ 0.275] send GOAWAY frame <length=8, flags=0x00, stream_id=0>
|
||||
(last_stream_id=0, error_code=NO_ERROR(0), opaque_data=)</pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="nghttpd-server">
|
||||
<h3>nghttpd - server<a class="headerlink" href="#nghttpd-server" title="Permalink to this headline">¶</a></h3>
|
||||
|
@ -202,6 +253,8 @@ output from <tt class="docutils literal"><span class="pre">nghttp</span></tt> cl
|
|||
multiplexes connections using non-blocking socket.</p>
|
||||
<p>By default, it uses SSL/TLS connection. Use <tt class="docutils literal"><span class="pre">--no-tls</span></tt> option to
|
||||
disable it.</p>
|
||||
<p><tt class="docutils literal"><span class="pre">nghttpd</span></tt> only accept the HTTP/2.0 connection via NPN or direct
|
||||
HTTP/2.0 connection. No HTTP Upgrade is supported.</p>
|
||||
<p>Just like <tt class="docutils literal"><span class="pre">nghttp</span></tt>, it has verbose output mode for framing
|
||||
information. Here is sample output from <tt class="docutils literal"><span class="pre">nghttpd</span></tt> server:</p>
|
||||
<div class="highlight-c"><pre>$ src/nghttpd 3000 --no-tls -v
|
||||
|
@ -243,13 +296,13 @@ IPv6: listen on port 3000
|
|||
<div class="section" id="nghttpx-proxy">
|
||||
<h3>nghttpx - proxy<a class="headerlink" href="#nghttpx-proxy" title="Permalink to this headline">¶</a></h3>
|
||||
<p>The <tt class="docutils literal"><span class="pre">nghttpx</span></tt> is a multi-threaded reverse proxy for
|
||||
HTTP-draft-04/2.0, SPDY/HTTPS. It has several operation modes:</p>
|
||||
HTTP-draft-04/2.0, SPDY and HTTP/1.1. It has several operation modes:</p>
|
||||
<table border="1" class="docutils">
|
||||
<colgroup>
|
||||
<col width="25%" />
|
||||
<col width="33%" />
|
||||
<col width="11%" />
|
||||
<col width="31%" />
|
||||
<col width="24%" />
|
||||
<col width="40%" />
|
||||
<col width="19%" />
|
||||
<col width="17%" />
|
||||
</colgroup>
|
||||
<thead valign="bottom">
|
||||
<tr class="row-odd"><th class="head">Mode option</th>
|
||||
|
@ -259,61 +312,67 @@ HTTP-draft-04/2.0, SPDY/HTTPS. It has several operation modes:</p>
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody valign="top">
|
||||
<tr class="row-even"><td>default</td>
|
||||
<td>HTTP/2.0, SPDY, HTTPS</td>
|
||||
<tr class="row-even"><td>default mode</td>
|
||||
<td>HTTP/2.0, SPDY, HTTP/1.1 (TLS)</td>
|
||||
<td>HTTP/1.1</td>
|
||||
<td>Reverse proxy</td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td><tt class="docutils literal"><span class="pre">--spdy</span></tt></td>
|
||||
<td>HTTP/2.0, SPDY, HTTPS</td>
|
||||
<td>HTTP/2.0, SPDY, HTTP/1.1 (TLS)</td>
|
||||
<td>HTTP/1.1</td>
|
||||
<td>SPDY proxy</td>
|
||||
</tr>
|
||||
<tr class="row-even"><td><tt class="docutils literal"><span class="pre">--spdy-bridge</span></tt></td>
|
||||
<td>HTTP/2.0, SPDY, HTTPS</td>
|
||||
<td>HTTP/2.0</td>
|
||||
<td>SPDY proxy</td>
|
||||
<td>HTTP/2.0, SPDY, HTTP/1.1 (TLS)</td>
|
||||
<td>HTTP/2.0 (TLS)</td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td><tt class="docutils literal"><span class="pre">--client</span></tt></td>
|
||||
<td>HTTP/1.1</td>
|
||||
<td>HTTP/2.0</td>
|
||||
<td>1.1 <-> 2.0 conversion</td>
|
||||
<td>HTTP/2.0, HTTP/1.1</td>
|
||||
<td>HTTP/2.0 (TLS)</td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr class="row-even"><td><tt class="docutils literal"><span class="pre">--client-proxy</span></tt></td>
|
||||
<td>HTTP/1.1</td>
|
||||
<td>HTTP/2.0</td>
|
||||
<td>HTTP/2.0, HTTP/1.1</td>
|
||||
<td>HTTP/2.0 (TLS)</td>
|
||||
<td>Forward proxy</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<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
|
||||
HTTPS and 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
|
||||
<tt class="docutils literal"><span class="pre">--frontend-spdy--no-tls</span></tt> to disable it in frontend
|
||||
connection. Likewise, use <tt class="docutils literal"><span class="pre">--backend-spdy-no-tls</span></tt> option to disable
|
||||
it in backend connection.</p>
|
||||
a reverse proxy and listens HTTP-draft-04/2.0, SPDY and HTTP/1.1 and
|
||||
can be deployed SSL/TLS terminator for existing web server.</p>
|
||||
<p>The default mode, <tt class="docutils literal"><span class="pre">--spdy</span></tt> and <tt class="docutils literal"><span class="pre">--spdy-bridge</span></tt> modes use SSL/TLS
|
||||
in the frontend connection by default. To disable SSL/TLS, use
|
||||
<tt class="docutils literal"><span class="pre">--frontend-no-tls</span></tt> option. If that option is used, SPDY is disabled
|
||||
in the frontend and incoming HTTP/1.1 connection can be upgraded to
|
||||
HTTP/2.0 through HTTP Upgrade.</p>
|
||||
<p>The <tt class="docutils literal"><span class="pre">--spdy-bridge</span></tt>, <tt class="docutils literal"><span class="pre">--client</span></tt> and <tt class="docutils literal"><span class="pre">--client-proxy</span></tt> modes use
|
||||
SSL/TLS in the backend connection by deafult. To disable SSL/TLS, use
|
||||
<tt class="docutils literal"><span class="pre">--backend-no-tls</span></tt> option.</p>
|
||||
<p>The <tt class="docutils literal"><span class="pre">nghttpx</span></tt> supports configuration file. See <tt class="docutils literal"><span class="pre">--conf</span></tt> option and
|
||||
sample configuration file <tt class="docutils literal"><span class="pre">nghttpx.conf.sample</span></tt>.</p>
|
||||
<p>The <tt class="docutils literal"><span class="pre">nghttpx</span></tt> is ported from <tt class="docutils literal"><span class="pre">shrpx</span></tt> in spdylay project, and it
|
||||
still has SPDY color in option names. They will be fixed as the
|
||||
development goes.</p>
|
||||
<p>Without any of <tt class="docutils literal"><span class="pre">-s</span></tt>, <tt class="docutils literal"><span class="pre">--spdy-bridge</span></tt>, <tt class="docutils literal"><span class="pre">-p</span></tt> and <tt class="docutils literal"><span class="pre">--client</span></tt>
|
||||
options, <tt class="docutils literal"><span class="pre">nghttpx</span></tt> works as reverse proxy to the backend server:</p>
|
||||
<div class="highlight-c"><div class="highlight"><pre><span class="n">Client</span> <span class="o"><--</span> <span class="p">(</span><span class="n">HTTP</span><span class="o">/</span><span class="mf">2.0</span><span class="p">,</span> <span class="n">SPDY</span><span class="p">,</span> <span class="n">HTTPS</span><span class="p">)</span> <span class="o">--></span> <span class="n">nghttpx</span> <span class="o"><--</span> <span class="p">(</span><span class="n">HTTP</span><span class="p">)</span> <span class="o">--></span> <span class="n">Web</span> <span class="n">Server</span>
|
||||
<span class="p">[</span><span class="n">reverse</span> <span class="n">proxy</span><span class="p">]</span>
|
||||
<p>In the default mode, (without any of <tt class="docutils literal"><span class="pre">--spdy</span></tt>, <tt class="docutils literal"><span class="pre">--spdy-bridge</span></tt>,
|
||||
<tt class="docutils literal"><span class="pre">--client-proxy</span></tt> and <tt class="docutils literal"><span class="pre">--client</span></tt> options), <tt class="docutils literal"><span class="pre">nghttpx</span></tt> works as
|
||||
reverse proxy to the backend server:</p>
|
||||
<div class="highlight-c"><div class="highlight"><pre><span class="n">Client</span> <span class="o"><--</span> <span class="p">(</span><span class="n">HTTP</span><span class="o">/</span><span class="mf">2.0</span><span class="p">,</span> <span class="n">SPDY</span><span class="p">,</span> <span class="n">HTTP</span><span class="o">/</span><span class="mf">1.1</span><span class="p">)</span> <span class="o">--></span> <span class="n">nghttpx</span> <span class="o"><--</span> <span class="p">(</span><span class="n">HTTP</span><span class="o">/</span><span class="mf">1.1</span><span class="p">)</span> <span class="o">--></span> <span class="n">Web</span> <span class="n">Server</span>
|
||||
<span class="p">[</span><span class="n">reverse</span> <span class="n">proxy</span><span class="p">]</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>With <tt class="docutils literal"><span class="pre">-s</span></tt> option, it works as so called secure SPDY proxy:</p>
|
||||
<div class="highlight-c"><div class="highlight"><pre><span class="n">Client</span> <span class="o"><--</span> <span class="p">(</span><span class="n">HTTP</span><span class="o">/</span><span class="mf">2.0</span><span class="p">,</span> <span class="n">SPDY</span><span class="p">,</span> <span class="n">HTTPS</span><span class="p">)</span> <span class="o">--></span> <span class="n">nghttpx</span> <span class="o"><--</span> <span class="p">(</span><span class="n">HTTP</span><span class="p">)</span> <span class="o">--></span> <span class="n">Proxy</span>
|
||||
<span class="p">[</span><span class="n">SPDY</span> <span class="n">proxy</span><span class="p">]</span> <span class="p">(</span><span class="n">e</span><span class="p">.</span><span class="n">g</span><span class="p">.,</span> <span class="n">Squid</span><span class="p">)</span>
|
||||
<p>With <tt class="docutils literal"><span class="pre">--spdy</span></tt> option, it works as so called secure proxy (aka SPDY
|
||||
proxy):</p>
|
||||
<div class="highlight-c"><div class="highlight"><pre><span class="n">Client</span> <span class="o"><--</span> <span class="p">(</span><span class="n">HTTP</span><span class="o">/</span><span class="mf">2.0</span><span class="p">,</span> <span class="n">SPDY</span><span class="p">,</span> <span class="n">HTTP</span><span class="o">/</span><span class="mf">1.1</span><span class="p">)</span> <span class="o">--></span> <span class="n">nghttpx</span> <span class="o"><--</span> <span class="p">(</span><span class="n">HTTP</span><span class="o">/</span><span class="mf">1.1</span><span class="p">)</span> <span class="o">--></span> <span class="n">Proxy</span>
|
||||
<span class="p">[</span><span class="n">secure</span> <span class="n">proxy</span><span class="p">]</span> <span class="p">(</span><span class="n">e</span><span class="p">.</span><span class="n">g</span><span class="p">.,</span> <span class="n">Squid</span><span class="p">)</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>The <tt class="docutils literal"><span class="pre">Client</span></tt> in the above is needs to be configured to use nghttpx as
|
||||
secure SPDY proxy.</p>
|
||||
<p>The <tt class="docutils literal"><span class="pre">Client</span></tt> in the above is needs to be configured to use
|
||||
<tt class="docutils literal"><span class="pre">nghttpx</span></tt> as secure proxy.</p>
|
||||
<p>At the time of this writing, Chrome is the only browser which supports
|
||||
secure SPDY proxy. The one way to configure Chrome to use secure SPDY
|
||||
proxy is create proxy.pac script like this:</p>
|
||||
secure proxy. The one way to configure Chrome to use secure proxy is
|
||||
create proxy.pac script like this:</p>
|
||||
<div class="highlight-c"><div class="highlight"><pre><span class="n">function</span> <span class="nf">FindProxyForURL</span><span class="p">(</span><span class="n">url</span><span class="p">,</span> <span class="n">host</span><span class="p">)</span> <span class="p">{</span>
|
||||
<span class="k">return</span> <span class="s">"HTTPS SERVERADDR:PORT"</span><span class="p">;</span>
|
||||
<span class="p">}</span>
|
||||
|
@ -321,39 +380,41 @@ proxy is create proxy.pac script like this:</p>
|
|||
</div>
|
||||
<p><tt class="docutils literal"><span class="pre">SERVERADDR</span></tt> and <tt class="docutils literal"><span class="pre">PORT</span></tt> is the hostname/address and port of the
|
||||
machine nghttpx is running. Please note that Chrome requires valid
|
||||
certificate for secure SPDY proxy.</p>
|
||||
certificate for secure proxy.</p>
|
||||
<p>Then run chrome with the following arguments:</p>
|
||||
<div class="highlight-c"><pre>$ google-chrome --proxy-pac-url=file:///path/to/proxy.pac --use-npn</pre>
|
||||
</div>
|
||||
<p>With <tt class="docutils literal"><span class="pre">--spdy-bridge</span></tt>, it accepts HTTP/2.0, SPDY and HTTPS
|
||||
<p>With <tt class="docutils literal"><span class="pre">--spdy-bridge</span></tt>, it accepts HTTP/2.0, SPDY and HTTP/1.1
|
||||
connections and communicates with backend in HTTP/2.0:</p>
|
||||
<div class="highlight-c"><div class="highlight"><pre><span class="n">Client</span> <span class="o"><--</span> <span class="p">(</span><span class="n">HTTP</span><span class="o">/</span><span class="mf">2.0</span><span class="p">,</span> <span class="n">SPDY</span><span class="p">,</span> <span class="n">HTTPS</span><span class="p">)</span> <span class="o">--></span> <span class="n">nghttpx</span> <span class="o"><--</span> <span class="p">(</span><span class="n">HTTP</span><span class="o">/</span><span class="mf">2.0</span><span class="p">)</span> <span class="o">--></span> <span class="n">Web</span> <span class="n">or</span> <span class="n">HTTP</span><span class="o">/</span><span class="mf">2.0</span> <span class="n">Proxy</span> <span class="n">etc</span>
|
||||
<span class="p">[</span><span class="n">SPDY</span> <span class="n">bridge</span><span class="p">]</span> <span class="p">(</span><span class="n">e</span><span class="p">.</span><span class="n">g</span><span class="p">.,</span> <span class="n">nghttpx</span> <span class="o">-</span><span class="n">s</span><span class="p">)</span>
|
||||
<div class="highlight-c"><div class="highlight"><pre><span class="n">Client</span> <span class="o"><--</span> <span class="p">(</span><span class="n">HTTP</span><span class="o">/</span><span class="mf">2.0</span><span class="p">,</span> <span class="n">SPDY</span><span class="p">,</span> <span class="n">HTTP</span><span class="o">/</span><span class="mf">1.1</span><span class="p">)</span> <span class="o">--></span> <span class="n">nghttpx</span> <span class="o"><--</span> <span class="p">(</span><span class="n">HTTP</span><span class="o">/</span><span class="mf">2.0</span><span class="p">)</span> <span class="o">--></span> <span class="n">Web</span> <span class="n">or</span> <span class="n">HTTP</span><span class="o">/</span><span class="mf">2.0</span> <span class="n">Proxy</span> <span class="n">etc</span>
|
||||
<span class="p">(</span><span class="n">e</span><span class="p">.</span><span class="n">g</span><span class="p">.,</span> <span class="n">nghttpx</span> <span class="o">-</span><span class="n">s</span><span class="p">)</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>With <tt class="docutils literal"><span class="pre">-p</span></tt> option, it works as forward proxy and expects that the
|
||||
backend is HTTP/2.0 proxy:</p>
|
||||
<div class="highlight-c"><div class="highlight"><pre><span class="n">Client</span> <span class="o"><--</span> <span class="p">(</span><span class="n">HTTP</span><span class="p">)</span> <span class="o">--></span> <span class="n">nghttpx</span> <span class="o"><--</span> <span class="p">(</span><span class="n">HTTP</span><span class="o">/</span><span class="mf">2.0</span><span class="p">)</span> <span class="o">--></span> <span class="n">HTTP</span><span class="o">/</span><span class="mf">2.0</span> <span class="n">Proxy</span>
|
||||
<span class="p">[</span><span class="n">forward</span> <span class="n">proxy</span><span class="p">]</span> <span class="p">(</span><span class="n">e</span><span class="p">.</span><span class="n">g</span><span class="p">.,</span> <span class="n">nghttpx</span> <span class="o">-</span><span class="n">s</span><span class="p">)</span>
|
||||
<p>With <tt class="docutils literal"><span class="pre">--client-proxy</span></tt> option, it works as forward proxy and expects
|
||||
that the backend is HTTP/2.0 proxy:</p>
|
||||
<div class="highlight-c"><div class="highlight"><pre><span class="n">Client</span> <span class="o"><--</span> <span class="p">(</span><span class="n">HTTP</span><span class="o">/</span><span class="mf">2.0</span><span class="p">,</span> <span class="n">HTTP</span><span class="o">/</span><span class="mf">1.1</span><span class="p">)</span> <span class="o">--></span> <span class="n">nghttpx</span> <span class="o"><--</span> <span class="p">(</span><span class="n">HTTP</span><span class="o">/</span><span class="mf">2.0</span><span class="p">)</span> <span class="o">--></span> <span class="n">HTTP</span><span class="o">/</span><span class="mf">2.0</span> <span class="n">Proxy</span>
|
||||
<span class="p">[</span><span class="n">forward</span> <span class="n">proxy</span><span class="p">]</span> <span class="p">(</span><span class="n">e</span><span class="p">.</span><span class="n">g</span><span class="p">.,</span> <span class="n">nghttpx</span> <span class="o">-</span><span class="n">s</span><span class="p">)</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>The <tt class="docutils literal"><span class="pre">Client</span></tt> is needs to be configured to use nghttpx as forward proxy.</p>
|
||||
<p>With the above configuration, one can use HTTP/1.1 client to access
|
||||
and test their HTTP/2.0 servers.</p>
|
||||
<p>The <tt class="docutils literal"><span class="pre">Client</span></tt> is needs to be configured to use nghttpx as forward
|
||||
proxy. The frontend HTTP/1.1 connection can be upgraded to HTTP/2.0
|
||||
through HTTP Upgrade. With the above configuration, one can use
|
||||
HTTP/1.1 client to access and test their HTTP/2.0 servers.</p>
|
||||
<p>With <tt class="docutils literal"><span class="pre">--client</span></tt> option, it works as reverse proxy and expects that
|
||||
the backend is HTTP/2.0 Web server:</p>
|
||||
<div class="highlight-c"><div class="highlight"><pre><span class="n">Client</span> <span class="o"><--</span> <span class="p">(</span><span class="n">HTTP</span><span class="p">)</span> <span class="o">--></span> <span class="n">nghttpx</span> <span class="o"><--</span> <span class="p">(</span><span class="n">HTTP</span><span class="o">/</span><span class="mf">2.0</span><span class="p">)</span> <span class="o">--></span> <span class="n">Web</span> <span class="n">Server</span>
|
||||
<span class="p">[</span><span class="n">reverse</span> <span class="n">proxy</span><span class="p">]</span>
|
||||
<div class="highlight-c"><div class="highlight"><pre><span class="n">Client</span> <span class="o"><--</span> <span class="p">(</span><span class="n">HTTP</span><span class="o">/</span><span class="mf">2.0</span><span class="p">,</span> <span class="n">HTTP</span><span class="o">/</span><span class="mf">1.1</span><span class="p">)</span> <span class="o">--></span> <span class="n">nghttpx</span> <span class="o"><--</span> <span class="p">(</span><span class="n">HTTP</span><span class="o">/</span><span class="mf">2.0</span><span class="p">)</span> <span class="o">--></span> <span class="n">Web</span> <span class="n">Server</span>
|
||||
<span class="p">[</span><span class="n">reverse</span> <span class="n">proxy</span><span class="p">]</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>For the operation modes which talk to the backend in HTTP/2.0, the
|
||||
backend connections can be tunneled though HTTP proxy. The proxy is
|
||||
specified using <tt class="docutils literal"><span class="pre">--backend-http-proxy-uri</span></tt> option. The following
|
||||
figure illustrates the example of <tt class="docutils literal"><span class="pre">--spdy-bridge</span></tt> and
|
||||
<tt class="docutils literal"><span class="pre">--backend-http-proxy-uri</span></tt> option to talk to the outside HTTP/2.0 proxy
|
||||
through HTTP proxy:</p>
|
||||
<div class="highlight-c"><div class="highlight"><pre><span class="n">Client</span> <span class="o"><--</span> <span class="p">(</span><span class="n">HTTP</span><span class="o">/</span><span class="mf">2.0</span><span class="p">,</span> <span class="n">SPDY</span><span class="p">,</span> <span class="n">HTTPS</span><span class="p">)</span> <span class="o">--></span> <span class="n">nghttpx</span> <span class="o"><--</span> <span class="p">(</span><span class="n">HTTP</span><span class="o">/</span><span class="mf">2.0</span><span class="p">)</span> <span class="o">--</span>
|
||||
<span class="p">[</span><span class="n">SPDY</span> <span class="n">bridge</span><span class="p">]</span>
|
||||
<p>The frontend HTTP/1.1 connection can be upgraded to HTTP/2.0
|
||||
through HTTP Upgrade.</p>
|
||||
<p>For the operation modes which talk to the backend in HTTP/2.0 over
|
||||
SSL/TLS, the backend connections can be tunneled though HTTP
|
||||
proxy. The proxy is specified using <tt class="docutils literal"><span class="pre">--backend-http-proxy-uri</span></tt>
|
||||
option. The following figure illustrates the example of
|
||||
<tt class="docutils literal"><span class="pre">--spdy-bridge</span></tt> and <tt class="docutils literal"><span class="pre">--backend-http-proxy-uri</span></tt> option to talk to
|
||||
the outside HTTP/2.0 proxy through HTTP proxy:</p>
|
||||
<div class="highlight-c"><div class="highlight"><pre><span class="n">Client</span> <span class="o"><--</span> <span class="p">(</span><span class="n">HTTP</span><span class="o">/</span><span class="mf">2.0</span><span class="p">,</span> <span class="n">SPDY</span><span class="p">,</span> <span class="n">HTTP</span><span class="o">/</span><span class="mf">1.1</span><span class="p">)</span> <span class="o">--></span> <span class="n">nghttpx</span> <span class="o"><--</span> <span class="p">(</span><span class="n">HTTP</span><span class="o">/</span><span class="mf">2.0</span><span class="p">)</span> <span class="o">--</span>
|
||||
|
||||
<span class="o">--===================---></span> <span class="n">HTTP</span><span class="o">/</span><span class="mf">2.0</span> <span class="n">Proxy</span>
|
||||
<span class="p">(</span><span class="n">HTTP</span> <span class="n">proxy</span> <span class="n">tunnel</span><span class="p">)</span> <span class="p">(</span><span class="n">e</span><span class="p">.</span><span class="n">g</span><span class="p">.,</span> <span class="n">nghttpx</span> <span class="o">-</span><span class="n">s</span><span class="p">)</span>
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue