mirror of
https://github.com/libevent/libevent.git
synced 2025-01-09 00:56:20 +08:00
test/http: chunk_out for https
This commit is contained in:
parent
a1b142bd3e
commit
a71ffb9d1b
@ -2934,6 +2934,10 @@ http_chunked_errorcb(struct bufferevent *bev, short what, void *arg)
|
||||
{
|
||||
struct evhttp_request *req = NULL;
|
||||
|
||||
/** SSL */
|
||||
if (what & BEV_EVENT_CONNECTED)
|
||||
return;
|
||||
|
||||
if (!test_ok)
|
||||
goto out;
|
||||
|
||||
@ -3068,7 +3072,7 @@ http_chunked_request_done(struct evhttp_request *req, void *arg)
|
||||
}
|
||||
|
||||
static void
|
||||
http_chunk_out_test(void *arg)
|
||||
http_chunk_out_test_impl(void *arg, int ssl)
|
||||
{
|
||||
struct basic_test_data *data = arg;
|
||||
struct bufferevent *bev;
|
||||
@ -3083,12 +3087,12 @@ http_chunk_out_test(void *arg)
|
||||
exit_base = data->base;
|
||||
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);
|
||||
|
||||
/* Stupid thing to send a request */
|
||||
bev = bufferevent_socket_new(data->base, fd, 0);
|
||||
bev = create_bev(data->base, fd, ssl);
|
||||
bufferevent_setcb(bev,
|
||||
http_chunked_readcb, http_chunked_writecb,
|
||||
http_chunked_errorcb, data->base);
|
||||
@ -3115,7 +3119,9 @@ http_chunk_out_test(void *arg)
|
||||
tt_int_op(test_ok, ==, 2);
|
||||
|
||||
/* 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);
|
||||
|
||||
/* make two requests to check the keepalive behavior */
|
||||
@ -3143,6 +3149,8 @@ http_chunk_out_test(void *arg)
|
||||
if (http)
|
||||
evhttp_free(http);
|
||||
}
|
||||
static void http_chunk_out_test(void *arg)
|
||||
{ return http_chunk_out_test_impl(arg, 0); }
|
||||
|
||||
static void
|
||||
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); }
|
||||
static void https_connection_retry_test(void *arg)
|
||||
{ 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
|
||||
|
||||
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_conn_address", https_connection_retry_conn_address_test,
|
||||
TT_ISOLATED|TT_OFF_BY_DEFAULT, &basic_setup, NULL },
|
||||
HTTPS(chunk_out),
|
||||
#endif
|
||||
|
||||
END_OF_TESTCASES
|
||||
|
Loading…
x
Reference in New Issue
Block a user