* It supports POST, SSL, Basic Auth etc.
*
* @author Tim Duesterhus
- * @copyright 2001-2014 WoltLab GmbH
+ * @copyright 2001-2015 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package com.woltlab.wcf
* @subpackage util
*/
private function setURL($url) {
$parsedUrl = $originUrl = parse_url($url);
- if (PROXY_SERVER_HTTP) {
- $parsedUrl = parse_url(PROXY_SERVER_HTTP);
+
+ $this->originUseSSL = $originUrl['scheme'] === 'https';
+ $this->originHost = $originUrl['host'];
+ $this->originPort = isset($originUrl['port']) ? $originUrl['port'] : ($this->originUseSSL ? 443 : 80);
+
+ if (PROXY_SERVER_HTTP && !$this->originUseSSL) {
$this->path = $url;
}
else {
$this->path = isset($parsedUrl['path']) ? $parsedUrl['path'] : '/';
}
+ if (PROXY_SERVER_HTTP) {
+ $parsedUrl = parse_url(PROXY_SERVER_HTTP);
+ }
+
$this->useSSL = $parsedUrl['scheme'] === 'https';
$this->host = $parsedUrl['host'];
$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 : ''));
*/
public function execute() {
// connect
- $remoteFile = new RemoteFile(($this->useSSL ? 'ssl://' : '').$this->host, $this->port, $this->options['timeout']);
+ $remoteFile = new RemoteFile(($this->useSSL ? 'ssl://' : '').$this->host, $this->port, $this->options['timeout'], array(
+ 'ssl' => array(
+ 'peer_name' => $this->originHost
+ )
+ ));
if ($this->originUseSSL && PROXY_SERVER_HTTP) {
if ($this->useSSL) throw new SystemException("Unable to proxy HTTPS when using TLS for proxy connection");