Changeset 3351

Show
Ignore:
Timestamp:
01/11/10 14:06:40 (10 years ago)
Author:
cemeyer
Message:

httpretrieve: Handle the server disconnecting sockets on us.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • seattle/trunk/seattlelib/httpretrieve.repy

    r3350 r3351  
    174174  headers_str = "" 
    175175  while True: 
    176     headers_str += sock.recv(1) 
    177     if headers_str.endswith("\r\n\r\n"): 
    178       break 
     176    try: 
     177      headers_str += sock.recv(1) 
     178      if headers_str.endswith("\r\n\r\n"): 
     179        break 
     180    except Exception, e: 
     181      if str(e) == "Socket closed": 
     182        break 
     183      else: 
     184        raise 
    179185 
    180186  httpheaderlines = headers_str.split("\r\n")