Skip to content
This repository has been archived by the owner on Dec 9, 2024. It is now read-only.

Commit

Permalink
Add support for SSL in StreamClient
Browse files Browse the repository at this point in the history
  • Loading branch information
Damian Lee committed Apr 7, 2017
1 parent eeec709 commit bb1f59f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/Doctrine/CouchDB/HTTP/StreamClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,15 @@ protected function checkConnection($method, $path, $data, $headers)
}
}
if ($this->httpFilePointer == null) {
// TODO SSL support?
$host = $this->options['host'];
if ($this->options['port'] != 80) {
$host .= ":{$this->options['port']}";
if (!in_array($this->options['port'], [80, 443])) {
$host .= ":{$this->options['port']}";
}
// Determine the correct scheme so SSL is handled too.
$scheme = !empty($this->options['ssl']) ? 'https' : 'http';

$this->httpFilePointer = @fopen(
'http://' . $basicAuth . $host . $path,
$scheme . '://' . $basicAuth . $host . $path,
'r',
false,
stream_context_create(
Expand Down

0 comments on commit bb1f59f

Please sign in to comment.