Пример #1
0
def test_parse_init_connect():
    assert HTTP1Protocol._parse_init_connect("CONNECT host.com:443 HTTP/1.0")
    assert not HTTP1Protocol._parse_init_connect("C\xfeONNECT host.com:443 HTTP/1.0")
    assert not HTTP1Protocol._parse_init_connect("CONNECT \0host.com:443 HTTP/1.0")
    assert not HTTP1Protocol._parse_init_connect("CONNECT host.com:444444 HTTP/1.0")
    assert not HTTP1Protocol._parse_init_connect("bogus")
    assert not HTTP1Protocol._parse_init_connect("GET host.com:443 HTTP/1.0")
    assert not HTTP1Protocol._parse_init_connect("CONNECT host.com443 HTTP/1.0")
    assert not HTTP1Protocol._parse_init_connect("CONNECT host.com:443 foo/1.0")
    assert not HTTP1Protocol._parse_init_connect("CONNECT host.com:foo HTTP/1.0")