nghttpx: Support server-wide OPTIONS in http/1 upstream
This commit is contained in:
parent
c859fb8f7c
commit
15055c11f9
|
@ -321,7 +321,12 @@ int Http2DownstreamConnection::push_request_headers()
|
||||||
http2::copy_url_component(path, &u, UF_PATH, url);
|
http2::copy_url_component(path, &u, UF_PATH, url);
|
||||||
http2::copy_url_component(query, &u, UF_QUERY, url);
|
http2::copy_url_component(query, &u, UF_QUERY, url);
|
||||||
if(path.empty()) {
|
if(path.empty()) {
|
||||||
path = "/";
|
if(!authority.empty() &&
|
||||||
|
downstream_->get_request_method() == "OPTIONS") {
|
||||||
|
path = "*";
|
||||||
|
} else {
|
||||||
|
path = "/";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(!query.empty()) {
|
if(!query.empty()) {
|
||||||
path += "?";
|
path += "?";
|
||||||
|
|
|
@ -135,15 +135,25 @@ int HttpDownstreamConnection::push_request_headers()
|
||||||
hdrs += downstream_->get_request_path();
|
hdrs += downstream_->get_request_path();
|
||||||
}
|
}
|
||||||
} else if(get_config()->http2_proxy &&
|
} else if(get_config()->http2_proxy &&
|
||||||
!downstream_->get_request_http2_scheme().empty() &&
|
!downstream_->get_request_http2_scheme().empty() &&
|
||||||
!downstream_->get_request_http2_authority().empty() &&
|
!downstream_->get_request_http2_authority().empty() &&
|
||||||
downstream_->get_request_path().c_str()[0] == '/') {
|
(downstream_->get_request_path().c_str()[0] == '/' ||
|
||||||
|
downstream_->get_request_path() == "*")) {
|
||||||
// Construct absolute-form request target because we are going to
|
// Construct absolute-form request target because we are going to
|
||||||
// send a request to a HTTP/1 proxy.
|
// send a request to a HTTP/1 proxy.
|
||||||
hdrs += downstream_->get_request_http2_scheme();
|
hdrs += downstream_->get_request_http2_scheme();
|
||||||
hdrs += "://";
|
hdrs += "://";
|
||||||
hdrs += downstream_->get_request_http2_authority();
|
hdrs += downstream_->get_request_http2_authority();
|
||||||
hdrs += downstream_->get_request_path();
|
|
||||||
|
// Server-wide OPTIONS takes following form in proxy request:
|
||||||
|
//
|
||||||
|
// OPTIONS http://example.org HTTP/1.1
|
||||||
|
//
|
||||||
|
// Notice that no slash after authority. See
|
||||||
|
// http://tools.ietf.org/html/rfc7230#section-5.3.4
|
||||||
|
if(downstream_->get_request_path() != "*") {
|
||||||
|
hdrs += downstream_->get_request_path();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// No proxy case. get_request_path() may be absolute-form but we
|
// No proxy case. get_request_path() may be absolute-form but we
|
||||||
// don't care.
|
// don't care.
|
||||||
|
|
Loading…
Reference in New Issue