mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-09 20:41:27 -04:00
test both piplining on persistent and non-persistent connections
svn:r262
This commit is contained in:
parent
36212f9df0
commit
9d81ac48f8
@ -218,14 +218,15 @@ http_basic_test(void)
|
|||||||
void http_request_done(struct evhttp_request *, void *);
|
void http_request_done(struct evhttp_request *, void *);
|
||||||
|
|
||||||
void
|
void
|
||||||
http_connection_test(void)
|
http_connection_test(int persistent)
|
||||||
{
|
{
|
||||||
short port = -1;
|
short port = -1;
|
||||||
struct evhttp_connection *evcon = NULL;
|
struct evhttp_connection *evcon = NULL;
|
||||||
struct evhttp_request *req = NULL;
|
struct evhttp_request *req = NULL;
|
||||||
|
|
||||||
test_ok = 0;
|
test_ok = 0;
|
||||||
fprintf(stdout, "Testing Basic HTTP Connection: ");
|
fprintf(stdout, "Testing Request Connection Pipeline %s: ",
|
||||||
|
persistent ? "(persistent)" : "");
|
||||||
|
|
||||||
http = http_setup(&port);
|
http = http_setup(&port);
|
||||||
|
|
||||||
@ -266,6 +267,13 @@ http_connection_test(void)
|
|||||||
/* Add the information that we care about */
|
/* Add the information that we care about */
|
||||||
evhttp_add_header(req->output_headers, "Host", "somehost");
|
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 */
|
/* We give ownership of the request to the connection */
|
||||||
if (evhttp_make_request(evcon, req, EVHTTP_REQ_GET, "/test") == -1) {
|
if (evhttp_make_request(evcon, req, EVHTTP_REQ_GET, "/test") == -1) {
|
||||||
fprintf(stdout, "FAILED\n");
|
fprintf(stdout, "FAILED\n");
|
||||||
@ -489,7 +497,8 @@ void
|
|||||||
http_suite(void)
|
http_suite(void)
|
||||||
{
|
{
|
||||||
http_basic_test();
|
http_basic_test();
|
||||||
http_connection_test();
|
http_connection_test(0 /* not-persistent */);
|
||||||
|
http_connection_test(1 /* persistent */);
|
||||||
http_post_test();
|
http_post_test();
|
||||||
http_failure_test();
|
http_failure_test();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user