mirror of
				https://github.com/python/cpython.git
				synced 2025-10-30 21:21:22 +00:00 
			
		
		
		
	Search from the end of the host/port combination to find the colon which
separates ip address from the port to accommodate ipv6 addresses.
This commit is contained in:
		
							parent
							
								
									065a32f550
								
							
						
					
					
						commit
						10e6e0e61a
					
				
					 2 changed files with 8 additions and 1 deletions
				
			
		|  | @ -524,7 +524,7 @@ def __init__(self, host, port=None, strict=None): | ||||||
| 
 | 
 | ||||||
|     def _set_hostport(self, host, port): |     def _set_hostport(self, host, port): | ||||||
|         if port is None: |         if port is None: | ||||||
|             i = host.find(':') |             i = host.rfind(':') | ||||||
|             if i >= 0: |             if i >= 0: | ||||||
|                 try: |                 try: | ||||||
|                     port = int(host[i+1:]) |                     port = int(host[i+1:]) | ||||||
|  |  | ||||||
|  | @ -118,6 +118,13 @@ def _test(): | ||||||
|         else: |         else: | ||||||
|             print "Expect InvalidURL" |             print "Expect InvalidURL" | ||||||
| 
 | 
 | ||||||
|  |     for hp in ("[fe80::207:e9ff:fe9b]:8000", "www.python.org:80", | ||||||
|  |                "www.python.org"): | ||||||
|  |         try: | ||||||
|  |             h = httplib.HTTP(hp) | ||||||
|  |         except httplib.InvalidURL: | ||||||
|  |             print "InvalidURL raised erroneously" | ||||||
|  | 
 | ||||||
|     # test response with multiple message headers with the same field name. |     # test response with multiple message headers with the same field name. | ||||||
|     text = ('HTTP/1.1 200 OK\r\n' |     text = ('HTTP/1.1 200 OK\r\n' | ||||||
|             'Set-Cookie: Customer="WILE_E_COYOTE"; Version="1"; Path="/acme"\r\n' |             'Set-Cookie: Customer="WILE_E_COYOTE"; Version="1"; Path="/acme"\r\n' | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Skip Montanaro
						Skip Montanaro