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

Commit 1f30fcf

Browse files
committed
Add support for SSL in StreamClient
1 parent eeec709 commit 1f30fcf

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
@@ -94,13 +94,15 @@ protected function checkConnection($method, $path, $data, $headers)
9494
}
9595
}
9696
if ($this->httpFilePointer == null) {
97-
// TODO SSL support?
9897
$host = $this->options['host'];
99-
if ($this->options['port'] != 80) {
100-
$host .= ":{$this->options['port']}";
98+
if (!in_array($this->options['port'], [80, 443])) {
99+
$host .= ":{$this->options['port']}";
101100
}
101+
// Determine the correct scheme so SSL is handled too.
102+
$scheme = !empty($this->options['ssl']) ? 'https' : 'http';
103+
102104
$this->httpFilePointer = @fopen(
103-
'http://' . $basicAuth . $host . $path,
105+
$scheme . '://' . $basicAuth . $host . $path,
104106
'r',
105107
false,
106108
stream_context_create(

0 commit comments

Comments
 (0)