]> granicus.if.org Git - python/commitdiff
SF Patch #103225 by Ping: httplib: smallest Python patch ever
authorGuido van Rossum <guido@python.org>
Sat, 13 Jan 2001 16:55:33 +0000 (16:55 +0000)
committerGuido van Rossum <guido@python.org>
Sat, 13 Jan 2001 16:55:33 +0000 (16:55 +0000)
  The ASCII-art diagram at the top of httplib contains a backslash at
  the end of a line, which causes Python to remove the newline. This
  one-character patch adds a space after the backslash so it will
  appear at the end of the line in the docstring as intended.

Lib/httplib.py

index 3e7921741041b6f294ee70d97a3736388d40a967..17ca268bc9914eb33df49e63e4e07fbddf8817d6 100644 (file)
@@ -25,7 +25,7 @@ request. This diagram details these state transitions:
       v
     Unread-response   [Response-headers-read]
       |\____________________
-      |                     \
+      |                     \ 
       | response.read()      | putrequest()
       v                      v
     Idle                   Req-started-unread-response
@@ -332,7 +332,10 @@ class HTTPConnection:
         if port is None:
             i = host.find(':')
             if i >= 0:
-                port = int(host[i+1:])
+                try:
+                    port = int(host[i+1:])
+                except ValueError, msg:
+                    raise socket.error, str(msg)
                 host = host[:i]
             else:
                 port = self.default_port