diff options
author | Senthil Kumaran <senthil@uthcode.com> | 2011-12-23 09:03:41 (GMT) |
---|---|---|
committer | Senthil Kumaran <senthil@uthcode.com> | 2011-12-23 09:03:41 (GMT) |
commit | 3075549d537cc5e25a11efeae013663b4ad91b8f (patch) | |
tree | c62fab243ac27798a9c07fcdf2c0634766e06154 /Lib | |
parent | 83194f5b92551a5e411ec60a487d00802bc0ef55 (diff) | |
download | cpython-3075549d537cc5e25a11efeae013663b4ad91b8f.zip cpython-3075549d537cc5e25a11efeae013663b4ad91b8f.tar.gz cpython-3075549d537cc5e25a11efeae013663b4ad91b8f.tar.bz2 |
Minor code style improvements in http.server suggested in Issue13294.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/http/server.py | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/Lib/http/server.py b/Lib/http/server.py index 86fa37f..6642729 100644 --- a/Lib/http/server.py +++ b/Lib/http/server.py @@ -271,14 +271,11 @@ class BaseHTTPRequestHandler(socketserver.StreamRequestHandler): self.request_version = version = self.default_request_version self.close_connection = 1 requestline = str(self.raw_requestline, 'iso-8859-1') - if requestline[-2:] == '\r\n': - requestline = requestline[:-2] - elif requestline[-1:] == '\n': - requestline = requestline[:-1] + requestline = requestline.rstrip('\r\n') self.requestline = requestline words = requestline.split() if len(words) == 3: - [command, path, version] = words + command, path, version = words if version[:5] != 'HTTP/': self.send_error(400, "Bad request version (%r)" % version) return False @@ -304,7 +301,7 @@ class BaseHTTPRequestHandler(socketserver.StreamRequestHandler): "Invalid HTTP Version (%s)" % base_version_number) return False elif len(words) == 2: - [command, path] = words + command, path = words self.close_connection = 1 if command != 'GET': self.send_error(400, |