async def handle_stream(self, stream: IOStream, address: tuple[str, int]): try: addr = await parse_proxy_line_from_buff(stream) if addr is not None: stream.proxy_addr = addr except iostream.StreamClosedError: raise finally: await super(ProxyProtocolTCPServer, self).handle_stream(stream, address)
async def handle_stream(self, stream: IOStream, address: tuple[str, int]): try: addr = await parse_proxy_line_from_buff(stream) if addr is not None: address = (addr['client_ip'], addr['client_port']) stream.proxy_addr = addr return await fn(self, stream, address) except iostream.StreamClosedError: raise except: return await fn(self, stream, address)
async def handle_stream(self, stream: IOStream, address: tuple[str, int]): """ Creates the stream for this connection. This parses out the proxy protocol from the request and injects the relevant fields onto the given stream object at: `stream.proxy_addr` """ try: addr = await parse_proxy_line_from_buff(stream) if addr is not None: stream.proxy_addr = addr # Use our parsed address here. super(ProxyProtocolHTTPServer, self).handle_stream(stream, address) except iostream.StreamClosedError: pass except: super(ProxyProtocolHTTPServer, self).handle_stream(stream, address)