Fix a memory leak and test timeout in websockets.

In some cases (primarily when prepare() is asynchronous), an
HTTP1ServerConnection could be left waiting forever for a connection
to finish when that connection has been detached and handed off to a
WebSocketHandler.  This would manifest as a leak and a timeout in
tests as the HTTPServer waited for all its existing connections to
finish.

Also fix a bug in the test tearDown method that would actually
wait forever for connections to finish instead of timing out.

Closes #1133.
Fix `PeriodicCallback' when callback function return `Future' and has
`Exception' will silence ignore
Merge pull request #1138 from zhicheng/master

Fix `PeriodicCallback' when callback function return `Future' and has
Start the next-release notes doc.
Forgot to git add the new file.
Merge pull request #1 from tornadoweb/master

update from upstream
Fix `IOStream' when callback function return `Future' and has
`Exception' will silence ignore
Merge pull request #1142 from zhicheng/master

Fix `IOStream' when callback function return `Future' and has `Exception' will silence ignore
Fix an AttributeError in WebSocketClientConnection._on_close.

Fix an issue that was preventing this issue from showing up in my
tests.

Closes #1140.
Correctly handle 204 response codes that do not include a content-length.

If a server sends a 204 with no content-length we would wait for the server
to close the connection instead of ending the request (any such servers
are ignoring the "Connection: close" header we send, but apparently exist).

Move some content-length logic from simple_httpclient.py to http1connection.py.

Fix the client-side use of on_connection_close; this affects the
handling of any HTTPInputException.

This fixes regressions relative to Tornado 3.2.
Fall back to pure-python mode on any exception during the build.

Stop the futile process of trying to enumerate which kinds of exceptions
distutils may throw (the latest potential addition: ValueError).

Closes #1115.
Add missing return statements to call_at and call_later.

Closes #1119.
Fix `PeriodicCallback' when callback function return `Future' and has
`Exception' will silence ignore
Fix `IOStream' when callback function return `Future' and has
`Exception' will silence ignore
Fix an AttributeError in WebSocketClientConnection._on_close.

Fix an issue that was preventing this issue from showing up in my
tests.

Closes #1140.
Correctly handle 204 response codes that do not include a content-length.

If a server sends a 204 with no content-length we would wait for the server
to close the connection instead of ending the request (any such servers
are ignoring the "Connection: close" header we send, but apparently exist).

Move some content-length logic from simple_httpclient.py to http1connection.py.

Fix the client-side use of on_connection_close; this affects the
handling of any HTTPInputException.

This fixes regressions relative to Tornado 3.2.

Conflicts:
	tornado/websocket.py
Add release notes for 4.0.1 and update version number.
Specify a non-zero port when testing localhost resolution.

Some getaddrinfo implementations (including OS X 10.6) fail
if we try to resolve port 0 without AI_PASSIVE.

Closes #1136.
Set version number to 4.0.1.
Merge branch 'branch4.0'

Conflicts:
	docs/releases.rst
	setup.py
	tornado/__init__.py