Exemplo n.º 1
0
 def close(self):
     HTTPResponse.close(self)
     if self.sock:
         try:
             # Prevent long CLOSE_WAIT state
             self.sock.shutdown(socket.SHUT_RDWR)
         except socket.error:
             pass
     self.sock = None
     self._actual_socket = None
Exemplo n.º 2
0
 def read(self, amount=None):
     try:
         return HTTPResponse.read(self, amount)
     except AttributeError as err:
         # We have seen that in production but could not reproduce.
         # This message will help us track the error further.
         if "no attribute 'recv'" in err.message:
             raise IOError('reading socket after close')
         else:
             raise
Exemplo n.º 3
0
 def read(self, amount=None):
     return HTTPResponse.read(self, amount)