]> granicus.if.org Git - libevent/commitdiff
test both piplining on persistent and non-persistent connections
authorNiels Provos <provos@gmail.com>
Sat, 18 Nov 2006 03:43:26 +0000 (03:43 +0000)
committerNiels Provos <provos@gmail.com>
Sat, 18 Nov 2006 03:43:26 +0000 (03:43 +0000)
svn:r262

test/regress_http.c

index d58c2ae13e4b52f9c7fcc9d519b1cf53897f443e..9ebf24d00a7651833d7835515856c4a41dd2806e 100644 (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();
 }