test/http: chunk_out for https

This commit is contained in:
Azat Khuzhin 2015-11-06 15:58:41 +03:00
parent a1b142bd3e
commit a71ffb9d1b

View File

@ -2934,6 +2934,10 @@ http_chunked_errorcb(struct bufferevent *bev, short what, void *arg)
{ {
struct evhttp_request *req = NULL; struct evhttp_request *req = NULL;
/** SSL */
if (what & BEV_EVENT_CONNECTED)
return;
if (!test_ok) if (!test_ok)
goto out; goto out;
@ -3068,7 +3072,7 @@ http_chunked_request_done(struct evhttp_request *req, void *arg)
} }
static void static void
http_chunk_out_test(void *arg) http_chunk_out_test_impl(void *arg, int ssl)
{ {
struct basic_test_data *data = arg; struct basic_test_data *data = arg;
struct bufferevent *bev; struct bufferevent *bev;
@ -3083,12 +3087,12 @@ http_chunk_out_test(void *arg)
exit_base = data->base; exit_base = data->base;
test_ok = 0; test_ok = 0;
http = http_setup(&port, data->base, 0); http = http_setup(&port, data->base, ssl ? HTTP_BIND_SSL : 0);
fd = http_connect("127.0.0.1", port); fd = http_connect("127.0.0.1", port);
/* Stupid thing to send a request */ /* Stupid thing to send a request */
bev = bufferevent_socket_new(data->base, fd, 0); bev = create_bev(data->base, fd, ssl);
bufferevent_setcb(bev, bufferevent_setcb(bev,
http_chunked_readcb, http_chunked_writecb, http_chunked_readcb, http_chunked_writecb,
http_chunked_errorcb, data->base); http_chunked_errorcb, data->base);
@ -3115,7 +3119,9 @@ http_chunk_out_test(void *arg)
tt_int_op(test_ok, ==, 2); tt_int_op(test_ok, ==, 2);
/* now try again with the regular connection object */ /* now try again with the regular connection object */
evcon = evhttp_connection_base_new(data->base, NULL, "127.0.0.1", port); bev = create_bev(data->base, -1, ssl);
evcon = evhttp_connection_base_bufferevent_new(
data->base, NULL, bev, "127.0.0.1", port);
tt_assert(evcon); tt_assert(evcon);
/* make two requests to check the keepalive behavior */ /* make two requests to check the keepalive behavior */
@ -3143,6 +3149,8 @@ http_chunk_out_test(void *arg)
if (http) if (http)
evhttp_free(http); evhttp_free(http);
} }
static void http_chunk_out_test(void *arg)
{ return http_chunk_out_test_impl(arg, 0); }
static void static void
http_stream_out_test(void *arg) http_stream_out_test(void *arg)
@ -4228,6 +4236,8 @@ static void https_connection_retry_conn_address_test(void *arg)
{ return http_connection_retry_conn_address_test_impl(arg, 1); } { return http_connection_retry_conn_address_test_impl(arg, 1); }
static void https_connection_retry_test(void *arg) static void https_connection_retry_test(void *arg)
{ return http_connection_retry_test_impl(arg, 1); } { return http_connection_retry_test_impl(arg, 1); }
static void https_chunk_out_test(void *arg)
{ return http_chunk_out_test_impl(arg, 1); }
#endif #endif
struct testcase_t http_testcases[] = { struct testcase_t http_testcases[] = {
@ -4296,6 +4306,7 @@ struct testcase_t http_testcases[] = {
{ "https_connection_retry", https_connection_retry_test, TT_ISOLATED|TT_OFF_BY_DEFAULT, &basic_setup, NULL }, { "https_connection_retry", https_connection_retry_test, TT_ISOLATED|TT_OFF_BY_DEFAULT, &basic_setup, NULL },
{ "https_connection_retry_conn_address", https_connection_retry_conn_address_test, { "https_connection_retry_conn_address", https_connection_retry_conn_address_test,
TT_ISOLATED|TT_OFF_BY_DEFAULT, &basic_setup, NULL }, TT_ISOLATED|TT_OFF_BY_DEFAULT, &basic_setup, NULL },
HTTPS(chunk_out),
#endif #endif
END_OF_TESTCASES END_OF_TESTCASES