mirror of
https://github.com/klzgrad/naiveproxy.git
synced 2024-11-21 21:06:12 +03:00
Add --http2-recv-window option
This commit is contained in:
parent
8b2599211f
commit
9b7d6038ea
@ -266,6 +266,26 @@ bool NaiveConfig::Parse(const base::Value::Dict& value) {
|
||||
no_post_quantum = true;
|
||||
}
|
||||
|
||||
if (const base::Value* v = value.Find("http2-recv-window")) {
|
||||
if (std::optional<int> i = v->GetIfInt()) {
|
||||
http2_recv_window = *i;
|
||||
} else if (const std::string* str = v->GetIfString()) {
|
||||
int http2_recv_window_int;
|
||||
if (!base::StringToInt(*str, &http2_recv_window_int)) {
|
||||
std::cerr << "Invalid http2-recv-window" << std::endl;
|
||||
return false;
|
||||
}
|
||||
http2_recv_window = http2_recv_window_int;
|
||||
} else {
|
||||
std::cerr << "Invalid http2-recv-window" << std::endl;
|
||||
return false;
|
||||
}
|
||||
if (http2_recv_window.has_value() && *http2_recv_window <= 0) {
|
||||
std::cerr << "Invalid http2-recv-window" << std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -62,6 +62,8 @@ struct NaiveConfig {
|
||||
|
||||
std::optional<bool> no_post_quantum;
|
||||
|
||||
std::optional<int> http2_recv_window;
|
||||
|
||||
NaiveConfig();
|
||||
NaiveConfig(const NaiveConfig&);
|
||||
~NaiveConfig();
|
||||
|
@ -197,11 +197,17 @@ std::unique_ptr<URLRequestContext> BuildURLRequestContext(
|
||||
// The windows size should be twice the BDP because WINDOW_UPDATEs
|
||||
// are sent after half the window is unacknowledged.
|
||||
constexpr int kTypicalWindow = kMaxBdpMB * 2 * 1024 * 1024;
|
||||
int http2_window_size = kTypicalWindow;
|
||||
if (config.http2_recv_window.has_value()) {
|
||||
http2_window_size = *config.http2_recv_window;
|
||||
LOG(INFO) << "Overriding HTTP/2 receive window size as "
|
||||
<< http2_window_size;
|
||||
}
|
||||
HttpNetworkSessionParams http_network_session_params;
|
||||
http_network_session_params.spdy_session_max_recv_window_size =
|
||||
kTypicalWindow * 2;
|
||||
http2_window_size * 5 / 2;
|
||||
http_network_session_params
|
||||
.http2_settings[spdy::SETTINGS_INITIAL_WINDOW_SIZE] = kTypicalWindow;
|
||||
.http2_settings[spdy::SETTINGS_INITIAL_WINDOW_SIZE] = http2_window_size;
|
||||
builder.set_http_network_session_params(http_network_session_params);
|
||||
|
||||
builder.set_net_log(net_log);
|
||||
|
Loading…
Reference in New Issue
Block a user