mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Addapted quick hack from issue #2057 for 2.6.3
This commit is contained in:
parent
07de23a692
commit
54a3f8724b
2 changed files with 30 additions and 1 deletions
|
@ -130,7 +130,7 @@ class CakeSocket {
|
||||||
}
|
}
|
||||||
|
|
||||||
$scheme = null;
|
$scheme = null;
|
||||||
if (!empty($this->config['protocol']) && strpos($this->config['host'], '://') === false) {
|
if (!empty($this->config['protocol']) && strpos($this->config['host'], '://') === false && empty($this->config['proxy'])) {
|
||||||
$scheme = $this->config['protocol'] . '://';
|
$scheme = $this->config['protocol'] . '://';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,6 +170,34 @@ class CakeSocket {
|
||||||
if ($this->connected) {
|
if ($this->connected) {
|
||||||
stream_set_timeout($this->connection, $this->config['timeout']);
|
stream_set_timeout($this->connection, $this->config['timeout']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!empty($this->config['request']) && $this->config['request']['uri']['scheme'] == 'https' && !empty($this->config['proxy'])) {
|
||||||
|
$req = array();
|
||||||
|
$req[] = 'CONNECT '. $this->config['request']['uri']['host'] . ':' . $this->config['request']['uri']['port'] . ' HTTP/1.1';
|
||||||
|
$req[] = 'Host: ' . $this->config['host'];
|
||||||
|
$req[] = 'User-Agent: php proxy';
|
||||||
|
|
||||||
|
fwrite($this->connection, implode("\r\n", $req)."\r\n\r\n");
|
||||||
|
|
||||||
|
while(true) {
|
||||||
|
$s = rtrim(fgets($this->connection, 4096));
|
||||||
|
if(preg_match('/^$/', $s)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$modes = array(STREAM_CRYPTO_METHOD_TLS_CLIENT,
|
||||||
|
STREAM_CRYPTO_METHOD_SSLv3_CLIENT,
|
||||||
|
STREAM_CRYPTO_METHOD_SSLv23_CLIENT,
|
||||||
|
STREAM_CRYPTO_METHOD_SSLv2_CLIENT);
|
||||||
|
$success = false;
|
||||||
|
foreach($modes as $mode) {
|
||||||
|
$success = stream_socket_enable_crypto($this->connection, true, $mode);
|
||||||
|
if ($success) break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $this->connected;
|
return $this->connected;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -652,6 +652,7 @@ class HttpSocket extends CakeSocket {
|
||||||
}
|
}
|
||||||
$this->config['host'] = $this->_proxy['host'];
|
$this->config['host'] = $this->_proxy['host'];
|
||||||
$this->config['port'] = $this->_proxy['port'];
|
$this->config['port'] = $this->_proxy['port'];
|
||||||
|
$this->config['proxy'] = true;
|
||||||
|
|
||||||
if (empty($this->_proxy['method']) || !isset($this->_proxy['user'], $this->_proxy['pass'])) {
|
if (empty($this->_proxy['method']) || !isset($this->_proxy['user'], $this->_proxy['pass'])) {
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue