Example #1
0
    def test_simple(self):
        libpry.raises(proxy.ProxyError, proxy.parse_proxy_request, "")

        u = "GET ... HTTP/1.1"
        libpry.raises("invalid url", proxy.parse_proxy_request, u)

        u = "MORK / HTTP/1.1"
        libpry.raises("unknown request method", proxy.parse_proxy_request, u)

        u = "GET http://foo.com:8888/test HTTP/1.1"
        m, s, h, po, pa = proxy.parse_proxy_request(u)
        assert m == "GET"
        assert s == "http"
        assert h == "foo.com"
        assert po == 8888
        assert pa == "/test"
Example #2
0
 def test_inner(self):
     u = "GET / HTTP/1.1"
     assert proxy.parse_proxy_request(u) == ('GET', None, None, None, '/')
Example #3
0
 def test_connect(self):
     u = "CONNECT host.com:443 HTTP/1.0"
     expected = ('CONNECT', None, 'host.com', 443, None)
     ret = proxy.parse_proxy_request(u)
     assert expected == ret