summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/BaseHTTPServer.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/BaseHTTPServer.py b/Lib/BaseHTTPServer.py
index 681139b..281ddf6 100644
--- a/Lib/BaseHTTPServer.py
+++ b/Lib/BaseHTTPServer.py
@@ -226,6 +226,7 @@ class BaseHTTPRequestHandler(SocketServer.StreamRequestHandler):
"""
self.raw_requestline = self.rfile.readline()
+ self.request_version = version = "HTTP/0.9" # Default
requestline = self.raw_requestline
if requestline[-2:] == '\r\n':
requestline = requestline[:-2]
@@ -244,15 +245,14 @@ class BaseHTTPRequestHandler(SocketServer.StreamRequestHandler):
self.send_error(400,
"Bad HTTP/0.9 request type (%s)" % `command`)
return
- version = "HTTP/0.9"
else:
- self.send_error(400, "Bad request syntax (%s)" % `command`)
+ self.send_error(400, "Bad request syntax (%s)" % `requestline`)
return
self.command, self.path, self.request_version = command, path, version
self.headers = self.MessageClass(self.rfile, 0)
mname = 'do_' + command
if not hasattr(self, mname):
- self.send_error(501, "Unsupported method (%s)" % `command`)
+ self.send_error(501, "Unsupported method (%s)" % `mname`)
return
method = getattr(self, mname)
method()