(self, req)
return True
This function:
            - "resolves" the address;
            - alters and sets the proper headers.
This function:
            - "resolves" the address;
            - alters and sets the proper headers.
This function : - resolves the address ; - alters and sets the proper headers .
def process_request(self, req):
        """
        This function:
            - "resolves" the address;
            - alters and sets the proper headers.
        """
        self.obj.uri = req.uri.decode('utf-8')
        self.obj.host_tor = "http://" + self.obj.onion
        self.obj.address = self.obj.host_tor + self.obj.uri
        self.obj.client_proto = 'http://' if config.transport == 'HTTP' else 'https://'
        self.obj.host_tor2web = self.obj.client_proto + self.obj.onion[:-len("onion")] + self.var[
            'basehost'] + self.port

        self.obj.headers = req.headers

        # we remove the x-forwarded-for header that may contain a leaked ip
        # self.obj.headers.removeHeader(b'x-forwarded-for')

        self.obj.headers.setRawHeaders(b'host', [self.obj.onion])
        self.obj.headers.setRawHeaders(b'connection', [b'keep-alive'])
        self.obj.headers.setRawHeaders(b'accept-encoding', [b'gzip, chunked'])
        # self.obj.headers.setRawHeaders(b'x-tor2web', [b'1'])
        # self.obj.headers.setRawHeaders(b'x-forwarded-host', [req.host])
        # self.obj.headers.setRawHeaders(b'x-forwarded-proto', [b'http' if config.transport == 'HTTP' else b'https'])

        return True
def process_request ( self , req ) : self . obj . uri = req . uri . decode ( 'utf-8' ) self . obj . host_tor = "http://" + self . obj . onion self . obj . address = self . obj . host_tor + self . obj . uri self . obj . client_proto = 'http://' if config . transport == 'HTTP' else 'https://' self . obj . host_tor2web = self . obj . client_proto + self . obj . onion [ : - len ( "onion" ) ] + self . var [ 'basehost' ] + self . port self . obj . headers = req . headers # we remove the x-forwarded-for header that may contain a leaked ip # self.obj.headers.removeHeader(b'x-forwarded-for') self . obj . headers . setRawHeaders ( b'host' , [ self . obj . onion ] ) self . obj . headers . setRawHeaders ( b'connection' , [ b'keep-alive' ] ) self . obj . headers . setRawHeaders ( b'accept-encoding' , [ b'gzip, chunked' ] ) # self.obj.headers.setRawHeaders(b'x-tor2web', [b'1']) # self.obj.headers.setRawHeaders(b'x-forwarded-host', [req.host]) # self.obj.headers.setRawHeaders(b'x-forwarded-proto', [b'http' if config.transport == 'HTTP' else b'https']) return True