summaryrefslogtreecommitdiffstats
path: root/Lib/BaseHTTPServer.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2008-05-18 09:12:20 (GMT)
committerGeorg Brandl <georg@python.org>2008-05-18 09:12:20 (GMT)
commitf899dfa1d179a126b5e23a9c61199293b89f6d70 (patch)
treea83c04a7d5c884e92576751db510b08716a0c6dd /Lib/BaseHTTPServer.py
parent67d6933ab5e43dd1e53b612fb0de598c23d02834 (diff)
downloadcpython-f899dfa1d179a126b5e23a9c61199293b89f6d70.zip
cpython-f899dfa1d179a126b5e23a9c61199293b89f6d70.tar.gz
cpython-f899dfa1d179a126b5e23a9c61199293b89f6d70.tar.bz2
GHOP #134, #171, #137: unit tests for the three HTTPServer modules.
Diffstat (limited to 'Lib/BaseHTTPServer.py')
-rw-r--r--Lib/BaseHTTPServer.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/BaseHTTPServer.py b/Lib/BaseHTTPServer.py
index 4f3d27a..cc244a7 100644
--- a/Lib/BaseHTTPServer.py
+++ b/Lib/BaseHTTPServer.py
@@ -218,6 +218,12 @@ class BaseHTTPRequestHandler(socketserver.StreamRequestHandler):
# where each string is of the form name[/version].
server_version = "BaseHTTP/" + __version__
+ # The default request version. This only affects responses up until
+ # the point where the request line is parsed, so it mainly decides what
+ # the client gets back when sending a malformed request line.
+ # Most web servers default to HTTP 0.9, i.e. don't send a status line.
+ default_request_version = "HTTP/0.9"
+
def parse_request(self):
"""Parse a request (internal).
@@ -230,7 +236,7 @@ class BaseHTTPRequestHandler(socketserver.StreamRequestHandler):
"""
self.command = None # set in case of error on the first line
- self.request_version = version = "HTTP/0.9" # Default
+ self.request_version = version = self.default_request_version
self.close_connection = 1
requestline = self.raw_requestline
if requestline[-2:] == '\r\n':