Tornado backports

@fiorix, Sorry for not putting these in separate change-sets, I started by diffing out tornado and cyclone, used git blame to find the commit behind any conspicuous changes. Please review.

Next up, we desperately need tests. I'll probably write some basic tests over the weekend and submit a pull request.

Changes
=======

### escape.py
1. `extra_params` arg to `escape.linkify` can be a callable. [tornado changeset](https://github.com/facebook/tornado/commit/53e7c751)

### auth.py
1. use `request.uri` instead of request.path as default redirect param. [tornado changeset](https://github.com/facebook/tornado/commit/96ecb660)

2. use `urlparse.urljoin` instead hand constructing the realm url. [tornado changeset](https://github.com/facebook/tornado/commit/1882670c)

3. Use POST instead of GET for OpenID `check_authentication`. [tornado changeset](https://github.com/facebook/tornado/commit/e5bd0c06)

4. Improve auth module on python 3 (covers openid and oauth2, but not oauth1.x). [tornado changeset](https://github.com/facebook/tornado/commit/495b39ce)


### httputil.py
1. Add a copy constructor to `HTTPHeaders`. [tornado changeset](https://github.com/facebook/tornado/commit/2f35821c)

2. Override `dict.copy` in `HTTPHeaders`. [tornado changeset](https://github.com/facebook/tornado/commit/f41306da)

### template.py
1. Add `else` as possible sub-clause in `try` blocks in templates. [tornado changeset](https://github.com/facebook/tornado/commit/4416c0a6)

### httpserver.py and web.py
1. Add support for HTTP `PATCH` method. [tornado changeset](https://github.com/facebook/tornado/commit/bd1fdaab)

### web.py
1. *[Backwards incompatible]* Add `status_code` to the `OutputTransform.transform_first_chunk interface`. [tornado changeset](https://github.com/facebook/tornado/commit/dd765596) 
(**NOTE**: It's very unlikely that anyone is actually overriding transform_first_chunk in their code).

2. 304 responses no longer include entity headers like `Content-Length`. Depends on previous change ([dd765596](https://github.com/facebook/tornado/commit/dd765596)). [tornado changeset](https://github.com/facebook/tornado/commit/b1df6635) (This is required for HTTP 1.1 compliance)

3. Use a single Cookie.SimpleCookie for outgoing cookies instead of a list. [tornado changeset](https://github.com/facebook/tornado/commit/70ea7a5a)

4. Use the standard mime type application/json when producing json output. [tornado changeset](https://github.com/facebook/tornado/commit/f5fd90fe)

5. In template, use handler reverse_url instead of application one. [tornado changeset](https://github.com/facebook/tornado/commit/eac1e538)

6. coerce kwarg keys to str. [tornado changeset](https://github.com/facebook/tornado/commit/0b75124b)

7. Fix mutable values used as default arguments. [tornado changeset](https://github.com/facebook/tornado/commit/aa7ac690)

8. Fix handling of non-ascii data in reverse_url. [tornado changeset](https://github.com/facebook/tornado/commit/28590fce)

9. Fix reponse header sanitization. [tornado changeset](https://github.com/facebook/tornado/commit/1ae91f6d)

10. RequestHandler.get_argument should raise an HTTP 400 Bad Request if 
	the argument is missing, not a misleading HTTP 404 Not Found.
	[tornado changeset](https://github.com/facebook/tornado/commit/1c446409)