def handleResponseEnd(self): """ Mangles the received response, and then replays that response to the client using the proxy. Closes both the connection to the client and the server. """ if self._finished: return self._finished = True self.transport.loseConnection() self.response.content.seek(0, 0) d = defer.maybeDeferred(self.mangler, self.response) d.addCallback(passthrough(self._replayContent)) d.addCallback(passthrough(self.father.transport.loseConnection))
def process(self): """ Processes this request. """ if self.mangler is not None: d = defer.maybeDeferred(self.mangler, self) d.addCallback(passthrough(self._finishProcessing)) else: self._finishProcessing()