Skip to content

Commit

Permalink
test: cleanup http/autofree_connection
Browse files Browse the repository at this point in the history
  • Loading branch information
azat committed May 18, 2020
1 parent 1cc94fe commit 70f6919
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions test/regress_http.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@
#include "regress.h"
#include "regress_testutils.h"

#define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0]))

/* set if a test needs to call loopexit on a base */
static struct event_base *exit_base;

Expand Down Expand Up @@ -1505,6 +1507,7 @@ http_autofree_connection_test(void *arg)
struct evhttp_connection *evcon = NULL;
struct evhttp_request *req[2] = { NULL };
struct evhttp *http = http_setup(&port, data->base, 0);
size_t i;

test_ok = 0;

Expand All @@ -1519,12 +1522,11 @@ http_autofree_connection_test(void *arg)
req[1] = evhttp_request_new(http_request_empty_done, data->base);

/* Add the information that we care about */
evhttp_add_header(evhttp_request_get_output_headers(req[0]), "Host", "somehost");
evhttp_add_header(evhttp_request_get_output_headers(req[0]), "Connection", "close");
evhttp_add_header(evhttp_request_get_output_headers(req[0]), "Empty", "itis");
evhttp_add_header(evhttp_request_get_output_headers(req[1]), "Host", "somehost");
evhttp_add_header(evhttp_request_get_output_headers(req[1]), "Connection", "close");
evhttp_add_header(evhttp_request_get_output_headers(req[1]), "Empty", "itis");
for (i = 0; i < ARRAY_SIZE(req); ++i) {
evhttp_add_header(evhttp_request_get_output_headers(req[i]), "Host", "somehost");
evhttp_add_header(evhttp_request_get_output_headers(req[i]), "Connection", "close");
evhttp_add_header(evhttp_request_get_output_headers(req[i]), "Empty", "itis");
}

/* We give ownership of the request to the connection */
if (evhttp_make_request(evcon, req[0], EVHTTP_REQ_GET, "/test") == -1) {
Expand Down Expand Up @@ -5095,8 +5097,6 @@ http_timeout_read_client_test(void *arg)
* Error callback tests
*/

#define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0]))

#define ERRCBFLAG_GENCB (0x01)
#define ERRCBFLAG_ERRCB (0x02)
#define ERRCBFLAG_BOTHCB (ERRCBFLAG_GENCB | ERRCBFLAG_ERRCB)
Expand Down

0 comments on commit 70f6919

Please sign in to comment.