Fix path of HTTP request if both a proxy and SSL are used
authorTim Düsterhus <duesterhus@woltlab.com>
Wed, 23 Sep 2015 01:37:51 +0000 (03:37 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Wed, 23 Sep 2015 01:38:43 +0000 (03:38 +0200)
wcfsetup/install/files/lib/util/HTTPRequest.class.php

index d8d26687cc5e0eeca6598db9d4fb6cfc2ab880e6..3393441fda36b993d5e752463829cfed47d3e0fa 100644 (file)
@@ -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 : ''));