Replicate document attachments

This commit adds an implementation for sending and
retrieving attachments during both push and pull
replication.

For pulling attachments, the document is downloaded and
the attachment stubs in the JSON are used to download the
document's attachments before inserting the document into
the database.

Attachments are first downloaded into the blob store, then
a transaction is created in which we insert the document and
its attachments are added to the databases.

We also need to handle GZIPped attachments.

Finally we need to handle copying over stub attachments during
forceInsert of the new documents, as we avoid downloading the
blobs for attachments we already have by using atts_since.

For pushing attachments, attachments need to be sent along
with the document to avoid creating spurious document revisions.
We do this in two ways:

1. For documents with only small[1] attachments, the attachments
   are sent inline with the document's JSON during _bulk_docs
   posts.
2. For large attachments, documents are sent using a
   multipart/related call instead of via _bulk_docs. This PR
   includes a multipart/related encoder for this.

[1] Defined per replication with a 65k default
Only update registered indexes when calling updateAllIndexes

Previously, IndexManager would try to update all indexes that exist
in the index database. This would cause an exception for those which
hadn't been registered this session with ensureIndexed as the
indexing function for those indexes wasn't known.

This patch just excludes unregistered indexes from the update process
and adds a regression test.