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);
/* 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");
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();
}