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

Add support for SSL in StreamClient #70

Open
wants to merge 58 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
2154063
Allow default headers to be set for clients
damiankloip Jan 10, 2017
bc2c341
Fix random fails in tests
damiankloip Jan 10, 2017
eadce31
Remove test database creation in .travis.yml
damiankloip Jan 10, 2017
e27069e
Add headers parameter from options in MultipartParserAndSender
damiankloip Jan 10, 2017
99a8fe3
Add tearDown() method for MultipartParserAndSenderTest
damiankloip Jan 10, 2017
eeec709
Merge pull request #1 from damiankloip/default-headers
damiankloip Apr 7, 2017
5055bba
Added search using Mango Query support
robsonvn May 10, 2017
9a3a517
Merge pull request #1 from damiankloip/master
robsonvn May 10, 2017
5ae947f
Revert "Add support for SSL in StreamClient"
robsonvn May 10, 2017
47dd13d
Merge pull request #2 from robsonvn/revert-1-master
robsonvn May 10, 2017
af87d45
Add functional test for find documents using Mango Query
robsonvn May 10, 2017
88824da
Merge branch 'master' of https://github.com/robsonvn/couchdb-client
robsonvn May 10, 2017
882828a
Removed all_or_nothing support. all_or_nothing is no longer available…
robsonvn May 10, 2017
2b02824
Updated testGetDatabaseInfo expected exception message to be compatib…
robsonvn May 10, 2017
0991c08
Updated testGetDatabaseInfo expected exception message to be compatib…
robsonvn May 10, 2017
e5b1e17
Updated testGetDatabaseInfo expected exception message to be compatib…
robsonvn May 10, 2017
87672c5
Updated testGetDatabaseInfo expected exception message to be compatib…
robsonvn May 10, 2017
fe58375
Updated testGetDatabaseInfo expected exception message to be compatib…
robsonvn May 10, 2017
d386a92
Updated testGetDatabaseInfo expected exception message to be compatib…
robsonvn May 10, 2017
72764db
Updated testFindRevisions to support version 2.0.0. Since the last_se…
robsonvn May 10, 2017
30b876b
Fixed tests to work with CouchDB v2.0.0
robsonvn May 10, 2017
18e5bdd
Added PHP7.1 to Travis
robsonvn May 10, 2017
a543c3e
Revert "Revert "Add support for SSL in StreamClient""
robsonvn May 10, 2017
903f595
Merge pull request #3 from robsonvn/revert-2-revert-1-master
robsonvn May 10, 2017
fd73a62
Skipping testGetChange due a result order bug on CouchDB v2.0.0. Test…
robsonvn May 10, 2017
8650416
Updated readme
robsonvn May 10, 2017
3d89b71
Installing CouchDB 2.0.0 on Travis
robsonvn May 10, 2017
01c1d80
Trying to fix CouchDB 2.00 installing on travis
robsonvn May 10, 2017
69b6d4b
Added new couchdb install file
robsonvn May 11, 2017
e4dfb13
Added new couchdb install file
robsonvn May 11, 2017
37b21d2
Using Ubuntu trusty
robsonvn May 11, 2017
2e68b52
Returing to root directory
robsonvn May 11, 2017
65d64ba
Tidying up
robsonvn May 11, 2017
7b759d2
Added suport to nested query, fields, sort, limit, skip, index. Added…
robsonvn May 15, 2017
6445dfd
Added dataset to test
robsonvn May 15, 2017
8254daf
Apply fixes from StyleCI
robsonvn May 16, 2017
1b76f66
Merge pull request #4 from robsonvn/analysis-qModyK
robsonvn May 16, 2017
b3a8d6b
Added Style CI flag; Added mango query example.
robsonvn May 16, 2017
1d48205
Removed trash
robsonvn May 22, 2017
1b906d0
Added support to create/delete mango indexes
robsonvn May 24, 2017
ddee3d5
Apply fixes from StyleCI
robsonvn May 24, 2017
8b14edd
Merge pull request #5 from robsonvn/analysis-Xa5PKx
robsonvn May 24, 2017
d0ff686
Created MangoClient and MangoQuery
robsonvn Jul 16, 2017
cf2f94a
Update README.md
robsonvn Jul 16, 2017
85f45a7
fixed phpunit garbage
robsonvn Jul 16, 2017
02185fb
Fixed phpunit.xml garbage
robsonvn Jul 16, 2017
6bfb475
Merge branch 'master' of https://github.com/robsonvn/couchdb-client
robsonvn Jul 16, 2017
b20246c
Fixed null comparison
robsonvn Jul 16, 2017
654fef1
Removed int typehint
robsonvn Jul 16, 2017
d5a8179
Update README.md
robsonvn Jul 16, 2017
d8797b0
Update README.md
robsonvn Jul 16, 2017
00538fe
Update README.md
robsonvn Jul 16, 2017
d61d12c
Update README.md
robsonvn Jul 16, 2017
7cd29b7
Merge pull request #83 from mikeSimonson/license
alcaeus Dec 22, 2017
fad64c5
Including 2.1.1 compatibility
robsonvn Apr 30, 2018
3f4b3eb
Update README.md
robsonvn Apr 30, 2018
0654638
Merge branch 'master' into master
robsonvn Apr 30, 2018
c0b1768
Add support for SSL in StreamClient
damiankloip Jan 17, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
language: php

dist: trusty
sudo: required
services:
- couchdb
- docker

php:
- 5.4
- 5.5
- 5.6
- 7.0
- 7.1

before_script:
- docker pull robsonvn/couchdb-ssl
- docker run -d -p 5984:5984 -p 6984:6984 robsonvn/couchdb-ssl
- sleep 10
- curl -X PUT localhost:5984/doctrine_test_database
- composer install

