Esempio n. 1
0
 def gen_connection(send_data):
     factory = ProxyClientFactory(http.Request(send_data))
     protocol = factory.buildProtocol(None)
     tr = FakeTransport(protocol, True)
     protocol.makeConnection(tr)
     sent = yield protocol.data_defer
     defer.returnValue((protocol, sent, factory.data_defer))
Esempio n. 2
0
def gen_client_protocol(req, stream_response=False):
    return_transport = TLSStringTransport()
    factory = ProxyClientFactory(req,
                                 save_all=True,
                                 stream_response=stream_response,
                                 return_transport=return_transport)
    protocol = factory.buildProtocol(('127.0.0.1', 0), _do_callback=False)
    tr = TLSStringTransport()
    protocol.makeConnection(tr)
    return protocol
Esempio n. 3
0
def gen_client_protocol(req, stream_response=False):
    return_transport = TLSStringTransport()
    factory = ProxyClientFactory(req,
                                 save_all=True,
                                 stream_response=stream_response,
                                 return_transport=return_transport)
    protocol = factory.buildProtocol(('127.0.0.1', 0), _do_callback=False)
    tr = TLSStringTransport()
    protocol.makeConnection(tr)
    return protocol
Esempio n. 4
0
    def gen_connection(send_data, new_req=False, new_rsp=False,
                       drop_req=False, drop_rsp=False):
        factory = ProxyClientFactory(http.Request(send_data))

        macro = gen_mangle_macro(new_req, new_rsp, drop_req, drop_rsp)
        factory.intercepting_macros['pappy_mangle'] = macro

        protocol = factory.buildProtocol(None)
        tr = FakeTransport(protocol, True)
        protocol.makeConnection(tr)
        sent = yield protocol.data_defer
        print sent
        defer.returnValue((protocol, sent, factory.data_defer))
Esempio n. 5
0
    def gen_connection(send_data,
                       new_req=False,
                       new_rsp=False,
                       drop_req=False,
                       drop_rsp=False):
        factory = ProxyClientFactory(http.Request(send_data))

        macro = gen_mangle_macro(new_req, new_rsp, drop_req, drop_rsp)
        factory.intercepting_macros['pappy_mangle'] = macro

        protocol = factory.buildProtocol(None)
        tr = FakeTransport(protocol, True)
        protocol.makeConnection(tr)
        sent = yield protocol.data_defer
        print sent
        defer.returnValue((protocol, sent, factory.data_defer))