TDPusher: Detect errors from _bulk_docs calls

If some of the docs fail to save it doesn't cause _bulk_docs to return an error;
rather, the JSON response will include individual errors for each doc. TDPusher
wasn't checking these, so it never found out about errors.
Fixed a race condition saving checkpoint

If the _db reference got nilled out before the remote checkpoint could be saved,
the local checkpoint wouldn't be updated. Then on the next sync the two checkpoints
would be out of sync, forcing sync to restart from sequence 0.
Fix TDPusher never starting sometimes after creating the remote DB

If TDPusher created the remote database, a logic glitch would sometimes cause it to never
start the replication.
Set correct Accept: header when GETting remote docs

TDMultipartDownloader was setting the Accept header to just "multipart/related",
but it does also accept JSON. Added ", application/json" to the Accept value so that
a remote server that doesn't do multipart won't reject the request with a 415.
Oops, _bulk_docs response is an array not a dictionary

Fixes regression introduced by 2c6692a.
Bump version to 0.971 (beta 7 candidate 1)
TDPusher supports servers that don't accept multipart PUTs
Fix edge case where TDPuller never stops if told to stop before it catches up

This in turn was resulting in the puller never re-starting after the app was reactivated.
Fixes #169 (I hope)
Really fix edge case where TDPuller never stops if told to stop before it catches up

There was a second place in the code where I needed to make the same change,
to make the fix really work...
Fixes #169 (I hope, again)
TDConnectionChangeTracker should honor a username in the URL

When looking up an auth credential, use the username in the URL if present.
This will prevent trying to use the wrong credentials if another username exists
in the keychain/credential store.
Avoid intermittent crash after stopping TDPuller

If a TDPuller remote request completes after the puller's been stopped,
avoid trying to send more requests, since the database connection is gone.
Fixes #179
Bump version to 0.981 (beta 8 candidate 1)
The return of TDSocketChangeTracker

* Fixes #177: Using it instead of TDConnectionChangeTracker to get around running out of sockets with 5+ replications active at once. (Also fixes #124 since the hostname-munging workaround is no longer needed.)
* It now uses CFReadStreamCreateForHTTPRequest.
* It now supports one-shot and long-poll modes, not just continuous.
Fix incorrect _changes entry after attachment update

Direct PUT or DELETE of an attachment was sending an incorrect notification to
pending _changes feeds that had include_docs -- the doc body was missing the _attachments property.
Fixes #180.
Make new change-tracker able to use custom TDAuthorizer (incl. OAuth)
TDSocketChangeTracker should stop when it gets an HTTP response error.
Increase max number of puller connections from 4 to 12

This was lowered from 8 to 4 a month ago by commit facc703, but
(a) that had a pretty major hit on performance, and
(b) I think the bug that fixed was actually caused by the _changes feed deadlock I just eliminated by restoring TDSocketChangeTracker.
Fixed an exception in the iOS demo's validation function

It would raise an exception if the "created_at" property of a doc was a non-string.
Optimize reduced/grouped queries through lazy parsing

Avoid parsing the keys and values from the index unless it's necessary.
This can speed up some queries a lot, if the reduce function doesn't access the keys or the values.
Converted to ARC.

Merged, and more fixes added, by Jens.