summaryrefslogtreecommitdiffstats
path: root/doc/nghttp.1.rst
blob: e10f3ee8a71eb88fb171a43a77eefdfe4d7f6495 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
.. GENERATED by help2rst.py.  DO NOT EDIT DIRECTLY.

.. program:: nghttp

nghttp(1)
=========

SYNOPSIS
--------

**nghttp** [OPTIONS]... <URI>...

DESCRIPTION
-----------

HTTP/2 client

.. describe:: <URI>

    Specify URI to access.

OPTIONS
-------

.. option:: -v, --verbose

    Print   debug   information   such  as   reception   and
    transmission of frames and name/value pairs.  Specifying
    this option multiple times increases verbosity.

.. option:: -n, --null-out

    Discard downloaded data.

.. option:: -O, --remote-name

    Save  download  data  in  the  current  directory.   The
    filename is  derived from  URI.  If  URI ends  with '*/*',
    'index.html'  is used  as a  filename.  Not  implemented
    yet.

.. option:: -t, --timeout=<DURATION>

    Timeout each request after <DURATION>.  Set 0 to disable
    timeout.

.. option:: -w, --window-bits=<N>

    Sets the stream level initial window size to 2\*\*<N>-1.

.. option:: -W, --connection-window-bits=<N>

    Sets  the  connection  level   initial  window  size  to
    2\*\*<N>-1.

.. option:: -a, --get-assets

    Download assets  such as stylesheets, images  and script
    files linked  from the downloaded resource.   Only links
    whose  origins are  the same  with the  linking resource
    will be downloaded.   nghttp prioritizes resources using
    HTTP/2 dependency  based priority.  The  priority order,
    from highest to lowest,  is html itself, css, javascript
    and images.

.. option:: -s, --stat

    Print statistics.

.. option:: -H, --header=<HEADER>

    Add a header to the requests.  Example: :option:`-H`\':method: PUT'

.. option:: --trailer=<HEADER>

    Add a trailer header to the requests.  <HEADER> must not
    include pseudo header field  (header field name starting
    with ':').  To  send trailer, one must use  :option:`-d` option to
    send request body.  Example: :option:`--trailer` 'foo: bar'.

.. option:: --cert=<CERT>

    Use  the specified  client certificate  file.  The  file
    must be in PEM format.

.. option:: --key=<KEY>

    Use the  client private key  file.  The file must  be in
    PEM format.

.. option:: -d, --data=<PATH>

    Post FILE to server. If '-'  is given, data will be read
    from stdin.

.. option:: -m, --multiply=<N>

    Request each URI <N> times.  By default, same URI is not
    requested twice.  This option disables it too.

.. option:: -u, --upgrade

    Perform HTTP Upgrade for HTTP/2.  This option is ignored
    if the request URI has https scheme.  If :option:`-d` is used, the
    HTTP upgrade request is performed with OPTIONS method.

.. option:: -p, --weight=<WEIGHT>

    Sets  weight of  given  URI.  This  option  can be  used
    multiple times, and  N-th :option:`-p` option sets  weight of N-th
    URI in the command line.  If  the number of :option:`-p` option is
    less than the number of URI, the last :option:`-p` option value is
    repeated.  If there is no :option:`-p` option, default weight, 16,
    is assumed.  The valid value range is
    [1, 256], inclusive.

.. option:: -M, --peer-max-concurrent-streams=<N>

    Use  <N>  as  SETTINGS_MAX_CONCURRENT_STREAMS  value  of
    remote endpoint as if it  is received in SETTINGS frame.

    Default: ``100``

.. option:: -c, --header-table-size=<SIZE>

    Specify decoder  header table  size.  If this  option is
    used  multiple times,  and the  minimum value  among the
    given values except  for last one is  strictly less than
    the last  value, that minimum  value is set  in SETTINGS
    frame  payload  before  the   last  value,  to  simulate
    multiple header table size change.

