Skip to content

Commit

Permalink
Fix HttpSocket test to actually reset protocols for correct test. Mod…
Browse files Browse the repository at this point in the history
…ify HttpSocket so that Https with non-passed in protocol doesn't set it to tcp and fail test.
  • Loading branch information
MelvinRoss committed Jun 12, 2014
1 parent 460cc29 commit ad4dbdc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/Cake/Network/Http/HttpSocket.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ public function request($request = array()) {
if (!empty($this->request['body']) && !isset($this->request['header']['Content-Length'])) { if (!empty($this->request['body']) && !isset($this->request['header']['Content-Length'])) {
$this->request['header']['Content-Length'] = strlen($this->request['body']); $this->request['header']['Content-Length'] = strlen($this->request['body']);
} }
if (isset($this->request['uri']['scheme']) && $this->request['uri']['scheme'] === 'https' && empty($this->config['protocol'])) { if (isset($this->request['uri']['scheme']) && $this->request['uri']['scheme'] === 'https' && in_array($this->config['protocol'], array(false, 'tcp'))) {
$this->config['protocol'] = 'ssl'; $this->config['protocol'] = 'ssl';
} }


Expand Down
5 changes: 4 additions & 1 deletion lib/Cake/Test/Case/Network/Http/HttpSocketTest.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ public function testRequest() {
) )
) )
), ),
'reset9' => array( 'reset10' => array(
'config.protocol' => 'ssl' 'config.protocol' => 'ssl'
), ),
array( array(
Expand Down Expand Up @@ -524,6 +524,9 @@ public function testRequest() {
) )
) )
), ),
'reset11' => array(
'config.protocol' => 'ssl'
),
array( array(
'request' => array( 'request' => array(
'method' => 'POST', 'method' => 'POST',
Expand Down

0 comments on commit ad4dbdc

Please sign in to comment.