This turned out to be more trouble than it's worth, since it doesn't
interact well with external installations of pycurl (e.g. from a .deb).
These dependencies are going away soon anyway.
Ben Darnell [Sat, 19 Feb 2011 23:39:27 +0000 (15:39 -0800)]
Track SSL handshake state separately from calling _add_io_state directly.
Calling _add_io_state would set a flag that immediately gets overwritten
in _handle_events when it sees that the application-level read/write
operations are idle. This happens to work with kqueue but not with epoll.
Ben Darnell [Sat, 19 Feb 2011 21:43:33 +0000 (13:43 -0800)]
Don't call curl.unsetopt(pycurl.CAINFO) to reset CA certificates to default.
This doesn't work because it clobbers the default CA certs, causing all
certificates to be rejected. There doesn't seem to be any way to restore
the defaults, so just leave it untouched in the default case and document
the requirement that all requests use ca_certs if any do.
Ben Darnell [Tue, 15 Feb 2011 02:58:02 +0000 (18:58 -0800)]
Add a set of default SSL CA certificates for use with SimpleAsyncHTTPClient.
This data was copied from the Ubuntu package ca-certificates (and is
ultimately derived for the most part from Mozilla). Its license is
MPL/GPL, unlike the rest of tornado, but for an optional data file it
ought to be fine.
This is a backwards-incompatible change. Applications that previously
relied on a blanket exception for XMLHTTPRequest may need to be modified
to explicitly include the XSRF token when making ajax requests.
The tornado chat demo application demonstrates one way of adding this
token (specifically the function postJSON in demos/chat/static/chat.js).
More information about this change and its justification can be found at
http://www.djangoproject.com/weblog/2011/feb/08/security/
http://weblog.rubyonrails.org/2011/2/8/csrf-protection-bypass-in-ruby-on-rails
Ben Darnell [Fri, 21 Jan 2011 21:14:06 +0000 (13:14 -0800)]
Move request logging from RequestHandler to Application.
Logging can now be configured with either a subclass or setting of
Application. This replaces the previous method of overriding a private
method of RequestHandler, which was difficult to do for built-in handlers
(StaticFileHandler and RedirectHandler).
Ben Darnell [Mon, 3 Jan 2011 20:32:44 +0000 (12:32 -0800)]
Log exceptions with exc_info=True instead of exc_info=e.
The logging module checks to see if the value passed for exc_info is a
tuple, and if so assumes it contains (type, value, traceback).
A bug in python 2.5 and 2.6 causes context manager's __exit__ methods
to sometimes receive a tuple instead of an exception object, which causes
a nonsensical message to be logged.
Ben Darnell [Tue, 28 Dec 2010 02:30:21 +0000 (18:30 -0800)]
Fix stack trace logging for uncaught RequestHandler exceptions.
_handle_request_exception is a private method, but since I've endorsed
overriding it on the mailing list preserve backwards compatibility by
re-raising the exception so it appears in sys.exc_info().
Ben Darnell [Tue, 14 Dec 2010 20:22:17 +0000 (12:22 -0800)]
Construct ErrorHandler with kwargs instead of positional arguments
for consistency with normal handler construction (and compatibility with
the initialize() changes from a couple of commits ago).
Romy Maxwell [Mon, 29 Nov 2010 09:44:51 +0000 (01:44 -0800)]
A few fixes for FacebookGraphMixin
- Added error handler for _on_access_token
- Modified to allow for extra returned fields in the auth call
- Removed username, which seems to have been deprecated
vijayp [Thu, 18 Nov 2010 18:58:44 +0000 (13:58 -0500)]
Set proxy to '' if no proxy is explicitly set in the request.
If this is not done, curls with proxies set are re-inserted into the empty list, and are then reused. This causes connections to be randomly proxied, if some requests use a proxy, and others don't.
Ben Darnell [Mon, 8 Nov 2010 19:27:27 +0000 (11:27 -0800)]
Fix mangled language names in tornado.locale for Chinese, Japanese, Korean.
For Chinese, also follow Google's example and reduce number of
variants to two: Simplified (zh_CN) and Traditional (zh_TW) (since I
couldn't find an appropriate copy-paste source for localized versions
of "Chinese (Hong Kong)" and "Chinese (Taiwan)")
Ben Darnell [Thu, 28 Oct 2010 04:23:29 +0000 (21:23 -0700)]
Don't manually set Content-Length in StaticFileHandler.
Content-Length will be set automatically in RequestHandler.finish. This
change fixes a bug in which RequestHandler.finish's Etag support strips
the response body without changing any headers. Transfer headers
(including Content-Length and Transfer-Encoding) are the responsibility
of the framework, not the "application-level" handlers (which includes
StaticFileHandler).