Commit Graph

552 Commits

Author SHA1 Message Date
Ben Darnell 7a288245dc Update installation instructions. 2010-07-22 14:07:41 -07:00
Ben Darnell 2c89b89536 Accept None (i.e. unmatched optional groups) when extracting parameters from
the path.

http://github.com/facebook/tornado/issues/issue/115
2010-07-20 10:25:25 -07:00
Ben Darnell ad104ffb41 When no json library is found, don't throw an exception unless
json functionality is used, to make the simplejson dependency optional
for python 2.5 users.
2010-07-19 19:39:42 -07:00
Ben Darnell ea032b6c9c Check for EINTR in a more flexible way for compatibility with older pythons
and poll implementations.

Original commit:
31c33737c5
2010-07-19 13:09:28 -07:00
Ben Darnell 7a30f9f6ea Fix typo in support for multiple ui_method/ui_module containers 2010-07-14 18:12:16 -07:00
Ben Darnell c78ab55dc0 Better timeout handling in AsyncHTTPClient2. Tornado and libcurl may
use different clock functions, which can cause timeouts to be delayed
(in some cases until the next fetch is started).  This change
resynchronizes the schedule after each timeout call.
2010-07-14 16:40:52 -07:00
David Novakovic 64d8d4e508 Fix small bug in database set up. 2010-07-14 08:44:06 -07:00
Robert Buchholz e2181b035b Make iteration over sql fields clearer 2010-07-13 10:28:52 +02:00
Robert Buchholz a9090a97f4 Remove unused imports and variables 2010-07-13 10:26:01 +02:00
Ben Darnell b42c61c88e In AsyncHTTPClient2, disable IPv6 for versions of libcurl with the
socket-reopening bug (i.e. <= 7.21.0).  (this can be overridden if needed
with a prepare_curl_callback)
2010-07-09 18:15:12 -07:00
Ben Darnell 557da3db1c Unquote percent escapes in captured groups in the path component of the URI,
to be more consistent with our handling of query parameters.

This change is slightly backwards-incompatible:  applications that have
already added an unquote() call on arguments to RequestHandler.get/post
will need to remove them.

This change replaces an earlier (reverted) commit:
7b80c2f4db
2010-07-09 13:07:43 -07:00
Ben Darnell 455eb75b18 Revert "Parse percent escapes in the path component of the uri, to be more"
This reverts commit 7b80c2f4db.

URI spec requires that '/' and '%2F' be distinguishable, so it's incorrect
to escape at this level.  The next commit will instead unquote captured
groups before passing them to get()/post() in web.py
2010-07-09 12:57:01 -07:00
Ben Darnell 7b80c2f4db Parse percent escapes in the path component of the uri, to be more
consistent with our handling of query parameters (especially important
when capturing groups are used in the URLSpec regex).

This change is slightly backwards-incompatible:  applications that have
already added an unquote() call on arguments to RequestHandler.get/post
or use percent escapes in URLSpec patterns will need to remove them.
2010-07-08 18:27:43 -07:00
Ben Darnell a7dc5bc4b4 Consolidate the various HTTP header dictionary classes into one,
which includes better handling of headers with repeated values
(e.g. Set-Cookie)
2010-07-08 17:14:20 -07:00
Ben Darnell e98735bf4b Disable preforking by default in HTTPServer.start().
This makes "server.listen(port)" and "server.bind(port);
server.start()" equivalent.
2010-07-08 15:52:44 -07:00
Ben Darnell 2ac7426855 UTF8-encode more user-supplied strings in httpclient (headers and user-agent) 2010-06-28 09:52:46 -07:00
Ben Darnell 52c378f7f8 Update the set of active file descriptors immediately after calling perform
instead of after running user callbacks, since those callbacks might have
started using file descriptors that were closed by curl in perform().

Thanks to David Novakovic for the fix.  Adapted from
6df99e948e
2010-06-26 16:00:26 -07:00
Ben Darnell 33c3f8d28b Include the HTTPResponse object as an attribute of HTTPError 2010-06-26 15:16:15 -07:00
Ben Darnell 60ef8d5d90 Remove unused "overwrite" argument to options.parse_config_file 2010-06-23 18:01:30 -07:00
Ben Darnell e7654cda9c Fix typo in comment 2010-06-21 09:29:27 -07:00
Ben Darnell 1ba0161e38 Add a second implementation of AsyncHTTPClient, using a new libcurl api.
Adapted from Jacob Kristhammar's work:
http://github.com/sris/tornado/blob/master/tornado/httpclient2.py
2010-06-19 19:55:40 -07:00
Ben Darnell df0d88eb8d Close wsgi responses correctly - the close method, if present, will
be on the result of self.wsgi_application() and not on the list
of output we're building up.
2010-06-18 15:59:19 -07:00
Ben Darnell 39ac6d169a In the libcurl file descriptor limit hack, log to both stderr and
logging.error since they may got to different places and one may be
more visible than the other.
2010-06-10 14:49:57 -07:00
Ben Darnell 27171cde84 Catch and log exceptions from user callbacks in AsyncHTTPClient. 2010-06-08 11:48:43 -07:00
Ben Darnell b8271f9443 Fix missing import 2010-06-07 00:43:59 -07:00
Ben Darnell d1e145039c Optionally allow nonstandard http methods to be used in httpclient.
By default we check that the method is one of the standard ones (and
is capitalized correctly), but this can be overridden to work with a
server that has implemented nonstandard methods (e.g. CouchDB)

