def test_client_slow(serve, client_app=None):
    if client_app is None:
        client_app = SendRequest()
    if not client_app._timeout_supported(client_app.HTTPConnection):
        # timeout isn't supported
        return
    with serve(slow_app) as server:
        req = Request.blank(server.url)
        req.environ["webob.client.timeout"] = 0.1
        resp = req.send(client_app)
        assert resp.status_code == 504, resp.status
예제 #2
0
def test_client_slow(client_app=None):
    if client_app is None:
        client_app = SendRequest()
    if not client_app._timeout_supported(client_app.HTTPConnection):
        # timeout isn't supported
        return
    with serve(slow_app) as server:
        req = Request.blank(server.url)
        req.environ["webob.client.timeout"] = 0.1
        resp = req.send(client_app)
        assert resp.status_code == 504, resp.status
예제 #3
0
def test_client_urllib3():
    try:
        import urllib3
    except:
        return
    client_app = SendRequest.with_urllib3()
    test_client(client_app)
    test_no_content_length(client_app)
    test_bad_server(client_app)
    test_client_slow(client_app)
예제 #4
0
    def __init__(self, global_conf, address, suppress_http_headers=None):

        parts = urlparse(address)
        self.scheme = parts[0]
        if ':' in parts[1]:
            self.server, self.port = parts[1].split(':')
        else:
            self.server, self.port = parts[1], 80

        filtered_headers = SendRequest.filtered_headers
        if suppress_http_headers is not None:
            filtered_headers += tuple(suppress_http_headers.split())

        self.proxy = SendRequest()
        self.proxy.filtered_headers = filtered_headers