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).
Ben Darnell [Mon, 16 Aug 2010 01:04:34 +0000 (18:04 -0700)]
Initialize member variables in AsyncTestCase.__init__ instead of setUp
to avoid masking the real error in _stack_context() if run() throws an
exception.
Ben Darnell [Mon, 9 Aug 2010 21:33:32 +0000 (14:33 -0700)]
Be less picky about line endings in headers in httpclient.
HTTP requires that lines end with \r\n, but some buggy servers (including
news.ycombinator.com) just use \n. Libcurl tolerates this and sends the
line as-is to the header callback, so we need to be prepared to handle
either form.
Ben Darnell [Mon, 9 Aug 2010 21:01:48 +0000 (14:01 -0700)]
The periodic call to multi_socket_all needs to be followed by
_finish_pending_request or else those requests won't be finished until
after the next one is started.