summaryrefslogtreecommitdiffstats
path: root/Lib/wsgiref
diff options
context:
space:
mode:
authorSenthil Kumaran <senthil@uthcode.com>2014-09-17 08:32:46 (GMT)
committerSenthil Kumaran <senthil@uthcode.com>2014-09-17 08:32:46 (GMT)
commitdc41440401b7c66271bf03c80aada942422a38bb (patch)
tree67d88188f38fc09e2458c5a18604355730cb9940 /Lib/wsgiref
parent810dc9bc81e83b6f31d10fd9e92a9f4f79f72b5d (diff)
parent86c9e1877cc287b602e06f3627cda2d81cbd176a (diff)
downloadcpython-dc41440401b7c66271bf03c80aada942422a38bb.zip
cpython-dc41440401b7c66271bf03c80aada942422a38bb.tar.gz
cpython-dc41440401b7c66271bf03c80aada942422a38bb.tar.bz2
Merge from 3.4
Issue #22419: Limit the length of incoming HTTP request in wsgiref server to 65536 bytes.
Diffstat (limited to 'Lib/wsgiref')
-rw-r--r--Lib/wsgiref/simple_server.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/Lib/wsgiref/simple_server.py b/Lib/wsgiref/simple_server.py
index cd9751a..378b316 100644
--- a/Lib/wsgiref/simple_server.py
+++ b/Lib/wsgiref/simple_server.py
@@ -115,7 +115,14 @@ class WSGIRequestHandler(BaseHTTPRequestHandler):
def handle(self):
"""Handle a single HTTP request"""
- self.raw_requestline = self.rfile.readline()
+ self.raw_requestline = self.rfile.readline(65537)
+ if len(self.raw_requestline) > 65536:
+ self.requestline = ''
+ self.request_version = ''
+ self.command = ''
+ self.send_error(414)
+ return
+
if not self.parse_request(): # An error code has been sent, just exit
return