mirror of
https://github.com/apache/httpd.git
synced 2025-08-08 15:02:10 +03:00
*) mod_http2: change the port synthesis on upgraded h1 requests
after review by rpluem. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1898593 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -94,24 +94,25 @@ apr_status_t h2_request_rcreate(h2_request **preq, apr_pool_t *pool,
|
|||||||
* the URL for the request. r->hostname has stripped any port info that
|
* the URL for the request. r->hostname has stripped any port info that
|
||||||
* might have been present. Do we need to add it?
|
* might have been present. Do we need to add it?
|
||||||
*/
|
*/
|
||||||
if (!ap_strchr_c(authority, ':')) {
|
if (r->parsed_uri.port_str) {
|
||||||
if (r->parsed_uri.port_str) {
|
/* Yes, it was there, add it again. */
|
||||||
/* Yes, it was there, add it again. */
|
authority = apr_pstrcat(pool, authority, ":", r->parsed_uri.port_str, NULL);
|
||||||
authority = apr_pstrcat(pool, authority, ":", r->parsed_uri.port_str, NULL);
|
}
|
||||||
}
|
else if (r->parsed_uri.hostname) {
|
||||||
else if (!r->parsed_uri.hostname && r->server && r->server->port) {
|
/* client sent an absolute URI, with no port in the authority.
|
||||||
/* If there was no hostname in the parsed URL, the URL was relative.
|
* Use that also in the h2 request. */
|
||||||
* In that case, we restore port from our server->port, if it
|
}
|
||||||
* is known and not the default port for the scheme. */
|
else {
|
||||||
apr_port_t defport = apr_uri_port_of_scheme(scheme);
|
/* request came in as relative uri, meaning the client did not specify
|
||||||
if (defport != r->server->port) {
|
* a port number and we have to guess which one to use. */
|
||||||
/* port info missing and port is not default for scheme: append */
|
apr_port_t defport = apr_uri_port_of_scheme(scheme);
|
||||||
authority = apr_psprintf(pool, "%s:%d", authority,
|
apr_port_t port = ap_get_server_port(r);
|
||||||
(int)r->server->port);
|
|
||||||
}
|
if (defport != port) {
|
||||||
|
authority = apr_psprintf(pool, "%s:%d", authority, (int)port);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
req = apr_pcalloc(pool, sizeof(*req));
|
req = apr_pcalloc(pool, sizeof(*req));
|
||||||
req->method = apr_pstrdup(pool, r->method);
|
req->method = apr_pstrdup(pool, r->method);
|
||||||
req->scheme = scheme;
|
req->scheme = scheme;
|
||||||
|
Reference in New Issue
Block a user