コード例 #1
0
ファイル: contentview.py プロジェクト: sriramoffcl/mitmproxy
 def __call__(self, hdrs, content, limit):
     lines = utils.urldecode(content)
     if lines:
         body = common.format_keyvals([(k + ":", v) for (k, v) in lines],
                                      key="header",
                                      val="text")
         return "URLEncoded form", body
コード例 #2
0
    def test_get_form_urlencoded(self):
        req = tutils.treq("foobar")
        assert req.get_form_urlencoded() == odict.ODict()

        req.headers["Content-Type"] = semantics.HDR_FORM_URLENCODED
        assert req.get_form_urlencoded() == odict.ODict(
            utils.urldecode(req.body))
コード例 #3
0
    def test_get_urlencoded_form(self):
        request = treq(content="foobar")
        assert request.urlencoded_form is None

        request.headers["Content-Type"] = "application/x-www-form-urlencoded"
        assert request.urlencoded_form == ODict(
            utils.urldecode(request.content))
コード例 #4
0
ファイル: http.py プロジェクト: nanonyme/mitmproxy
 def get_query(self):
     """
         Gets the request query string. Returns an ODict object.
     """
     _, _, _, _, query, _ = urlparse.urlparse(self.get_url())
     if query:
         return ODict(utils.urldecode(query))
     return ODict([])
コード例 #5
0
 def get_query(self):
     """
         Gets the request query string. Returns an ODict object.
     """
     _, _, _, _, query, _ = urlparse.urlparse(self.get_url())
     if query:
         return ODict(utils.urldecode(query))
     return ODict([])
コード例 #6
0
ファイル: contentview.py プロジェクト: Fuzion24/mitmproxy
 def __call__(self, hdrs, content, limit):
     lines = utils.urldecode(content)
     if lines:
         body = common.format_keyvals(
             [(k + ":", v) for (k, v) in lines],
             key = "header",
             val = "text"
         )
         return "URLEncoded form", body
コード例 #7
0
ファイル: request.py プロジェクト: shadow000902/mitmproxy
 def query(self):
     """
     The request query string as an :py:class:`ODict` object.
     None, if there is no query.
     """
     _, _, _, _, query, _ = urllib.parse.urlparse(self.url)
     if query:
         return ODict(utils.urldecode(query))
     return None
コード例 #8
0
 def urlencoded_form(self):
     """
     The URL-encoded form data as an :py:class:`ODict` object.
     None if there is no data or the content-type indicates non-form data.
     """
     is_valid_content_type = "application/x-www-form-urlencoded" in self.headers.get("content-type", "").lower()
     if self.content and is_valid_content_type:
         return ODict(utils.urldecode(self.content))
     return None
コード例 #9
0
ファイル: http.py プロジェクト: nanonyme/mitmproxy
 def get_form_urlencoded(self):
     """
         Retrieves the URL-encoded form data, returning an ODict object.
         Returns an empty ODict if there is no data or the content-type
         indicates non-form data.
     """
     if self.content and self.headers.in_any("content-type", HDR_FORM_URLENCODED, True):
         return ODict(utils.urldecode(self.content))
     return ODict([])
コード例 #10
0
ファイル: request.py プロジェクト: Lukasa/mitmproxy
 def urlencoded_form(self):
     """
     The URL-encoded form data as an :py:class:`ODict` object.
     None if there is no data or the content-type indicates non-form data.
     """
     is_valid_content_type = "application/x-www-form-urlencoded" in self.headers.get("content-type", "").lower()
     if self.content and is_valid_content_type:
         return ODict(utils.urldecode(self.content))
     return None
コード例 #11
0
ファイル: request.py プロジェクト: Lukasa/mitmproxy
 def query(self):
     """
     The request query string as an :py:class:`ODict` object.
     None, if there is no query.
     """
     _, _, _, _, query, _ = urllib.parse.urlparse(self.url)
     if query:
         return ODict(utils.urldecode(query))
     return None
