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

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

        u = "GET http://foo.com:8888/test HTTP/1.1"
        m, s, h, po, pa, minor = proxy.parse_request_line(u)
        assert m == "GET"
        assert s == "http"
        assert h == "foo.com"
        assert po == 8888
        assert pa == "/test"
        assert minor == 1
Exemple #2
0
    def test_simple(self):
        libpry.raises(proxy.ProxyError, proxy.parse_request_line, "")

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

        u = "GET http://foo.com:8888/test HTTP/1.1"
        m, s, h, po, pa, minor = proxy.parse_request_line(u)
        assert m == "GET"
        assert s == "http"
        assert h == "foo.com"
        assert po == 8888
        assert pa == "/test"
        assert minor == 1
Exemple #3
0
 def test_inner(self):
     u = "GET / HTTP/1.1"
     assert proxy.parse_request_line(u) == ('GET', None, None, None, '/', 1)
Exemple #4
0
 def test_connect(self):
     u = "CONNECT host.com:443 HTTP/1.0"
     expected = ('CONNECT', None, 'host.com', 443, None, 0)
     ret = proxy.parse_request_line(u)
     assert expected == ret
Exemple #5
0
 def test_inner(self):
     u = "GET / HTTP/1.1"
     assert proxy.parse_request_line(u) == ('GET', None, None, None, '/', 1)
Exemple #6
0
 def test_connect(self):
     u = "CONNECT host.com:443 HTTP/1.0"
     expected = ('CONNECT', None, 'host.com', 443, None, 0)
     ret = proxy.parse_request_line(u)
     assert expected == ret