[Python-checkins] CVS: python/dist/src/Lib httplib.py,1.47,1.48

Skip Montanaro montanaro@users.sourceforge.net
Sun, 24 Mar 2002 08:53:52 -0800


Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv27725

Modified Files:
	httplib.py 
Log Message:
add InvalidURL exception - raised if port is given but empty or non-numeric


Index: httplib.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/httplib.py,v
retrieving revision 1.47
retrieving revision 1.48
diff -C2 -d -r1.47 -r1.48
*** httplib.py	18 Mar 2002 22:51:48 -0000	1.47
--- httplib.py	24 Mar 2002 16:53:50 -0000	1.48
***************
*** 348,352 ****
              i = host.find(':')
              if i >= 0:
!                 port = int(host[i+1:])
                  host = host[:i]
              else:
--- 348,355 ----
              i = host.find(':')
              if i >= 0:
!                 try:
!                     port = int(host[i+1:])
!                 except ValueError:
!                     raise InvalidURL, "nonnumeric port: '%s'"%host[i+1:]
                  host = host[:i]
              else:
***************
*** 807,810 ****
--- 810,816 ----
  
  class NotConnected(HTTPException):
+     pass
+ 
+ class InvalidURL(HTTPException):
      pass