.. option:: --encoder-header-table-size=<SIZE>

    Specify encoder header table size.  The decoder (server)
    specifies  the maximum  dynamic table  size it  accepts.
    Then the negotiated dynamic table size is the minimum of
    this option value and the value which server specified.

.. option:: -b, --padding=<N>

    Add at  most <N>  bytes to a  frame payload  as padding.
    Specify 0 to disable padding.

.. option:: -r, --har=<PATH>

    Output HTTP  transactions <PATH> in HAR  format.  If '-'
    is given, data is written to stdout.

.. option:: --color

    Force colored log output.

.. option:: --continuation

    Send large header to test CONTINUATION.

.. option:: --no-content-length

    Don't send content-length header field.

.. option:: --no-dep

    Don't send dependency based priority hint to server.

.. option:: --hexdump

    Display the  incoming traffic in  hexadecimal (Canonical
    hex+ASCII display).  If SSL/TLS  is used, decrypted data
    are used.

.. option:: --no-push

    Disable server push.

.. option:: --max-concurrent-streams=<N>

    The  number of  concurrent  pushed  streams this  client
    accepts.

.. option:: --expect-continue

    Perform an Expect/Continue handshake:  wait to send DATA
    (up to  a short  timeout)  until the server sends  a 100
    Continue interim response. This option is ignored unless
    combined with the :option:`-d` option.

.. option:: -y, --no-verify-peer

    Suppress  warning  on  server  certificate  verification
    failure.

.. option:: --ktls

    Enable ktls.

.. option:: --no-rfc7540-pri

    Disable RFC7540 priorities.

.. option:: --version

    Display version information and exit.

.. option:: -h, --help

    Display this help and exit.



The <SIZE> argument is an integer and an optional unit (e.g., 10K is
10 * 1024).  Units are K, M and G (powers of 1024).

The <DURATION> argument is an integer and an optional unit (e.g., 1s
is 1 second and 500ms is 500 milliseconds).  Units are h, m, s or ms
(hours, minutes, seconds and milliseconds, respectively).  If a unit
is omitted, a second is used as unit.

DEPENDENCY BASED PRIORITY
-------------------------

nghttp sends priority hints to server by default unless
:option:`--no-dep` is used.  nghttp mimics the way Firefox employs to
manages dependency using idle streams.  We follows the behaviour of
Firefox Nightly as of April, 2015, and nghttp's behaviour is very
static and could be different from Firefox in detail.  But reproducing
the same behaviour of Firefox is not our goal.  The goal is provide
the easy way to test out the dependency priority in server
implementation.

When connection is established, nghttp sends 5 PRIORITY frames to idle
streams 3, 5, 7, 9 and 11 to create "anchor" nodes in dependency
tree:

.. code-block:: text

                      +-----+
                      |id=0 |
                      +-----+
                     ^   ^   ^
              w=201 /    |    \ w=1
                   /     |     \
                  / w=101|      \
              +-----+ +-----+ +-----+
              |id=3 | |id=5 | |id=7 |
              +-----+ +-----+ +-----+
                 ^               ^
             w=1 |           w=1 |
                 |               |
              +-----+         +-----+
              |id=11|         |id=9 |
              +-----+         +-----+

In the above figure, ``id`` means stream ID, and ``w`` means weight.
The stream 0 is non-existence stream, and forms the root of the tree.
The stream 7 and 9 are not used for now.

The URIs given in the command-line depend on stream 11 with the weight
given in :option:`-p` option, which defaults to 16.

If :option:`-a` option is used, nghttp parses the resource pointed by
URI given in command-line as html, and extracts resource links from
it.  When requesting those resources, nghttp uses dependency according
to its resource type.

For CSS, and Javascript files inside "head" element, they depend on
stream 3 with the weight 2.  The Javascript files outside "head"
element depend on stream 5 with the weight 2.  The mages depend on
stream 11 with the weight 12.  The other resources (e.g., icon) depend
on stream 11 with the weight 2.

SEE ALSO
--------

:manpage:`nghttpd(1)`, :manpage:`nghttpx(1)`, :manpage:`h2load(1)`