Update doc

This commit is contained in:
Tatsuhiro Tsujikawa 2014-05-15 00:22:42 +09:00
parent f6f6dadff4
commit 703d9f7b6c
3 changed files with 123 additions and 90 deletions

Binary file not shown.

View File

@ -259,7 +259,7 @@ resource) in <tt class="docutils literal"><span class="pre">nghttp</span></tt>,
<li>cython &gt;= 0.19</li>
<li>python &gt;= 2.7</li>
</ul>
<p>If you are using Ubuntu 12.04, you need the following packages
<p>If you are using Ubuntu 14.04 LTS, you need the following packages
installed:</p>
<ul class="simple">
<li>autoconf</li>
@ -274,6 +274,8 @@ installed:</p>
<li>libevent-dev</li>
<li>libjansson-dev</li>
<li>libjemalloc-dev</li>
<li>cython</li>
<li>python3.4-dev</li>
</ul>
<p>spdylay is not packaged in Ubuntu, so you need to build it yourself:
<a class="reference external" href="http://tatsuhiro-t.github.io/spdylay/">http://tatsuhiro-t.github.io/spdylay/</a></p>
@ -303,7 +305,7 @@ $ make
<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>
<a class="reference external" href="https://nghttp2.org/documentation/">https://nghttp2.org/documentation/</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>
@ -314,115 +316,143 @@ $ make
with prior knowledge, HTTP Upgrade and NPN/ALPN TLS extension.</p>
<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>
<div class="highlight-c"><div class="highlight"><pre>$ src/nghttp -nv https://localhost:8443
[ 0.004][NPN] server offers:
<div class="highlight-c"><div class="highlight"><pre>$ src/nghttp -nv https://nghttp2.org
[ 0.033][NPN] server offers:
* h2-12
* spdy/3.1
* spdy/3
* spdy/2
* http/1.1
The negotiated protocol: h2-12
[ 0.006] send SETTINGS frame &lt;length=10, flags=0x00, stream_id=0&gt;
(niv=2)
[ 0.068] send SETTINGS frame &lt;length=15, flags=0x00, stream_id=0&gt;
(niv=3)
[SETTINGS_MAX_CONCURRENT_STREAMS(3):100]
[SETTINGS_INITIAL_WINDOW_SIZE(4):65535]
[ 0.007] send HEADERS frame &lt;length=48, flags=0x05, stream_id=1&gt;
[SETTINGS_COMPRESS_DATA(5):1]
[ 0.068] send HEADERS frame &lt;length=46, flags=0x05, stream_id=1&gt;
; END_STREAM | END_HEADERS
(padlen=0)
; Open new stream
:authority: localhost:8443
:authority: nghttp2.org
:method: GET
:path: /
:scheme: https
accept: */*
accept-encoding: gzip, deflate
user-agent: nghttp2/0.4.0-DEV
[ 0.007] recv SETTINGS frame &lt;length=15, flags=0x00, stream_id=0&gt;
(niv=3)
[ 0.068] recv SETTINGS frame &lt;length=10, flags=0x00, stream_id=0&gt;
(niv=2)
[SETTINGS_MAX_CONCURRENT_STREAMS(3):100]
[SETTINGS_INITIAL_WINDOW_SIZE(4):65535]
[SETTINGS_ENABLE_PUSH(2):0]
[ 0.007] send SETTINGS frame &lt;length=0, flags=0x01, stream_id=0&gt;
[ 0.068] send SETTINGS frame &lt;length=0, flags=0x01, stream_id=0&gt;
; ACK
(niv=0)
[ 0.007] recv SETTINGS frame &lt;length=0, flags=0x01, stream_id=0&gt;
[ 0.079] recv SETTINGS frame &lt;length=0, flags=0x01, stream_id=0&gt;
; ACK
(niv=0)
[ 0.008] (stream_id=1) :status: 200
[ 0.008] (stream_id=1) accept-ranges: bytes
[ 0.008] (stream_id=1) content-encoding: gzip
[ 0.008] (stream_id=1) content-length: 146
[ 0.008] (stream_id=1) content-type: text/html
[ 0.008] (stream_id=1) date: Sat, 15 Feb 2014 08:14:12 GMT
[ 0.008] (stream_id=1) etag: &quot;b1-4e5535a027780-gzip&quot;
[ 0.008] (stream_id=1) last-modified: Sun, 01 Sep 2013 14:34:22 GMT
[ 0.008] (stream_id=1) server: Apache/2.4.6 (Debian)
[ 0.008] (stream_id=1) vary: Accept-Encoding
[ 0.008] (stream_id=1) via: 1.1 nghttpx
[ 0.008] recv HEADERS frame &lt;length=141, flags=0x04, stream_id=1&gt;
[ 0.080] (stream_id=1, noind=0) :status: 200
[ 0.080] (stream_id=1, noind=0) accept-ranges: bytes
[ 0.080] (stream_id=1, noind=0) age: 15
[ 0.080] (stream_id=1, noind=0) content-length: 40243
[ 0.080] (stream_id=1, noind=0) content-type: text/html
[ 0.080] (stream_id=1, noind=0) date: Wed, 14 May 2014 15:14:30 GMT
[ 0.080] (stream_id=1, noind=0) etag: &quot;535d0eea-9d33&quot;
[ 0.080] (stream_id=1, noind=0) last-modified: Sun, 27 Apr 2014 14:06:34 GMT
[ 0.080] (stream_id=1, noind=0) server: nginx/1.4.6 (Ubuntu)
[ 0.080] (stream_id=1, noind=0) x-varnish: 2114900538 2114900537
[ 0.080] (stream_id=1, noind=0) via: 1.1 varnish, 1.1 nghttpx
[ 0.080] (stream_id=1, noind=0) strict-transport-security: max-age=31536000
[ 0.080] recv HEADERS frame &lt;length=162, flags=0x04, stream_id=1&gt;
; END_HEADERS
(padlen=0)
; First response header
[ 0.008] recv DATA frame &lt;length=146, flags=0x00, stream_id=1&gt;
[ 0.008] recv DATA frame &lt;length=0, flags=0x01, stream_id=1&gt;
[ 0.080] recv DATA frame &lt;length=3786, flags=0x00, stream_id=1&gt;
[ 0.080] recv DATA frame &lt;length=4096, flags=0x00, stream_id=1&gt;
[ 0.081] recv DATA frame &lt;length=4096, flags=0x00, stream_id=1&gt;
[ 0.093] recv DATA frame &lt;length=4096, flags=0x00, stream_id=1&gt;
[ 0.093] recv DATA frame &lt;length=4096, flags=0x00, stream_id=1&gt;
[ 0.094] recv DATA frame &lt;length=4096, flags=0x00, stream_id=1&gt;
[ 0.094] recv DATA frame &lt;length=4096, flags=0x00, stream_id=1&gt;
[ 0.094] recv DATA frame &lt;length=4096, flags=0x00, stream_id=1&gt;
[ 0.096] recv DATA frame &lt;length=4096, flags=0x00, stream_id=1&gt;
[ 0.096] send WINDOW_UPDATE frame &lt;length=4, flags=0x00, stream_id=0&gt;
(window_size_increment=36554)
[ 0.096] send WINDOW_UPDATE frame &lt;length=4, flags=0x00, stream_id=1&gt;
(window_size_increment=36554)
[ 0.108] recv DATA frame &lt;length=3689, flags=0x00, stream_id=1&gt;
[ 0.108] recv DATA frame &lt;length=0, flags=0x01, stream_id=1&gt;
; END_STREAM
[ 0.008] send GOAWAY frame &lt;length=8, flags=0x00, stream_id=0&gt;
[ 0.108] send GOAWAY frame &lt;length=8, flags=0x00, stream_id=0&gt;
(last_stream_id=0, error_code=NO_ERROR(0), opaque_data(0)=[])
</pre></div>
</div>
<p>The HTTP Upgrade is performed like this:</p>
<div class="highlight-c"><div class="highlight"><pre>$ src/nghttp -nvu http://localhost:8080
[ 0.000] HTTP Upgrade request
<div class="highlight-c"><div class="highlight"><pre>$ src/nghttp -nvu http://nghttp2.org
[ 0.013] HTTP Upgrade request
GET / HTTP/1.1
Host: localhost:8080
Host: nghttp2.org
Connection: Upgrade, HTTP2-Settings
Upgrade: h2c-11
HTTP2-Settings: AwAAAGQEAAD__w
Upgrade: h2c-12
HTTP2-Settings: AwAAAGQEAAD__wUAAAAB
Accept: */*
User-Agent: nghttp2/0.4.0-DEV
[ 0.001] HTTP Upgrade response
[ 0.024] HTTP Upgrade response
HTTP/1.1 101 Switching Protocols
Connection: Upgrade
Upgrade: h2c-11
Upgrade: h2c-12
[ 0.001] HTTP Upgrade success
[ 0.001] send SETTINGS frame &lt;length=10, flags=0x00, stream_id=0&gt;
(niv=2)
[SETTINGS_MAX_CONCURRENT_STREAMS(3):100]
[SETTINGS_INITIAL_WINDOW_SIZE(4):65535]
[ 0.001] recv SETTINGS frame &lt;length=15, flags=0x00, stream_id=0&gt;
[ 0.024] HTTP Upgrade success
[ 0.024] send SETTINGS frame &lt;length=15, flags=0x00, stream_id=0&gt;
(niv=3)
[SETTINGS_MAX_CONCURRENT_STREAMS(3):100]
[SETTINGS_INITIAL_WINDOW_SIZE(4):65535]
[SETTINGS_ENABLE_PUSH(2):0]
[ 0.001] (stream_id=1) :status: 200
[ 0.001] (stream_id=1) accept-ranges: bytes
[ 0.001] (stream_id=1) content-length: 177
[ 0.001] (stream_id=1) content-type: text/html
[ 0.001] (stream_id=1) date: Sat, 15 Feb 2014 08:16:23 GMT
[ 0.001] (stream_id=1) etag: &quot;b1-4e5535a027780&quot;
[ 0.001] (stream_id=1) last-modified: Sun, 01 Sep 2013 14:34:22 GMT
[ 0.001] (stream_id=1) server: Apache/2.4.6 (Debian)
[ 0.001] (stream_id=1) vary: Accept-Encoding
[ 0.001] (stream_id=1) via: 1.1 nghttpx
[ 0.001] recv HEADERS frame &lt;length=132, flags=0x04, stream_id=1&gt;
[SETTINGS_COMPRESS_DATA(5):1]
[ 0.024] recv SETTINGS frame &lt;length=10, flags=0x00, stream_id=0&gt;
(niv=2)
[SETTINGS_MAX_CONCURRENT_STREAMS(3):100]
[SETTINGS_INITIAL_WINDOW_SIZE(4):65535]
[ 0.024] recv ALTSVC frame &lt;length=43, flags=0x00, stream_id=0&gt;
(max-age=86400, port=443, protocol_id=h2-12, host=nghttp2.org, origin=http://nghttp2.org)
[ 0.024] send SETTINGS frame &lt;length=0, flags=0x01, stream_id=0&gt;
; ACK
(niv=0)
[ 0.024] (stream_id=1, noind=0) :status: 200
[ 0.024] (stream_id=1, noind=0) accept-ranges: bytes
[ 0.024] (stream_id=1, noind=0) age: 10
[ 0.024] (stream_id=1, noind=0) content-length: 40243
[ 0.024] (stream_id=1, noind=0) content-type: text/html
[ 0.024] (stream_id=1, noind=0) date: Wed, 14 May 2014 15:16:34 GMT
[ 0.024] (stream_id=1, noind=0) etag: &quot;535d0eea-9d33&quot;
[ 0.024] (stream_id=1, noind=0) last-modified: Sun, 27 Apr 2014 14:06:34 GMT
[ 0.024] (stream_id=1, noind=0) server: nginx/1.4.6 (Ubuntu)
[ 0.024] (stream_id=1, noind=0) x-varnish: 2114900541 2114900540
[ 0.024] (stream_id=1, noind=0) via: 1.1 varnish, 1.1 nghttpx
[ 0.024] recv HEADERS frame &lt;length=148, flags=0x04, stream_id=1&gt;
; END_HEADERS
(padlen=0)
; First response header
[ 0.001] recv DATA frame &lt;length=177, flags=0x00, stream_id=1&gt;
[ 0.001] recv DATA frame &lt;length=0, flags=0x01, stream_id=1&gt;
[ 0.024] recv DATA frame &lt;length=3786, flags=0x00, stream_id=1&gt;
[ 0.025] recv DATA frame &lt;length=4096, flags=0x00, stream_id=1&gt;
[ 0.031] recv DATA frame &lt;length=4096, flags=0x00, stream_id=1&gt;
[ 0.031] recv DATA frame &lt;length=4096, flags=0x00, stream_id=1&gt;
[ 0.032] recv DATA frame &lt;length=4096, flags=0x00, stream_id=1&gt;
[ 0.032] recv DATA frame &lt;length=4096, flags=0x00, stream_id=1&gt;
[ 0.033] recv DATA frame &lt;length=4096, flags=0x00, stream_id=1&gt;
[ 0.033] recv DATA frame &lt;length=4096, flags=0x00, stream_id=1&gt;
[ 0.033] send WINDOW_UPDATE frame &lt;length=4, flags=0x00, stream_id=0&gt;
(window_size_increment=33164)
[ 0.033] send WINDOW_UPDATE frame &lt;length=4, flags=0x00, stream_id=1&gt;
(window_size_increment=33164)
[ 0.038] recv DATA frame &lt;length=4096, flags=0x00, stream_id=1&gt;
[ 0.038] recv DATA frame &lt;length=3689, flags=0x00, stream_id=1&gt;
[ 0.038] recv DATA frame &lt;length=0, flags=0x01, stream_id=1&gt;
; END_STREAM
[ 0.002] send SETTINGS frame &lt;length=0, flags=0x01, stream_id=0&gt;
[ 0.038] recv SETTINGS frame &lt;length=0, flags=0x01, stream_id=0&gt;
; ACK
(niv=0)
[ 0.002] send GOAWAY frame &lt;length=8, flags=0x00, stream_id=0&gt;
[ 0.038] send GOAWAY frame &lt;length=8, flags=0x00, stream_id=0&gt;
(last_stream_id=0, error_code=NO_ERROR(0), opaque_data(0)=[])
[ 0.002] recv SETTINGS frame &lt;length=0, flags=0x01, stream_id=0&gt;
; ACK
(niv=0)
</pre></div>
</div>
</div>
@ -439,47 +469,50 @@ information. Here is sample output from <tt class="docutils literal"><span clas
<div class="highlight-c"><div class="highlight"><pre>$ src/nghttpd --no-tls -v 8080
IPv4: listen on port 8080
IPv6: listen on port 8080
[id=1] [ 1.027] send SETTINGS frame &lt;length=10, flags=0x00, stream_id=0&gt;
[id=1] [ 15.921] send SETTINGS frame &lt;length=10, flags=0x00, stream_id=0&gt;
(niv=2)
[SETTINGS_MAX_CONCURRENT_STREAMS(3):100]
[SETTINGS_ENABLE_PUSH(2):0]
[id=1] [ 1.027] recv SETTINGS frame &lt;length=10, flags=0x00, stream_id=0&gt;
(niv=2)
[SETTINGS_COMPRESS_DATA(5):1]
[id=1] [ 15.921] recv SETTINGS frame &lt;length=15, flags=0x00, stream_id=0&gt;
(niv=3)
[SETTINGS_MAX_CONCURRENT_STREAMS(3):100]
[SETTINGS_INITIAL_WINDOW_SIZE(4):65535]
[id=1] [ 1.027] (stream_id=1) :authority: localhost:8080
[id=1] [ 1.027] (stream_id=1) :method: GET
[id=1] [ 1.027] (stream_id=1) :path: /
[id=1] [ 1.027] (stream_id=1) :scheme: http
[id=1] [ 1.027] (stream_id=1) accept: */*
[id=1] [ 1.027] (stream_id=1) accept-encoding: gzip, deflate
[id=1] [ 1.027] (stream_id=1) user-agent: nghttp2/0.4.0-DEV
[id=1] [ 1.027] recv HEADERS frame &lt;length=48, flags=0x05, stream_id=1&gt;
[SETTINGS_COMPRESS_DATA(5):1]
[id=1] [ 15.921] (stream_id=1, noind=0) :authority: localhost:8080
[id=1] [ 15.921] (stream_id=1, noind=0) :method: GET
[id=1] [ 15.921] (stream_id=1, noind=0) :path: /
[id=1] [ 15.921] (stream_id=1, noind=0) :scheme: http
[id=1] [ 15.921] (stream_id=1, noind=0) accept: */*
[id=1] [ 15.921] (stream_id=1, noind=0) accept-encoding: gzip, deflate
[id=1] [ 15.921] (stream_id=1, noind=0) user-agent: nghttp2/0.4.0-DEV
[id=1] [ 15.921] recv HEADERS frame &lt;length=48, flags=0x05, stream_id=1&gt;
; END_STREAM | END_HEADERS
(padlen=0)
; Open new stream
[id=1] [ 1.027] send SETTINGS frame &lt;length=0, flags=0x01, stream_id=0&gt;
[id=1] [ 15.921] recv SETTINGS frame &lt;length=0, flags=0x01, stream_id=0&gt;
; ACK
(niv=0)
[id=1] [ 1.027] send HEADERS frame &lt;length=72, flags=0x04, stream_id=1&gt;
[id=1] [ 15.921] send SETTINGS frame &lt;length=0, flags=0x01, stream_id=0&gt;
; ACK
(niv=0)
[id=1] [ 15.921] send HEADERS frame &lt;length=82, flags=0x04, stream_id=1&gt;
; END_HEADERS
(padlen=0)
; First response header
:status: 404
content-encoding: gzip
content-type: text/html; charset=UTF-8
date: Sat, 15 Feb 2014 08:18:53 GMT
:status: 200
cache-control: max-age=3600
content-length: 612
date: Wed, 14 May 2014 15:19:03 GMT
last-modified: Sat, 08 Mar 2014 16:04:06 GMT
server: nghttpd nghttp2/0.4.0-DEV
[id=1] [ 1.028] send DATA frame &lt;length=118, flags=0x00, stream_id=1&gt;
[id=1] [ 1.028] send DATA frame &lt;length=0, flags=0x01, stream_id=1&gt;
[id=1] [ 15.922] send DATA frame &lt;length=381, flags=0x20, stream_id=1&gt;
; COMPRESSED
[id=1] [ 15.922] send DATA frame &lt;length=0, flags=0x01, stream_id=1&gt;
; END_STREAM
[id=1] [ 1.028] stream_id=1 closed
[id=1] [ 1.028] recv SETTINGS frame &lt;length=0, flags=0x01, stream_id=0&gt;
; ACK
(niv=0)
[id=1] [ 1.028] recv GOAWAY frame &lt;length=8, flags=0x00, stream_id=0&gt;
[id=1] [ 15.922] stream_id=1 closed
[id=1] [ 15.922] recv GOAWAY frame &lt;length=8, flags=0x00, stream_id=0&gt;
(last_stream_id=0, error_code=NO_ERROR(0), opaque_data(0)=[])
[id=1] [ 1.028] closed
[id=1] [ 15.922] closed
</pre></div>
</div>
</div>
@ -1059,7 +1092,7 @@ and HTTP/2 server.</p>
determined by configure script. If the detected Python version is not
what you expect, specify a path to Python executable in <tt class="docutils literal"><span class="pre">PYTHON</span></tt>
variable as an argument to configure script (e.g., <tt class="docutils literal"><span class="pre">./configure</span>
<span class="pre">PYTHON=/usr/bin/python3.3</span></tt>).</p>
<span class="pre">PYTHON=/usr/bin/python3.4</span></tt>).</p>
<p>The following example code illustrates basic usage of HPACK compressor
and decompressor in Python:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">binascii</span>

File diff suppressed because one or more lines are too long