diff options
author | Ian Bicking <ianb@colorstudy.com> | 2011-08-17 15:39:56 -0500 |
---|---|---|
committer | Ian Bicking <ianb@colorstudy.com> | 2011-08-17 15:39:56 -0500 |
commit | ccb6218e9c83004c343896d0d333aa346e8e58a9 (patch) | |
tree | 1dfaa13f6a3f143c7f2e3b5c93584cf01a2f99fd /paste/httpserver.py | |
parent | 95c72213ea545ecead3dcd008ab4a8a2d78e3959 (diff) | |
download | paste-ccb6218e9c83004c343896d0d333aa346e8e58a9.tar.gz |
Always wrap wsgi.input with LimitedLengthFile, even when using the ContinueHook. Also always use ContinueHook when there is Expect: 100-Continue, even if the server is supposed to be HTTP/1.0 (because the client wouldn't know the server version when it sends the request; curl notable stalls waiting for a continue)
Diffstat (limited to 'paste/httpserver.py')
-rwxr-xr-x | paste/httpserver.py | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/paste/httpserver.py b/paste/httpserver.py index 7865fce..cd21713 100755 --- a/paste/httpserver.py +++ b/paste/httpserver.py @@ -186,16 +186,15 @@ class WSGIHandlerMixin: (server_name, server_port) = self.server.server_address[:2] rfile = self.rfile - if 'HTTP/1.1' == self.protocol_version and \ - '100-continue' == self.headers.get('Expect','').lower(): - rfile = ContinueHook(rfile, self.wfile.write) + # We can put in the protection to keep from over-reading the + # file + try: + content_length = int(self.headers.get('Content-Length', '0')) + except ValueError: + content_length = 0 + if '100-continue' == self.headers.get('Expect','').lower(): + rfile = LimitedLengthFile(ContinueHook(rfile, self.wfile.write), content_length) else: - # We can put in the protection to keep from over-reading the - # file - try: - content_length = int(self.headers.get('Content-Length', '0')) - except ValueError: - content_length = 0 if not hasattr(self.connection, 'get_context'): # @@: LimitedLengthFile is currently broken in connection # with SSL (sporatic errors that are diffcult to trace, but |