]> granicus.if.org Git - libevent/commitdiff
test: http/autofree_connection cleanup
authorAzat Khuzhin <azat@libevent.org>
Sun, 24 May 2020 23:06:32 +0000 (02:06 +0300)
committerAzat Khuzhin <azat@libevent.org>
Sun, 24 May 2020 23:07:44 +0000 (02:07 +0300)
test/regress_http.c

index b7656cf8341c2963fb83b7558670e75e1cf18b51..6b664e055738d9c30082c095567c8536595f2ea4 100644 (file)
@@ -1526,14 +1526,10 @@ http_autofree_connection_test(void *arg)
                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) {
-               tt_abort_msg("couldn't make request");
-       }
-       if (evhttp_make_request(evcon, req[1], EVHTTP_REQ_GET, "/test") == -1) {
-               tt_abort_msg("couldn't make request");
+               if (evhttp_make_request(evcon, req[i], EVHTTP_REQ_GET, "/test") == -1) {
+                       tt_abort_msg("couldn't make request");
+               }
        }
 
        /*
@@ -1544,10 +1540,8 @@ http_autofree_connection_test(void *arg)
        evhttp_connection_free_on_completion(evcon);
        evcon = NULL;
 
-       // req0
-       event_base_dispatch(data->base);
-       // req1
-       event_base_dispatch(data->base);
+       for (i = 0; i < ARRAY_SIZE(req); ++i)
+               event_base_dispatch(data->base);
 
        /* at this point, the http server should have no connection */
        tt_assert(TAILQ_FIRST(&http->connections) == NULL);