From 3eb352c535ea6d9d8bc3ec82162a30a62724ba40 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Thu, 18 Dec 2014 22:44:36 +0100 Subject: [PATCH] Revert "Properly support certificate validation if a HTTP proxy is used" This reverts commit c79b8fcb3e9db22ac5b4c558a8ed7a3d68f3eb80. --- wcfsetup/install/files/lib/system/io/RemoteFile.class.php | 7 ++----- wcfsetup/install/files/lib/util/HTTPRequest.class.php | 6 +----- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/wcfsetup/install/files/lib/system/io/RemoteFile.class.php b/wcfsetup/install/files/lib/system/io/RemoteFile.class.php index ba17cb01d5..da47f6a843 100644 --- a/wcfsetup/install/files/lib/system/io/RemoteFile.class.php +++ b/wcfsetup/install/files/lib/system/io/RemoteFile.class.php @@ -51,14 +51,11 @@ class RemoteFile extends File { * @param integer $timeout * @param array $options */ - public function __construct($host, $port, $timeout = 30, $options = array()) { + public function __construct($host, $port, $timeout = 30) { $this->host = $host; $this->port = $port; - if (!preg_match('/^[a-z0-9]+:/', $this->host)) $this->host = 'tcp://'.$this->host; - - $context = stream_context_create($options); - $this->resource = @stream_socket_client($this->host.':'.$this->port, $this->errorNumber, $this->errorDesc, $timeout, STREAM_CLIENT_CONNECT, $context); + $this->resource = @fsockopen($host, $port, $this->errorNumber, $this->errorDesc, $timeout); if ($this->resource === false) { throw new SystemException('Can not connect to ' . $host, 0, $this->errorDesc); } diff --git a/wcfsetup/install/files/lib/util/HTTPRequest.class.php b/wcfsetup/install/files/lib/util/HTTPRequest.class.php index 2c55563d84..867eb942bd 100644 --- a/wcfsetup/install/files/lib/util/HTTPRequest.class.php +++ b/wcfsetup/install/files/lib/util/HTTPRequest.class.php @@ -249,11 +249,7 @@ final class HTTPRequest { */ public function execute() { // connect - $remoteFile = new RemoteFile(($this->useSSL ? 'ssl://' : '').$this->host, $this->port, $this->options['timeout'], array( - 'ssl' => array( - 'peer_name' => $this->originHost - ) - )); + $remoteFile = new RemoteFile(($this->useSSL ? 'ssl://' : '').$this->host, $this->port, $this->options['timeout']); if ($this->originUseSSL && PROXY_SERVER_HTTP) { if ($this->useSSL) throw new SystemException("Unable to proxy HTTPS when using TLS for proxy connection"); -- 2.20.1