From: Niels Provos Date: Sat, 18 Nov 2006 03:43:26 +0000 (+0000) Subject: test both piplining on persistent and non-persistent connections X-Git-Tag: release-2.0.1-alpha~697 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9d81ac48f8031e6a49afb1c7c35358d9751f414c;p=libevent test both piplining on persistent and non-persistent connections svn:r262 --- diff --git a/test/regress_http.c b/test/regress_http.c index d58c2ae1..9ebf24d0 100644 --- a/test/regress_http.c +++ b/test/regress_http.c @@ -218,14 +218,15 @@ http_basic_test(void) void http_request_done(struct evhttp_request *, void *); void -http_connection_test(void) +http_connection_test(int persistent) { short port = -1; struct evhttp_connection *evcon = NULL; struct evhttp_request *req = NULL; test_ok = 0; - fprintf(stdout, "Testing Basic HTTP Connection: "); + fprintf(stdout, "Testing Request Connection Pipeline %s: ", + persistent ? "(persistent)" : ""); http = http_setup(&port); @@ -266,6 +267,13 @@ http_connection_test(void) /* Add the information that we care about */ evhttp_add_header(req->output_headers, "Host", "somehost"); + /* + * if our connections are not supposed to be persistent; request + * a close from the server. + */ + if (!persistent) + evhttp_add_header(req->output_headers, "Connection", "close"); + /* We give ownership of the request to the connection */ if (evhttp_make_request(evcon, req, EVHTTP_REQ_GET, "/test") == -1) { fprintf(stdout, "FAILED\n"); @@ -489,7 +497,8 @@ void http_suite(void) { http_basic_test(); - http_connection_test(); + http_connection_test(0 /* not-persistent */); + http_connection_test(1 /* persistent */); http_post_test(); http_failure_test(); }