def getproto(self, request): rfile = BytesIO(request) wfile = BytesIO() handler = testutil.gettestinghandler(rfile, wfile, self.config) return ProtocolMultiplexer.getProtocol(file.readline(), handler.server, handler, handler.rfile, handler.wfile, self.config)
def getproto(self, request): rfile = StringIO(request) wfile = StringIO() handler = testutil.gettestinghandler(rfile, wfile, self.config) return ProtocolMultiplexer.getProtocol(file.readline(), handler.server, handler, handler.rfile, handler.wfile, self.config)
def handle(self): request = self.rfile.readline() protohandler = \ ProtocolMultiplexer.getProtocol(request, \ self.server, self, self.rfile, self.wfile, self.server.config) try: protohandler.handle() except socket.error, e: if not (e[0] in [errno.ECONNRESET, errno.EPIPE]): traceback.print_exc() GopherExceptions.log(sys.exc_info()[1], protohandler, None)
def handle(self): request = self.rfile.readline() protohandler = ProtocolMultiplexer.getProtocol( request, self.server, self, self.rfile, self.wfile, self.server.config ) try: protohandler.handle() except socket.error, e: if not (e[0] in [errno.ECONNRESET, errno.EPIPE]): traceback.print_exc() GopherExceptions.log(sys.exc_info()[1], protohandler, None)
def gettestingprotocol(request, config=None): config = config or getconfig() rfile = StringIO(request) # Pass fake rfile, wfile to gettestinghandler -- they'll be closed before # we can get the info, and some protocols need to read more from them. handler = gettestinghandler(StringIO(), StringIO(), config) # Now override. handler.rfile = rfile return ProtocolMultiplexer.getProtocol(rfile.readline(), handler.server, handler, handler.rfile, handler.wfile, config)
def gettestingprotocol(request, config = None): config = config or getconfig() rfile = StringIO(request) # Pass fake rfile, wfile to gettestinghandler -- they'll be closed before # we can get the info, and some protocols need to read more from them. handler = gettestinghandler(StringIO(), StringIO(), config) # Now override. handler.rfile = rfile return ProtocolMultiplexer.getProtocol(rfile.readline(), handler.server, handler, handler.rfile, handler.wfile, config)
def handle(self): request = self.rfile.readline() protohandler = \ ProtocolMultiplexer.getProtocol(request, \ self.server, self, self.rfile, self.wfile, self.server.config) try: protohandler.handle() except socket.error as e: if not (e[0] in [errno.ECONNRESET, errno.EPIPE]): traceback.print_exc() GopherExceptions.log(sys.exc_info()[1], protohandler, None) except: if GopherExceptions.tracebacks: # Yes, this may be invalid. Not much else we can do. #traceback.print_exc(file = self.wfile) traceback.print_exc() GopherExceptions.log(sys.exc_info()[1], protohandler, None)
def handle(self) -> None: request = self.rfile.readline().decode(errors="surrogateescape") protohandler = ProtocolMultiplexer.getProtocol( request, self.server, self, self.rfile, self.wfile, self.server.config ) try: protohandler.handle() except IOError as e: if not (e.errno in [errno.ECONNRESET, errno.EPIPE]): traceback.print_exc() GopherExceptions.log(e, protohandler, None) except Exception as e: if GopherExceptions.tracebacks: # Yes, this may be invalid. Not much else we can do. # traceback.print_exc(file = self.wfile) traceback.print_exc() GopherExceptions.log(e, protohandler, None)