2013-07-28 14:26:41 +02:00
< !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
< html xmlns = "http://www.w3.org/1999/xhtml" >
< head >
< meta http-equiv = "Content-Type" content = "text/html; charset=utf-8" / >
< title > nghttp2 - HTTP/2.0 C Library — nghttp2 0.1.0-DEV documentation< / title >
< link rel = "stylesheet" href = "_static/default.css" type = "text/css" / >
< link rel = "stylesheet" href = "_static/pygments.css" type = "text/css" / >
< link rel = "stylesheet" href = "_static/default2.css" type = "text/css" / >
< script type = "text/javascript" >
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '',
VERSION: '0.1.0-DEV',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
< / script >
< script type = "text/javascript" src = "_static/jquery.js" > < / script >
< script type = "text/javascript" src = "_static/underscore.js" > < / script >
< script type = "text/javascript" src = "_static/doctools.js" > < / script >
< link rel = "top" title = "nghttp2 0.1.0-DEV documentation" href = "index.html" / >
< link rel = "next" title = "API Reference" href = "apiref.html" / >
< link rel = "prev" title = "nghttp2 - HTTP/2.0 C Library" href = "index.html" / >
< / head >
< body >
< div class = "related" >
< h3 > Navigation< / h3 >
< ul >
< li class = "right" style = "margin-right: 10px" >
< a href = "genindex.html" title = "General Index"
accesskey="I">index< / a > < / li >
< li class = "right" >
< a href = "apiref.html" title = "API Reference"
accesskey="N">next< / a > |< / li >
< li class = "right" >
< a href = "index.html" title = "nghttp2 - HTTP/2.0 C Library"
accesskey="P">previous< / a > |< / li >
< li > < a href = "index.html" > nghttp2 0.1.0-DEV documentation< / a > » < / li >
< / ul >
< / div >
< div class = "document" >
< div class = "documentwrapper" >
< div class = "bodywrapper" >
< div class = "body" >
< div class = "section" id = "nghttp2-http-2-0-c-library" >
< h1 > nghttp2 - HTTP/2.0 C Library< a class = "headerlink" href = "#nghttp2-http-2-0-c-library" title = "Permalink to this headline" > ¶< / a > < / h1 >
< p > This is an experimental implementation of Hypertext Transfer Protocol
version 2.0.< / p >
< div class = "section" id = "development-status" >
< h2 > Development Status< a class = "headerlink" href = "#development-status" title = "Permalink to this headline" > ¶< / a > < / h2 >
2013-08-25 15:59:06 +02:00
< p > We started to implement HTTP-draft-06/2.0
(< a class = "reference external" href = "http://tools.ietf.org/html/draft-ietf-httpbis-http2-06" > http://tools.ietf.org/html/draft-ietf-httpbis-http2-06< / a > ) and the
header compression
(< a class = "reference external" href = "http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-02" > http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-02< / a > ).< / p >
< p > The nghttp2 code base was forked from spdylay project.< / p >
< table border = "1" class = "docutils" >
< colgroup >
< col width = "53%" / >
< col width = "47%" / >
< / colgroup >
< thead valign = "bottom" >
< tr class = "row-odd" > < th class = "head" > Features< / th >
< th class = "head" > HTTP-draft-04/2.0< / th >
< / tr >
< / thead >
< tbody valign = "top" >
< tr class = "row-even" > < td > Flow Control< / td >
< td > Done< / td >
< / tr >
< tr class = "row-odd" > < td > Header Compression< / td >
< td > Done< / td >
< / tr >
< tr class = "row-even" > < td > Reprioritization< / td >
< td > Done< / td >
< / tr >
< tr class = "row-odd" > < td > Header Continuation< / td >
< td > < / td >
< / tr >
< tr class = "row-even" > < td > Server Push< / td >
< td > Done< / td >
< / tr >
< tr class = "row-odd" > < td > HTTP Upgrade< / td >
< td > Done< / td >
< / tr >
< tr class = "row-even" > < td > ALPN< / td >
< td > < / td >
< / tr >
< tr class = "row-odd" > < td > NPN< / td >
< td > Done< / td >
< / tr >
< / tbody >
< / table >
< / div >
< 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 >
< p > The following endpoints are available to try out nghttp2
implementation. These endpoints supports < tt class = "docutils literal" > < span class = "pre" > HTTP-draft-06/2.0< / span > < / tt > and
the earlier draft versions are not supporeted.< / p >
< ul >
< li > < p class = "first" > < a class = "reference external" href = "https://106.186.112.116:8443" > https://106.186.112.116:8443< / a > TLS + NPN< / p >
< p > Note: certificate is self-signed and a browser will show alert< / p >
< / li >
< li > < p class = "first" > < a class = "reference external" href = "http://106.186.112.116:8080" > http://106.186.112.116:8080< / a > direct, HTTP Upgrade< / p >
< / li >
2013-07-28 14:26:41 +02:00
< / ul >
< / div >
< div class = "section" id = "requirements" >
< h2 > Requirements< a class = "headerlink" href = "#requirements" title = "Permalink to this headline" > ¶< / a > < / h2 >
< p > The following packages are needed to build the library:< / p >
< ul class = "simple" >
< li > pkg-config > = 0.20< / li >
< li > zlib > = 1.2.3< / li >
< / ul >
< p > To build and run the unit test programs, the following packages are
required:< / p >
< ul class = "simple" >
< li > cunit > = 2.1< / li >
< / ul >
< p > To build and run the application programs (< tt class = "docutils literal" > < span class = "pre" > nghttp< / span > < / tt > , < tt class = "docutils literal" > < span class = "pre" > nghttpd< / span > < / tt > and
< tt class = "docutils literal" > < span class = "pre" > nghttpx< / span > < / tt > ) in < tt class = "docutils literal" > < span class = "pre" > src< / span > < / tt > directory, the following packages are
required:< / p >
< ul class = "simple" >
< li > OpenSSL > = 1.0.1< / li >
< li > libevent-openssl > = 2.0.8< / li >
< / ul >
< p > To enable SPDY protocol in the application program < tt class = "docutils literal" > < span class = "pre" > nghttpx< / span > < / tt > , the
following packages are required:< / p >
< ul class = "simple" >
< li > spdylay > = 1.0.0< / li >
< / ul >
< p > To enable < tt class = "docutils literal" > < span class = "pre" > -a< / span > < / tt > option (getting linked assets from the downloaded
resouce) in < tt class = "docutils literal" > < span class = "pre" > nghttp< / span > < / tt > , the following
packages are needed:< / p >
< ul class = "simple" >
< li > libxml2 > = 2.7.7< / li >
< / ul >
< p > If you are using Ubuntu 12.04, you need the following packages
installed:< / p >
< ul class = "simple" >
< li > autoconf< / li >
< li > automake< / li >
< li > autotools-dev< / li >
< li > libtool< / li >
< li > pkg-config< / li >
< li > zlib1g-dev< / li >
< li > libcunit1-dev< / li >
< li > libssl-dev< / li >
< li > libxml2-dev< / li >
< li > libevent-dev< / li >
< / ul >
< p > spdylay is not packaged in Ubuntu, so you need to build it yourself:
< a class = "reference external" href = "http://spdylay.sourceforge.net/" > http://spdylay.sourceforge.net/< / a > < / p >
< / div >
< div class = "section" id = "build-from-git" >
< h2 > Build from git< a class = "headerlink" href = "#build-from-git" title = "Permalink to this headline" > ¶< / a > < / h2 >
< p > Building from git is easy, but please be sure that at least autoconf 2.68 is
used:< / p >
< div class = "highlight-c" > < pre > $ autoreconf -i
$ automake
$ autoconf
$ ./configure
$ make< / pre >
< / div >
< / div >
< div class = "section" id = "building-documentation" >
< h2 > Building documentation< a class = "headerlink" href = "#building-documentation" title = "Permalink to this headline" > ¶< / a > < / h2 >
< div class = "admonition note" >
< p class = "first admonition-title" > Note< / p >
< p class = "last" > Documentation is still incomplete.< / p >
< / div >
< p > To build documentation, run:< / p >
< div class = "highlight-c" > < pre > $ make html< / 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 >
2013-08-03 13:03:39 +02:00
< 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 >
2013-07-28 14:26:41 +02:00
< / div >
< div class = "section" id = "client-server-and-proxy-programs" >
< h2 > Client, Server and Proxy programs< a class = "headerlink" href = "#client-server-and-proxy-programs" title = "Permalink to this headline" > ¶< / a > < / h2 >
< p > The src directory contains HTTP/2.0 client, server and proxy programs.< / p >
< div class = "section" id = "nghttp-client" >
< h3 > nghttp - client< a class = "headerlink" href = "#nghttp-client" title = "Permalink to this headline" > ¶< / a > < / h3 >
2013-08-04 11:30:37 +02:00
< p > < tt class = "docutils literal" > < span class = "pre" > nghttp< / span > < / tt > is a HTTP/2.0 client. It can connect to the HTTP/2.0 server
with prior knowledge, HTTP Upgrade and NPN TLS extension.< / p >
2013-07-28 14:26:41 +02:00
< p > It has verbose output mode for framing information. Here is sample
output from < tt class = "docutils literal" > < span class = "pre" > nghttp< / span > < / tt > client:< / p >
2013-08-25 15:59:06 +02:00
< div class = "highlight-c" > < pre > $ src/nghttp -vn https://localhost:8443
[ 0.001] NPN select next protocol: the remote server offers:
* HTTP-draft-06/2.0
2013-07-28 14:26:41 +02:00
* spdy/3
* spdy/2
* http/1.1
2013-08-25 15:59:06 +02:00
NPN selected the protocol: HTTP-draft-06/2.0
[ 0.006] send SETTINGS frame < length=16, flags=0x00, stream_id=0>
(niv=2)
[MAX_CONCURRENT_STREAMS(4):100]
[INITIAL_WINDOW_SIZE(7):65535]
[ 0.006] send HEADERS frame < length=58, flags=0x05, stream_id=1>
2013-07-28 14:26:41 +02:00
; END_STREAM | END_HEADERS
; Open new stream
2013-08-25 15:59:06 +02:00
:host: localhost:8443
2013-07-28 14:26:41 +02:00
:method: GET
:path: /
:scheme: https
accept: */*
accept-encoding: gzip, deflate
user-agent: nghttp2/0.1.0-DEV
2013-08-25 15:59:06 +02:00
[ 0.007] recv SETTINGS frame < length=16, flags=0x00, stream_id=0>
2013-07-28 14:26:41 +02:00
(niv=2)
2013-08-25 15:59:06 +02:00
[MAX_CONCURRENT_STREAMS(4):100]
[INITIAL_WINDOW_SIZE(7):65535]
[ 0.008] recv WINDOW_UPDATE frame < length=4, flags=0x00, stream_id=0>
(window_size_increment=1000000007)
[ 0.008] recv HEADERS frame < length=179, flags=0x04, stream_id=1>
2013-07-28 14:26:41 +02:00
; END_HEADERS
; First response header
:status: 200 OK
accept-ranges: bytes
content-encoding: gzip
content-length: 56
content-type: text/html
2013-08-25 15:59:06 +02:00
date: Thu, 22 Aug 2013 16:37:17 GMT
2013-07-28 14:26:41 +02:00
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
2013-08-25 15:59:06 +02:00
[ 0.009] recv DATA frame < length=56, flags=0x00, stream_id=1>
[ 0.009] recv DATA frame < length=0, flags=0x01, stream_id=1>
; END_STREAM
[ 0.009] send GOAWAY frame < length=8, flags=0x00, stream_id=0>
(last_stream_id=0, error_code=NO_ERROR(0), opaque_data(0)=[])< / pre >
2013-07-28 14:26:41 +02:00
< / div >
2013-08-03 13:03:39 +02:00
< p > The HTTP Upgrade is performed like this:< / p >
2013-08-25 15:59:06 +02:00
< div class = "highlight-c" > < pre > $ src/nghttp -vnu http://localhost:8080
2013-08-03 13:03:39 +02:00
[ 0.000] HTTP Upgrade request
GET / HTTP/1.1
2013-08-25 15:59:06 +02:00
Host: localhost:8080
2013-08-03 13:03:39 +02:00
Connection: Upgrade, HTTP2-Settings
2013-08-25 15:59:06 +02:00
Upgrade: HTTP-draft-06/2.0
2013-08-03 13:03:39 +02:00
HTTP2-Settings: AAAABAAAAGQAAAAHAAD__w
Accept: */*
User-Agent: nghttp2/0.1.0-DEV
2013-08-25 15:59:06 +02:00
[ 0.000] HTTP Upgrade response
2013-08-03 13:03:39 +02:00
HTTP/1.1 101 Switching Protocols
Connection: Upgrade
Upgrade: HTTP/2.0
2013-08-25 15:59:06 +02:00
[ 0.000] HTTP Upgrade success
[ 0.001] send SETTINGS frame < length=16, flags=0x00, stream_id=0>
2013-08-03 13:03:39 +02:00
(niv=2)
2013-08-25 15:59:06 +02:00
[MAX_CONCURRENT_STREAMS(4):100]
[INITIAL_WINDOW_SIZE(7):65535]
[ 0.001] recv SETTINGS frame < length=16, flags=0x00, stream_id=0>
2013-08-03 13:03:39 +02:00
(niv=2)
2013-08-25 15:59:06 +02:00
[MAX_CONCURRENT_STREAMS(4):100]
[INITIAL_WINDOW_SIZE(7):65535]
[ 0.001] recv WINDOW_UPDATE frame < length=4, flags=0x00, stream_id=0>
(window_size_increment=1000000007)
[ 0.001] recv HEADERS frame < length=198, flags=0x04, stream_id=1>
2013-08-03 13:03:39 +02:00
; END_HEADERS
; First response header
:status: 200 OK
accept-ranges: bytes
content-length: 45
content-type: text/html
2013-08-25 15:59:06 +02:00
date: Thu, 22 Aug 2013 16:39:04 GMT
2013-08-03 13:03:39 +02:00
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
2013-08-25 15:59:06 +02:00
[ 0.001] recv DATA frame < length=45, flags=0x00, stream_id=1>
[ 0.001] recv DATA frame < length=0, flags=0x01, stream_id=1>
; END_STREAM
[ 0.001] send GOAWAY frame < length=8, flags=0x00, stream_id=0>
(last_stream_id=0, error_code=NO_ERROR(0), opaque_data(0)=[])< / pre >
2013-08-03 13:03:39 +02:00
< / div >
2013-07-28 14:26:41 +02:00
< / div >
< div class = "section" id = "nghttpd-server" >
< h3 > nghttpd - server< a class = "headerlink" href = "#nghttpd-server" title = "Permalink to this headline" > ¶< / a > < / h3 >
< p > < tt class = "docutils literal" > < span class = "pre" > nghttpd< / span > < / tt > is static web server. It is single threaded and
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 >
2013-08-03 13:03:39 +02:00
< 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 >
2013-07-28 14:26:41 +02:00
< 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 >
2013-08-25 15:59:06 +02:00
< div class = "highlight-c" > < pre > $ src/nghttpd --no-tls -v 8080
IPv4: listen on port 8080
IPv6: listen on port 8080
[id=1] [ 14.716] send SETTINGS frame < length=8, flags=0x00, stream_id=0>
2013-07-28 14:26:41 +02:00
(niv=1)
2013-08-25 15:59:06 +02:00
[MAX_CONCURRENT_STREAMS(4):100]
[id=1] [ 14.717] recv SETTINGS frame < length=16, flags=0x00, stream_id=0>
(niv=2)
[MAX_CONCURRENT_STREAMS(4):100]
[INITIAL_WINDOW_SIZE(7):65535]
[id=1] [ 14.717] recv HEADERS frame < length=58, flags=0x05, stream_id=1>
2013-07-28 14:26:41 +02:00
; END_STREAM | END_HEADERS
; Open new stream
2013-08-25 15:59:06 +02:00
:host: localhost:8080
2013-07-28 14:26:41 +02:00
:method: GET
:path: /
:scheme: http
accept: */*
accept-encoding: gzip, deflate
user-agent: nghttp2/0.1.0-DEV
2013-08-25 15:59:06 +02:00
[id=1] [ 14.717] send HEADERS frame < length=105, flags=0x04, stream_id=1>
2013-07-28 14:26:41 +02:00
; END_HEADERS
; First response header
:status: 404 Not Found
content-encoding: gzip
content-type: text/html; charset=UTF-8
2013-08-25 15:59:06 +02:00
date: Thu, 22 Aug 2013 16:41:05 GMT
2013-07-28 14:26:41 +02:00
server: nghttpd nghttp2/0.1.0-DEV
2013-08-25 15:59:06 +02:00
[id=1] [ 14.717] send DATA frame < length=128, flags=0x00, stream_id=1>
[id=1] [ 14.717] send DATA frame < length=0, flags=0x01, stream_id=1>
; END_STREAM
[id=1] [ 14.717] stream_id=1 closed
[id=1] [ 14.717] recv GOAWAY frame < length=8, flags=0x00, stream_id=0>
(last_stream_id=0, error_code=NO_ERROR(0), opaque_data(0)=[])
[id=1] [ 14.717] closed< / pre >
2013-07-28 14:26:41 +02:00
< / div >
< / div >
< 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
2013-08-25 15:59:06 +02:00
HTTP-draft-06/2.0, SPDY and HTTP/1.1. It has several operation modes:< / p >
2013-07-28 14:26:41 +02:00
< table border = "1" class = "docutils" >
< colgroup >
2013-08-03 13:03:39 +02:00
< col width = "24%" / >
< col width = "40%" / >
< col width = "19%" / >
< col width = "17%" / >
2013-07-28 14:26:41 +02:00
< / colgroup >
< thead valign = "bottom" >
< tr class = "row-odd" > < th class = "head" > Mode option< / th >
< th class = "head" > Frontend< / th >
< th class = "head" > Backend< / th >
< th class = "head" > Note< / th >
< / tr >
< / thead >
< tbody valign = "top" >
2013-08-03 13:03:39 +02:00
< tr class = "row-even" > < td > default mode< / td >
< td > HTTP/2.0, SPDY, HTTP/1.1 (TLS)< / td >
2013-07-28 14:26:41 +02:00
< 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 >
2013-08-03 13:03:39 +02:00
< td > HTTP/2.0, SPDY, HTTP/1.1 (TLS)< / td >
2013-07-28 14:26:41 +02:00
< 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 >
2013-08-03 13:03:39 +02:00
< td > HTTP/2.0, SPDY, HTTP/1.1 (TLS)< / td >
< td > HTTP/2.0 (TLS)< / td >
< td > < / td >
2013-07-28 14:26:41 +02:00
< / tr >
< tr class = "row-odd" > < td > < tt class = "docutils literal" > < span class = "pre" > --client< / span > < / tt > < / td >
2013-08-03 13:03:39 +02:00
< td > HTTP/2.0, HTTP/1.1< / td >
< td > HTTP/2.0 (TLS)< / td >
< td > < / td >
2013-07-28 14:26:41 +02:00
< / tr >
< tr class = "row-even" > < td > < tt class = "docutils literal" > < span class = "pre" > --client-proxy< / span > < / tt > < / td >
2013-08-03 13:03:39 +02:00
< td > HTTP/2.0, HTTP/1.1< / td >
< td > HTTP/2.0 (TLS)< / td >
2013-07-28 14:26:41 +02:00
< td > Forward proxy< / td >
< / tr >
< / tbody >
< / table >
< p > The interesting mode at the moment is the default mode. It works like
2013-08-25 15:59:06 +02:00
a reverse proxy and listens HTTP-draft-06/2.0, SPDY and HTTP/1.1 and
2013-08-03 13:03:39 +02:00
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 >
2013-07-28 14:26:41 +02:00
< 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 >
2013-08-03 13:03:39 +02:00
< 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 >
2013-07-28 14:26:41 +02:00
< / pre > < / div >
< / div >
2013-08-03 13:03:39 +02:00
< 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 >
2013-07-28 14:26:41 +02:00
< / pre > < / div >
< / div >
2013-08-03 13:03:39 +02:00
< 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 >
2013-07-28 14:26:41 +02:00
< p > At the time of this writing, Chrome is the only browser which supports
2013-08-03 13:03:39 +02:00
secure proxy. The one way to configure Chrome to use secure proxy is
create proxy.pac script like this:< / p >
2013-07-28 14:26:41 +02:00
< 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 >
< / pre > < / div >
< / 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
2013-08-03 13:03:39 +02:00
certificate for secure proxy.< / p >
2013-07-28 14:26:41 +02:00
< 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 >
2013-08-03 13:03:39 +02:00
< p > With < tt class = "docutils literal" > < span class = "pre" > --spdy-bridge< / span > < / tt > , it accepts HTTP/2.0, SPDY and HTTP/1.1
2013-07-28 14:26:41 +02:00
connections and communicates with backend in HTTP/2.0:< / p >
2013-08-03 13:03:39 +02:00
< 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 >
2013-07-28 14:26:41 +02:00
< / pre > < / div >
< / div >
2013-08-03 13:03:39 +02:00
< 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 >
2013-07-28 14:26:41 +02:00
< / pre > < / div >
< / div >
2013-08-03 13:03:39 +02:00
< 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 >
2013-07-28 14:26:41 +02:00
< 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 >
2013-08-03 13:03:39 +02:00
< 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 >
2013-07-28 14:26:41 +02:00
< / pre > < / div >
< / div >
2013-08-03 13:03:39 +02:00
< 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 >
2013-07-28 14:26:41 +02:00
< 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 >
< / pre > < / div >
< / div >
< / div >
< / div >
< / div >
< / div >
< / div >
< / div >
< div class = "sphinxsidebar" >
< div class = "sphinxsidebarwrapper" > < h3 > Menu< / h3 >
< ul >
< li > < a href = "https://github.com/tatsuhiro-t/nghttp2/issues" > Issues< / a > < / li >
< li > < a href = "https://github.com/tatsuhiro-t/nghttp2" > Source< / a > < / li >
< / ul >
< h3 > < a href = "index.html" > Table Of Contents< / a > < / h3 >
< ul >
< li > < a class = "reference internal" href = "#" > nghttp2 - HTTP/2.0 C Library< / a > < ul >
< li > < a class = "reference internal" href = "#development-status" > Development Status< / a > < / li >
2013-08-25 15:59:06 +02:00
< li > < a class = "reference internal" href = "#public-test-server" > Public Test Server< / a > < / li >
2013-07-28 14:26:41 +02:00
< li > < a class = "reference internal" href = "#requirements" > Requirements< / a > < / li >
< li > < a class = "reference internal" href = "#build-from-git" > Build from git< / a > < / li >
< li > < a class = "reference internal" href = "#building-documentation" > Building documentation< / a > < / li >
< li > < a class = "reference internal" href = "#client-server-and-proxy-programs" > Client, Server and Proxy programs< / a > < ul >
< li > < a class = "reference internal" href = "#nghttp-client" > nghttp - client< / a > < / li >
< li > < a class = "reference internal" href = "#nghttpd-server" > nghttpd - server< / a > < / li >
< li > < a class = "reference internal" href = "#nghttpx-proxy" > nghttpx - proxy< / a > < / li >
< / ul >
< / li >
< / ul >
< / li >
< / ul >
< h4 > Previous topic< / h4 >
< p class = "topless" > < a href = "index.html"
title="previous chapter">nghttp2 - HTTP/2.0 C Library< / a > < / p >
< h4 > Next topic< / h4 >
< p class = "topless" > < a href = "apiref.html"
title="next chapter">API Reference< / a > < / p >
< h3 > This Page< / h3 >
< ul class = "this-page-menu" >
< li > < a href = "_sources/package_README.txt"
rel="nofollow">Show Source< / a > < / li >
< / ul >
< div id = "searchbox" style = "display: none" >
< h3 > Quick search< / h3 >
< form class = "search" action = "search.html" method = "get" >
< input type = "text" name = "q" / >
< input type = "submit" value = "Go" / >
< input type = "hidden" name = "check_keywords" value = "yes" / >
< input type = "hidden" name = "area" value = "default" / >
< / form >
< p class = "searchtip" style = "font-size: 90%" >
Enter search terms or a module, class or function name.
< / p >
< / div >
< script type = "text/javascript" > $ ( '#searchbox' ) . show ( 0 ) ; < / script >
< / div >
< / div >
< div class = "clearer" > < / div >
< / div >
< div class = "related" >
< h3 > Navigation< / h3 >
< ul >
< li class = "right" style = "margin-right: 10px" >
< a href = "genindex.html" title = "General Index"
>index< / a > < / li >
< li class = "right" >
< a href = "apiref.html" title = "API Reference"
>next< / a > |< / li >
< li class = "right" >
< a href = "index.html" title = "nghttp2 - HTTP/2.0 C Library"
>previous< / a > |< / li >
< li > < a href = "index.html" > nghttp2 0.1.0-DEV documentation< / a > » < / li >
< / ul >
< / div >
< div class = "footer" >
© Copyright 2012, 2013, Tatsuhiro Tsujikawa.
Created using < a href = "http://sphinx.pocoo.org/" > Sphinx< / a > 1.1.3.
< / div >
< / body >
< / html >