Beispiel #1
0
 def getresponse(self):
     if self._current_response is None:
         raise httplib.ResponseNotReady()
     r = self._current_response
     while r.headers is None:
         if not r._select() and not r.complete():
             raise _readers.HTTPRemoteClosedError()
     if r.will_close:
         self.sock = None
         self._current_response = None
     elif r.complete():
         self._current_response = None
     else:
         self._current_response_taken = True
     return r
Beispiel #2
0
 def getresponse(self):
     """Returns the response to the most recent request."""
     if self._current_response is None:
         raise httplib.ResponseNotReady()
     r = self._current_response
     while r.headers is None:
         # We're a friend of the response class, so let us use the
         # private attribute.
         # pylint: disable=W0212
         if not r._select() and not r.complete():
             raise _readers.HTTPRemoteClosedError()
     if r.will_close:
         self.sock = None
         self._current_response = None
     elif r.complete():
         self._current_response = None
     else:
         self._current_response_taken = True
     return r