nghttpx: Replace "spdy" in option name with "http2"
This commit is contained in:
parent
f3d71aa5bb
commit
ba3db66cec
74
src/shrpx.cc
74
src/shrpx.cc
|
@ -262,7 +262,7 @@ int event_loop()
|
||||||
} else {
|
} else {
|
||||||
sv_ssl_ctx = get_config()->upstream_no_tls ?
|
sv_ssl_ctx = get_config()->upstream_no_tls ?
|
||||||
nullptr : get_config()->default_ssl_ctx;
|
nullptr : get_config()->default_ssl_ctx;
|
||||||
cl_ssl_ctx = get_config()->spdy_bridge &&
|
cl_ssl_ctx = get_config()->http2_bridge &&
|
||||||
!get_config()->downstream_no_tls ?
|
!get_config()->downstream_no_tls ?
|
||||||
ssl::create_ssl_client_context() : nullptr;
|
ssl::create_ssl_client_context() : nullptr;
|
||||||
}
|
}
|
||||||
|
@ -345,8 +345,8 @@ void fill_default_config()
|
||||||
mod_config()->cert_file = 0;
|
mod_config()->cert_file = 0;
|
||||||
|
|
||||||
// Read timeout for SPDY upstream connection
|
// Read timeout for SPDY upstream connection
|
||||||
mod_config()->spdy_upstream_read_timeout.tv_sec = 180;
|
mod_config()->http2_upstream_read_timeout.tv_sec = 180;
|
||||||
mod_config()->spdy_upstream_read_timeout.tv_usec = 0;
|
mod_config()->http2_upstream_read_timeout.tv_usec = 0;
|
||||||
|
|
||||||
// Read timeout for non-SPDY upstream connection
|
// Read timeout for non-SPDY upstream connection
|
||||||
mod_config()->upstream_read_timeout.tv_sec = 180;
|
mod_config()->upstream_read_timeout.tv_sec = 180;
|
||||||
|
@ -368,8 +368,8 @@ void fill_default_config()
|
||||||
// window bits for HTTP/2.0 and SPDY upstream/downstream
|
// window bits for HTTP/2.0 and SPDY upstream/downstream
|
||||||
// connection. 2**16-1 = 64KiB-1, which is HTTP/2.0 default. Please
|
// connection. 2**16-1 = 64KiB-1, which is HTTP/2.0 default. Please
|
||||||
// note that SPDY/3 default is 64KiB.
|
// note that SPDY/3 default is 64KiB.
|
||||||
mod_config()->spdy_upstream_window_bits = 16;
|
mod_config()->http2_upstream_window_bits = 16;
|
||||||
mod_config()->spdy_downstream_window_bits = 16;
|
mod_config()->http2_downstream_window_bits = 16;
|
||||||
|
|
||||||
mod_config()->upstream_no_tls = false;
|
mod_config()->upstream_no_tls = false;
|
||||||
mod_config()->downstream_no_tls = false;
|
mod_config()->downstream_no_tls = false;
|
||||||
|
@ -380,7 +380,7 @@ void fill_default_config()
|
||||||
mod_config()->downstream_addrlen = 0;
|
mod_config()->downstream_addrlen = 0;
|
||||||
|
|
||||||
mod_config()->num_worker = 1;
|
mod_config()->num_worker = 1;
|
||||||
mod_config()->spdy_max_concurrent_streams = 100;
|
mod_config()->http2_max_concurrent_streams = 100;
|
||||||
mod_config()->add_x_forwarded_for = false;
|
mod_config()->add_x_forwarded_for = false;
|
||||||
mod_config()->no_via = false;
|
mod_config()->no_via = false;
|
||||||
mod_config()->accesslog = false;
|
mod_config()->accesslog = false;
|
||||||
|
@ -392,8 +392,8 @@ void fill_default_config()
|
||||||
mod_config()->backlog = 256;
|
mod_config()->backlog = 256;
|
||||||
mod_config()->ciphers = 0;
|
mod_config()->ciphers = 0;
|
||||||
mod_config()->honor_cipher_order = false;
|
mod_config()->honor_cipher_order = false;
|
||||||
mod_config()->spdy_proxy = false;
|
mod_config()->http2_proxy = false;
|
||||||
mod_config()->spdy_bridge = false;
|
mod_config()->http2_bridge = false;
|
||||||
mod_config()->client_proxy = false;
|
mod_config()->client_proxy = false;
|
||||||
mod_config()->client = false;
|
mod_config()->client = false;
|
||||||
mod_config()->client_mode = false;
|
mod_config()->client_mode = false;
|
||||||
|
@ -513,10 +513,10 @@ void print_help(std::ostream& out)
|
||||||
<< get_config()->write_burst << "\n"
|
<< get_config()->write_burst << "\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< " Timeout:\n"
|
<< " Timeout:\n"
|
||||||
<< " --frontend-spdy-read-timeout=<SEC>\n"
|
<< " --frontend-http2-read-timeout=<SEC>\n"
|
||||||
<< " Specify read timeout for HTTP/2.0 and SPDY frontend\n"
|
<< " Specify read timeout for HTTP/2.0 and SPDY frontend\n"
|
||||||
<< " connection. Default: "
|
<< " connection. Default: "
|
||||||
<< get_config()->spdy_upstream_read_timeout.tv_sec << "\n"
|
<< get_config()->http2_upstream_read_timeout.tv_sec << "\n"
|
||||||
<< " --frontend-read-timeout=<SEC>\n"
|
<< " --frontend-read-timeout=<SEC>\n"
|
||||||
<< " Specify read timeout for HTTP/1.1 frontend\n"
|
<< " Specify read timeout for HTTP/1.1 frontend\n"
|
||||||
<< " connection. Default: "
|
<< " connection. Default: "
|
||||||
|
@ -611,22 +611,22 @@ void print_help(std::ostream& out)
|
||||||
<< " authentication.\n"
|
<< " authentication.\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< " HTTP/2.0 and SPDY:\n"
|
<< " HTTP/2.0 and SPDY:\n"
|
||||||
<< " -c, --spdy-max-concurrent-streams=<NUM>\n"
|
<< " -c, --http2-max-concurrent-streams=<NUM>\n"
|
||||||
<< " Set the maximum number of the concurrent\n"
|
<< " Set the maximum number of the concurrent\n"
|
||||||
<< " streams in one HTTP/2.0 and SPDY session.\n"
|
<< " streams in one HTTP/2.0 and SPDY session.\n"
|
||||||
<< " Default: "
|
<< " Default: "
|
||||||
<< get_config()->spdy_max_concurrent_streams << "\n"
|
<< get_config()->http2_max_concurrent_streams << "\n"
|
||||||
<< " --frontend-spdy-window-bits=<N>\n"
|
<< " --frontend-http2-window-bits=<N>\n"
|
||||||
<< " Sets the initial window size of HTTP/2.0 and SPDY\n"
|
<< " Sets the initial window size of HTTP/2.0 and SPDY\n"
|
||||||
<< " frontend connection to 2**<N>-1.\n"
|
<< " frontend connection to 2**<N>-1.\n"
|
||||||
<< " Default: "
|
<< " Default: "
|
||||||
<< get_config()->spdy_upstream_window_bits << "\n"
|
<< get_config()->http2_upstream_window_bits << "\n"
|
||||||
<< " --frontend-no-tls Disable SSL/TLS on frontend connections.\n"
|
<< " --frontend-no-tls Disable SSL/TLS on frontend connections.\n"
|
||||||
<< " --backend-spdy-window-bits=<N>\n"
|
<< " --backend-http2-window-bits=<N>\n"
|
||||||
<< " Sets the initial window size of HTTP/2.0 and SPDY\n"
|
<< " Sets the initial window size of HTTP/2.0 and SPDY\n"
|
||||||
<< " backend connection to 2**<N>-1.\n"
|
<< " backend connection to 2**<N>-1.\n"
|
||||||
<< " Default: "
|
<< " Default: "
|
||||||
<< get_config()->spdy_downstream_window_bits << "\n"
|
<< get_config()->http2_downstream_window_bits << "\n"
|
||||||
<< " --backend-no-tls Disable SSL/TLS on backend connections.\n"
|
<< " --backend-no-tls Disable SSL/TLS on backend connections.\n"
|
||||||
<< "\n"
|
<< "\n"
|
||||||
<< " Mode:\n"
|
<< " Mode:\n"
|
||||||
|
@ -636,8 +636,8 @@ void print_help(std::ostream& out)
|
||||||
<< " HTTP/1.1 connection can be upgraded to\n"
|
<< " HTTP/1.1 connection can be upgraded to\n"
|
||||||
<< " HTTP/2.0 through HTTP Upgrade.\n"
|
<< " HTTP/2.0 through HTTP Upgrade.\n"
|
||||||
<< " The protocol to the backend is HTTP/1.1.\n"
|
<< " The protocol to the backend is HTTP/1.1.\n"
|
||||||
<< " -s, --spdy-proxy Like default mode, but enable secure proxy mode.\n"
|
<< " -s, --http2-proxy Like default mode, but enable secure proxy mode.\n"
|
||||||
<< " --spdy-bridge Like default mode, but communicate with the\n"
|
<< " --http2-bridge Like default mode, but communicate with the\n"
|
||||||
<< " backend in HTTP/2.0 over SSL/TLS. Thus the\n"
|
<< " backend in HTTP/2.0 over SSL/TLS. Thus the\n"
|
||||||
<< " incoming all connections are converted\n"
|
<< " incoming all connections are converted\n"
|
||||||
<< " to HTTP/2.0 connection and relayed to\n"
|
<< " to HTTP/2.0 connection and relayed to\n"
|
||||||
|
@ -702,23 +702,23 @@ int main(int argc, char **argv)
|
||||||
{"daemon", no_argument, nullptr, 'D'},
|
{"daemon", no_argument, nullptr, 'D'},
|
||||||
{"log-level", required_argument, nullptr, 'L'},
|
{"log-level", required_argument, nullptr, 'L'},
|
||||||
{"backend", required_argument, nullptr, 'b'},
|
{"backend", required_argument, nullptr, 'b'},
|
||||||
{"spdy-max-concurrent-streams", required_argument, nullptr, 'c'},
|
{"http2-max-concurrent-streams", required_argument, nullptr, 'c'},
|
||||||
{"frontend", required_argument, nullptr, 'f'},
|
{"frontend", required_argument, nullptr, 'f'},
|
||||||
{"help", no_argument, nullptr, 'h'},
|
{"help", no_argument, nullptr, 'h'},
|
||||||
{"insecure", no_argument, nullptr, 'k'},
|
{"insecure", no_argument, nullptr, 'k'},
|
||||||
{"workers", required_argument, nullptr, 'n'},
|
{"workers", required_argument, nullptr, 'n'},
|
||||||
{"client-proxy", no_argument, nullptr, 'p'},
|
{"client-proxy", no_argument, nullptr, 'p'},
|
||||||
{"spdy-proxy", no_argument, nullptr, 's'},
|
{"http2-proxy", no_argument, nullptr, 's'},
|
||||||
{"version", no_argument, nullptr, 'v'},
|
{"version", no_argument, nullptr, 'v'},
|
||||||
{"add-x-forwarded-for", no_argument, &flag, 1},
|
{"add-x-forwarded-for", no_argument, &flag, 1},
|
||||||
{"frontend-spdy-read-timeout", required_argument, &flag, 2},
|
{"frontend-http2-read-timeout", required_argument, &flag, 2},
|
||||||
{"frontend-read-timeout", required_argument, &flag, 3},
|
{"frontend-read-timeout", required_argument, &flag, 3},
|
||||||
{"frontend-write-timeout", required_argument, &flag, 4},
|
{"frontend-write-timeout", required_argument, &flag, 4},
|
||||||
{"backend-read-timeout", required_argument, &flag, 5},
|
{"backend-read-timeout", required_argument, &flag, 5},
|
||||||
{"backend-write-timeout", required_argument, &flag, 6},
|
{"backend-write-timeout", required_argument, &flag, 6},
|
||||||
{"accesslog", no_argument, &flag, 7},
|
{"accesslog", no_argument, &flag, 7},
|
||||||
{"backend-keep-alive-timeout", required_argument, &flag, 8},
|
{"backend-keep-alive-timeout", required_argument, &flag, 8},
|
||||||
{"frontend-spdy-window-bits", required_argument, &flag, 9},
|
{"frontend-http2-window-bits", required_argument, &flag, 9},
|
||||||
{"pid-file", required_argument, &flag, 10},
|
{"pid-file", required_argument, &flag, 10},
|
||||||
{"user", required_argument, &flag, 11},
|
{"user", required_argument, &flag, 11},
|
||||||
{"conf", required_argument, &flag, 12},
|
{"conf", required_argument, &flag, 12},
|
||||||
|
@ -727,14 +727,14 @@ int main(int argc, char **argv)
|
||||||
{"backlog", required_argument, &flag, 15},
|
{"backlog", required_argument, &flag, 15},
|
||||||
{"ciphers", required_argument, &flag, 16},
|
{"ciphers", required_argument, &flag, 16},
|
||||||
{"client", no_argument, &flag, 17},
|
{"client", no_argument, &flag, 17},
|
||||||
{"backend-spdy-window-bits", required_argument, &flag, 18},
|
{"backend-http2-window-bits", required_argument, &flag, 18},
|
||||||
{"cacert", required_argument, &flag, 19},
|
{"cacert", required_argument, &flag, 19},
|
||||||
{"backend-ipv4", no_argument, &flag, 20},
|
{"backend-ipv4", no_argument, &flag, 20},
|
||||||
{"backend-ipv6", no_argument, &flag, 21},
|
{"backend-ipv6", no_argument, &flag, 21},
|
||||||
{"private-key-passwd-file", required_argument, &flag, 22},
|
{"private-key-passwd-file", required_argument, &flag, 22},
|
||||||
{"no-via", no_argument, &flag, 23},
|
{"no-via", no_argument, &flag, 23},
|
||||||
{"subcert", required_argument, &flag, 24},
|
{"subcert", required_argument, &flag, 24},
|
||||||
{"spdy-bridge", no_argument, &flag, 25},
|
{"http2-bridge", no_argument, &flag, 25},
|
||||||
{"backend-http-proxy-uri", required_argument, &flag, 26},
|
{"backend-http-proxy-uri", required_argument, &flag, 26},
|
||||||
{"backend-no-tls", no_argument, &flag, 27},
|
{"backend-no-tls", no_argument, &flag, 27},
|
||||||
{"frontend-no-tls", no_argument, &flag, 29},
|
{"frontend-no-tls", no_argument, &flag, 29},
|
||||||
|
@ -770,7 +770,7 @@ int main(int argc, char **argv)
|
||||||
cmdcfgs.push_back(std::make_pair(SHRPX_OPT_BACKEND, optarg));
|
cmdcfgs.push_back(std::make_pair(SHRPX_OPT_BACKEND, optarg));
|
||||||
break;
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
cmdcfgs.push_back(std::make_pair(SHRPX_OPT_SPDY_MAX_CONCURRENT_STREAMS,
|
cmdcfgs.push_back(std::make_pair(SHRPX_OPT_HTTP2_MAX_CONCURRENT_STREAMS,
|
||||||
optarg));
|
optarg));
|
||||||
break;
|
break;
|
||||||
case 'f':
|
case 'f':
|
||||||
|
@ -789,7 +789,7 @@ int main(int argc, char **argv)
|
||||||
cmdcfgs.push_back(std::make_pair(SHRPX_OPT_CLIENT_PROXY, "yes"));
|
cmdcfgs.push_back(std::make_pair(SHRPX_OPT_CLIENT_PROXY, "yes"));
|
||||||
break;
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
cmdcfgs.push_back(std::make_pair(SHRPX_OPT_SPDY_PROXY, "yes"));
|
cmdcfgs.push_back(std::make_pair(SHRPX_OPT_HTTP2_PROXY, "yes"));
|
||||||
break;
|
break;
|
||||||
case 'v':
|
case 'v':
|
||||||
print_version(std::cout);
|
print_version(std::cout);
|
||||||
|
@ -804,8 +804,8 @@ int main(int argc, char **argv)
|
||||||
"yes"));
|
"yes"));
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
// --frontend-spdy-read-timeout
|
// --frontend-http2-read-timeout
|
||||||
cmdcfgs.push_back(std::make_pair(SHRPX_OPT_FRONTEND_SPDY_READ_TIMEOUT,
|
cmdcfgs.push_back(std::make_pair(SHRPX_OPT_FRONTEND_HTTP2_READ_TIMEOUT,
|
||||||
optarg));
|
optarg));
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
|
@ -837,8 +837,8 @@ int main(int argc, char **argv)
|
||||||
optarg));
|
optarg));
|
||||||
break;
|
break;
|
||||||
case 9:
|
case 9:
|
||||||
// --frontend-spdy-window-bits
|
// --frontend-http2-window-bits
|
||||||
cmdcfgs.push_back(std::make_pair(SHRPX_OPT_FRONTEND_SPDY_WINDOW_BITS,
|
cmdcfgs.push_back(std::make_pair(SHRPX_OPT_FRONTEND_HTTP2_WINDOW_BITS,
|
||||||
optarg));
|
optarg));
|
||||||
break;
|
break;
|
||||||
case 10:
|
case 10:
|
||||||
|
@ -872,8 +872,8 @@ int main(int argc, char **argv)
|
||||||
cmdcfgs.push_back(std::make_pair(SHRPX_OPT_CLIENT, "yes"));
|
cmdcfgs.push_back(std::make_pair(SHRPX_OPT_CLIENT, "yes"));
|
||||||
break;
|
break;
|
||||||
case 18:
|
case 18:
|
||||||
// --backend-spdy-window-bits
|
// --backend-http2-window-bits
|
||||||
cmdcfgs.push_back(std::make_pair(SHRPX_OPT_BACKEND_SPDY_WINDOW_BITS,
|
cmdcfgs.push_back(std::make_pair(SHRPX_OPT_BACKEND_HTTP2_WINDOW_BITS,
|
||||||
optarg));
|
optarg));
|
||||||
break;
|
break;
|
||||||
case 19:
|
case 19:
|
||||||
|
@ -902,8 +902,8 @@ int main(int argc, char **argv)
|
||||||
cmdcfgs.push_back(std::make_pair(SHRPX_OPT_SUBCERT, optarg));
|
cmdcfgs.push_back(std::make_pair(SHRPX_OPT_SUBCERT, optarg));
|
||||||
break;
|
break;
|
||||||
case 25:
|
case 25:
|
||||||
// --spdy-bridge
|
// --http2-bridge
|
||||||
cmdcfgs.push_back(std::make_pair(SHRPX_OPT_SPDY_BRIDGE, "yes"));
|
cmdcfgs.push_back(std::make_pair(SHRPX_OPT_HTTP2_BRIDGE, "yes"));
|
||||||
break;
|
break;
|
||||||
case 26:
|
case 26:
|
||||||
// --backend-http-proxy-uri
|
// --backend-http-proxy-uri
|
||||||
|
@ -1049,9 +1049,9 @@ int main(int argc, char **argv)
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(get_config()->spdy_proxy + get_config()->spdy_bridge +
|
if(get_config()->http2_proxy + get_config()->http2_bridge +
|
||||||
get_config()->client_proxy + get_config()->client > 1) {
|
get_config()->client_proxy + get_config()->client > 1) {
|
||||||
LOG(FATAL) << "--spdy-proxy, --spdy-bridge, --client-proxy and --client "
|
LOG(FATAL) << "--http2-proxy, --http2-bridge, --client-proxy and --client "
|
||||||
<< "cannot be used at the same time.";
|
<< "cannot be used at the same time.";
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
@ -1060,7 +1060,7 @@ int main(int argc, char **argv)
|
||||||
mod_config()->client_mode = true;
|
mod_config()->client_mode = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(get_config()->client_mode || get_config()->spdy_bridge) {
|
if(get_config()->client_mode || get_config()->http2_bridge) {
|
||||||
mod_config()->downstream_proto = PROTO_SPDY;
|
mod_config()->downstream_proto = PROTO_SPDY;
|
||||||
} else {
|
} else {
|
||||||
mod_config()->downstream_proto = PROTO_HTTP;
|
mod_config()->downstream_proto = PROTO_HTTP;
|
||||||
|
|
|
@ -60,16 +60,16 @@ const char SHRPX_OPT_BACKEND[] = "backend";
|
||||||
const char SHRPX_OPT_FRONTEND[] = "frontend";
|
const char SHRPX_OPT_FRONTEND[] = "frontend";
|
||||||
const char SHRPX_OPT_WORKERS[] = "workers";
|
const char SHRPX_OPT_WORKERS[] = "workers";
|
||||||
const char
|
const char
|
||||||
SHRPX_OPT_SPDY_MAX_CONCURRENT_STREAMS[] = "spdy-max-concurrent-streams";
|
SHRPX_OPT_HTTP2_MAX_CONCURRENT_STREAMS[] = "http2-max-concurrent-streams";
|
||||||
const char SHRPX_OPT_LOG_LEVEL[] = "log-level";
|
const char SHRPX_OPT_LOG_LEVEL[] = "log-level";
|
||||||
const char SHRPX_OPT_DAEMON[] = "daemon";
|
const char SHRPX_OPT_DAEMON[] = "daemon";
|
||||||
const char SHRPX_OPT_SPDY_PROXY[] = "spdy-proxy";
|
const char SHRPX_OPT_HTTP2_PROXY[] = "http2-proxy";
|
||||||
const char SHRPX_OPT_SPDY_BRIDGE[] = "spdy-bridge";
|
const char SHRPX_OPT_HTTP2_BRIDGE[] = "http2-bridge";
|
||||||
const char SHRPX_OPT_CLIENT_PROXY[] = "client-proxy";
|
const char SHRPX_OPT_CLIENT_PROXY[] = "client-proxy";
|
||||||
const char SHRPX_OPT_ADD_X_FORWARDED_FOR[] = "add-x-forwarded-for";
|
const char SHRPX_OPT_ADD_X_FORWARDED_FOR[] = "add-x-forwarded-for";
|
||||||
const char SHRPX_OPT_NO_VIA[] = "no-via";
|
const char SHRPX_OPT_NO_VIA[] = "no-via";
|
||||||
const char
|
const char
|
||||||
SHRPX_OPT_FRONTEND_SPDY_READ_TIMEOUT[] = "frontend-spdy-read-timeout";
|
SHRPX_OPT_FRONTEND_HTTP2_READ_TIMEOUT[] = "frontend-http2-read-timeout";
|
||||||
const char SHRPX_OPT_FRONTEND_READ_TIMEOUT[] = "frontend-read-timeout";
|
const char SHRPX_OPT_FRONTEND_READ_TIMEOUT[] = "frontend-read-timeout";
|
||||||
const char SHRPX_OPT_FRONTEND_WRITE_TIMEOUT[] = "frontend-write-timeout";
|
const char SHRPX_OPT_FRONTEND_WRITE_TIMEOUT[] = "frontend-write-timeout";
|
||||||
const char SHRPX_OPT_BACKEND_READ_TIMEOUT[] = "backend-read-timeout";
|
const char SHRPX_OPT_BACKEND_READ_TIMEOUT[] = "backend-read-timeout";
|
||||||
|
@ -77,8 +77,9 @@ const char SHRPX_OPT_BACKEND_WRITE_TIMEOUT[] = "backend-write-timeout";
|
||||||
const char SHRPX_OPT_ACCESSLOG[] = "accesslog";
|
const char SHRPX_OPT_ACCESSLOG[] = "accesslog";
|
||||||
const char
|
const char
|
||||||
SHRPX_OPT_BACKEND_KEEP_ALIVE_TIMEOUT[] = "backend-keep-alive-timeout";
|
SHRPX_OPT_BACKEND_KEEP_ALIVE_TIMEOUT[] = "backend-keep-alive-timeout";
|
||||||
const char SHRPX_OPT_FRONTEND_SPDY_WINDOW_BITS[] = "frontend-spdy-window-bits";
|
const char
|
||||||
const char SHRPX_OPT_BACKEND_SPDY_WINDOW_BITS[] = "backend-spdy-window-bits";
|
SHRPX_OPT_FRONTEND_HTTP2_WINDOW_BITS[] = "frontend-http2-window-bits";
|
||||||
|
const char SHRPX_OPT_BACKEND_HTTP2_WINDOW_BITS[] = "backend-http2-window-bits";
|
||||||
const char SHRPX_OPT_FRONTEND_NO_TLS[] = "frontend-no-tls";
|
const char SHRPX_OPT_FRONTEND_NO_TLS[] = "frontend-no-tls";
|
||||||
const char SHRPX_OPT_BACKEND_NO_TLS[] = "backend-no-tls";
|
const char SHRPX_OPT_BACKEND_NO_TLS[] = "backend-no-tls";
|
||||||
const char SHRPX_OPT_BACKEND_TLS_SNI_FIELD[] = "backend-tls-sni-field";
|
const char SHRPX_OPT_BACKEND_TLS_SNI_FIELD[] = "backend-tls-sni-field";
|
||||||
|
@ -244,8 +245,8 @@ int parse_config(const char *opt, const char *optarg)
|
||||||
}
|
}
|
||||||
} else if(util::strieq(opt, SHRPX_OPT_WORKERS)) {
|
} else if(util::strieq(opt, SHRPX_OPT_WORKERS)) {
|
||||||
mod_config()->num_worker = strtol(optarg, nullptr, 10);
|
mod_config()->num_worker = strtol(optarg, nullptr, 10);
|
||||||
} else if(util::strieq(opt, SHRPX_OPT_SPDY_MAX_CONCURRENT_STREAMS)) {
|
} else if(util::strieq(opt, SHRPX_OPT_HTTP2_MAX_CONCURRENT_STREAMS)) {
|
||||||
mod_config()->spdy_max_concurrent_streams = strtol(optarg, nullptr, 10);
|
mod_config()->http2_max_concurrent_streams = strtol(optarg, nullptr, 10);
|
||||||
} else if(util::strieq(opt, SHRPX_OPT_LOG_LEVEL)) {
|
} else if(util::strieq(opt, SHRPX_OPT_LOG_LEVEL)) {
|
||||||
if(Log::set_severity_level_by_name(optarg) == -1) {
|
if(Log::set_severity_level_by_name(optarg) == -1) {
|
||||||
LOG(ERROR) << "Invalid severity level: " << optarg;
|
LOG(ERROR) << "Invalid severity level: " << optarg;
|
||||||
|
@ -253,19 +254,19 @@ int parse_config(const char *opt, const char *optarg)
|
||||||
}
|
}
|
||||||
} else if(util::strieq(opt, SHRPX_OPT_DAEMON)) {
|
} else if(util::strieq(opt, SHRPX_OPT_DAEMON)) {
|
||||||
mod_config()->daemon = util::strieq(optarg, "yes");
|
mod_config()->daemon = util::strieq(optarg, "yes");
|
||||||
} else if(util::strieq(opt, SHRPX_OPT_SPDY_PROXY)) {
|
} else if(util::strieq(opt, SHRPX_OPT_HTTP2_PROXY)) {
|
||||||
mod_config()->spdy_proxy = util::strieq(optarg, "yes");
|
mod_config()->http2_proxy = util::strieq(optarg, "yes");
|
||||||
} else if(util::strieq(opt, SHRPX_OPT_SPDY_BRIDGE)) {
|
} else if(util::strieq(opt, SHRPX_OPT_HTTP2_BRIDGE)) {
|
||||||
mod_config()->spdy_bridge = util::strieq(optarg, "yes");
|
mod_config()->http2_bridge = util::strieq(optarg, "yes");
|
||||||
} else if(util::strieq(opt, SHRPX_OPT_CLIENT_PROXY)) {
|
} else if(util::strieq(opt, SHRPX_OPT_CLIENT_PROXY)) {
|
||||||
mod_config()->client_proxy = util::strieq(optarg, "yes");
|
mod_config()->client_proxy = util::strieq(optarg, "yes");
|
||||||
} else if(util::strieq(opt, SHRPX_OPT_ADD_X_FORWARDED_FOR)) {
|
} else if(util::strieq(opt, SHRPX_OPT_ADD_X_FORWARDED_FOR)) {
|
||||||
mod_config()->add_x_forwarded_for = util::strieq(optarg, "yes");
|
mod_config()->add_x_forwarded_for = util::strieq(optarg, "yes");
|
||||||
} else if(util::strieq(opt, SHRPX_OPT_NO_VIA)) {
|
} else if(util::strieq(opt, SHRPX_OPT_NO_VIA)) {
|
||||||
mod_config()->no_via = util::strieq(optarg, "yes");
|
mod_config()->no_via = util::strieq(optarg, "yes");
|
||||||
} else if(util::strieq(opt, SHRPX_OPT_FRONTEND_SPDY_READ_TIMEOUT)) {
|
} else if(util::strieq(opt, SHRPX_OPT_FRONTEND_HTTP2_READ_TIMEOUT)) {
|
||||||
timeval tv = {strtol(optarg, nullptr, 10), 0};
|
timeval tv = {strtol(optarg, nullptr, 10), 0};
|
||||||
mod_config()->spdy_upstream_read_timeout = tv;
|
mod_config()->http2_upstream_read_timeout = tv;
|
||||||
} else if(util::strieq(opt, SHRPX_OPT_FRONTEND_READ_TIMEOUT)) {
|
} else if(util::strieq(opt, SHRPX_OPT_FRONTEND_READ_TIMEOUT)) {
|
||||||
timeval tv = {strtol(optarg, nullptr, 10), 0};
|
timeval tv = {strtol(optarg, nullptr, 10), 0};
|
||||||
mod_config()->upstream_read_timeout = tv;
|
mod_config()->upstream_read_timeout = tv;
|
||||||
|
@ -283,16 +284,16 @@ int parse_config(const char *opt, const char *optarg)
|
||||||
} else if(util::strieq(opt, SHRPX_OPT_BACKEND_KEEP_ALIVE_TIMEOUT)) {
|
} else if(util::strieq(opt, SHRPX_OPT_BACKEND_KEEP_ALIVE_TIMEOUT)) {
|
||||||
timeval tv = {strtol(optarg, nullptr, 10), 0};
|
timeval tv = {strtol(optarg, nullptr, 10), 0};
|
||||||
mod_config()->downstream_idle_read_timeout = tv;
|
mod_config()->downstream_idle_read_timeout = tv;
|
||||||
} else if(util::strieq(opt, SHRPX_OPT_FRONTEND_SPDY_WINDOW_BITS) ||
|
} else if(util::strieq(opt, SHRPX_OPT_FRONTEND_HTTP2_WINDOW_BITS) ||
|
||||||
util::strieq(opt, SHRPX_OPT_BACKEND_SPDY_WINDOW_BITS)) {
|
util::strieq(opt, SHRPX_OPT_BACKEND_HTTP2_WINDOW_BITS)) {
|
||||||
size_t *resp;
|
size_t *resp;
|
||||||
const char *optname;
|
const char *optname;
|
||||||
if(util::strieq(opt, SHRPX_OPT_FRONTEND_SPDY_WINDOW_BITS)) {
|
if(util::strieq(opt, SHRPX_OPT_FRONTEND_HTTP2_WINDOW_BITS)) {
|
||||||
resp = &mod_config()->spdy_upstream_window_bits;
|
resp = &mod_config()->http2_upstream_window_bits;
|
||||||
optname = SHRPX_OPT_FRONTEND_SPDY_WINDOW_BITS;
|
optname = SHRPX_OPT_FRONTEND_HTTP2_WINDOW_BITS;
|
||||||
} else {
|
} else {
|
||||||
resp = &mod_config()->spdy_downstream_window_bits;
|
resp = &mod_config()->http2_downstream_window_bits;
|
||||||
optname = SHRPX_OPT_BACKEND_SPDY_WINDOW_BITS;
|
optname = SHRPX_OPT_BACKEND_HTTP2_WINDOW_BITS;
|
||||||
}
|
}
|
||||||
errno = 0;
|
errno = 0;
|
||||||
unsigned long int n = strtoul(optarg, nullptr, 10);
|
unsigned long int n = strtoul(optarg, nullptr, 10);
|
||||||
|
|
|
@ -53,23 +53,23 @@ extern const char SHRPX_OPT_SUBCERT[];
|
||||||
extern const char SHRPX_OPT_BACKEND[];
|
extern const char SHRPX_OPT_BACKEND[];
|
||||||
extern const char SHRPX_OPT_FRONTEND[];
|
extern const char SHRPX_OPT_FRONTEND[];
|
||||||
extern const char SHRPX_OPT_WORKERS[];
|
extern const char SHRPX_OPT_WORKERS[];
|
||||||
extern const char SHRPX_OPT_SPDY_MAX_CONCURRENT_STREAMS[];
|
extern const char SHRPX_OPT_HTTP2_MAX_CONCURRENT_STREAMS[];
|
||||||
extern const char SHRPX_OPT_LOG_LEVEL[];
|
extern const char SHRPX_OPT_LOG_LEVEL[];
|
||||||
extern const char SHRPX_OPT_DAEMON[];
|
extern const char SHRPX_OPT_DAEMON[];
|
||||||
extern const char SHRPX_OPT_SPDY_PROXY[];
|
extern const char SHRPX_OPT_HTTP2_PROXY[];
|
||||||
extern const char SHRPX_OPT_SPDY_BRIDGE[];
|
extern const char SHRPX_OPT_HTTP2_BRIDGE[];
|
||||||
extern const char SHRPX_OPT_CLIENT_PROXY[];
|
extern const char SHRPX_OPT_CLIENT_PROXY[];
|
||||||
extern const char SHRPX_OPT_ADD_X_FORWARDED_FOR[];
|
extern const char SHRPX_OPT_ADD_X_FORWARDED_FOR[];
|
||||||
extern const char SHRPX_OPT_NO_VIA[];
|
extern const char SHRPX_OPT_NO_VIA[];
|
||||||
extern const char SHRPX_OPT_FRONTEND_SPDY_READ_TIMEOUT[];
|
extern const char SHRPX_OPT_FRONTEND_HTTP2_READ_TIMEOUT[];
|
||||||
extern const char SHRPX_OPT_FRONTEND_READ_TIMEOUT[];
|
extern const char SHRPX_OPT_FRONTEND_READ_TIMEOUT[];
|
||||||
extern const char SHRPX_OPT_FRONTEND_WRITE_TIMEOUT[];
|
extern const char SHRPX_OPT_FRONTEND_WRITE_TIMEOUT[];
|
||||||
extern const char SHRPX_OPT_BACKEND_READ_TIMEOUT[];
|
extern const char SHRPX_OPT_BACKEND_READ_TIMEOUT[];
|
||||||
extern const char SHRPX_OPT_BACKEND_WRITE_TIMEOUT[];
|
extern const char SHRPX_OPT_BACKEND_WRITE_TIMEOUT[];
|
||||||
extern const char SHRPX_OPT_ACCESSLOG[];
|
extern const char SHRPX_OPT_ACCESSLOG[];
|
||||||
extern const char SHRPX_OPT_BACKEND_KEEP_ALIVE_TIMEOUT[];
|
extern const char SHRPX_OPT_BACKEND_KEEP_ALIVE_TIMEOUT[];
|
||||||
extern const char SHRPX_OPT_FRONTEND_SPDY_WINDOW_BITS[];
|
extern const char SHRPX_OPT_FRONTEND_HTTP2_WINDOW_BITS[];
|
||||||
extern const char SHRPX_OPT_BACKEND_SPDY_WINDOW_BITS[];
|
extern const char SHRPX_OPT_BACKEND_HTTP2_WINDOW_BITS[];
|
||||||
extern const char SHRPX_OPT_FRONTEND_NO_TLS[];
|
extern const char SHRPX_OPT_FRONTEND_NO_TLS[];
|
||||||
extern const char SHRPX_OPT_BACKEND_NO_TLS[];
|
extern const char SHRPX_OPT_BACKEND_NO_TLS[];
|
||||||
extern const char SHRPX_OPT_PID_FILE[];
|
extern const char SHRPX_OPT_PID_FILE[];
|
||||||
|
@ -126,22 +126,22 @@ struct Config {
|
||||||
char *downstream_hostport;
|
char *downstream_hostport;
|
||||||
sockaddr_union downstream_addr;
|
sockaddr_union downstream_addr;
|
||||||
size_t downstream_addrlen;
|
size_t downstream_addrlen;
|
||||||
timeval spdy_upstream_read_timeout;
|
timeval http2_upstream_read_timeout;
|
||||||
timeval upstream_read_timeout;
|
timeval upstream_read_timeout;
|
||||||
timeval upstream_write_timeout;
|
timeval upstream_write_timeout;
|
||||||
timeval downstream_read_timeout;
|
timeval downstream_read_timeout;
|
||||||
timeval downstream_write_timeout;
|
timeval downstream_write_timeout;
|
||||||
timeval downstream_idle_read_timeout;
|
timeval downstream_idle_read_timeout;
|
||||||
size_t num_worker;
|
size_t num_worker;
|
||||||
size_t spdy_max_concurrent_streams;
|
size_t http2_max_concurrent_streams;
|
||||||
bool spdy_proxy;
|
bool http2_proxy;
|
||||||
bool spdy_bridge;
|
bool http2_bridge;
|
||||||
bool client_proxy;
|
bool client_proxy;
|
||||||
bool add_x_forwarded_for;
|
bool add_x_forwarded_for;
|
||||||
bool no_via;
|
bool no_via;
|
||||||
bool accesslog;
|
bool accesslog;
|
||||||
size_t spdy_upstream_window_bits;
|
size_t http2_upstream_window_bits;
|
||||||
size_t spdy_downstream_window_bits;
|
size_t http2_downstream_window_bits;
|
||||||
bool upstream_no_tls;
|
bool upstream_no_tls;
|
||||||
bool downstream_no_tls;
|
bool downstream_no_tls;
|
||||||
char *backend_tls_sni_name;
|
char *backend_tls_sni_name;
|
||||||
|
|
|
@ -630,7 +630,7 @@ int Http2Session::submit_window_update(Http2DownstreamConnection *dconn,
|
||||||
|
|
||||||
int32_t Http2Session::get_initial_window_size() const
|
int32_t Http2Session::get_initial_window_size() const
|
||||||
{
|
{
|
||||||
return (1 << get_config()->spdy_downstream_window_bits) - 1;
|
return (1 << get_config()->http2_downstream_window_bits) - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
nghttp2_session* Http2Session::get_session() const
|
nghttp2_session* Http2Session::get_session() const
|
||||||
|
@ -1168,7 +1168,7 @@ int Http2Session::on_connect()
|
||||||
entry[0].settings_id = NGHTTP2_SETTINGS_ENABLE_PUSH;
|
entry[0].settings_id = NGHTTP2_SETTINGS_ENABLE_PUSH;
|
||||||
entry[0].value = 0;
|
entry[0].value = 0;
|
||||||
entry[1].settings_id = NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS;
|
entry[1].settings_id = NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS;
|
||||||
entry[1].value = get_config()->spdy_max_concurrent_streams;
|
entry[1].value = get_config()->http2_max_concurrent_streams;
|
||||||
|
|
||||||
entry[2].settings_id = NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE;
|
entry[2].settings_id = NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE;
|
||||||
entry[2].value = get_initial_window_size();
|
entry[2].value = get_initial_window_size();
|
||||||
|
|
|
@ -288,8 +288,8 @@ int on_frame_recv_callback
|
||||||
// :authority or host for methods.
|
// :authority or host for methods.
|
||||||
if(!http2::non_empty_value(method) ||
|
if(!http2::non_empty_value(method) ||
|
||||||
!http2::non_empty_value(scheme) ||
|
!http2::non_empty_value(scheme) ||
|
||||||
(get_config()->spdy_proxy && !having_authority) ||
|
(get_config()->http2_proxy && !having_authority) ||
|
||||||
(!get_config()->spdy_proxy && !having_authority && !having_host) ||
|
(!get_config()->http2_proxy && !having_authority && !having_host) ||
|
||||||
!http2::non_empty_value(path)) {
|
!http2::non_empty_value(path)) {
|
||||||
upstream->rst_stream(downstream, NGHTTP2_PROTOCOL_ERROR);
|
upstream->rst_stream(downstream, NGHTTP2_PROTOCOL_ERROR);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -467,7 +467,7 @@ Http2Upstream::Http2Upstream(ClientHandler *handler)
|
||||||
session_(nullptr),
|
session_(nullptr),
|
||||||
settings_timerev_(nullptr)
|
settings_timerev_(nullptr)
|
||||||
{
|
{
|
||||||
handler->set_upstream_timeouts(&get_config()->spdy_upstream_read_timeout,
|
handler->set_upstream_timeouts(&get_config()->http2_upstream_read_timeout,
|
||||||
&get_config()->upstream_write_timeout);
|
&get_config()->upstream_write_timeout);
|
||||||
|
|
||||||
nghttp2_session_callbacks callbacks;
|
nghttp2_session_callbacks callbacks;
|
||||||
|
@ -490,7 +490,7 @@ Http2Upstream::Http2Upstream(ClientHandler *handler)
|
||||||
|
|
||||||
int val = 1;
|
int val = 1;
|
||||||
flow_control_ = true;
|
flow_control_ = true;
|
||||||
initial_window_size_ = (1 << get_config()->spdy_upstream_window_bits) - 1;
|
initial_window_size_ = (1 << get_config()->http2_upstream_window_bits) - 1;
|
||||||
rv = nghttp2_session_set_option(session_,
|
rv = nghttp2_session_set_option(session_,
|
||||||
NGHTTP2_OPT_NO_AUTO_STREAM_WINDOW_UPDATE,
|
NGHTTP2_OPT_NO_AUTO_STREAM_WINDOW_UPDATE,
|
||||||
&val, sizeof(val));
|
&val, sizeof(val));
|
||||||
|
@ -503,7 +503,7 @@ Http2Upstream::Http2Upstream(ClientHandler *handler)
|
||||||
// TODO Maybe call from outside?
|
// TODO Maybe call from outside?
|
||||||
nghttp2_settings_entry entry[2];
|
nghttp2_settings_entry entry[2];
|
||||||
entry[0].settings_id = NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS;
|
entry[0].settings_id = NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS;
|
||||||
entry[0].value = get_config()->spdy_max_concurrent_streams;
|
entry[0].value = get_config()->http2_max_concurrent_streams;
|
||||||
|
|
||||||
entry[1].settings_id = NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE;
|
entry[1].settings_id = NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE;
|
||||||
entry[1].value = initial_window_size_;
|
entry[1].value = initial_window_size_;
|
||||||
|
|
|
@ -127,7 +127,7 @@ int HttpDownstreamConnection::push_request_headers()
|
||||||
} else {
|
} else {
|
||||||
hdrs += downstream_->get_request_path();
|
hdrs += downstream_->get_request_path();
|
||||||
}
|
}
|
||||||
} else if(get_config()->spdy_proxy &&
|
} else if(get_config()->http2_proxy &&
|
||||||
!downstream_->get_request_http2_scheme().empty() &&
|
!downstream_->get_request_http2_scheme().empty() &&
|
||||||
!downstream_->get_request_http2_authority().empty() &&
|
!downstream_->get_request_http2_authority().empty() &&
|
||||||
downstream_->get_request_path().c_str()[0] == '/') {
|
downstream_->get_request_path().c_str()[0] == '/') {
|
||||||
|
|
|
@ -357,7 +357,7 @@ SpdyUpstream::SpdyUpstream(uint16_t version, ClientHandler *handler)
|
||||||
session_(0)
|
session_(0)
|
||||||
{
|
{
|
||||||
//handler->set_bev_cb(spdy_readcb, 0, spdy_eventcb);
|
//handler->set_bev_cb(spdy_readcb, 0, spdy_eventcb);
|
||||||
handler->set_upstream_timeouts(&get_config()->spdy_upstream_read_timeout,
|
handler->set_upstream_timeouts(&get_config()->http2_upstream_read_timeout,
|
||||||
&get_config()->upstream_write_timeout);
|
&get_config()->upstream_write_timeout);
|
||||||
|
|
||||||
spdylay_session_callbacks callbacks;
|
spdylay_session_callbacks callbacks;
|
||||||
|
@ -380,7 +380,7 @@ SpdyUpstream::SpdyUpstream(uint16_t version, ClientHandler *handler)
|
||||||
if(version == SPDYLAY_PROTO_SPDY3) {
|
if(version == SPDYLAY_PROTO_SPDY3) {
|
||||||
int val = 1;
|
int val = 1;
|
||||||
flow_control_ = true;
|
flow_control_ = true;
|
||||||
initial_window_size_ = (1 << get_config()->spdy_upstream_window_bits) - 1;
|
initial_window_size_ = (1 << get_config()->http2_upstream_window_bits) - 1;
|
||||||
rv = spdylay_session_set_option(session_,
|
rv = spdylay_session_set_option(session_,
|
||||||
SPDYLAY_OPT_NO_AUTO_WINDOW_UPDATE, &val,
|
SPDYLAY_OPT_NO_AUTO_WINDOW_UPDATE, &val,
|
||||||
sizeof(val));
|
sizeof(val));
|
||||||
|
@ -392,7 +392,7 @@ SpdyUpstream::SpdyUpstream(uint16_t version, ClientHandler *handler)
|
||||||
// TODO Maybe call from outside?
|
// TODO Maybe call from outside?
|
||||||
spdylay_settings_entry entry[2];
|
spdylay_settings_entry entry[2];
|
||||||
entry[0].settings_id = SPDYLAY_SETTINGS_MAX_CONCURRENT_STREAMS;
|
entry[0].settings_id = SPDYLAY_SETTINGS_MAX_CONCURRENT_STREAMS;
|
||||||
entry[0].value = get_config()->spdy_max_concurrent_streams;
|
entry[0].value = get_config()->http2_max_concurrent_streams;
|
||||||
entry[0].flags = SPDYLAY_ID_FLAG_SETTINGS_NONE;
|
entry[0].flags = SPDYLAY_ID_FLAG_SETTINGS_NONE;
|
||||||
|
|
||||||
entry[1].settings_id = SPDYLAY_SETTINGS_INITIAL_WINDOW_SIZE;
|
entry[1].settings_id = SPDYLAY_SETTINGS_INITIAL_WINDOW_SIZE;
|
||||||
|
|
Loading…
Reference in New Issue