test both piplining on persistent and non-persistent connections

svn:r262
This commit is contained in:
Niels Provos 2006-11-18 03:43:26 +00:00
parent 36212f9df0
commit 9d81ac48f8

View File

@ -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();
}