mirror of
https://gitee.com/openharmony/third_party_nghttp2
synced 2024-11-23 07:50:02 +00:00
nghttpx: Deprecate --http2-max-concurrent-streams option
We added 2 new option instead: --frontend-http2-max-concurrent-streams and --backend-http2-max-concurrent-streams.
This commit is contained in:
parent
c731d1fea5
commit
aafcc55006
@ -122,7 +122,9 @@ OPTIONS = [
|
||||
"tls-ticket-key-memcached-cert-file",
|
||||
"tls-ticket-key-memcached-private-key-file",
|
||||
"tls-ticket-key-memcached-address-family",
|
||||
"backend-address-family"
|
||||
"backend-address-family",
|
||||
"frontend-http2-max-concurrent-streams",
|
||||
"backend-http2-max-concurrent-streams"
|
||||
]
|
||||
|
||||
LOGVARS = [
|
||||
|
32
src/shrpx.cc
32
src/shrpx.cc
@ -1096,6 +1096,7 @@ void fill_default_config() {
|
||||
// HTTP/2 SPDY/3.1 has connection-level flow control. The default
|
||||
// window size for HTTP/2 is 64KiB - 1. SPDY/3's default is 64KiB
|
||||
upstreamconf.connection_window_bits = 16;
|
||||
upstreamconf.max_concurrent_streams = 100;
|
||||
|
||||
nghttp2_option_new(&upstreamconf.option);
|
||||
nghttp2_option_set_no_auto_window_update(upstreamconf.option, 1);
|
||||
@ -1106,14 +1107,13 @@ void fill_default_config() {
|
||||
auto &downstreamconf = http2conf.downstream;
|
||||
downstreamconf.window_bits = 16;
|
||||
downstreamconf.connection_window_bits = 16;
|
||||
downstreamconf.max_concurrent_streams = 100;
|
||||
|
||||
nghttp2_option_new(&downstreamconf.option);
|
||||
nghttp2_option_set_no_auto_window_update(downstreamconf.option, 1);
|
||||
nghttp2_option_set_peer_max_concurrent_streams(downstreamconf.option, 100);
|
||||
}
|
||||
|
||||
http2conf.max_concurrent_streams = 100;
|
||||
|
||||
auto &loggingconf = mod_config()->logging;
|
||||
{
|
||||
auto &accessconf = loggingconf.access;
|
||||
@ -1621,10 +1621,18 @@ SSL/TLS:
|
||||
the complete HTTP/2 cipher suites black list.
|
||||
|
||||
HTTP/2 and SPDY:
|
||||
-c, --http2-max-concurrent-streams=<N>
|
||||
-c, --frontend-http2-max-concurrent-streams=<N>
|
||||
Set the maximum number of the concurrent streams in one
|
||||
HTTP/2 and SPDY session.
|
||||
Default: )" << get_config()->http2.max_concurrent_streams << R"(
|
||||
frontend HTTP/2 and SPDY session.
|
||||
Default: )"
|
||||
<< get_config()->http2.upstream.max_concurrent_streams << R"(
|
||||
--backend-http2-max-concurrent-streams=<N>
|
||||
Set the maximum number of the concurrent streams in one
|
||||
backend HTTP/2 session. This sets maximum number of
|
||||
concurrent opened pushed streams. The maximum number of
|
||||
concurrent requests are set by a remote server.
|
||||
Default: )"
|
||||
<< get_config()->http2.downstream.max_concurrent_streams << R"(
|
||||
--frontend-http2-window-bits=<N>
|
||||
Sets the per-stream initial window size of HTTP/2 SPDY
|
||||
frontend connection. For HTTP/2, the size is 2**<N>-1.
|
||||
@ -2451,6 +2459,10 @@ int main(int argc, char **argv) {
|
||||
{SHRPX_OPT_TLS_SESSION_CACHE_MEMCACHED_ADDRESS_FAMILY,
|
||||
required_argument, &flag, 115},
|
||||
{SHRPX_OPT_BACKEND_ADDRESS_FAMILY, required_argument, &flag, 116},
|
||||
{SHRPX_OPT_FRONTEND_HTTP2_MAX_CONCURRENT_STREAMS, required_argument,
|
||||
&flag, 117},
|
||||
{SHRPX_OPT_BACKEND_HTTP2_MAX_CONCURRENT_STREAMS, required_argument,
|
||||
&flag, 118},
|
||||
{nullptr, 0, nullptr, 0}};
|
||||
|
||||
int option_index = 0;
|
||||
@ -2946,6 +2958,16 @@ int main(int argc, char **argv) {
|
||||
// --backend-address-family
|
||||
cmdcfgs.emplace_back(SHRPX_OPT_BACKEND_ADDRESS_FAMILY, optarg);
|
||||
break;
|
||||
case 117:
|
||||
// --frontend-http2-max-concurrent-streams
|
||||
cmdcfgs.emplace_back(SHRPX_OPT_FRONTEND_HTTP2_MAX_CONCURRENT_STREAMS,
|
||||
optarg);
|
||||
break;
|
||||
case 118:
|
||||
// --backend-http2-max-concurrent-streams
|
||||
cmdcfgs.emplace_back(SHRPX_OPT_BACKEND_HTTP2_MAX_CONCURRENT_STREAMS,
|
||||
optarg);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -660,6 +660,7 @@ enum {
|
||||
SHRPX_OPTID_BACKEND_HTTP1_TLS,
|
||||
SHRPX_OPTID_BACKEND_HTTP2_CONNECTION_WINDOW_BITS,
|
||||
SHRPX_OPTID_BACKEND_HTTP2_CONNECTIONS_PER_WORKER,
|
||||
SHRPX_OPTID_BACKEND_HTTP2_MAX_CONCURRENT_STREAMS,
|
||||
SHRPX_OPTID_BACKEND_HTTP2_WINDOW_BITS,
|
||||
SHRPX_OPTID_BACKEND_IPV4,
|
||||
SHRPX_OPTID_BACKEND_IPV6,
|
||||
@ -692,6 +693,7 @@ enum {
|
||||
SHRPX_OPTID_FRONTEND_HTTP2_CONNECTION_WINDOW_BITS,
|
||||
SHRPX_OPTID_FRONTEND_HTTP2_DUMP_REQUEST_HEADER,
|
||||
SHRPX_OPTID_FRONTEND_HTTP2_DUMP_RESPONSE_HEADER,
|
||||
SHRPX_OPTID_FRONTEND_HTTP2_MAX_CONCURRENT_STREAMS,
|
||||
SHRPX_OPTID_FRONTEND_HTTP2_READ_TIMEOUT,
|
||||
SHRPX_OPTID_FRONTEND_HTTP2_WINDOW_BITS,
|
||||
SHRPX_OPTID_FRONTEND_NO_TLS,
|
||||
@ -1398,6 +1400,9 @@ int option_lookup_token(const char *name, size_t namelen) {
|
||||
if (util::strieq_l("backend-http2-connection-window-bit", name, 35)) {
|
||||
return SHRPX_OPTID_BACKEND_HTTP2_CONNECTION_WINDOW_BITS;
|
||||
}
|
||||
if (util::strieq_l("backend-http2-max-concurrent-stream", name, 35)) {
|
||||
return SHRPX_OPTID_BACKEND_HTTP2_MAX_CONCURRENT_STREAMS;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@ -1412,6 +1417,9 @@ int option_lookup_token(const char *name, size_t namelen) {
|
||||
if (util::strieq_l("frontend-http2-connection-window-bit", name, 36)) {
|
||||
return SHRPX_OPTID_FRONTEND_HTTP2_CONNECTION_WINDOW_BITS;
|
||||
}
|
||||
if (util::strieq_l("frontend-http2-max-concurrent-stream", name, 36)) {
|
||||
return SHRPX_OPTID_FRONTEND_HTTP2_MAX_CONCURRENT_STREAMS;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@ -1559,8 +1567,20 @@ int parse_config(const char *opt, const char *optarg,
|
||||
#else // !NOTHREADS
|
||||
return parse_uint(&mod_config()->num_worker, opt, optarg);
|
||||
#endif // !NOTHREADS
|
||||
case SHRPX_OPTID_HTTP2_MAX_CONCURRENT_STREAMS:
|
||||
return parse_uint(&mod_config()->http2.max_concurrent_streams, opt, optarg);
|
||||
case SHRPX_OPTID_HTTP2_MAX_CONCURRENT_STREAMS: {
|
||||
LOG(WARN) << opt << ": deprecated. Use "
|
||||
<< SHRPX_OPT_FRONTEND_HTTP2_MAX_CONCURRENT_STREAMS << " and "
|
||||
<< SHRPX_OPT_BACKEND_HTTP2_MAX_CONCURRENT_STREAMS << " instead.";
|
||||
size_t n;
|
||||
if (parse_uint(&n, opt, optarg) != 0) {
|
||||
return -1;
|
||||
}
|
||||
auto &http2conf = mod_config()->http2;
|
||||
http2conf.upstream.max_concurrent_streams = n;
|
||||
http2conf.downstream.max_concurrent_streams = n;
|
||||
|
||||
return 0;
|
||||
}
|
||||
case SHRPX_OPTID_LOG_LEVEL:
|
||||
if (Log::set_severity_level_by_name(optarg) == -1) {
|
||||
LOG(ERROR) << opt << ": Invalid severity level: " << optarg;
|
||||
@ -2314,6 +2334,12 @@ int parse_config(const char *opt, const char *optarg,
|
||||
case SHRPX_OPTID_BACKEND_ADDRESS_FAMILY:
|
||||
return parse_address_family(&mod_config()->conn.downstream.family, opt,
|
||||
optarg);
|
||||
case SHRPX_OPTID_FRONTEND_HTTP2_MAX_CONCURRENT_STREAMS:
|
||||
return parse_uint(&mod_config()->http2.upstream.max_concurrent_streams, opt,
|
||||
optarg);
|
||||
case SHRPX_OPTID_BACKEND_HTTP2_MAX_CONCURRENT_STREAMS:
|
||||
return parse_uint(&mod_config()->http2.downstream.max_concurrent_streams,
|
||||
opt, optarg);
|
||||
case SHRPX_OPTID_CONF:
|
||||
LOG(WARN) << "conf: ignored";
|
||||
|
||||
|
@ -228,6 +228,10 @@ constexpr char SHRPX_OPT_TLS_TICKET_KEY_MEMCACHED_PRIVATE_KEY_FILE[] =
|
||||
constexpr char SHRPX_OPT_TLS_TICKET_KEY_MEMCACHED_ADDRESS_FAMILY[] =
|
||||
"tls-ticket-key-memcached-address-family";
|
||||
constexpr char SHRPX_OPT_BACKEND_ADDRESS_FAMILY[] = "backend-address-family";
|
||||
constexpr char SHRPX_OPT_FRONTEND_HTTP2_MAX_CONCURRENT_STREAMS[] =
|
||||
"frontend-http2-max-concurrent-streams";
|
||||
constexpr char SHRPX_OPT_BACKEND_HTTP2_MAX_CONCURRENT_STREAMS[] =
|
||||
"backend-http2-max-concurrent-streams";
|
||||
|
||||
constexpr size_t SHRPX_OBFUSCATED_NODE_LENGTH = 8;
|
||||
|
||||
@ -479,18 +483,19 @@ struct Http2Config {
|
||||
nghttp2_session_callbacks *callbacks;
|
||||
size_t window_bits;
|
||||
size_t connection_window_bits;
|
||||
size_t max_concurrent_streams;
|
||||
} upstream;
|
||||
struct {
|
||||
nghttp2_option *option;
|
||||
nghttp2_session_callbacks *callbacks;
|
||||
size_t window_bits;
|
||||
size_t connection_window_bits;
|
||||
size_t max_concurrent_streams;
|
||||
} downstream;
|
||||
struct {
|
||||
ev_tstamp stream_read;
|
||||
ev_tstamp stream_write;
|
||||
} timeout;
|
||||
size_t max_concurrent_streams;
|
||||
bool no_cookie_crumbling;
|
||||
bool no_server_push;
|
||||
};
|
||||
|
@ -1453,7 +1453,7 @@ int Http2Session::connection_made() {
|
||||
std::array<nghttp2_settings_entry, 3> entry;
|
||||
size_t nentry = 2;
|
||||
entry[0].settings_id = NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS;
|
||||
entry[0].value = http2conf.max_concurrent_streams;
|
||||
entry[0].value = http2conf.downstream.max_concurrent_streams;
|
||||
|
||||
entry[1].settings_id = NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE;
|
||||
entry[1].value = (1 << http2conf.downstream.window_bits) - 1;
|
||||
|
@ -846,7 +846,7 @@ Http2Upstream::Http2Upstream(ClientHandler *handler)
|
||||
// TODO Maybe call from outside?
|
||||
std::array<nghttp2_settings_entry, 2> entry;
|
||||
entry[0].settings_id = NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS;
|
||||
entry[0].value = http2conf.max_concurrent_streams;
|
||||
entry[0].value = http2conf.upstream.max_concurrent_streams;
|
||||
|
||||
entry[1].settings_id = NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE;
|
||||
entry[1].value = (1 << http2conf.upstream.window_bits) - 1;
|
||||
|
@ -547,7 +547,7 @@ SpdyUpstream::SpdyUpstream(uint16_t version, ClientHandler *handler)
|
||||
// TODO Maybe call from outside?
|
||||
std::array<spdylay_settings_entry, 2> entry;
|
||||
entry[0].settings_id = SPDYLAY_SETTINGS_MAX_CONCURRENT_STREAMS;
|
||||
entry[0].value = http2conf.max_concurrent_streams;
|
||||
entry[0].value = http2conf.upstream.max_concurrent_streams;
|
||||
entry[0].flags = SPDYLAY_ID_FLAG_SETTINGS_NONE;
|
||||
|
||||
entry[1].settings_id = SPDYLAY_SETTINGS_INITIAL_WINDOW_SIZE;
|
||||
|
Loading…
Reference in New Issue
Block a user