Move query server related stats from couch to couch_mrview
Remove couch_query_servers:map_docs/2

It's not being used since couch_mrview introduction which provides own
couch_mrview_updater:map_docs/2 and actually uses it instead.
Make couch_stream monitor the stream opener

This commit fixes a process leak which would happen when a process
opened a couch_stream and exited with reason normal before closing
the stream.

This patch makes the couch_stream gen_server monitor the process
which opens the stream. When that monitor sends an exit signal
the couch_stream gen_server is stopped and the process dies.

Closes COUCHDB-2365
Fix header for documents with newlines in the name

Properly urlencode the Document-Id in the Location field of the
header

Based on a patch from Sean Bartell <wingedtachikoma@gmail.com>

Added some eunit-tests

COUCHDB-708
extract couch_httpd changes API in its own module
add supports of view changes in the _changes API

Now when the option `seq_indexed=true` is set in the design doc, the
view filter in _changes will use it to retrieve the results. Compared to
the current way, using a view index will be faster to retrieve changes.
It also gives the possibility to filter changes by key or get changes in
a key range. All the view options can be used.

Note 1: if someone is trying to filter a changes with view options when
the views are not indexed by sequence, a 400 error will be returned.
Note 2: The changes will only be returned when the view is updated if
seq_indexed=true
couch_httpd_changes: check removed keys from the view filter

Make sure to only emit deleted document when a deleted key is passed to
the view filter.

Conflicts:
	src/couch_httpd_changes.erl
Add preliminary version of view changes
Make feed=continuous work for view changes
Fix view changes feed=continuous
Add view filtering optimization to changes feeds
Add rev to view changes respose. See couch_mrview for corresponding changes
Open view in changes start function rather than outside
Make include_docs=true work for view changes
Refactor code for sanity and so the view changes handler can reuse code better
Fix rebase. Squash later
fix silly mistake
Add comment and do minor refactoring
Make _view_changes return one row per seq

This commit makes view changes return one row per seq rather than one
row per key/seq pair. Since the seq btree is keyed on key and seq, this
commit adds functionality in the changes enumerator for aggregating
btree nodes into a single changes feed row.
Change return format of view changes

Prior to this commit, added KV pairs would be returned in the format
"add": {"key": "value"}. This would break when keys were not strings, as
that's not valid JSON. This commit changes that format to be "add":
[["key","value"]].