Expand Down
30 changes: 27 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Doctrine CouchDB Client
# Doctrine CouchDB v2.x Client

[![Build Status](https://travis-ci.org/doctrine/couchdb-client.png?branch=master)](https://travis-ci.org/doctrine/couchdb-client)
[![StyleCI](https://styleci.io/repos/90809440/shield?style=flat)](https://styleci.io/repos/90809440)

Simple API that wraps around CouchDBs HTTP API.

Simple API that wraps around CouchDBs v2.x HTTP API.

## Features

Expand All @@ -18,6 +20,7 @@ Simple API that wraps around CouchDBs HTTP API.
* Compaction Info and Triggering APIs
* Replication API
* Symfony Console Commands
* Find Documents using Mango Query

## Installation

Expand Down Expand Up @@ -62,6 +65,27 @@ $client->deleteDocument($id, $rev);

// Delete a database.
$client->deleteDatabase($client->getDatabase());

//Search documents using Mango Query CouchDB v2.x

$selector = ['_id'=>['$gt'=>null]];
$options = ['limit'=>1,'skip'=>1,'use_index'=>['_design/doc','index'],'sort'=>[['_id'=>'desc']]];
$query = new \Doctrine\CouchDB\Mango\MangoQuery($selector,$options);
$docs = $client->find($query);

$query = new \Doctrine\CouchDB\Mango\MangoQuery();
$query->select(['_id', 'name'])->where(['$and'=> [
[
'name'=> [
'$eq'=> 'Under the Dome',
],
'genres'=> [
'$in'=> ['Drama','Comedy'],
],
],
])->sort([['_id'=>'desc']])->limit(1)->skip(1)->use_index(['_design/doc','index']);
$docs = $client->find($query);

```

### Views
Expand Down Expand Up @@ -131,4 +155,4 @@ foreach ($result as $row) {
}
// Author Alice has written 1 articles
// Author Bob has written 2 articles
```
```
36 changes: 21 additions & 15 deletions lib/Doctrine/CouchDB/Attachment.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php


namespace Doctrine\CouchDB;

use Doctrine\CouchDB\HTTP\Client;
Expand All @@ -14,14 +13,16 @@
* binary and base64 data of everything if possible to ease the API.
*
* @license http://www.opensource.org/licenses/mit-license.php MIT
*
* @link www.doctrine-project.com
* @since 1.0
*
* @author Benjamin Eberlei <kontakt@beberlei.de>
*/
class Attachment
{
/**
* Content-Type of the Attachment
* Content-Type of the Attachment.
*
* If this is false on putting a new attachment into the database the
* generic "application/octet-stream" type will be used.
Expand Down Expand Up @@ -96,6 +97,7 @@ public function getLength()
if (!$this->stub && !is_int($this->length)) {
$this->length = strlen($this->data);
}

return $this->length;
}

Expand All @@ -122,7 +124,7 @@ public function getBase64EncodedData()
}

/**
* Lazy Load Data from CouchDB if necessary
* Lazy Load Data from CouchDB if necessary.
*
* @return void
*/
Expand Down Expand Up @@ -165,22 +167,23 @@ public function getRevPos()
public function toArray()
{
if ($this->stub) {
$json = array('stub' => true);
$json = ['stub' => true];
} else {
$json = array('data' => $this->getBase64EncodedData());
$json = ['data' => $this->getBase64EncodedData()];
if ($this->contentType) {
$json['content_type'] = $this->contentType;
}
}

return $json;
}

/**
* @param string $binaryData
* @param string $base64Data
* @param string $contentType
* @param int $length
* @param int $revPos
* @param int $length
* @param int $revPos
* @param Client $httpClient
* @param string $path
*/
Expand All @@ -189,7 +192,7 @@ final private function __construct($binaryData = null, $base64Data = null, $cont
if ($binaryData || $base64Data) {
$this->binaryData = $binaryData;
$this->data = $base64Data;
$this->stub = false;
$this->stub = false;
} else {
$this->stub = true;
}
Expand All @@ -206,10 +209,11 @@ final private function __construct($binaryData = null, $base64Data = null, $cont
* WARNING: Changes to the file handle after calling this method will *NOT* be recognized anymore.
*
* @param string|resource $data
* @param string $contentType
* @param string $contentType
*
* @return Attachment
*/
static public function createFromBinaryData($data, $contentType = false)
public static function createFromBinaryData($data, $contentType = false)
{
if (\is_resource($data)) {
$data = \stream_get_contents($data);
Expand All @@ -223,10 +227,11 @@ static public function createFromBinaryData($data, $contentType = false)
*
* @param string $data
* @param string $contentType
* @param int $revpos
* @param int $revpos
*
* @return Attachment
*/
static public function createFromBase64Data($data, $contentType = false, $revpos = false)
public static function createFromBase64Data($data, $contentType = false, $revpos = false)
{
return new self(\base64_decode($data), $data, $contentType, false, $revpos);
}
Expand All @@ -235,13 +240,14 @@ static public function createFromBase64Data($data, $contentType = false, $revpos
* Create a stub attachment that has lazy loading capabilities.
*
* @param string $contentType
* @param int $length
* @param int $revPos
* @param int $length
* @param int $revPos
* @param Client $httpClient
* @param string $path
*
* @return Attachment
*/
static public function createStub($contentType, $length, $revPos, Client $httpClient, $path)
public static function createStub($contentType, $length, $revPos, Client $httpClient, $path)
{
return new self(null, null, $contentType, $length, $revPos, $httpClient, $path);
}
Expand Down
Loading