From f5342494f42253fa823821e6ad109df3eddb0ea8 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sun, 16 Feb 2014 19:39:41 +0900 Subject: [PATCH] src: Format help message and add --version to make man page generation easier --- src/nghttp.cc | 120 ++++++------ src/nghttpd.cc | 89 +++++---- src/shrpx.cc | 514 ++++++++++++++++++++++++------------------------- 3 files changed, 375 insertions(+), 348 deletions(-) diff --git a/src/nghttp.cc b/src/nghttp.cc index 59ca75d5..0c144085 100644 --- a/src/nghttp.cc +++ b/src/nghttp.cc @@ -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 ] [-w ] [-W ]\n" - << " [--cert=] [--key=] [-d ] [-m ]\n" - << " [-p ] [-M ] [-b ]\n" - << " ..." - << std::endl; + out << "Usage: nghttp [OPTIONS]... ...\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= Timeout each request after seconds.\n" - << " -w, --window-bits=\n" - << " Sets the stream level initial window size\n" - << " to 2**-1.\n" - << " -W, --connection-window-bits=\n" - << " Sets the connection level initial window\n" - << " size to 2**-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= Use the specified client certificate file.\n" - << " The file must be in PEM format.\n" - << " --key= Use the client private key file. The file\n" - << " must be in PEM format.\n" - << " -d, --data= Post FILE to server. If - is given, data\n" - << " will be read from stdin.\n" - << " -m, --multiply= Request each URI 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=\n" - << " Sets stream priority. Default: " + << " 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= Timeout each request after seconds.\n" + << " -w, --window-bits=\n" + << " Sets the stream level initial window size\n" + << " to 2**-1.\n" + << " -W, --connection-window-bits=\n" + << " Sets the connection level initial window\n" + << " size to 2**-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= Use the specified client certificate file.\n" + << " The file must be in PEM format.\n" + << " --key= Use the client private key file. The file\n" + << " must be in PEM format.\n" + << " -d, --data= Post FILE to server. If - is given, data\n" + << " will be read from stdin.\n" + << " -m, --multiply= Request each URI 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=\n" + << " Sets stream priority. Default: " << NGHTTP2_PRI_DEFAULT << "\n" - << " -M, --peer-max-concurrent-streams=\n" - << " Use 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" - << " Specify decoder header table size.\n" - << " -b, --padding= Add at most 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" + << " Use 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" + << " Specify decoder header table size.\n" + << " -b, --padding= Add at most 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: diff --git a/src/nghttpd.cc b/src/nghttpd.cc index 9bb9d2c2..dac39f0d 100644 --- a/src/nghttpd.cc +++ b/src/nghttpd.cc @@ -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 ] [--no-tls] [-b ]\n" - << " [ ]" - << std::endl; + out << "Usage: nghttpd [OPTION]... \n" + << " or: nghttpd --no-tls [OPTION]... \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=\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" - << " Specify decoder header table size.\n" - << " --color Force colored log output.\n" - << " -p, --push==\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= Add at most bytes to a frame payload as\n" - << " padding. Specify 0 to disable padding.\n" - << " -h, --help Print this help.\n" + << " Specify listening port number.\n" + << " Set path to server's private key. Required\n" + << " unless --no-tls is specified.\n" + << " 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=\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" + << " Specify decoder header table size.\n" + << " --color Force colored log output.\n" + << " -p, --push==\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= Add at most 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: diff --git a/src/shrpx.cc b/src/shrpx.cc index ed551aff..04fdc3c0 100644 --- a/src/shrpx.cc +++ b/src/shrpx.cc @@ -462,12 +462,8 @@ void print_version(std::ostream& out) namespace { void print_usage(std::ostream& out) { - out << "Usage: nghttpx [-Dh] [-s|--client|-p] [-b ]\n" - << " [-f ] [-n ] [-c ] [-L ]\n" - << " [OPTIONS...] [ ]\n" - << "\n" - << "A reverse proxy for HTTP/2, HTTP/1 and SPDY.\n" - << std::endl; + out << "Usage: nghttpx [OPTIONS]... [ ]\n" + << "A reverse proxy for HTTP/2, HTTP/1 and SPDY." << std::endl; } } // namespace @@ -475,289 +471,289 @@ namespace { void print_help(std::ostream& out) { print_usage(out); - out << "Positional arguments:\n" - << " Set path to server's private key. Required\n" - << " unless -p, --client or --frontend-no-tls\n" - << " are given.\n" - << " Set path to server's certificate. Required\n" - << " unless -p, --client or --frontend-no-tls\n" - << " are given.\n" + out << "\n" + << " Set path to server's private key. Required\n" + << " unless -p, --client or --frontend-no-tls\n" + << " are given.\n" + << " Set path to server's certificate. Required\n" + << " unless -p, --client or --frontend-no-tls\n" + << " are given.\n" + << "Options:\n" + << " The options are categorized into several groups.\n" << "\n" - << "OPTIONS:\n" - << "\n" - << " Connections:\n" - << " -b, --backend=\n" - << " Set backend host and port.\n" - << " Default: '" + << "Connections:\n" + << " -b, --backend=\n" + << " Set backend host and port.\n" + << " Default: '" << get_config()->downstream_host << "," << get_config()->downstream_port << "'\n" - << " -f, --frontend=\n" - << " Set frontend host and port.\n" - << " Default: '" + << " -f, --frontend=\n" + << " Set frontend host and port.\n" + << " Default: '" << get_config()->host << "," << get_config()->port << "'\n" - << " --backlog= Set listen backlog size. If -1 is given,\n" - << " libevent will choose suitable value.\n" - << " Default: " + << " --backlog= Set listen backlog size. If -1 is given,\n" + << " libevent will choose suitable value.\n" + << " Default: " << get_config()->backlog << "\n" - << " --backend-ipv4 Resolve backend hostname to IPv4 address\n" - << " only.\n" - << " --backend-ipv6 Resolve backend hostname to IPv6 address\n" - << " only.\n" + << " --backend-ipv4 Resolve backend hostname to IPv4 address\n" + << " only.\n" + << " --backend-ipv6 Resolve backend hostname to IPv6 address\n" + << " only.\n" << "\n" - << " Performance:\n" - << " -n, --workers=\n" - << " Set the number of worker threads.\n" - << " Default: " + << "Performance:\n" + << " -n, --workers=\n" + << " Set the number of worker threads.\n" + << " Default: " << get_config()->num_worker << "\n" - << " --read-rate= Set maximum average read rate on frontend\n" - << " connection. Setting 0 to this option means\n" - << " read rate is unlimited.\n" - << " Default: " + << " --read-rate= Set maximum average read rate on frontend\n" + << " connection. Setting 0 to this option means\n" + << " read rate is unlimited.\n" + << " Default: " << get_config()->read_rate << "\n" - << " --read-burst=\n" - << " Set maximum read burst size on frontend\n" - << " connection. Setting 0 to this option means\n" - << " read burst size is unlimited.\n" - << " Default: " + << " --read-burst=\n" + << " Set maximum read burst size on frontend\n" + << " connection. Setting 0 to this option means\n" + << " read burst size is unlimited.\n" + << " Default: " << get_config()->read_burst << "\n" - << " --write-rate=\n" - << " Set maximum average write rate on frontend\n" - << " connection. Setting 0 to this option means\n" - << " write rate is unlimited.\n" - << " Default: " + << " --write-rate=\n" + << " Set maximum average write rate on frontend\n" + << " connection. Setting 0 to this option means\n" + << " write rate is unlimited.\n" + << " Default: " << get_config()->write_rate << "\n" - << " --write-burst=\n" - << " Set maximum write burst size on frontend\n" - << " connection. Setting 0 to this option means\n" - << " write burst size is unlimited.\n" - << " Default: " + << " --write-burst=\n" + << " Set maximum write burst size on frontend\n" + << " connection. Setting 0 to this option means\n" + << " write burst size is unlimited.\n" + << " Default: " << get_config()->write_burst << "\n" << "\n" - << " Timeout:\n" - << " --frontend-http2-read-timeout=\n" - << " Specify read timeout for HTTP/2.0 and SPDY frontend\n" - << " connection. Default: " + << "Timeout:\n" + << " --frontend-http2-read-timeout=\n" + << " Specify read timeout for HTTP/2.0 and SPDY frontend\n" + << " connection. Default: " << get_config()->http2_upstream_read_timeout.tv_sec << "\n" - << " --frontend-read-timeout=\n" - << " Specify read timeout for HTTP/1.1 frontend\n" - << " connection. Default: " + << " --frontend-read-timeout=\n" + << " Specify read timeout for HTTP/1.1 frontend\n" + << " connection. Default: " << get_config()->upstream_read_timeout.tv_sec << "\n" - << " --frontend-write-timeout=\n" - << " Specify write timeout for all frontends.\n" - << " connection. Default: " + << " --frontend-write-timeout=\n" + << " Specify write timeout for all frontends.\n" + << " connection. Default: " << get_config()->upstream_write_timeout.tv_sec << "\n" - << " --backend-read-timeout=\n" - << " Specify read timeout for backend connection.\n" - << " Default: " + << " --backend-read-timeout=\n" + << " Specify read timeout for backend connection.\n" + << " Default: " << get_config()->downstream_read_timeout.tv_sec << "\n" - << " --backend-write-timeout=\n" - << " Specify write timeout for backend\n" - << " connection. Default: " + << " --backend-write-timeout=\n" + << " Specify write timeout for backend\n" + << " connection. Default: " << get_config()->downstream_write_timeout.tv_sec << "\n" - << " --backend-keep-alive-timeout=\n" - << " Specify keep-alive timeout for backend\n" - << " connection. Default: " + << " --backend-keep-alive-timeout=\n" + << " Specify keep-alive timeout for backend\n" + << " connection. Default: " << get_config()->downstream_idle_read_timeout.tv_sec << "\n" - << " --backend-http-proxy-uri=\n" - << " Specify proxy URI in the form\n" - << " http://[:@]:. If\n" - << " a proxy requires authentication, specify\n" - << " and . Note that they must be\n" - << " properly percent-encoded. This proxy is used\n" - << " when the backend connection is HTTP/2.0. First,\n" - << " make a CONNECT request to the proxy and\n" - << " it connects to the backend on behalf of\n" - << " nghttpx. This forms tunnel. After that, nghttpx\n" - << " performs SSL/TLS handshake with the\n" - << " downstream through the tunnel. The timeouts\n" - << " when connecting and making CONNECT request\n" - << " can be specified by --backend-read-timeout\n" - << " and --backend-write-timeout options.\n" + << " --backend-http-proxy-uri=\n" + << " Specify proxy URI in the form\n" + << " http://[:@]:. If\n" + << " a proxy requires authentication, specify\n" + << " and . Note that they must be\n" + << " properly percent-encoded. This proxy is used\n" + << " when the backend connection is HTTP/2.0. First,\n" + << " make a CONNECT request to the proxy and\n" + << " it connects to the backend on behalf of\n" + << " nghttpx. This forms tunnel. After that, nghttpx\n" + << " performs SSL/TLS handshake with the\n" + << " downstream through the tunnel. The timeouts\n" + << " when connecting and making CONNECT request\n" + << " can be specified by --backend-read-timeout\n" + << " and --backend-write-timeout options.\n" << "\n" - << " SSL/TLS:\n" - << " --ciphers= Set allowed cipher list. The format of the\n" - << " string is described in OpenSSL ciphers(1).\n" - << " If this option is used, --honor-cipher-order\n" - << " is implicitly enabled.\n" - << " --honor-cipher-order\n" - << " Honor server cipher order, giving the\n" - << " ability to mitigate BEAST attacks.\n" - << " -k, --insecure Don't verify backend server's certificate\n" - << " if -p, --client or --http2-bridge are given\n" - << " and --backend-no-tls is not given\n" - << " --cacert= Set path to trusted CA certificate file\n" - << " if -p, --client or --http2-bridge are given\n" - << " and --backend-no-tls is not given\n" - << " The file must be in PEM format. It can\n" - << " contain multiple certificates. If the\n" - << " linked OpenSSL is configured to load system\n" - << " wide certificates, they are loaded\n" - << " at startup regardless of this option.\n" - << " --private-key-passwd-file=\n" - << " Path to file that contains password for the\n" - << " server's private key. If none is given and\n" - << " the private key is password protected it'll\n" - << " be requested interactively.\n" - << " --subcert=:\n" - << " Specify additional certificate and private\n" - << " key file. nghttpx will choose certificates\n" - << " based on the hostname indicated by client\n" - << " using TLS SNI extension. This option can be\n" - << " used multiple times.\n" - << " --backend-tls-sni-field=\n" - << " Explicitly set the content of the TLS SNI\n" - << " extension. This will default to the backend\n" - << " HOST name.\n" - << " --dh-param-file=\n" - << " Path to file that contains DH parameters in\n" - << " PEM format. Without this option, DHE cipher\n" - << " suites are not available.\n" - << " --npn-list= Comma delimited list of NPN/ALPN protocol sorted\n" - << " in the order of preference. That means\n" - << " most desirable protocol comes first.\n" - << " The parameter must be delimited by a single\n" - << " comma only and any white spaces are treated\n" - << " as a part of protocol string.\n" - << " Default: " << DEFAULT_NPN_LIST << "\n" - << " --verify-client Require and verify client certificate.\n" - << " --verify-client-cacert=\n" - << " Path to file that contains CA certificates\n" - << " to verify client certificate.\n" - << " The file must be in PEM format. It can\n" - << " contain multiple certificates.\n" - << " --client-private-key-file=\n" - << " Path to file that contains client private\n" - << " key used in backend client authentication.\n" - << " --client-cert-file=\n" - << " Path to file that contains client\n" - << " certificate used in backend client\n" - << " authentication.\n" - << " --tls-proto-list=\n" - << " Comma delimited list of SSL/TLS protocol to\n" - << " be enabled.\n" - << " The following protocols are available:\n" - << " TLSv1.2, TLSv1.1, TLSv1.0, SSLv3\n" - << " The name matching is done in case-insensitive\n" - << " manner.\n" - << " The parameter must be delimited by a single\n" - << " comma only and any white spaces are treated\n" - << " as a part of protocol string.\n" - << " Default: " << DEFAULT_TLS_PROTO_LIST << "\n" + << "SSL/TLS:\n" + << " --ciphers= Set allowed cipher list. The format of the\n" + << " string is described in OpenSSL ciphers(1).\n" + << " If this option is used, --honor-cipher-order\n" + << " is implicitly enabled.\n" + << " --honor-cipher-order\n" + << " Honor server cipher order, giving the\n" + << " ability to mitigate BEAST attacks.\n" + << " -k, --insecure Don't verify backend server's certificate\n" + << " if -p, --client or --http2-bridge are given\n" + << " and --backend-no-tls is not given\n" + << " --cacert= Set path to trusted CA certificate file\n" + << " if -p, --client or --http2-bridge are given\n" + << " and --backend-no-tls is not given\n" + << " The file must be in PEM format. It can\n" + << " contain multiple certificates. If the\n" + << " linked OpenSSL is configured to load system\n" + << " wide certificates, they are loaded\n" + << " at startup regardless of this option.\n" + << " --private-key-passwd-file=\n" + << " Path to file that contains password for the\n" + << " server's private key. If none is given and\n" + << " the private key is password protected it'll\n" + << " be requested interactively.\n" + << " --subcert=:\n" + << " Specify additional certificate and private\n" + << " key file. nghttpx will choose certificates\n" + << " based on the hostname indicated by client\n" + << " using TLS SNI extension. This option can be\n" + << " used multiple times.\n" + << " --backend-tls-sni-field=\n" + << " Explicitly set the content of the TLS SNI\n" + << " extension. This will default to the backend\n" + << " HOST name.\n" + << " --dh-param-file=\n" + << " Path to file that contains DH parameters in\n" + << " PEM format. Without this option, DHE cipher\n" + << " suites are not available.\n" + << " --npn-list= Comma delimited list of NPN/ALPN protocol sorted\n" + << " in the order of preference. That means\n" + << " most desirable protocol comes first.\n" + << " The parameter must be delimited by a single\n" + << " comma only and any white spaces are treated\n" + << " as a part of protocol string.\n" + << " Default: " << DEFAULT_NPN_LIST << "\n" + << " --verify-client Require and verify client certificate.\n" + << " --verify-client-cacert=\n" + << " Path to file that contains CA certificates\n" + << " to verify client certificate.\n" + << " The file must be in PEM format. It can\n" + << " contain multiple certificates.\n" + << " --client-private-key-file=\n" + << " Path to file that contains client private\n" + << " key used in backend client authentication.\n" + << " --client-cert-file=\n" + << " Path to file that contains client\n" + << " certificate used in backend client\n" + << " authentication.\n" + << " --tls-proto-list=\n" + << " Comma delimited list of SSL/TLS protocol to\n" + << " be enabled.\n" + << " The following protocols are available:\n" + << " TLSv1.2, TLSv1.1, TLSv1.0, SSLv3\n" + << " The name matching is done in case-insensitive\n" + << " manner.\n" + << " The parameter must be delimited by a single\n" + << " comma only and any white spaces are treated\n" + << " as a part of protocol string.\n" + << " Default: " << DEFAULT_TLS_PROTO_LIST << "\n" << "\n" - << " HTTP/2.0 and SPDY:\n" - << " -c, --http2-max-concurrent-streams=\n" - << " Set the maximum number of the concurrent\n" - << " streams in one HTTP/2.0 and SPDY session.\n" - << " Default: " + << "HTTP/2.0 and SPDY:\n" + << " -c, --http2-max-concurrent-streams=\n" + << " Set the maximum number of the concurrent\n" + << " streams in one HTTP/2.0 and SPDY session.\n" + << " Default: " << get_config()->http2_max_concurrent_streams << "\n" - << " --frontend-http2-window-bits=\n" - << " Sets the per-stream initial window size of HTTP/2.0\n" - << " SPDY frontend connection. For HTTP/2.0, the size is\n" - << " 2**-1. For SPDY, the size is 2**\n" - << " Default: " + << " --frontend-http2-window-bits=\n" + << " Sets the per-stream initial window size of HTTP/2.0\n" + << " SPDY frontend connection. For HTTP/2.0, the size is\n" + << " 2**-1. For SPDY, the size is 2**\n" + << " Default: " << get_config()->http2_upstream_window_bits << "\n" - << " --frontend-http2-connection-window-bits=\n" - << " Sets the per-connection window size of HTTP/2.0 and\n" - << " SPDY frontend connection. For HTTP/2.0, the size is\n" - << " 2**-1. For SPDY, the size is 2**.\n" - << " Default: " + << " --frontend-http2-connection-window-bits=\n" + << " Sets the per-connection window size of HTTP/2.0 and\n" + << " SPDY frontend connection. For HTTP/2.0, the size is\n" + << " 2**-1. For SPDY, the size is 2**.\n" + << " Default: " << get_config()->http2_upstream_connection_window_bits << "\n" - << " --frontend-no-tls Disable SSL/TLS on frontend connections.\n" - << " --backend-http2-window-bits=\n" - << " Sets the initial window size of HTTP/2.0 backend\n" - << " connection to 2**-1.\n" - << " Default: " + << " --frontend-no-tls Disable SSL/TLS on frontend connections.\n" + << " --backend-http2-window-bits=\n" + << " Sets the initial window size of HTTP/2.0 backend\n" + << " connection to 2**-1.\n" + << " Default: " << get_config()->http2_downstream_window_bits << "\n" - << " --backend-http2-connection-window-bits=\n" - << " Sets the per-connection window size of HTTP/2.0\n" - << " backend connection to 2**-1.\n" - << " Default: " + << " --backend-http2-connection-window-bits=\n" + << " Sets the per-connection window size of HTTP/2.0\n" + << " backend connection to 2**-1.\n" + << " Default: " << get_config()->http2_downstream_connection_window_bits << "\n" - << " --backend-no-tls Disable SSL/TLS on backend connections.\n" - << " --http2-no-cookie-crumbling\n" - << " Don't crumble cookie header field.\n" - << " --padding= Add at most bytes to a HTTP/2 frame payload\n" - << " as padding.\n" - << " Specify 0 to disable padding. This option is\n" - << " meant for debugging purpose and not intended\n" - << " to enhance protocol security.\n" + << " --backend-no-tls Disable SSL/TLS on backend connections.\n" + << " --http2-no-cookie-crumbling\n" + << " Don't crumble cookie header field.\n" + << " --padding= Add at most bytes to a HTTP/2 frame payload\n" + << " as padding.\n" + << " Specify 0 to disable padding. This option is\n" + << " meant for debugging purpose and not intended\n" + << " to enhance protocol security.\n" << "\n" - << " Mode:\n" - << " (default mode) Accept HTTP/2.0, SPDY and HTTP/1.1 over\n" - << " SSL/TLS. If --frontend-no-tls is used,\n" - << " accept HTTP/2.0 and HTTP/1.1. The incoming\n" - << " HTTP/1.1 connection can be upgraded to\n" - << " HTTP/2.0 through HTTP Upgrade.\n" - << " The protocol to the backend is HTTP/1.1.\n" - << " -s, --http2-proxy Like default mode, but enable secure proxy mode.\n" - << " --http2-bridge Like default mode, but communicate with the\n" - << " backend in HTTP/2.0 over SSL/TLS. Thus the\n" - << " incoming all connections are converted\n" - << " to HTTP/2.0 connection and relayed to\n" - << " the backend. See --backend-http-proxy-uri\n" - << " option if you are behind the proxy and want\n" - << " to connect to the outside HTTP/2.0 proxy.\n" - << " --client Accept HTTP/2.0 and HTTP/1.1 without SSL/TLS.\n" - << " The incoming HTTP/1.1 connection can be\n" - << " upgraded to HTTP/2.0 connection through\n" - << " HTTP Upgrade.\n" - << " The protocol to the backend is HTTP/2.0.\n" - << " To use nghttpx as a forward proxy, use -p\n" - << " option instead.\n" - << " -p, --client-proxy Like --client option, but it also requires\n" - << " the request path from frontend must be\n" - << " an absolute URI, suitable for use as a\n" - << " forward proxy.\n" + << "Mode:\n" + << " (default mode) Accept HTTP/2.0, SPDY and HTTP/1.1 over\n" + << " SSL/TLS. If --frontend-no-tls is used,\n" + << " accept HTTP/2.0 and HTTP/1.1. The incoming\n" + << " HTTP/1.1 connection can be upgraded to\n" + << " HTTP/2.0 through HTTP Upgrade.\n" + << " The protocol to the backend is HTTP/1.1.\n" + << " -s, --http2-proxy Like default mode, but enable secure proxy mode.\n" + << " --http2-bridge Like default mode, but communicate with the\n" + << " backend in HTTP/2.0 over SSL/TLS. Thus the\n" + << " incoming all connections are converted\n" + << " to HTTP/2.0 connection and relayed to\n" + << " the backend. See --backend-http-proxy-uri\n" + << " option if you are behind the proxy and want\n" + << " to connect to the outside HTTP/2.0 proxy.\n" + << " --client Accept HTTP/2.0 and HTTP/1.1 without SSL/TLS.\n" + << " The incoming HTTP/1.1 connection can be\n" + << " upgraded to HTTP/2.0 connection through\n" + << " HTTP Upgrade.\n" + << " The protocol to the backend is HTTP/2.0.\n" + << " To use nghttpx as a forward proxy, use -p\n" + << " option instead.\n" + << " -p, --client-proxy Like --client option, but it also requires\n" + << " the request path from frontend must be\n" + << " an absolute URI, suitable for use as a\n" + << " forward proxy.\n" << "\n" - << " Logging:\n" - << " -L, --log-level=\n" - << " Set the severity level of log output.\n" - << " INFO, WARNING, ERROR and FATAL.\n" - << " Default: WARNING\n" - << " --accesslog Print simple accesslog to stderr.\n" - << " --syslog Send log messages to syslog.\n" - << " --syslog-facility=\n" - << " Set syslog facility.\n" - << " Default: " + << "Logging:\n" + << " -L, --log-level=\n" + << " Set the severity level of log output.\n" + << " INFO, WARNING, ERROR and FATAL.\n" + << " Default: WARNING\n" + << " --accesslog Print simple accesslog to stderr.\n" + << " --syslog Send log messages to syslog.\n" + << " --syslog-facility=\n" + << " Set syslog facility.\n" + << " Default: " << str_syslog_facility(get_config()->syslog_facility) << "\n" << "\n" - << " Misc:\n" - << " --add-x-forwarded-for\n" - << " Append X-Forwarded-For header field to the\n" - << " downstream request.\n" - << " --no-via Don't append to Via header field. If Via\n" - << " header field is received, it is left\n" - << " unaltered.\n" - << " --frontend-http2-dump-request-header=\n" - << " Dumps request headers received by HTTP/2.0\n" - << " frontend to the file denoted in PATH.\n" - << " The output is done in HTTP/1 header field\n" - << " format and each header block is followed by\n" - << " an empty line.\n" - << " This option is not thread safe and MUST NOT\n" - << " be used with option -n=N, where N >= 2.\n" - << " --frontend-http2-dump-response-header=\n" - << " Dumps response headers sent from HTTP/2.0\n" - << " frontend to the file denoted in PATH.\n" - << " The output is done in HTTP/1 header field\n" - << " format and each header block is followed by\n" - << " an empty line.\n" - << " This option is not thread safe and MUST NOT\n" - << " be used with option -n=N, where N >= 2.\n" - << " -o, --frontend-frame-debug\n" - << " Print HTTP/2 frames in frontend to stderr.\n" - << " This option is not thread safe and MUST NOT\n" - << " be used with option -n=N, where N >= 2.\n" - << " -D, --daemon Run in a background. If -D is used, the\n" - << " current working directory is changed to '/'.\n" - << " --pid-file= Set path to save PID of this program.\n" - << " --user= Run this program as USER. This option is\n" - << " intended to be used to drop root privileges.\n" - << " --conf= Load configuration from PATH.\n" - << " Default: " + << "Misc:\n" + << " --add-x-forwarded-for\n" + << " Append X-Forwarded-For header field to the\n" + << " downstream request.\n" + << " --no-via Don't append to Via header field. If Via\n" + << " header field is received, it is left\n" + << " unaltered.\n" + << " --frontend-http2-dump-request-header=\n" + << " Dumps request headers received by HTTP/2.0\n" + << " frontend to the file denoted in PATH.\n" + << " The output is done in HTTP/1 header field\n" + << " format and each header block is followed by\n" + << " an empty line.\n" + << " This option is not thread safe and MUST NOT\n" + << " be used with option -n=N, where N >= 2.\n" + << " --frontend-http2-dump-response-header=\n" + << " Dumps response headers sent from HTTP/2.0\n" + << " frontend to the file denoted in PATH.\n" + << " The output is done in HTTP/1 header field\n" + << " format and each header block is followed by\n" + << " an empty line.\n" + << " This option is not thread safe and MUST NOT\n" + << " be used with option -n=N, where N >= 2.\n" + << " -o, --frontend-frame-debug\n" + << " Print HTTP/2 frames in frontend to stderr.\n" + << " This option is not thread safe and MUST NOT\n" + << " be used with option -n=N, where N >= 2.\n" + << " -D, --daemon Run in a background. If -D is used, the\n" + << " current working directory is changed to '/'.\n" + << " --pid-file= Set path to save PID of this program.\n" + << " --user= Run this program as USER. This option is\n" + << " intended to be used to drop root privileges.\n" + << " --conf= Load configuration from PATH.\n" + << " Default: " << get_config()->conf_path << "\n" - << " -v, --version Print version and exit.\n" - << " -h, --help Print this help and exit.\n" + << " -v, --version Print version and exit.\n" + << " -h, --help Print this help and exit.\n" << std::endl; } } // namespace