From 63f9ff4e0efc619ab8851463bbafe8f44eb72a89 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Wed, 23 Sep 2015 03:37:51 +0200 Subject: [PATCH] Fix path of HTTP request if both a proxy and SSL are used --- .../install/files/lib/util/HTTPRequest.class.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) 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 : '')); -- 2.20.1