summaryrefslogtreecommitdiffstats
path: root/Lib/httplib.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/httplib.py')
-rw-r--r--Lib/httplib.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/httplib.py b/Lib/httplib.py
index fc908d2..7223ba1 100644
--- a/Lib/httplib.py
+++ b/Lib/httplib.py
@@ -810,6 +810,11 @@ class HTTPConnection:
method = self._method)
(version, code, message) = response._read_status()
+ if version == "HTTP/0.9":
+ # HTTP/0.9 doesn't support the CONNECT verb, so if httplib has
+ # concluded HTTP/0.9 is being used something has gone wrong.
+ self.close()
+ raise socket.error("Invalid response from tunnel request")
if code != 200:
self.close()
raise socket.error("Tunnel connection failed: %d %s" % (code,