From 31d8116313e93bf729f8fbb4c85746f0a0f034ba Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Fri, 11 Mar 2016 14:23:03 +0300 Subject: [PATCH] test/http: cover "Expect: 100-continue" client-server interaction --- test/regress_http.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/test/regress_http.c b/test/regress_http.c index d788017d..d75265f6 100644 --- a/test/regress_http.c +++ b/test/regress_http.c @@ -3786,12 +3786,15 @@ http_data_length_constraints_test(void *arg) struct evhttp_connection *evcon = NULL; struct evhttp_request *req = NULL; char *long_str = NULL; - size_t size = (1<<20) * 3; + const size_t continue_size = 1<<20; + const size_t size = (1<<20) * 3; test_ok = 0; http = http_setup(&port, data->base, 0); + tt_assert(continue_size < size); + evcon = evhttp_connection_base_new(data->base, NULL, "127.0.0.1", port); tt_assert(evcon); tt_assert(!evhttp_connection_set_flags(evcon, EVHTTP_CON_READ_ON_WRITE_ERROR)); @@ -3848,6 +3851,16 @@ http_data_length_constraints_test(void *arg) } event_base_dispatch(data->base); + req = evhttp_request_new(http_dispatcher_test_done, data->base); + evhttp_add_header(evhttp_request_get_output_headers(req), "Host", "somehost"); + evhttp_add_header(evhttp_request_get_output_headers(req), "Expect", "100-continue"); + long_str[continue_size] = '\0'; + evbuffer_add_printf(evhttp_request_get_output_buffer(req), "%s", long_str); + if (evhttp_make_request(evcon, req, EVHTTP_REQ_POST, "/") == -1) { + tt_abort_msg("Couldn't make request"); + } + event_base_dispatch(data->base); + test_ok = 1; end: if (evcon) -- 2.40.0