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).
Make exception handling in AsyncHTTPClient more customizable
Call handle_callback_exception() with the callback as argument
instead of hardcoding the call to logging.debug(). This way, users
can add their own exception handling code by subclassing
AsyncHTTPClient.
Default implementation for handle_callback_exception() calls that
same function on the IOLoop associated to this AsyncHTTPClient
instance, so users can handle any exceptions raised from their
callbacks just by overriding handle_callback_exception() in IOLoop.
Ben Darnell [Tue, 19 Oct 2010 19:28:47 +0000 (12:28 -0700)]
Add test case for encoding of request parameters and paths,
in response to a mailing list thread that raised questions about
handling of '%3F' and '?'.
Matthew Graham [Sat, 9 Oct 2010 19:27:13 +0000 (15:27 -0400)]
make StaticFileHandler support default filename
allows an app to configure a handler so that if a request to '/dir', the
handler will return '/dir/index.html' if it exists. the default
filename, the 'index.html' part is configurable when creating the
Handler object. Using the default filename is optional.
Paul Buchheit [Thu, 30 Sep 2010 21:41:13 +0000 (14:41 -0700)]
add a linkify() function for converting text to html with link detection. Also changed xhtml_escape to not convert return value to utf8, since pages should be assembed in unicode and not utf8 encoded until they are ready to write().
Ben Darnell [Fri, 24 Sep 2010 18:42:33 +0000 (11:42 -0700)]
Make StackContext more usable in libraries by reducing the need to
explicitly use IOLoop.add_callback or NullContext.
This change also simplifies and codifies the ordering behavior of
StackContext: When a wrapped callback is executed, the innermost
StackContexts are those that were active when the callback was
wrapped. Additional StackContexts (possibly including other copies
of the same contexts) may be present in outer levels of the stack, but
since the role of most StackContexts is to catch exceptions this should
not have any effect.
Backwards compatibility note: StackContexts that do something other than
catch exceptions may need to be modified to be reentrant.
Ben Darnell [Thu, 16 Sep 2010 20:45:13 +0000 (13:45 -0700)]
Refactor IOStream reading logic to fix problems with SSL sockets.
Now reads from the socket until it would block. This ensures that we
see data in SSLSocket's internal buffers, which are otherwise invisible
to functions like select().
Added a test that makes a large POST request to an SSL server, which was
the scenario that originally exposed this bug.
When forking multiple processes, properly initialize the random seed
Avoid seeding the random module with the same value in all processes.
If available, use the same method used by random.py, otherwise
generate a seed using the current time in milliseconds and the pid.
Joe Bowman [Tue, 31 Aug 2010 15:38:06 +0000 (11:38 -0400)]
auth.py updates for OAuth 1.0a and 2.0.
OAuthMixin now supports both 1.0a and 1.0 (defaults to 1.0a). TwitterMixin
and GoogleMixin now use 1.0a, FriendfeedMixin remains at 1.0. This adds
support for the callback_uri parameter to TwitterMixin.
New classes OAuth2Mixin and FacebookGraphMixin are introduced for the new
Facebook APIs.
Backwards compatibility notes:
Pending authorizations begun prior to this change will not be able to
be completed after it (tokens issued under prior versions of this code
will still work; this warning applies only to users who have started
but not yet completed their initial authorizations).
If you have used OAuthMixin directly (not one of the subclasses in this
module) to access a service that does not support OAuth 1.0a, set
_OAUTH_VERSION = "1.0" in your subclass.
Ben Darnell [Wed, 1 Sep 2010 22:16:57 +0000 (15:16 -0700)]
Remove __del__ method from HTTPResponse. Closing cStringIO objects isn't
really necessary, and the presence of a __del__ method prevents python's
GC from breaking cyclical references (which happen on errors as HTTPError
and HTTPResponse refer to each other).