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

Commit 47dd13d

Browse files
authored
Merge pull request #2 from robsonvn/revert-1-master
Revert "Add support for SSL in StreamClient"
2 parents 9a3a517 + 5ae947f commit 47dd13d

File tree

10 files changed

+7
-46
lines changed

10 files changed

+7
-46
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ php:
1010
- 7.0
1111

1212
before_script:
13+
- curl -X PUT localhost:5984/doctrine_test_database
1314
- composer install
1415

1516
script:

lib/Doctrine/CouchDB/CouchDBClient.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ static public function create(array $options)
122122
'path' => null,
123123
'logging' => false,
124124
'timeout' => 10,
125-
'headers' => array(),
126125
);
127126
$options = array_merge($defaults, $options);
128127

@@ -140,8 +139,7 @@ static public function create(array $options)
140139
$options['ip'],
141140
$options['ssl'],
142141
$options['path'],
143-
$options['timeout'],
144-
$options['headers']
142+
$options['timeout']
145143
);
146144
if ($options['logging'] === true) {
147145
$connection = new HTTP\LoggingClient($connection);

lib/Doctrine/CouchDB/HTTP/AbstractHTTPClient.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ abstract class AbstractHTTPClient implements Client
3030
'username' => null,
3131
'password' => null,
3232
'path' => null,
33-
'headers' => array(),
3433
);
3534

3635
/**
@@ -46,11 +45,9 @@ abstract class AbstractHTTPClient implements Client
4645
* @param string $ip
4746
* @param bool $ssl
4847
* @param string $path
49-
* @param int $timeout
50-
* @param array $headers
5148
* @return \Doctrine\CouchDB\HTTP\AbstractHTTPClient
5249
*/
53-
public function __construct($host = 'localhost', $port = 5984, $username = null, $password = null, $ip = null , $ssl = false, $path = null, $timeout = 10, array $headers = array())
50+
public function __construct($host = 'localhost', $port = 5984, $username = null, $password = null, $ip = null , $ssl = false, $path = null, $timeout = 10)
5451
{
5552
$this->options['host'] = (string) $host;
5653
$this->options['port'] = (int) $port;
@@ -59,7 +56,6 @@ public function __construct($host = 'localhost', $port = 5984, $username = null,
5956
$this->options['password'] = $password;
6057
$this->options['path'] = $path;
6158
$this->options['timeout'] = (float) $timeout;
62-
$this->options['headers'] = $headers;
6359

6460
if ($ip === null) {
6561
$this->options['ip'] = gethostbyname($this->options['host']);
@@ -90,7 +86,6 @@ public function setOption( $option, $value )
9086
break;
9187

9288
case 'http-log':
93-
case 'headers':
9489
case 'password':
9590
case 'username':
9691
$this->options[$option] = $value;

lib/Doctrine/CouchDB/HTTP/MultipartParserAndSender.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ public function __construct(
5050
$sourceOptions['ip'],
5151
$sourceOptions['ssl'],
5252
$sourceOptions['path'],
53-
$sourceOptions['timeout'],
54-
$sourceOptions['headers']
53+
$sourceOptions['timeout']
5554
);
5655

5756
$targetOptions = $target->getOptions();
@@ -63,8 +62,7 @@ public function __construct(
6362
$targetOptions['ip'],
6463
$targetOptions['ssl'],
6564
$targetOptions['path'],
66-
$targetOptions['timeout'],
67-
$sourceOptions['headers']
65+
$targetOptions['timeout']
6866
);
6967
}
7068

lib/Doctrine/CouchDB/HTTP/SocketClient.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,6 @@ protected function buildRequest(
159159
// available in the locale net.
160160
$request .= "Connection: " . ($this->options['keep-alive'] ? 'Keep-Alive' : 'Close') . "\r\n";
161161

162-
if ($this->options['headers']) {
163-
$headers = array_merge($this->options['headers'], $headers);
164-
}
165162
if (!isset($headers['Content-Type'])) {
166163
$headers['Content-Type'] = 'application/json';
167164
}

lib/Doctrine/CouchDB/HTTP/StreamClient.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,6 @@ protected function checkConnection($method, $path, $data, $headers)
8181
if ($this->options['username']) {
8282
$basicAuth .= "{$this->options['username']}:{$this->options['password']}@";
8383
}
84-
if ($this->options['headers']) {
85-
$headers = array_merge($this->options['headers'], $headers);
86-
}
8784
if (!isset($headers['Content-Type'])) {
8885
$headers['Content-Type'] = 'application/json';
8986
}

tests/Doctrine/Tests/CouchDB/CouchDBClientTest.php

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ public function testCreateClientFromUrl()
3939
'timeout' => 10,
4040
'keep-alive' => true,
4141
'path' => null,
42-
'headers' => array(),
4342
),
4443
$client->getHttpClient()->getOptions()
4544
);
@@ -61,24 +60,11 @@ public function testCreateClientFromUrlWithPath()
6160
'timeout' => 10,
6261
'keep-alive' => true,
6362
'path' => 'baz/qux',
64-
'headers' => array(),
6563
),
6664
$client->getHttpClient()->getOptions()
6765
);
6866
}
6967