コード例 #12
0
ファイル: semantics.py プロジェクト: camerony/netlib
 def get_form_urlencoded(self):
     """
         Retrieves the URL-encoded form data, returning an ODict object.
         Returns an empty ODict if there is no data or the content-type
         indicates non-form data.
     """
     if self.body and HDR_FORM_URLENCODED in self.headers.get("content-type", "").lower():
         return odict.ODict(utils.urldecode(self.body))
     return odict.ODict([])
コード例 #13
0
ファイル: semantics.py プロジェクト: fireswood/netlib
 def get_form_urlencoded(self):
     """
         Retrieves the URL-encoded form data, returning an ODict object.
         Returns an empty ODict if there is no data or the content-type
         indicates non-form data.
     """
     if self.body and HDR_FORM_URLENCODED in self.headers.get(
             "content-type", "").lower():
         return odict.ODict(utils.urldecode(self.body))
     return odict.ODict([])
コード例 #14
0
 def get_form_urlencoded(self):
     """
         Retrieves the URL-encoded form data, returning an ODict object.
         Returns an empty ODict if there is no data or the content-type
         indicates non-form data.
     """
     if self.content and self.headers.in_any("content-type",
                                             HDR_FORM_URLENCODED, True):
         return ODict(utils.urldecode(self.content))
     return ODict([])
コード例 #15
0
ファイル: test_request.py プロジェクト: ganguera/mitmproxy
    def test_get_urlencoded_form(self):
        request = treq(content="foobar")
        assert request.urlencoded_form is None

        request.headers["Content-Type"] = "application/x-www-form-urlencoded"
        assert request.urlencoded_form == ODict(utils.urldecode(request.content))
コード例 #16
0
ファイル: test_utils.py プロジェクト: fireswood/netlib
def test_urldecode():
    s = "one=two&three=four"
    assert len(utils.urldecode(s)) == 2
コード例 #17
0
ファイル: test_models.py プロジェクト: pombredanne/netlib
    def test_get_form_urlencoded(self):
        req = tutils.treq(body="foobar")
        assert req.get_form_urlencoded() == ODict()

        req.headers["Content-Type"] = HDR_FORM_URLENCODED
        assert req.get_form_urlencoded() == ODict(utils.urldecode(req.body))
コード例 #18
0
ファイル: contentviews.py プロジェクト: pombredanne/mitmproxy
 def __call__(self, data, **metadata):
     d = urldecode(data)
     return "URLEncoded form", format_dict(ODict(d))
コード例 #19
0
ファイル: request.py プロジェクト: thomasbhatia/mitmproxy
 def _get_query(self):
     _, _, _, _, query, _ = urllib.parse.urlparse(self.url)
     return tuple(utils.urldecode(query))
コード例 #20
0
ファイル: contentviews.py プロジェクト: saugatt/mitmproxy
 def __call__(self, data, **metadata):
     d = urldecode(data)
     return "URLEncoded form", format_dict(ODict(d))
コード例 #21
0
ファイル: test_utils.py プロジェクト: PidgeyL/netlib
def test_urldecode():
    s = "one=two&three=four"
    assert len(utils.urldecode(s)) == 2
コード例 #22
0
ファイル: request.py プロジェクト: thomasbhatia/mitmproxy
 def _get_urlencoded_form(self):
     is_valid_content_type = "application/x-www-form-urlencoded" in self.headers.get("content-type", "").lower()
     if is_valid_content_type:
         return tuple(utils.urldecode(self.content))
     return ()
コード例 #23
0
    def test_get_form_urlencoded(self):
        req = tutils.treq("foobar")
        assert req.get_form_urlencoded() == odict.ODict()

        req.headers["Content-Type"] = [semantics.HDR_FORM_URLENCODED]
        assert req.get_form_urlencoded() == odict.ODict(utils.urldecode(req.body))