Skip to content
This repository was archived by the owner on Feb 5, 2024. It is now read-only.

Commit c0b1768

Browse files
committed
Add support for SSL in StreamClient
1 parent 0654638 commit c0b1768

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/Doctrine/CouchDB/HTTP/StreamClient.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,15 @@ protected function checkConnection($method, $path, $data, $headers)
8383
}
8484
}
8585
if ($this->httpFilePointer == null) {
86-
// TODO SSL support?
8786
$host = $this->options['host'];
88-
if ($this->options['port'] != 80) {
89-
$host .= ":{$this->options['port']}";
87+
if (!in_array($this->options['port'], [80, 443])) {
88+
$host .= ":{$this->options['port']}";
9089
}
90+
// Determine the correct scheme so SSL is handled too.
91+
$scheme = !empty($this->options['ssl']) ? 'https' : 'http';
92+
9193
$this->httpFilePointer = @fopen(
92-
'http://'.$basicAuth.$host.$path,
94+
$scheme.'://'.$basicAuth.$host.$path,
9395
'r',
9496
false,
9597
stream_context_create(

0 commit comments

Comments
 (0)