mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-15 07:15:03 -04:00
test/http: cover "Expect: 100-continue" client-server interaction
This commit is contained in:
parent
ed469abbac
commit
31d8116313
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user