http://github.com/facebook/tornado/issues/issue/90
2010-05-30 23:39:32 -07:00
Mike Lewis d5a3d8a027 Changed it so one can access the StringIO buffer
This allows for people to use the file-like object
that already exists without having to convert the body
back to the StringIO
2010-05-30 23:39:32 -07:00
Ben Darnell 6f6c95054f Clear the close_callback set on the IOStream by RequestHandlers in
finish(), so that the close_callback does not prevent garbage collection
of the handlers.

http://github.com/facebook/tornado/issues/issue/95/
2010-05-30 23:39:32 -07:00
Ben Darnell 5d430b100a Close the socket on uncaught exceptions from iostream handlers.
This prevents a possible denial of service if erroneous requests are
made faster than garbage collection can reclaim socket file
descriptors.

http://groups.google.com/group/python-tornado/browse_frm/thread/7a5d61e6ba0c71b8/8af41b48ac02cc6c
2010-05-30 23:39:22 -07:00
Ben Darnell 2b0684028a Improve parsing of multipart/form-data headers.
This change was motivated by google app engine's xmpp support,
which uses different spacing in the header than other common clients
and quotes its boundary string.

Based on changes by jehiah:
18cb45ca73
9d67963466
2010-05-30 23:38:50 -07:00
Ben Darnell 982554e710 Added RequestHandler.get_arguments(), which does the same normalization
as get_argument() but returns a list for repeated arguments.

Based on changes by jehiah:
cbe2eeb175
af08ab067f
2010-05-30 23:38:50 -07:00
Ben Darnell 548bd70d7b Update documentation for WebSocketHandler 2010-05-28 17:25:59 -07:00
Ben Darnell 70a377088a Revert "websockets: continue listening for messages after parsing completion"
This reverts commit 9ea5f8a277.

The one-shot behavior of receive_message was intentional, and simply
requeuing the old callback every time will eventually overflow the
stack due to repeated async_callback wrappers.  An alternate interface
that doesn't require receive_message to be called for every message
may be added in a future change.

See discussion at
9ea5f8a277
2010-05-28 17:16:52 -07:00
Ben Darnell 7f8725c718 Allow StaticFileHandler subclasses to set additional headers on the response 2010-05-25 14:36:50 -07:00
Ben Darnell 57a9ac031a Don't try to compute max() of an empty sequence (which throws an exception) 2010-05-25 11:40:42 -07:00
Ben Darnell d6002cafa1 Add a hacky workaround for libcurl's FD_SETSIZE bug. It's ugly,
but better than undefined behavior.
2010-05-24 19:06:31 -07:00
Ben Darnell b9a9ccc388 Make it possible to override template_path at the handler level 2010-05-20 13:50:03 -07:00
Ben Darnell 0c36366246 Use a lambda instead of functools.partial for pycurl.HEADERFUNCTION.
Older versions of pycurl (including 7.16.2.1, which is the recommended
version for Mac OS X 10.5) only work with real functions, not objects
with a __call__ method like functools.partial.

Remove exception-swallowing - curl versions that predate HEADERFUNCTION
are no longer supported.
2010-05-16 19:35:06 -07:00
Ben Darnell e8dec4d0b0 Merge remote branch 'dlo/master' 2010-05-09 18:54:34 -07:00
Ben Darnell f0a3d8950b Translate </ to <\/ in json output to avoid issues with the string
"</script>".
2010-05-09 18:51:49 -07:00
Ben Darnell 26af9e40e0 Support additional keyword arguments on cookies (to be handled by the
underlying stdlib Cookie module)
2010-05-09 18:46:06 -07:00
Dan Loewenherz 9ea5f8a277 websockets: continue listening for messages after parsing completion
The prior implementation stops listening for messages after the first
message is received.
2010-05-04 16:05:05 -07:00
Ben Darnell 00ad92f398 Allow for missing "expires" field in facebook session, which can
happen if offline_access is granted.
2010-04-30 17:28:40 -07:00
Jon Parise 339f08bdbd Correcting a grammatical error (attribute -> attributes). 2010-04-28 23:27:45 -07:00
Evan Klitzke 808473910a UIModule.css_files returns CSS files, not Javascript files 2010-04-27 07:27:30 +08:00
Joseph Bowman bbdf207637 Updating base Twitter url 2010-04-25 12:27:18 -07:00
Ben Darnell 0fcef4e237 Clear itimer signals in autoreload so the combination of autoreload
and ioloop.set_blocking_log_threshold doesn't cause the new process
to get killed.
2010-04-22 16:12:41 -07:00
Ben Darnell 9f7c9a38ff Use escape.utf8() instead of .encode('utf-8') so we don't double-encode 2010-04-21 14:17:58 -07:00
Ben Darnell c87e84f068 cStringIO's constructor uses a 16-bit encoding when given a unicode
string.  This is inconsistent with its write method, which encodes all
strings as ascii (and rejects unicode strings iff they have any
non-ascii characters).  This change uses utf-8 as the default encoding
when constructing cStringIO objects in tornado.
2010-04-21 13:57:05 -07:00
Ben Darnell b686d6d446 Add an option to log a stack trace any time the ioloop is blocked for
more than a specified amount of time.
2010-04-21 11:57:44 -07:00