Exemplo n.º 1
0
 def _httpResponse2httplib( self, originalResponse, mangledResponse ):
     '''
     Convert an httpResponse.httpResponse object to a httplib.httpresponse subclass that I created in keepalive.
     
     @parameter httpResponse: httpResponse.httpResponse object
     @return: httplib.httpresponse subclass 
     '''
     kaRes = kaHTTPResponse( originalResponse._connection.sock, debuglevel=0, strict=0, method=None )
     kaRes.setBody( mangledResponse.getBody() )
     kaRes.headers = mangledResponse.getHeaders()
     kaRes.code = mangledResponse.getCode()
     kaRes._url = mangledResponse.getURI()
     kaRes.msg = originalResponse.msg
     return kaRes
Exemplo n.º 2
0
    def _HTTPResponse2httplib(self, originalResponse, mangled_response):
        '''
        Convert an HTTPResponse.HTTPResponse object to a httplib.httpresponse
        subclass that I created in keepalive.

        :param HTTPResponse: HTTPResponse.HTTPResponse object
        :return: httplib.httpresponse subclass
        '''
        ka_resp = kaHTTPResponse(originalResponse._connection.sock, debuglevel=0,
                                 strict=0, method=None)
        ka_resp.set_body(mangled_response.get_body())
        ka_resp.headers = mangled_response.get_headers()
        ka_resp.code = mangled_response.get_code()
        ka_resp._url = mangled_response.get_uri().url_string
        ka_resp.msg = originalResponse.msg
        ka_resp.id = originalResponse.id
        ka_resp.encoding = mangled_response.charset
        return ka_resp
Exemplo n.º 3
0
    def _HTTPResponse2httplib(self, originalResponse, mangled_response):
        '''
        Convert an HTTPResponse.HTTPResponse object to a httplib.httpresponse
        subclass that I created in keepalive.

        :param HTTPResponse: HTTPResponse.HTTPResponse object
        :return: httplib.httpresponse subclass
        '''
        ka_resp = kaHTTPResponse(originalResponse._connection.sock,
                                 debuglevel=0,
                                 strict=0,
                                 method=None)
        ka_resp.set_body(mangled_response.get_body())
        ka_resp.headers = mangled_response.get_headers()
        ka_resp.code = mangled_response.get_code()
        ka_resp._url = mangled_response.get_uri().url_string
        ka_resp.msg = originalResponse.msg
        ka_resp.id = originalResponse.id
        ka_resp.encoding = mangled_response.charset
        return ka_resp