nghttp: Use method given in -H with ":method" in HTTP Upgrade

This commit is contained in:
Tatsuhiro Tsujikawa 2015-11-07 11:14:28 +09:00
parent 5e7e479c6c
commit 6958d0b55d
1 changed files with 10 additions and 1 deletions

View File

@ -813,7 +813,16 @@ int HttpClient::on_upgrade_connect() {
// If the request contains upload data, use OPTIONS * to upgrade
req = "OPTIONS *";
} else {
auto meth = std::find_if(
std::begin(config.headers), std::end(config.headers),
[](const Header &kv) { return util::strieq_l(":method", kv.name); });
if (meth == std::end(config.headers)) {
req = "GET ";
} else {
req = (*meth).value;
req += " ";
}
req += reqvec[0]->make_reqpath();
}