70-
public function testCreateClientWithDefaultHeaders()
71-
{
72-
$client = CouchDBClient::create(array('dbname' => 'test', 'headers' => array('X-Test' => 'test')));
73-
$http_client = $client->getHttpClient();
74-
$connection_options = $http_client->getOptions();
75-
$this->assertSame(array('X-Test' => 'test'), $connection_options['headers']);
76-
77-
$http_client->setOption('headers', array('X-Test-New' => 'new'));
78-
$connection_options = $http_client->getOptions();
79-
$this->assertSame(array('X-Test-New' => 'new'), $connection_options['headers']);
80-
}
81-
8268
public function testCreateClientWithLogging()
8369
{
8470
$client = CouchDBClient::create(array('dbname' => 'test', 'logging' => true));

tests/Doctrine/Tests/CouchDB/CouchDBFunctionalTestCase.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,7 @@ abstract class CouchDBFunctionalTestCase extends \PHPUnit_Framework_TestCase
99
{
1010
private $httpClient = null;
1111

12-
protected function tearDown() {
13-
parent::tearDown();
14-
$this->createCouchDBClient()->deleteDatabase($this->getTestDatabase());
15-
}
16-
17-
/**
12+
/**
1813
* @return \Doctrine\CouchDB\HTTP\Client
1914
*/
2015
public function getHttpClient()

tests/Doctrine/Tests/CouchDB/Functional/CouchDBClientTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ class CouchDBClientTest extends \Doctrine\Tests\CouchDB\CouchDBFunctionalTestCas
1414
public function setUp()
1515
{
1616
$this->couchClient = $this->createCouchDBClient();
17-
$this->couchClient->createDatabase($this->getTestDatabase());
1817
}
1918

2019
public function testGetUuids()
@@ -74,6 +73,7 @@ public function testDropMultipleTimesSkips()
7473
*/
7574
public function testCreateDuplicateDatabaseThrowsException()
7675
{
76+
$this->couchClient->createDatabase($this->getTestDatabase());
7777
$this->setExpectedException('Doctrine\CouchDB\HTTP\HTTPException', 'HTTP Error with status 412 occurred while requesting /'.$this->getTestDatabase().'. Error: file_exists The database could not be created, the file already exists.');
7878
$this->couchClient->createDatabase($this->getTestDatabase());
7979
}

tests/Doctrine/Tests/CouchDB/Functional/HTTP/MultipartParserAndSenderTest.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,6 @@ public function setUp()
5252

5353
}
5454

55-
public function tearDown()
56-
{
57-
parent::tearDown();
58-
$this->createCouchDBClient()->deleteDatabase($this->getTestDatabase() . '_multipart_copy');
59-
}
60-
6155
public function testRequestThrowsHTTPExceptionOnEmptyStatus()
6256
{
6357
$this->setExpectedException(

0 commit comments

Comments
 (0)