Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nghttp2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
nghttp2
Commits
f5342494
Commit
f5342494
authored
Feb 16, 2014
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
src: Format help message and add --version to make man page generation easier
parent
1fd5fdd5
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
375 additions
and
348 deletions
+375
-348
src/nghttp.cc
src/nghttp.cc
+66
-54
src/nghttpd.cc
src/nghttpd.cc
+54
-35
src/shrpx.cc
src/shrpx.cc
+255
-259
No files found.
src/nghttp.cc
View file @
f5342494
...
...
@@ -1654,14 +1654,18 @@ int run(char **uris, int n)
}
}
// namespace
namespace
{
void
print_version
(
std
::
ostream
&
out
)
{
out
<<
"nghttp nghttp2/"
NGHTTP2_VERSION
<<
std
::
endl
;
}
}
// namespace
namespace
{
void
print_usage
(
std
::
ostream
&
out
)
{
out
<<
"Usage: nghttp [-Oansuv] [-t <SECONDS>] [-w <WINDOW_BITS>] [-W <WINDOW_BITS>]
\n
"
<<
" [--cert=<CERT>] [--key=<KEY>] [-d <FILE>] [-m <N>]
\n
"
<<
" [-p <PRIORITY>] [-M <N>] [-b <ALIGNMENT>]
\n
"
<<
" <URI>..."
<<
std
::
endl
;
out
<<
"Usage: nghttp [OPTIONS]... <URI>...
\n
"
<<
"HTTP/2 experimental client"
<<
std
::
endl
;
}
}
// namespace
...
...
@@ -1670,56 +1674,59 @@ void print_help(std::ostream& out)
{
print_usage
(
out
);
out
<<
"
\n
"
<<
"OPTIONS:
\n
"
<<
" -v, --verbose Print debug information such as reception/
\n
"
<<
" transmission of frames and name/value pairs.
\n
"
<<
" -n, --null-out Discard downloaded data.
\n
"
<<
" -O, --remote-name Save download data in the current directory.
\n
"
<<
" The filename is dereived from URI. If URI
\n
"
<<
" ends with '/', 'index.html' is used as a
\n
"
<<
" filename. Not implemented yet.
\n
"
<<
" -t, --timeout=<N> Timeout each request after <N> seconds.
\n
"
<<
" -w, --window-bits=<N>
\n
"
<<
" Sets the stream level initial window size
\n
"
<<
" to 2**<N>-1.
\n
"
<<
" -W, --connection-window-bits=<N>
\n
"
<<
" Sets the connection level initial window
\n
"
<<
" size to 2**<N>-1.
\n
"
<<
" -a, --get-assets Download assets such as stylesheets, images
\n
"
<<
" and script files linked from the downloaded
\n
"
<<
" resource. Only links whose origins are the
\n
"
<<
" same with the linking resource will be
\n
"
<<
" downloaded.
\n
"
<<
" -s, --stat Print statistics.
\n
"
<<
" -H, --header Add a header to the requests.
\n
"
<<
" --cert=<CERT> Use the specified client certificate file.
\n
"
<<
" The file must be in PEM format.
\n
"
<<
" --key=<KEY> Use the client private key file. The file
\n
"
<<
" must be in PEM format.
\n
"
<<
" -d, --data=<FILE> Post FILE to server. If - is given, data
\n
"
<<
" will be read from stdin.
\n
"
<<
" -m, --multiply=<N> Request each URI <N> times. By default, same
\n
"
<<
" URI is not requested twice. This option
\n
"
<<
" disables it too.
\n
"
<<
" -u, --upgrade Perform HTTP Upgrade for HTTP/2.0. This
\n
"
<<
" option is ignored if the request URI has
\n
"
<<
" https scheme.
\n
"
<<
" If -d is used, the HTTP upgrade request is
\n
"
<<
" performed with OPTIONS method.
\n
"
<<
" -p, --pri=<PRIORITY>
\n
"
<<
" Sets stream priority. Default: "
<<
" <URI> Specify URI to access.
\n
"
<<
"Options:
\n
"
<<
" -v, --verbose Print debug information such as reception/
\n
"
<<
" transmission of frames and name/value pairs.
\n
"
<<
" -n, --null-out Discard downloaded data.
\n
"
<<
" -O, --remote-name Save download data in the current directory.
\n
"
<<
" The filename is dereived from URI. If URI
\n
"
<<
" ends with '/', 'index.html' is used as a
\n
"
<<
" filename. Not implemented yet.
\n
"
<<
" -t, --timeout=<N> Timeout each request after <N> seconds.
\n
"
<<
" -w, --window-bits=<N>
\n
"
<<
" Sets the stream level initial window size
\n
"
<<
" to 2**<N>-1.
\n
"
<<
" -W, --connection-window-bits=<N>
\n
"
<<
" Sets the connection level initial window
\n
"
<<
" size to 2**<N>-1.
\n
"
<<
" -a, --get-assets Download assets such as stylesheets, images
\n
"
<<
" and script files linked from the downloaded
\n
"
<<
" resource. Only links whose origins are the
\n
"
<<
" same with the linking resource will be
\n
"
<<
" downloaded.
\n
"
<<
" -s, --stat Print statistics.
\n
"
<<
" -H, --header Add a header to the requests.
\n
"
<<
" --cert=<CERT> Use the specified client certificate file.
\n
"
<<
" The file must be in PEM format.
\n
"
<<
" --key=<KEY> Use the client private key file. The file
\n
"
<<
" must be in PEM format.
\n
"
<<
" -d, --data=<FILE> Post FILE to server. If - is given, data
\n
"
<<
" will be read from stdin.
\n
"
<<
" -m, --multiply=<N> Request each URI <N> times. By default, same
\n
"
<<
" URI is not requested twice. This option
\n
"
<<
" disables it too.
\n
"
<<
" -u, --upgrade Perform HTTP Upgrade for HTTP/2.0. This
\n
"
<<
" option is ignored if the request URI has
\n
"
<<
" https scheme.
\n
"
<<
" If -d is used, the HTTP upgrade request is
\n
"
<<
" performed with OPTIONS method.
\n
"
<<
" -p, --pri=<PRIORITY>
\n
"
<<
" Sets stream priority. Default: "
<<
NGHTTP2_PRI_DEFAULT
<<
"
\n
"
<<
" -M, --peer-max-concurrent-streams=<N>
\n
"
<<
" Use <N> as SETTINGS_MAX_CONCURRENT_STREAMS
\n
"
<<
" value of remote endpoint as if it is
\n
"
<<
" received in SETTINGS frame. The default
\n
"
<<
" is large enough as it is seen as unlimited.
\n
"
<<
" -c, --header-table-size=<N>
\n
"
<<
" Specify decoder header table size.
\n
"
<<
" -b, --padding=<N> Add at most <N> bytes to a frame payload as
\n
"
<<
" padding. Specify 0 to disable padding.
\n
"
<<
" --color Force colored log output.
\n
"
<<
" --continuation Send large header to test CONTINUATION.
\n
"
<<
" -M, --peer-max-concurrent-streams=<N>
\n
"
<<
" Use <N> as SETTINGS_MAX_CONCURRENT_STREAMS
\n
"
<<
" value of remote endpoint as if it is
\n
"
<<
" received in SETTINGS frame. The default
\n
"
<<
" is large enough as it is seen as unlimited.
\n
"
<<
" -c, --header-table-size=<N>
\n
"
<<
" Specify decoder header table size.
\n
"
<<
" -b, --padding=<N> Add at most <N> bytes to a frame payload as
\n
"
<<
" padding. Specify 0 to disable padding.
\n
"
<<
" --color Force colored log output.
\n
"
<<
" --continuation Send large header to test CONTINUATION.
\n
"
<<
" --version Display version information and exit.
\n
"
<<
" -h, --help Display this help and exit.
\n
"
<<
std
::
endl
;
}
}
// namespace
...
...
@@ -1751,6 +1758,7 @@ int main(int argc, char **argv)
{
"key"
,
required_argument
,
&
flag
,
2
},
{
"color"
,
no_argument
,
&
flag
,
3
},
{
"continuation"
,
no_argument
,
&
flag
,
4
},
{
"version"
,
no_argument
,
&
flag
,
5
},
{
nullptr
,
0
,
nullptr
,
0
}
};
int
option_index
=
0
;
...
...
@@ -1889,6 +1897,10 @@ int main(int argc, char **argv)
// continuation option
config
.
continuation
=
true
;
break
;
case
5
:
// version option
print_version
(
std
::
cout
);
exit
(
EXIT_SUCCESS
);
}
break
;
default:
...
...
src/nghttpd.cc
View file @
f5342494
...
...
@@ -72,12 +72,19 @@ int parse_push_config(Config& config, const char *optarg)
}
}
// namespace
namespace
{
void
print_version
(
std
::
ostream
&
out
)
{
out
<<
"nghttpd nghttp2/"
NGHTTP2_VERSION
<<
std
::
endl
;
}
}
// namespace
namespace
{
void
print_usage
(
std
::
ostream
&
out
)
{
out
<<
"Usage: nghttpd [
-DVhpv] [-d <PATH>] [--no-tls] [-b <ALIGNMENT>]
\n
"
<<
"
<PORT> [<PRIVATE_KEY> <CERT>]
"
<<
std
::
endl
;
out
<<
"Usage: nghttpd [
OPTION]... <PORT> <PRIVATE_KEY> <CERT>
\n
"
<<
"
or: nghttpd --no-tls [OPTION]... <PORT>
\n
"
<<
"HTTP/2 experimental server"
<<
std
::
endl
;
}
}
// namespace
...
...
@@ -86,38 +93,45 @@ void print_help(std::ostream& out)
{
print_usage
(
out
);
out
<<
"
\n
"
<<
"OPTIONS:
\n
"
<<
" -D, --daemon Run in a background. If -D is used, the
\n
"
<<
" current working directory is changed to '/'.
\n
"
<<
" Therefore if this option is used, -d option
\n
"
<<
" must be specified.
\n
"
<<
" -V, --verify-client
\n
"
<<
" The server sends a client certificate
\n
"
<<
" request. If the client did not return a
\n
"
<<
" certificate, the handshake is terminated.
\n
"
<<
" Currently, this option just requests a
\n
"
<<
" client certificate and does not verify it.
\n
"
<<
" -d, --htdocs=<PATH>
\n
"
<<
" Specify document root. If this option is
\n
"
<<
" not specified, the document root is the
\n
"
<<
" current working directory.
\n
"
<<
" -v, --verbose Print debug information such as reception/
\n
"
<<
" transmission of frames and name/value pairs.
\n
"
<<
" --no-tls Disable SSL/TLS.
\n
"
<<
" -c, --header-table-size=<N>
\n
"
<<
" Specify decoder header table size.
\n
"
<<
" --color Force colored log output.
\n
"
<<
" -p, --push=<PATH>=<PUSH_PATH,...>
\n
"
<<
" Push resources PUSH_PATHs when PATH is
\n
"
<<
" requested. This option can be used
\n
"
<<
" repeatedly to specify multiple push
\n
"
<<
" configurations. For example,
\n
"
<<
" -p/=/foo.png -p/doc=/bar.css
\n
"
<<
" PATH and PUSH_PATHs are relative to document
\n
"
<<
" root. See --htdocs option.
\n
"
<<
" -b, --padding=<N> Add at most <N> bytes to a frame payload as
\n
"
<<
" padding. Specify 0 to disable padding.
\n
"
<<
" -h, --help Print this help.
\n
"
<<
" <PORT> Specify listening port number.
\n
"
<<
" <PRIVATE_KEY> Set path to server's private key. Required
\n
"
<<
" unless --no-tls is specified.
\n
"
<<
" <CERT> Set path to server's certificate. Required
\n
"
<<
" unless --no-tls is specified.
\n
"
<<
"
\n
"
<<
"Options:
\n
"
<<
" -D, --daemon Run in a background. If -D is used, the
\n
"
<<
" current working directory is changed to '/'.
\n
"
<<
" Therefore if this option is used, -d option
\n
"
<<
" must be specified.
\n
"
<<
" -V, --verify-client
\n
"
<<
" The server sends a client certificate
\n
"
<<
" request. If the client did not return a
\n
"
<<
" certificate, the handshake is terminated.
\n
"
<<
" Currently, this option just requests a
\n
"
<<
" client certificate and does not verify it.
\n
"
<<
" -d, --htdocs=<PATH>
\n
"
<<
" Specify document root. If this option is
\n
"
<<
" not specified, the document root is the
\n
"
<<
" current working directory.
\n
"
<<
" -v, --verbose Print debug information such as reception/
\n
"
<<
" transmission of frames and name/value pairs.
\n
"
<<
" --no-tls Disable SSL/TLS.
\n
"
<<
" -c, --header-table-size=<N>
\n
"
<<
" Specify decoder header table size.
\n
"
<<
" --color Force colored log output.
\n
"
<<
" -p, --push=<PATH>=<PUSH_PATH,...>
\n
"
<<
" Push resources PUSH_PATHs when PATH is
\n
"
<<
" requested. This option can be used
\n
"
<<
" repeatedly to specify multiple push
\n
"
<<
" configurations. For example,
\n
"
<<
" -p/=/foo.png -p/doc=/bar.css
\n
"
<<
" PATH and PUSH_PATHs are relative to document
\n
"
<<
" root. See --htdocs option.
\n
"
<<
" -b, --padding=<N> Add at most <N> bytes to a frame payload as
\n
"
<<
" padding. Specify 0 to disable padding.
\n
"
<<
" --version Display version information and exit.
\n
"
<<
" -h, --help Display this help and exit.
\n
"
<<
std
::
endl
;
}
}
// namespace
...
...
@@ -139,6 +153,7 @@ int main(int argc, char **argv)
{
"padding"
,
required_argument
,
nullptr
,
'b'
},
{
"no-tls"
,
no_argument
,
&
flag
,
1
},
{
"color"
,
no_argument
,
&
flag
,
2
},
{
"version"
,
no_argument
,
&
flag
,
3
},
{
nullptr
,
0
,
nullptr
,
0
}
};
int
option_index
=
0
;
...
...
@@ -192,6 +207,10 @@ int main(int argc, char **argv)
// color option
color
=
true
;
break
;
case
3
:
// version
print_version
(
std
::
cout
);
exit
(
EXIT_SUCCESS
);
}
break
;
default:
...
...
src/shrpx.cc
View file @
f5342494
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment