Ejemplo n.º 1
0
 def __call__(self, data, **metadata):
     try:
         data = data.decode("ascii", "strict")
     except ValueError:
         return None
     d = url.decode(data)
     return "URLEncoded form", base.format_pairs(d)
Ejemplo n.º 2
0
 def __call__(self, data, **metadata):
     try:
         data = data.decode("ascii", "strict")
     except ValueError:
         return None
     d = url.decode(data)
     return "URLEncoded form", format_dict(multidict.MultiDict(d))
Ejemplo n.º 3
0
 def __call__(self, data, **metadata):
     try:
         data = data.decode("ascii", "strict")
     except ValueError:
         return None
     d = url.decode(data)
     return "URLEncoded form", format_dict(multidict.MultiDict(d))
Ejemplo n.º 4
0
 def _decode(self, data, **metadata):
     try:
         if type(data) is not str:
             data = data.decode("ascii", "strict")
         if not data.startswith('http'):
             raise ValueError("[Phorcys] Failed to parse input.")
         data = url.decode(data)
         if not data:
             raise ValueError("[Phorcys] Failed to parse input.")
         for (k, v) in data:
             child = Layer(True)
             child.human_readable = True
             child.parent = self.layer
             child.raw_data = v
             child.name = k
             child.lines = [v]
             self.layer.lines.append('%s=%s' % (k, v))
             self.layer.add_extracted_layer(child)
     except:
         raise ValueError("[Phorcys] Failed to parse input.")
Ejemplo n.º 5
0
 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(url.decode(self.get_text(strict=False)))
     return ()
Ejemplo n.º 6
0
 def _get_query(self):
     query = urllib.parse.urlparse(self.url).query
     return tuple(url.decode(query))
Ejemplo n.º 7
0
def test_decode():
    s = "one=two&three=four"
    assert len(url.decode(s)) == 2
    assert url.decode(surrogates)
Ejemplo n.º 8
0
def test_decode():
    s = "one=two&three=four"
    assert len(url.decode(s)) == 2
    assert url.decode(surrogates)