From: Tim Düsterhus Date: Wed, 23 Sep 2015 01:37:51 +0000 (+0200) Subject: Fix path of HTTP request if both a proxy and SSL are used X-Git-Tag: 2.1.8~39 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=63f9ff4e0efc619ab8851463bbafe8f44eb72a89;p=GitHub%2FWoltLab%2FWCF.git Fix path of HTTP request if both a proxy and SSL are used --- diff --git a/wcfsetup/install/files/lib/util/HTTPRequest.class.php b/wcfsetup/install/files/lib/util/HTTPRequest.class.php index d8d26687cc..3393441fda 100644 --- a/wcfsetup/install/files/lib/util/HTTPRequest.class.php +++ b/wcfsetup/install/files/lib/util/HTTPRequest.class.php @@ -219,8 +219,16 @@ final class HTTPRequest { */ private function setURL($url) { $parsedUrl = $originUrl = parse_url($url); + + $this->originUseSSL = $originUrl['scheme'] === 'https'; + $this->originHost = $originUrl['host']; + $this->originPort = isset($originUrl['port']) ? $originUrl['port'] : ($this->originUseSSL ? 443 : 80); + if (PROXY_SERVER_HTTP) { $parsedUrl = parse_url(PROXY_SERVER_HTTP); + } + + if (PROXY_SERVER_HTTP && !$this->originUseSSL) { $this->path = $url; } else { @@ -232,10 +240,6 @@ final class HTTPRequest { $this->port = isset($parsedUrl['port']) ? $parsedUrl['port'] : ($this->useSSL ? 443 : 80); $this->query = isset($parsedUrl['query']) ? $parsedUrl['query'] : ''; - $this->originUseSSL = $originUrl['scheme'] === 'https'; - $this->originHost = $originUrl['host']; - $this->originPort = isset($originUrl['port']) ? $originUrl['port'] : ($this->originUseSSL ? 443 : 80); - // update the 'Host:' header if URL has changed if ($this->url != $url) { $this->addHeader('host', $this->originHost.($this->originPort != ($this->originUseSSL ? 443 : 80) ? ':'.$this->originPort : ''));