예제 #1
0
 def finish_response(self):
     try:
         ServerHandler.finish_response(self)
     except IOError as ex:
         if ex.errno == 32:
             print('client disconnected.')
         else:
             raise ex
예제 #2
0
    def finish_response(self):
        # If the browser closes the connection while we still want to sen stuff back,
        # we want to fail silently and give up. This often happens in tests where the
        # browser may want to request embedded links (like stylesheets) too, yet the
        # test has already clicked on the next link.
        ssl_eof_error = ssl.SSLEOFError
        broken_pipe_error = BrokenPipeError

        try:
            ServerHandler.finish_response(self)
        except (ssl_eof_error, broken_pipe_error):
            # Silently ignore it if it looks like the client browser closed the connection.
            pass