Support auth cookies with : characters

The parts of a couchdb authentication cookie are separated by
colons. One of these parts can contain colons and, more rarely, runs
of colons. The string:tokens function silently drops any empty token,
thus giving a spurious failure for valid input. The fix changes this
mechanism to one that losslessly decodes this part.

COUCHDB-1607
Make cardinality of result explicit, remove join hacks
Allow a final config override to be specified via environment.

This lets the OS X startup define this user's config which will be
used for editing and what-not.

Forward port from 1.2.0

Change-Id: I03ebce57030457e25c9c8cb60a679547a0cd84bf
Reviewed-on: http://review.membase.org/6380
Tested-by: Dustin Sallings <dustin@spy.net>
Reviewed-by: Steve Yen <steve.yen@gmail.com>
Reviewed-by: Filipe David Borba Manana <fdmanana@gmail.com>
Revert "Document Id and Rev in response headers" patch

This patch breaks some update handlers and also assumes that any JSON
response body with a property called 'id' is the actual id of a
created or updated document.

This reverts;
0a64f310b43b90176bb59040e7e866978c429c88
4edbb93d2271ac1eb82f4d2bb072b8bdf6829f85
b9af7ea506ac95034a91951f29e1f4249ef4317c
test for 1608
Return X-Couch-Id from show functions if doc is created
COUCHDB-430,514,764 Fix list HTTP header handling.

Currently calls to getRow() cause the HTTP headers to be sent immediately back
to the client. This happens even if an error is thrown after the getRow(), but
before any send(...) or start(...). Worse, if a list throws an exception an
extra, invalid header is sent to the client (resulting in various bad
behavior).

Erlang list handling will now wait until data has been sent BEFORE sending the
HTTP headers to the client. If an error is reported it will result in an HTTP
error code as expected. This does not change the behavior of errors thrown
AFTER data has been sent: They will still result in an HTTP 200 even if an
error is reported.

The line protocol between Erlang and os processes has been extended to support
an optional Header field on "chunks" and "end". The javascript list handling
has been updated to use this if a new header is set via start(...). This makes
it possible to begin processing with getRow(), but later reset the headers via
start(...). Again, if data has been sent(...) the new headers will NOT take
effect.

COUCHDB-430
COUCHDB-514
COUCHDB-764
fix formatting in NEWS
Deprecate E4X
Make dependency on unistd.h specific to HAVE_CURL instead in the whole file

- introduced in COUCHDB-1338
- allows building cleanly on Windows without cURL
Don't eat custom ERL_LIBS.

Patch by Volker Mische.

Closes COUCHDB-1621
COUCHDB-1622 ensure that Windows batch file uses same VM flags as the service and UNIX
use more docs in view_compaction test to ensure a difference
Experimental support for Cross-Origin Resource Sharing (CORS).

Closes COUCHDB-431

Patch by:

 - Dale Harvey
 - Benoit Chesneau
 - Jan Lehnardt
 - Robert Newson

See `etc/couchdb/default.ini.tpl.in` for configuration examples.
fix whitespace
Require Erlang R13B04 or later
Close view files cleanly on DB create/delete

The shutdown_sync was actually interfering with a clean shutdown
initiated by the index processes themselves when they received a 'DOWN'
message from their monitoring of the DB process.  The explicit 'delete'
cast message in this patch is very probably redundant, but it makes the
intent clear.  The important bit is to let the index process terminate
*and* get confirmation of the termination before attempting to nuke the
directory.

COUCHDB-1364
import Couchbase docs

git clone git://github.com/janl/couchdb-docs.git
cd couchdb-docs
rm -rf DocKit Makefile Makefile.bootstrap README.md common couchdb-manual-1.1 couchdb-release-1.1 metadocs
git checkout 9fc95b422060d020ba25f559e893fc7fb98c9a15 -- 'couchdb-manual-1.1/*.xml' 'couchdb-release-1.1/*.xml'
tar cvzf couchdb-docs.tar.gz couchdb-manual-1.1 couchdb-release-1.1
Transmogrify Couchbase XML to .rst and support Sphinx

Authors:
Alexander Shorin <kxepal@gmail.com>
Dave Cottlehuber <dch@apache.org>
Dirkjan Ochtman <dirkjan@ochtman.nl>
Robert Newson <rnewson@apache.org>
Tady Walsh for the spiffy logo

Robert Newson:
- hear no eval, see no eval, speak no eval
- fix minor niggles

Dave Cottlehuber:
- Remove vestiges of svn URLs in comments
- Add browser EventSource protocol support for changes feed
- Add all UUID algorithms including new utc+suffix-based UUID scheme
- refactor 1.1.x features and other into 1.2.0 docs
- remove manual.rst & release.rst files, only used during migration
- prepare conf.py to be run from share/Makefile similar to:
    sphinx-build -a -E -W -n \
    -D version='$ver' \
    -D release='$ver-git-sha' \
    -D project='Apache CouchDB' \
    -D copyright='$year, Apache Software Foundation' \
    -c `pwd` \
    -d /tmp/ \
    rst/ \
     <output_dir>
- set sphinx config:
- update copyright & project
- set default syntax highlighting to JSON
- output docs to share/docs/manual
- move into share/docs/rst
- move old 1.1 .rst updates into main area
- add release.rst for future release notes
- swap specific versions and releases for sphinx variables
Transmogrify XML to rst using pandoc 1.9.4.2:
    pandoc --smart --preserve-tabs --normalize --reference-links --chapters \
      --number-sections --standalone --from docbook --to rst --output
    rst/manual.rst couchdb-manual-1.1/*.xml
    pandoc --smart --preserve-tabs --normalize --reference-links --chapters \
      --number-sections --standalone --from docbook --to rst --output
    rst/release.rst couchdb-release-1.1/*.xml
    rm -rf share/docs

Alexander Shorin:
- Convert CHANGES file to rst, update information about 1.3.0 release.
- Actual till #fb670f5712 commit at 2012-12-02.
- Enable extlink extension. Setup extlink to CouchDB JIRA and Apache Git commits.
- Enable sections enumeration. Looks nicer for further referencing.
- Fix copy-paste typo, remove changes history for request object
- Add article about queryservers: JavaScript and Erlang one
- Complete article about how to write design documents
- Shift filter functions from changes and point to ddocs
- Add response object and view head info structure
- Add query server and CommonJS
- Fix markup of errors section
- Fix caution blocks
- Add back JSON structure reference
- Clarify what kind of contents should go in views
- Add back configuration option reference
- Add TODO.txt for future reference
- Add tables to start of API reference sections (except for design docs)
- Fix indentation
- Add syntax highlighting
- Add to-do statements
- Fix weird `_` escaping
- Wrap statements
- Add method descriptions
- Clean up tables
- Add missed `PUT /db/_revs_limit` description

Dirkjan Ochtman:
- Move .rst files into Sphinx Layout
- Move rst files and copy images into a Sphinx project
- Split manual & release docs into smaller pieces
- Update version numbers
- Move API docs into separate directory
Integrate Sphinx into autotools

Integrate Sphinx into autotools
- Remove M4 macros and require as external dependencies instead
- Skip help2man generation if help2man is not installed
- ensure THANKS file is only updated during make distcheck
- Add TexInfo, PDF, HTML doc targets via Sphinx
- Add licenses and header compliance checking
- support optional builds of PDF, HTML, texinfo via Sphinx and pdflatex
- support skipping docs or compiler tests for happy developers

Travis: clean up package dependencies
- include sphinx via aptitude
- use spidermonkey 1.8.5 instead of default libmozjs
- include latex components for building PDFs