diff options
author | Guido van Rossum <guido@python.org> | 1995-09-30 16:50:46 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1995-09-30 16:50:46 (GMT) |
commit | 928fcede658e8ae533677095e7055b58a64e7dc4 (patch) | |
tree | f84f318a1484dec9c93fde281043ec594f632e15 | |
parent | c7ae92069d9b83b3c50ffd68b86a97a28d6f75cc (diff) | |
download | cpython-928fcede658e8ae533677095e7055b58a64e7dc4.zip cpython-928fcede658e8ae533677095e7055b58a64e7dc4.tar.gz cpython-928fcede658e8ae533677095e7055b58a64e7dc4.tar.bz2 |
actualized example/reference, fix bug w/ nonnumeric port
-rw-r--r-- | Lib/httplib.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/Lib/httplib.py b/Lib/httplib.py index 59799cc..3aeb643 100644 --- a/Lib/httplib.py +++ b/Lib/httplib.py @@ -1,15 +1,14 @@ # HTTP client class # -# See the following document for a tentative protocol description: -# Hypertext Transfer Protocol (HTTP) Tim Berners-Lee, CERN -# Internet Draft 5 Nov 1993 -# draft-ietf-iiir-http-00.txt Expires 5 May 1994 +# See the following URL for a description of the HTTP/1.0 protocol: +# http://www.w3.org/hypertext/WWW/Protocols/ +# (I actually implemented it from a much earlier draft.) # # Example: # # >>> from httplib import HTTP -# >>> h = HTTP('www.cwi.nl') -# >>> h.putreqest('GET', '/index.html') +# >>> h = HTTP('www.python.org') +# >>> h.putrequest('GET', '/index.html') # >>> h.putheader('Accept', 'text/html') # >>> h.putheader('Accept', 'text/plain') # >>> h.endheaders() @@ -18,7 +17,8 @@ # ... f = h.getfile() # ... print f.read() # Print the raw HTML # ... -# <TITLE>Home Page of CWI, Amsterdam</TITLE> +# <HEAD> +# <TITLE>Python Language Home Page</TITLE> # [...many more lines...] # >>> # @@ -58,7 +58,8 @@ class HTTP: if i >= 0: host, port = host[:i], host[i+1:] try: port = string.atoi(port) - except string.atoi_error: pass + except string.atoi_error: + raise socket.error, "nonnumeric port" if not port: port = HTTP_PORT self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) if self.debuglevel > 0: print 'connect:', (host, port) |