Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

235 lines (168 sloc) 9.376 kb
Sag Changes
Version 0.7.0
New Features
* The HTTP socket code was abstracted out of the core Sag class into its own
HTTP module. It is called SagNativeHTTPAdapter and remains the default
transport mechanism. This allows for drivers to be written that leverage
different HTTP libraries, potentially adding extra functionality. The
SagNativeHTTPAdapter is referenced by the Sag::$HTTP_NATIVE_SOCKETS static
public variable and can be specified with the setHTTPAdapter() function.
(closes #12)
* cURL can now be used when communicating with CouchDB, allowing for
additional functionality. If your system has the cURL PHP extension
installed then you can tell Sag to use it by calling
* SSL is now supported if you use cURL instead of native sockets. This
introduces setSSL() to turn SSL on/off, and setSSLCert() to specify a
certificate file to verify against. Verification is only supported if you
provide a certificate with setSSLCert(). HTTP libraries that do not support
SSL (ie., native sockets) will throw a SagException if you call an SSL
* You can now tell getAllDocs() to sort in descending order. Thanks to cygal
(github/cygal) for the patch and pull request. (closes #31)
Fixed Bugs
* If you set the database name and then set it again with the same value, but
also specify to create the database if it doesn't exist, Sag was previously
not checking to see if it should create the database. This is not fixed:
even if you specify the currentDatabase() value as the name the check will
still run. (closes #33)
Version 0.6.1
Fixed Bugs
* Fixed a typo bug where I was trying to throw the concept of an Exception
instead of an instantiation. Luckily it is rare for this corner case in the
code to run. Thanks to Oliver Kurowski (github/a4mc) for reporting.
(closes #26)
* Fixed a problem with the HTTP/1.1 decoding of chunked message bodies that
was causing continuous change feed requests (/db/_changes?continuous=true)
to fail. (closes #27)
* Fixed a typo bug in examples/phpSessions, changed createdOn to createdAt.
Thanks to Yo-Han (github/yo-han) for finding the bug and submitting the
patch as a pull request. (closes #28)
Version 0.6.0
Breaking Changes
* The HTTP status was incorrectly being added to the root of the response
object in addition to where it belongs in `$resp->headers->_HTTP->status`.
It is now removed. Applications that were using it at the `$resp->status`
should fix their code to use the proper location.
New Features
* Sag's internals now use HTTP/1.1 instead of HTTP/1.0. This requires zero
code changes for your application because Sag's interface is not impacted
by this.
* You can now set cookies that will be sent with every request using
setCookie(), and retrieve them with getCookie().
* SagUserUtils is the first of several utility classes that will be added to
Sag. It gently wraps the Sag interface to make managing CouchDB users much
easier. You can create and get users, and change their password.
* An example of how to proxy the cookie based auth's AuthSession cookie from
your PHP layer to CouchDB, making it easier to have user accounts in your
application without rewriting user management yet again.
* Support for the server level _session object with getSession(). Thanks to
Tim Juravich for the original patch.
Fixed Bugs
* As of CouchDB 1.1.0 inline attachments are sent as multipart HTTP
responses, which was breaking our parser. This is now fixed by always
sending an Accept header for 'application/json'. Thanks to Rob Newson and
Dale Harvey in #couchdb for helping on this. (closes #23)
* Previously an HTTP response code >=400 to a HEAD request would not throw a
SagCouchException because there was no error property in the message body
(because HEAD responses do not have bodies). Now a SagCouchException is
thrown as expected with the exception's code set to the HTTP response code.
This also creates a slight performance boost for parsing HEAD requests.
* When calling setDatabase() and specifying to create the database if it does
not already exist, the logic now uses a HEAD request instead of a GET. This
was a typo/mistake at the time, so it is getting bug status.
Version 0.5.1
Fixed Bugs
* Previously PUT was caching CouchDB's response, which created unexpected
results (the actual data being POST'd was expected to be cached). This is
now fixed: that data provided to post() is combined with the server's
response to create a cacheable object whose headers will not be entirely
accurate. POST is still not cached because CouchDB does not respond with an
E-tag to cache against. Thanks to Peter Kruithof for reporting and original
patch. (closes #17)
* setAttachment() now properly URL encodes the ?rev parameter when you
specify the document's _rev (last function parameter). Thanks to skyshard
for reporting the issue and the fix. (closes #19)
Version 0.5.0
Breaking Changes
* These Sag class functions now return the class's current instance ($this):
decode, setDatabase, setOpenTimeout, setRWTimeout, setCache,
setStaleDefault. This allows configuration functions to be chained before
you make a call to CouchDB. (closes #14)
* Sag->setDatabase() will now URL encode database names that are passed to
it. This may break your code if you were already encoding database names
before passing them. For example,
`$sag->setDatabase(urlencode('some/db'));` will no longer work as expected.
Instead use `$sag->setDatabase('some/db');`.
New Features
* Sag now supports connection pooling for sockets with HTTP's Connection:
Keep-Alive. This means Sag no longer opens and closes a socket for each
request made (better performance). No management is provided for the
maximum number of sockets that can be kept open, since this should be done
at the operating system level (ulimit or pam for Linux/Unix). (closes #15)
* Adding support for CouchDB 1.1.x, while dropping support for 0.11.x - most
of, or all of, 0.11.x will still work with Sag.
* Added the examples/ directory with an example of how one could store PHP
session data in CouchDB. Related blog post:
* Added tests/bootstrap.php to make running the tests easier.
Fixed Bugs
* All functions that take query parameters as function parameters, such as
'startkey' in Sag->getAllDocs(), now URL encode those parameters before
adding them to the URL. However, functions that you pass whole URLs to,
like Sag->get(), do not deconstruct the URL for parameters - you must do
your own URL encoding when providing a full URL to a function.
* Sag->bulk() no longer attempts to cache. This is not a breaking change,
because it was never able to successfully cache before.
Version 0.4.0
New Features
* When initiated, Sag checks the PHP environment for unsupported
error_reporting values. Thanks to Simeon Willbanks. (closes #8, #9)
* setStaleDefault() was created to easily allow developers the choice of
making all of their GET and HEAD requests use stale=ok or not. This is
great for production systems that do all their querying against stale
views, allowing another process to trigger index updates based on the
_changes feed.
* Now when calling setDatabase() you can tell it to create the database if it
does not exist (uses an HTTP GET to check if it exists). If the database
does not exist, then createDatabase() is called to create it.
Fixed Bugs
* Fixed a bug where an invalid Content-Size was being sent even if no data
was passed to the packet.
* Fixed a bug in POST where an incorrect variable name was being used,
allowing improper paths to be sent to CouchDB.
* When caching, bulk() now iterates over the documents it's trying to update
and sends them to the cache. If a document's _deleted property is true,
then it's removed from the cache.
Version 0.3
New Features
* Cookie based authentication. Thanks to Benjamin Young. (closes #1)
* Cache results with the SagCache interface. Currently supports caching to
disk with SagFileCache.
* Support for HEAD requests. Thanks to Doug Cone. (closes #3)
* You can now POST to any URI in the database, adding a second $uri parameter
to the post() function. Allows POST'ing to views. Thanks to Peter Kruithof.
(closes #7)
* Exposing CouchDB's runtime _stats interface with the getStats() function.
Fixed Bugs
* getAllDocs() no longer always includes documents. Thanks to
Version 0.2
* Officially adding support for 1.0.x and dropping support for 0.10.x.
New Features
* Native support for attachments.
* Internal support for different Content-Type values.
* Can set timeout on socket connection.
* Can set timeout on socket read/write.
Fixed Bugs
* Removed leading white space in header values.
* Fixed ending line breaks when sending data via a PUT.
Jump to Line
Something went wrong with that request. Please try again.