From 54232c654292ae0ee7f1759527b4249ac3fa4749 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sat, 15 Nov 2014 23:42:26 +0900 Subject: [PATCH] nghttp: Add --no-dep option to disable sending priority hints to server --- src/nghttp.cc | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/nghttp.cc b/src/nghttp.cc index 7e2c83a3..90d7c359 100644 --- a/src/nghttp.cc +++ b/src/nghttp.cc @@ -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: