diff options
author | Senthil Kumaran <senthil@uthcode.com> | 2011-12-23 09:07:13 (GMT) |
---|---|---|
committer | Senthil Kumaran <senthil@uthcode.com> | 2011-12-23 09:07:13 (GMT) |
commit | 139c457106b0230b3a0e16d4865f0d195c9c6014 (patch) | |
tree | 61ea720bc2e385d42a12cca9c8bea41a9e7bac1b /Lib/BaseHTTPServer.py | |
parent | 84c18aaa4cac8f2603d7767db24c52afa06fe658 (diff) | |
download | cpython-139c457106b0230b3a0e16d4865f0d195c9c6014.zip cpython-139c457106b0230b3a0e16d4865f0d195c9c6014.tar.gz cpython-139c457106b0230b3a0e16d4865f0d195c9c6014.tar.bz2 |
port to 2.7 - Minor code style improvements in http.server suggested in Issue13294.
Diffstat (limited to 'Lib/BaseHTTPServer.py')
-rw-r--r-- | Lib/BaseHTTPServer.py | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/Lib/BaseHTTPServer.py b/Lib/BaseHTTPServer.py index da04315..1a39485 100644 --- a/Lib/BaseHTTPServer.py +++ b/Lib/BaseHTTPServer.py @@ -244,14 +244,11 @@ class BaseHTTPRequestHandler(SocketServer.StreamRequestHandler): self.request_version = version = self.default_request_version self.close_connection = 1 requestline = self.raw_requestline - 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 @@ -277,7 +274,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, |