Skip to content

Commit

Permalink
Fix proxy authentication when SSL is used
Browse files Browse the repository at this point in the history
  • Loading branch information
RichieB2B committed Dec 11, 2015
1 parent 1af5d23 commit e315fb6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/Cake/Network/CakeSocket.php
Expand Up @@ -189,6 +189,9 @@ public function connect() {
$this->config['request']['uri']['port'] . ' HTTP/1.1';
$req[] = 'Host: ' . $this->config['host'];
$req[] = 'User-Agent: php proxy';
if(!empty($this->config['proxyauth'])) {
$req[] = 'Proxy-Authorization: ' . $this->config['proxyauth'];
}

fwrite($this->connection, implode("\r\n", $req) . "\r\n\r\n");

Expand Down
7 changes: 7 additions & 0 deletions lib/Cake/Network/Http/HttpSocket.php
Expand Up @@ -668,6 +668,13 @@ protected function _setProxy() {
throw new SocketException(__d('cake_dev', 'The %s does not support proxy authentication.', $authClass));
}
call_user_func_array("$authClass::proxyAuthentication", array($this, &$this->_proxy));

if (!empty($this->request['header']['Proxy-Authorization'])) {
$this->config['proxyauth'] = $this->request['header']['Proxy-Authorization'];
if ($this->request['uri']['scheme'] === 'https') {
$this->request['header'] = Hash::remove($this->request['header'], 'Proxy-Authorization');
}
}
}

/**
Expand Down

0 comments on commit e315fb6

Please sign in to comment.