Allow TDURLProtocol and CouchCocoa to access multiple TDServers

This allows TouchDB databases in arbitrary locations in the filesystem to be accessed using CouchCocoa. Each TDServer is associated with a different hostname, which allows them to have distinct URLs.

Conflicts:

	TouchDB.xcodeproj/project.pbxproj
	TouchDB.xcodeproj/xcshareddata/xcschemes/iOS Demo.xcscheme
Speculative fix for a crash in -[TDSocketChangeTracker start]

Make sure that calling -stop always cancels a pending delayed connection retry.
(Crash was reported via email, by Nicolas Lapomarda.)
Revision IDs should be deterministic

Make revision ID a digest of the document & attachments. Fixes #56.
This means that if the same change is made to a document in two databases, it will not cause a conflict when they sync with each other (because the rev IDs will be the same.)
It also means that if some conflict occurs, and two peers fix it in the same way, the fixes will not conflict with each other.
Added unit tests for TDCanonicalJSON

These caught an edge case, where ASCII 31 (\037) wasn't being escaped in strings.
Handle a single attachment without a digest in a multipart download

Attachment metadata without a digest property is a problem in multipart downloads because we can't figure out how to match the metadata with the MIME bodies.
But the case where there's only one attachment is easy, since no mixup is possible.
This is a partial workaround for issue #61.
Status code (TDStatus) overhaul

* Use symbolic constants for codes, i.e. kTDStatusNotFound instead of 404.
* Add extra, more detailed status codes and map them to custom response messages.
Include still current documents from previous indexing attempts in the list of conflicts.
Catch exception in TDRouter and return a 500 status.
Make GET of _all_docs and _changes cacheable.

These now set the Etag response header, and check If-None-Match: and return a 304 if it matches. (Only applies to _changes in default mode, not continuous or longpoll.)

Also added some unit tests to verify cacheability.
Merge remote-tracking branch 'refs/remotes/origin/master' into syncpoint

Conflicts:
	Source/ChangeTracker/TDRemoteRequest.m
	Source/TDDatabase+Insertion.m
	Source/TDMisc.m
	Source/TDURLProtocol.m
	TouchDB.xcodeproj/project.pbxproj
Remove TDHexString, in favor of TDHexFromBytes from master branch

I added the same utility function in both branches, with different names :-p

This will require a fix in Syncpoint, which calls TDHexString.
added TDStatus.h to header files included with the iOS framework
Merge pull request #66 from pegli/issue64

added TDStatus.h to header files included with the iOS framework
Add extensible authorization interface to replicator.

A TDReplicator can be given a TDAuthorizer object, which is given access to requests before they're sent and can add authorization headers.
TDAuthorizer is just a protocol, which can be implemented to do anything from basic auth to OAuth.
A TDBasicAuthorizer is provided for basic auth.
Return custom HTTP error messages

Propagate the new error messages to the response from TDURLProtocol.
Unfortunately I can't get them into the regular HTTP status line, but they do show up in the JSON body.
Moved TDCollateRevIDs to TDRevision.m, and added TDCompareRevIDs.

Small cleanup for the next commit, which needs TDCompareRevIDs.
Fixes for indexing documents in conflict

There were a couple of problems in the situation where you're indexing a new revision that conflicts with an already-indexed revision.
(a) If the new revision is the 'winner', the previously-emitted view rows for the earlier revision need to be removed, because that revision's not visible anymore. Otherwise you can have two revs of the same document showing up in the index.
(b) If the new revision is the 'loser', the *older* revision needs to be indexed again, with the new emitted rows *replacing* the old ones. This is because the map function needs to see the new _conflicts array in the doc properties.

This fixes #65, which reported case (a). Case (b) I noticed on my own and fixed at the same time.
Updated README, and added some Apache license comments

The README now points out that Xcode 4.3 is required (because of the use of forward references to methods.)
Merge remote-tracking branch 'refs/remotes/origin/master' into syncpoint
Fixed mixed-up progress counting in TDPuller

It was incrementing changesTotal too much, so it looked like replications never finished.

Also fixed a case where changesProcessed didn't get incremented upon an HTTP error.