]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Fixes bug disallowing custom-made reason phrase 1102/head
authorPer Kraulis <per.kraulis@scilifelab.se>
Thu, 10 Jul 2014 13:47:28 +0000 (15:47 +0200)
committerPer Kraulis <per.kraulis@scilifelab.se>
Thu, 10 Jul 2014 13:47:28 +0000 (15:47 +0200)
The send_error method is, I believe, supposed to allow sending an HTTP reason phrase that is not one of the standard ones. This change corrects an apparent bug which made this impossible. With the correction, specifying an 'error' keyword argument to send_error actually sends the specified
reason phrase to the client.

tornado/web.py

index 25ac56ebe14aaa7beb1388876a6cc985b5aaf8a9..28477c26956386483f2994c147330b1c45fc7345 100644 (file)
@@ -919,7 +919,7 @@ class RequestHandler(object):
             return
         self.clear()
 
-        reason = None
+        reason = kwargs.get('reason')
         if 'exc_info' in kwargs:
             exception = kwargs['exc_info'][1]
             if isinstance(exception, HTTPError) and exception.reason: