nghttp: add an --expect-continue option

Add a placeholder for the expect-continue option, which will perform an
Expect/Continue handshake for DATA uploads.
This commit is contained in:
Jacob Champion 2016-03-21 11:34:09 -07:00
parent 7c954c1ea7
commit feb3d1b478
2 changed files with 13 additions and 1 deletions

View File

@ -113,7 +113,8 @@ Config::Config()
no_content_length(false), no_content_length(false),
no_dep(false), no_dep(false),
hexdump(false), hexdump(false),
no_push(false) { no_push(false),
expect_continue(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);
@ -2505,6 +2506,11 @@ Options:
--max-concurrent-streams=<N> --max-concurrent-streams=<N>
The number of concurrent pushed streams this client The number of concurrent pushed streams this client
accepts. accepts.
--expect-continue
Perform an Expect/Continue handshake: wait to send DATA
(up to a short timeout) until the server sends a 100
Continue interim response. This option is ignored unless
combined with the -d option.
--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.
@ -2556,6 +2562,7 @@ int main(int argc, char **argv) {
{"hexdump", no_argument, &flag, 10}, {"hexdump", no_argument, &flag, 10},
{"no-push", no_argument, &flag, 11}, {"no-push", no_argument, &flag, 11},
{"max-concurrent-streams", required_argument, &flag, 12}, {"max-concurrent-streams", required_argument, &flag, 12},
{"expect-continue", no_argument, &flag, 13},
{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:",
@ -2753,6 +2760,10 @@ int main(int argc, char **argv) {
// max-concurrent-streams option // max-concurrent-streams option
config.max_concurrent_streams = strtoul(optarg, nullptr, 10); config.max_concurrent_streams = strtoul(optarg, nullptr, 10);
break; break;
case 13:
// expect-continue option
config.expect_continue = true;
break;
} }
break; break;
default: default:

View File

@ -91,6 +91,7 @@ struct Config {
bool no_dep; bool no_dep;
bool hexdump; bool hexdump;
bool no_push; bool no_push;
bool expect_continue;
}; };
enum class RequestState { INITIAL, ON_REQUEST, ON_RESPONSE, ON_COMPLETE }; enum class RequestState { INITIAL, ON_REQUEST, ON_RESPONSE, ON_COMPLETE };