コード例 #1
0
def tflow(client_conn=True, server_conn=True, req=True, resp=None, err=None):
    """
    @type client_conn: bool | None | libmproxy.proxy.connection.ClientConnection
    @type server_conn: bool | None | libmproxy.proxy.connection.ServerConnection
    @type req:         bool | None | libmproxy.protocol.http.HTTPRequest
    @type resp:        bool | None | libmproxy.protocol.http.HTTPResponse
    @type err:         bool | None | libmproxy.protocol.primitives.Error
    @return:           bool | None | libmproxy.protocol.http.HTTPFlow
    """
    if client_conn is True:
        client_conn = tclient_conn()
    if server_conn is True:
        server_conn = tserver_conn()
    if req is True:
        req = treq()
    if resp is True:
        resp = tresp()
    if err is True:
        err = terr()

    f = http.HTTPFlow(client_conn, server_conn)
    f.request = req
    f.response = resp
    f.error = err
    f.reply = controller.DummyReply()
    return f
コード例 #2
0
ファイル: test_filt.py プロジェクト: owers19856/mitmproxy
 def req(self):
     headers = Headers(header="qvalue")
     req = http.HTTPRequest("absolute", "GET", "http", "host", 80, "/path",
                            (1, 1), headers, "content_request", None, None)
     f = http.HTTPFlow(tutils.tclient_conn(), None)
     f.request = req
     return f
コード例 #3
0
 def req(self):
     headers = odict.ODictCaseless()
     headers["header"] = ["qvalue"]
     req = http.HTTPRequest("absolute", "GET", "http", "host", 80, "/path",
                            (1, 1), headers, "content_request", None, None)
     f = http.HTTPFlow(tutils.tclient_conn(), None)
     f.request = req
     return f
コード例 #4
0
ファイル: tutils.py プロジェクト: yuljasc/mitmproxy
def treq(conn=None, content="content"):
    if not conn:
        conn = tclient_conn()
    server_conn = tserver_conn()
    headers = flow.ODictCaseless()
    headers["header"] = ["qvalue"]

    f = http.HTTPFlow(conn, server_conn)
    f.request = http.HTTPRequest("relative", "GET", None, None, None, "/path",
                                 (1, 1), headers, content, None, None, None)
    f.request.reply = controller.DummyReply()
    return f.request