diff Lib/BaseHTTPServer.py @ 47153:efe22eef26be legacy-trunk

GHOP #134, #171, #137: unit tests for the three HTTPServer modules.
author Georg Brandl <georg@python.org>
date Sun, 18 May 2008 09:12:20 +0000
parents a375b1346eb3
children ba1fa511b72d
line wrap: on
line diff
--- a/Lib/BaseHTTPServer.py	Sun May 18 08:52:59 2008 +0000
+++ b/Lib/BaseHTTPServer.py	Sun May 18 09:12:20 2008 +0000
@@ -218,6 +218,12 @@
     # 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 @@
 
         """
         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':