nghttp: Add --no-dep option to disable sending priority hints to server

This commit is contained in:
Tatsuhiro Tsujikawa 2014-11-15 23:42:26 +09:00
parent ee2856f9bc
commit 54232c6542
1 changed files with 15 additions and 6 deletions

View File

@ -106,6 +106,7 @@ struct Config {
bool upgrade;
bool continuation;
bool no_content_length;
bool no_dep;
Config()
: output_upper_thres(1024*1024),
@ -124,7 +125,8 @@ struct Config {
stat(false),
upgrade(false),
continuation(false),
no_content_length(false)
no_content_length(false),
no_dep(false)
{
nghttp2_option_new(&http2_option);
nghttp2_option_set_peer_max_concurrent_streams
@ -139,6 +141,10 @@ struct Config {
};
} // namespace
namespace {
Config config;
} // namespace
enum StatStage {
STAT_INITIAL,
STAT_ON_REQUEST,
@ -282,7 +288,7 @@ struct Request {
nghttp2_priority_spec_default_init(&pri_spec);
if(pri == 0) {
if(config.no_dep || pri == 0) {
return pri_spec;
}
@ -372,10 +378,6 @@ struct SessionStat {
};
} // namespace
namespace {
Config config;
} // namespace
namespace {
size_t populate_settings(nghttp2_settings_entry *iv)
{
@ -2235,6 +2237,8 @@ Options:
--continuation Send large header to test CONTINUATION.
--no-content-length
Don't send content-length header field.
--no-dep Don't send dependency based priority hint to
server.
--version Display version information and exit.
-h, --help Display this help and exit.)"
<< std::endl;
@ -2271,6 +2275,7 @@ int main(int argc, char **argv)
{"continuation", no_argument, &flag, 4},
{"version", no_argument, &flag, 5},
{"no-content-length", no_argument, &flag, 6},
{"no-dep", no_argument, &flag, 7},
{nullptr, 0, nullptr, 0 }
};
int option_index = 0;
@ -2429,6 +2434,10 @@ int main(int argc, char **argv)
// no-content-length option
config.no_content_length = true;
break;
case 7:
// no-dep option
config.no_dep = true;
break;
}
break;
default: