Commit Graph

471 Commits

Author SHA1 Message Date
Ben Darnell adafcc06d8 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.
2011-01-03 12:52:11 -08:00
Ben Darnell f63525f7a4 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().

Closes #199.
2010-12-27 18:30:21 -08:00
Ben Darnell d677b158dd Remove logging for EINTR in IOLoop, since this is not really an error. 2010-12-17 13:42:33 -08:00
Ben Darnell f73f135d2d 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).

Closes #194.
2010-12-14 12:22:17 -08:00
Ben Darnell 2675142454 Override initialize() instead of __init__() in RequestHandler subclasses.
This is a slight simplification and makes it easier to create further
application-specific subclasses.

Closes #191.
2010-12-13 12:33:25 -08:00
Jon Parise cce8218a03 tornado.httpserver is unused in this scope 2010-12-13 10:28:09 -08:00
Ben Darnell ade3ce2e98 Add a simple HTTP benchmark 2010-12-10 17:03:21 -08:00
Ben Darnell dfac3a67b5 Avoid unnecessary work in HTTPHeaders._normalize_name. 2010-12-10 16:35:54 -08:00
Ben Darnell dd706f9fa6 Implement ExceptionStackContext independently of StackContext to improve
performance.
2010-12-10 16:04:39 -08:00
Ben Darnell 6e7c8b99d0 Avoid use of the @contextlib.contextmanager decorator.
This decorator has over 5x the overhead of a hand-written class
with __enter__ and __exit__ methods.
2010-12-10 15:56:38 -08:00
Ben Darnell 8e4a7730d3 Merge remote branch 'slay2k/fb_fix_graph_mixin' 2010-12-03 15:33:13 -08:00
Ben Darnell a18eead89e Fix duplicated remote_ip field in HTTPRequest.__repr__
Closes #185.
2010-11-30 22:28:53 -08:00
Romy Maxwell ffe291f2ee 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
2010-11-29 20:02:16 -08:00
Ben Darnell 96ecb6603a Use request.uri instead of request.path as default redirect for auth.py.
This allows the next parameter (added by @authenticated) to be preserved.

Closes #161.
2010-11-29 15:01:16 -08:00
Ben Darnell 6151498dba Log malformed HTTP requests more gracefully.
Malformed requests are now logged as a single INFO line (which
includes the IP address) instead of a verbose but uninformative stack
trace.
2010-11-29 14:08:01 -08:00
Ben Darnell ae3cc317c2 Treat HEAD requests the same as GET for e.g. sending Etag headers.
Closes #180.
2010-11-29 13:49:06 -08:00
Ben Darnell eededcf5d5 Preserve the order of css_files from UIModules, like we already do for JS 2010-11-29 13:34:15 -08:00
Ben Darnell 00b9ee91f1 Expose the client's SSL certificate as HTTPRequest.get_ssl_certificate(). 2010-11-29 13:17:03 -08:00
Josh Staiger 263994e8fc Fix bug in multipart/form-data requests.
In Firefox and Safari, I'm seeing k = " boundary"
for multipart/form-data posts.  

" boundary" != "boundary", so the mime fields
aren't parsed.  

This commit gets rid of the leading space.
2010-11-22 19:31:08 -05:00
Josh Staiger b0578819e1 Update pydoc to mention response.rethrow instead of reraise. 2010-11-20 11:51:39 -05:00
Ben Darnell 9e965556ff Don't assume 'boundary' is last field in Content-Type header.
http://groups.google.com/group/python-tornado/browse_thread/thread/d0531e331c189c56#

Closes #172.
2010-11-19 14:04:53 -08:00
Ben Darnell cb232b22da Merge remote branch 'vijayp/master' 2010-11-18 11:26:14 -08:00
vijayp 905a215a28 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.
2010-11-18 13:58:44 -05:00
Ben Darnell d0620d6718 Add debug logging for queuing in simple_httpclient.
Also remove some old extremely verbose debug logging.
2010-11-16 16:37:53 -08:00
Ben Darnell 08e5ba5da8 Add address parameter to Application.listen to match HTTPServer.listen 2010-11-16 16:30:51 -08:00
Ben Darnell 0b607c10ba Fixes for python 2.5 2010-11-15 21:32:51 -08:00
Ben Darnell a853850e26 Add convenience method Application.listen(port) so most apps don't need
to explicitly touch HTTPServer.
2010-11-15 21:15:32 -08:00
Ben Darnell 5f5e0bb3be Implement max_clients limitation and queueing for SimpleAsyncHTTPClient 2010-11-15 16:53:44 -08:00
Ben Darnell 7750fe7773 Port pseudo-singleton magic from AsyncHTTPClient to SimpleAsyncHTTPClient 2010-11-15 16:11:09 -08:00
Ben Darnell f2aa302bcb Add timeout support to simple_httpclient 2010-11-14 14:45:17 -08:00
Ben Darnell 8a941c42b2 Improve docs for IOLoop.add/remove_timeout() 2010-11-14 12:58:14 -08:00
Ben Darnell 31b0ab0c5d Fix typo in docs 2010-11-09 11:52:34 -08:00
Ben Darnell 3dc7ebad62 Add Amharic to tornado.locale's list of languages.
Closes #168.
2010-11-08 11:53:36 -08:00
Ben Darnell 0dcee8d7dc 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)")

Closes #168.
2010-11-08 11:42:22 -08:00
Ben Darnell ee55403cd4 Support X-Forwarded-Proto in addition to X-Scheme 2010-11-08 10:54:50 -08:00
Ben Darnell 7ed8fbe136 Support websockets over https.
Closes #164.
2010-11-08 10:51:02 -08:00
Ben Darnell 965099eda0 Support "from x import y" in templates, not just "import x" 2010-11-08 10:49:03 -08:00
Ben Darnell 3e44643d3b Fix typo from commit 2b44fac
Closes #169.
2010-11-06 11:07:59 -07:00
Ben Darnell 9ec87c2ba2 Capture StackContext explicitly in HTTPConnection to prevent leaks from
one request to the next.
2010-11-05 11:19:18 -07:00
Ben Darnell 2b44fac4ec Check for a closed connection in _add_io_state.
Closes #163.
2010-11-04 11:47:34 -07:00
Paul Buchheit c467cf0274 fix linkify regex plus add unit test 2010-11-03 17:12:31 -07:00
Ben Darnell b914a94ac2 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).

Closes #160.
2010-10-27 21:26:55 -07:00
Ben Darnell 5e987aa6b2 Merge remote branch 'szeim/master' 2010-10-27 12:11:59 -07:00
Ben Darnell 88111779c9 Merge remote branch 'fiam/master' 2010-10-27 11:47:25 -07:00
Imre SZEBENYI 2dbb05d5a0 SSLIOStream._do_ssl_handshake SSL error check 2010-10-27 13:36:12 +02:00
Imre SZEBENYI 3b486fc4f8 Fixed IOStream._handle_events (try/except block)
Fixed IOStream._handle_events (try/except block) to prevent
infinite loop when an unhandled exception occurs
2010-10-27 13:34:47 +02:00
Alberto García Hierro bd4ef586e0 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.
2010-10-26 22:04:16 +02:00
Ben Darnell af3d0b3b03 Add gzip support to SimpleAsyncHTTPClient 2010-10-21 16:00:42 -07:00
Ben Darnell d06f8f4bcd Support minor HTTP request attributes in SimpleAsyncHTTPClient.
Adds allow_nonstandard_methods and user_agent, and gives an explicit
warning for network_interface.
2010-10-21 15:17:06 -07:00
Ben Darnell 3d19e10355 Add basic auth support to SimpleAsyncHTTPClient 2010-10-21 14:58:30 -07:00