nghttp: Add --no-push option to disable server push
This commit is contained in:
parent
0b41e20d54
commit
c4e994c97d
|
@ -95,7 +95,7 @@ Config::Config()
|
||||||
timeout(0.), window_bits(-1), connection_window_bits(-1), verbose(0),
|
timeout(0.), window_bits(-1), connection_window_bits(-1), verbose(0),
|
||||||
null_out(false), remote_name(false), get_assets(false), stat(false),
|
null_out(false), remote_name(false), get_assets(false), stat(false),
|
||||||
upgrade(false), continuation(false), no_content_length(false),
|
upgrade(false), continuation(false), no_content_length(false),
|
||||||
no_dep(false), hexdump(false) {
|
no_dep(false), hexdump(false), no_push(false) {
|
||||||
nghttp2_option_new(&http2_option);
|
nghttp2_option_new(&http2_option);
|
||||||
nghttp2_option_set_peer_max_concurrent_streams(http2_option,
|
nghttp2_option_set_peer_max_concurrent_streams(http2_option,
|
||||||
peer_max_concurrent_streams);
|
peer_max_concurrent_streams);
|
||||||
|
@ -737,6 +737,13 @@ size_t populate_settings(nghttp2_settings_entry *iv) {
|
||||||
iv[niv].value = config.header_table_size;
|
iv[niv].value = config.header_table_size;
|
||||||
++niv;
|
++niv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (config.no_push) {
|
||||||
|
iv[niv].settings_id = NGHTTP2_SETTINGS_ENABLE_PUSH;
|
||||||
|
iv[niv].value = 0;
|
||||||
|
++niv;
|
||||||
|
}
|
||||||
|
|
||||||
return niv;
|
return niv;
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
@ -745,7 +752,7 @@ int HttpClient::on_upgrade_connect() {
|
||||||
ssize_t rv;
|
ssize_t rv;
|
||||||
record_connect_end_time();
|
record_connect_end_time();
|
||||||
assert(!reqvec.empty());
|
assert(!reqvec.empty());
|
||||||
std::array<nghttp2_settings_entry, 32> iv;
|
std::array<nghttp2_settings_entry, 16> iv;
|
||||||
size_t niv = populate_settings(iv.data());
|
size_t niv = populate_settings(iv.data());
|
||||||
assert(settings_payload.size() >= 8 * niv);
|
assert(settings_payload.size() >= 8 * niv);
|
||||||
rv = nghttp2_pack_settings_payload(settings_payload.data(),
|
rv = nghttp2_pack_settings_payload(settings_payload.data(),
|
||||||
|
@ -2372,6 +2379,7 @@ Options:
|
||||||
--hexdump Display the incoming traffic in hexadecimal (Canonical
|
--hexdump Display the incoming traffic in hexadecimal (Canonical
|
||||||
hex+ASCII display). If SSL/TLS is used, decrypted data
|
hex+ASCII display). If SSL/TLS is used, decrypted data
|
||||||
are used.
|
are used.
|
||||||
|
--no-push Disable server push.
|
||||||
--version Display version information and exit.
|
--version Display version information and exit.
|
||||||
-h, --help Display this help and exit.
|
-h, --help Display this help and exit.
|
||||||
|
|
||||||
|
@ -2414,6 +2422,7 @@ int main(int argc, char **argv) {
|
||||||
{"no-dep", no_argument, &flag, 7},
|
{"no-dep", no_argument, &flag, 7},
|
||||||
{"trailer", required_argument, &flag, 9},
|
{"trailer", required_argument, &flag, 9},
|
||||||
{"hexdump", no_argument, &flag, 10},
|
{"hexdump", no_argument, &flag, 10},
|
||||||
|
{"no-push", no_argument, &flag, 11},
|
||||||
{nullptr, 0, nullptr, 0}};
|
{nullptr, 0, nullptr, 0}};
|
||||||
int option_index = 0;
|
int option_index = 0;
|
||||||
int c = getopt_long(argc, argv, "M:Oab:c:d:gm:np:r:hH:vst:uw:W:",
|
int c = getopt_long(argc, argv, "M:Oab:c:d:gm:np:r:hH:vst:uw:W:",
|
||||||
|
@ -2597,6 +2606,10 @@ int main(int argc, char **argv) {
|
||||||
// hexdump option
|
// hexdump option
|
||||||
config.hexdump = true;
|
config.hexdump = true;
|
||||||
break;
|
break;
|
||||||
|
case 11:
|
||||||
|
// no-push option
|
||||||
|
config.no_push = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -84,6 +84,7 @@ struct Config {
|
||||||
bool no_content_length;
|
bool no_content_length;
|
||||||
bool no_dep;
|
bool no_dep;
|
||||||
bool hexdump;
|
bool hexdump;
|
||||||
|
bool no_push;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class RequestState { INITIAL, ON_REQUEST, ON_RESPONSE, ON_COMPLETE };
|
enum class RequestState { INITIAL, ON_REQUEST, ON_RESPONSE, ON_COMPLETE };
|
||||||
|
|
Loading…
Reference in New Issue