nghttpx: Add --http2-no-cookie-crumbling option
This commit is contained in:
parent
faedc4381d
commit
53b3fba05b
|
@ -422,6 +422,7 @@ void fill_default_config()
|
|||
mod_config()->client_cert_file = nullptr;
|
||||
mod_config()->http2_upstream_dump_request_header = nullptr;
|
||||
mod_config()->http2_upstream_dump_response_header = nullptr;
|
||||
mod_config()->http2_no_cookie_crumbling = false;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
|
@ -630,6 +631,8 @@ void print_help(std::ostream& out)
|
|||
<< " Default: "
|
||||
<< get_config()->http2_downstream_window_bits << "\n"
|
||||
<< " --backend-no-tls Disable SSL/TLS on backend connections.\n"
|
||||
<< " --http2-no-cookie-crumbling\n"
|
||||
<< " Don't crumble cookie header field.\n"
|
||||
<< "\n"
|
||||
<< " Mode:\n"
|
||||
<< " (default mode) Accept HTTP/2.0, SPDY and HTTP/1.1 over\n"
|
||||
|
@ -770,6 +773,7 @@ int main(int argc, char **argv)
|
|||
{"client-cert-file", required_argument, &flag, 42},
|
||||
{"frontend-http2-dump-request-header", required_argument, &flag, 43},
|
||||
{"frontend-http2-dump-response-header", required_argument, &flag, 44},
|
||||
{"http2-no-cookie-crumbling", no_argument, &flag, 45},
|
||||
{nullptr, 0, nullptr, 0 }
|
||||
};
|
||||
|
||||
|
@ -1004,6 +1008,11 @@ int main(int argc, char **argv)
|
|||
(SHRPX_OPT_FRONTEND_HTTP2_DUMP_RESPONSE_HEADER,
|
||||
optarg));
|
||||
break;
|
||||
case 45:
|
||||
// --http2-no-cookie-crumbling
|
||||
cmdcfgs.push_back(std::make_pair
|
||||
(SHRPX_OPT_HTTP2_NO_COOKIE_CRUMBLING, "yes"));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -109,6 +109,7 @@ const char SHRPX_OPT_FRONTEND_HTTP2_DUMP_REQUEST_HEADER[] =
|
|||
"frontend-http2-dump-request-header";
|
||||
const char SHRPX_OPT_FRONTEND_HTTP2_DUMP_RESPONSE_HEADER[] =
|
||||
"frontend-http2-dump-response-header";
|
||||
const char SHRPX_OPT_HTTP2_NO_COOKIE_CRUMBLING[] = "http2-no-cookie-crumbling";
|
||||
|
||||
namespace {
|
||||
Config *config = nullptr;
|
||||
|
@ -447,6 +448,8 @@ int parse_config(const char *opt, const char *optarg)
|
|||
return -1;
|
||||
}
|
||||
mod_config()->http2_upstream_dump_response_header = f;
|
||||
} else if(util::strieq(opt, SHRPX_OPT_HTTP2_NO_COOKIE_CRUMBLING)) {
|
||||
mod_config()->http2_no_cookie_crumbling = util::strieq(optarg, "yes");
|
||||
} else if(util::strieq(opt, "conf")) {
|
||||
LOG(WARNING) << "conf is ignored";
|
||||
} else {
|
||||
|
|
|
@ -98,6 +98,7 @@ extern const char SHRPX_OPT_CLIENT_PRIVATE_KEY_FILE[];
|
|||
extern const char SHRPX_OPT_CLIENT_CERT_FILE[];
|
||||
extern const char SHRPX_OPT_FRONTEND_HTTP2_DUMP_REQUEST_HEADER[];
|
||||
extern const char SHRPX_OPT_FRONTEND_HTTP2_DUMP_RESPONSE_HEADER[];
|
||||
extern const char SHRPX_OPT_HTTP2_NO_COOKIE_CRUMBLING[];
|
||||
|
||||
union sockaddr_union {
|
||||
sockaddr sa;
|
||||
|
@ -200,6 +201,7 @@ struct Config {
|
|||
char *client_cert_file;
|
||||
FILE *http2_upstream_dump_request_header;
|
||||
FILE *http2_upstream_dump_response_header;
|
||||
bool http2_no_cookie_crumbling;
|
||||
};
|
||||
|
||||
const Config* get_config();
|
||||
|
|
|
@ -228,7 +228,9 @@ int Http2DownstreamConnection::push_request_headers()
|
|||
return 0;
|
||||
}
|
||||
size_t nheader = downstream_->get_request_headers().size();
|
||||
downstream_->crumble_request_cookie();
|
||||
if(!get_config()->http2_no_cookie_crumbling) {
|
||||
downstream_->crumble_request_cookie();
|
||||
}
|
||||
downstream_->normalize_request_headers();
|
||||
auto end_headers = std::end(downstream_->get_request_headers());
|
||||
// 12 means:
|
||||
|
|
Loading…
Reference in New Issue