xref: /netbsd-src/crypto/external/bsd/openssl/dist/test/http_test.c (revision 0e2e28bced52bda3788c857106bde6c44d2df3b8)
1b0d17251Schristos /*
2b0d17251Schristos  * Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.
3b0d17251Schristos  * Copyright Siemens AG 2020
4b0d17251Schristos  *
5b0d17251Schristos  * Licensed under the Apache License 2.0 (the "License").  You may not use
6b0d17251Schristos  * this file except in compliance with the License.  You can obtain a copy
7b0d17251Schristos  * in the file LICENSE in the source distribution or at
8b0d17251Schristos  * https://www.openssl.org/source/license.html
9b0d17251Schristos  */
10b0d17251Schristos 
11b0d17251Schristos #include <openssl/http.h>
12b0d17251Schristos #include <openssl/pem.h>
13b0d17251Schristos #include <openssl/x509v3.h>
14b0d17251Schristos #include <string.h>
15b0d17251Schristos 
16b0d17251Schristos #include "testutil.h"
17b0d17251Schristos 
18b0d17251Schristos static const ASN1_ITEM *x509_it = NULL;
19b0d17251Schristos static X509 *x509 = NULL;
20b0d17251Schristos #define RPATH "/path/result.crt"
21b0d17251Schristos 
22b0d17251Schristos typedef struct {
23b0d17251Schristos     BIO *out;
24b0d17251Schristos     char version;
25b0d17251Schristos     int keep_alive;
26b0d17251Schristos } server_args;
27b0d17251Schristos 
28b0d17251Schristos /*-
29b0d17251Schristos  * Pretty trivial HTTP mock server:
30b0d17251Schristos  * For POST, copy request headers+body from mem BIO 'in' as response to 'out'.
31b0d17251Schristos  * For GET, redirect to RPATH, else respond with 'rsp' of ASN1 type 'it'.
32b0d17251Schristos  * Respond with HTTP version 1.'version' and 'keep_alive' (unless implicit).
33b0d17251Schristos  */
mock_http_server(BIO * in,BIO * out,char version,int keep_alive,ASN1_VALUE * rsp,const ASN1_ITEM * it)34b0d17251Schristos static int mock_http_server(BIO *in, BIO *out, char version, int keep_alive,
35b0d17251Schristos                             ASN1_VALUE *rsp, const ASN1_ITEM *it)
36b0d17251Schristos {
37b0d17251Schristos     const char *req, *path;
38b0d17251Schristos     long count = BIO_get_mem_data(in, (unsigned char **)&req);
39b0d17251Schristos     const char *hdr = (char *)req;
40b0d17251Schristos     int is_get = count >= 4 && strncmp(hdr, "GET ", 4) == 0;
41b0d17251Schristos     int len;
42b0d17251Schristos 
43b0d17251Schristos     /* first line should contain "<GET or POST> <path> HTTP/1.x" */
44b0d17251Schristos     if (is_get)
45b0d17251Schristos         hdr += 4;
46b0d17251Schristos     else if (TEST_true(count >= 5 && strncmp(hdr, "POST ", 5) == 0))
47b0d17251Schristos         hdr += 5;
48b0d17251Schristos     else
49b0d17251Schristos         return 0;
50b0d17251Schristos 
51b0d17251Schristos     path = hdr;
52b0d17251Schristos     hdr = strchr(hdr, ' ');
53b0d17251Schristos     if (hdr == NULL)
54b0d17251Schristos         return 0;
55b0d17251Schristos     len = strlen("HTTP/1.");
56b0d17251Schristos     if (!TEST_strn_eq(++hdr, "HTTP/1.", len))
57b0d17251Schristos         return 0;
58b0d17251Schristos     hdr += len;
59b0d17251Schristos     /* check for HTTP version 1.0 .. 1.1 */
60b0d17251Schristos     if (!TEST_char_le('0', *hdr) || !TEST_char_le(*hdr++, '1'))
61b0d17251Schristos         return 0;
62b0d17251Schristos     if (!TEST_char_eq(*hdr++, '\r') || !TEST_char_eq(*hdr++, '\n'))
63b0d17251Schristos         return 0;
64b0d17251Schristos     count -= (hdr - req);
65b0d17251Schristos     if (count < 0 || out == NULL)
66b0d17251Schristos         return 0;
67b0d17251Schristos 
68b0d17251Schristos     if (strncmp(path, RPATH, strlen(RPATH)) != 0) {
69b0d17251Schristos         if (!is_get)
70b0d17251Schristos             return 0;
71b0d17251Schristos         return BIO_printf(out, "HTTP/1.%c 301 Moved Permanently\r\n"
72b0d17251Schristos                           "Location: %s\r\n\r\n",
73b0d17251Schristos                           version, RPATH) > 0; /* same server */
74b0d17251Schristos     }
75b0d17251Schristos     if (BIO_printf(out, "HTTP/1.%c 200 OK\r\n", version) <= 0)
76b0d17251Schristos         return 0;
77b0d17251Schristos     if ((version == '0') == keep_alive) /* otherwise, default */
78b0d17251Schristos         if (BIO_printf(out, "Connection: %s\r\n",
79b0d17251Schristos                        version == '0' ? "keep-alive" : "close") <= 0)
80b0d17251Schristos             return 0;
81b0d17251Schristos     if (is_get) { /* construct new header and body */
82b0d17251Schristos         if ((len = ASN1_item_i2d(rsp, NULL, it)) <= 0)
83b0d17251Schristos             return 0;
84b0d17251Schristos         if (BIO_printf(out, "Content-Type: application/x-x509-ca-cert\r\n"
85b0d17251Schristos                        "Content-Length: %d\r\n\r\n", len) <= 0)
86b0d17251Schristos             return 0;
87b0d17251Schristos         return ASN1_item_i2d_bio(it, out, rsp);
88b0d17251Schristos     } else {
89b0d17251Schristos         len = strlen("Connection: ");
90b0d17251Schristos         if (strncmp(hdr, "Connection: ", len) == 0) {
91b0d17251Schristos             /* skip req Connection header */
92b0d17251Schristos             hdr = strstr(hdr + len, "\r\n");
93b0d17251Schristos             if (hdr == NULL)
94b0d17251Schristos                 return 0;
95b0d17251Schristos             hdr += 2;
96b0d17251Schristos         }
97b0d17251Schristos         /* echo remaining request header and body */
98b0d17251Schristos         return BIO_write(out, hdr, count) == count;
99b0d17251Schristos     }
100b0d17251Schristos }
101b0d17251Schristos 
http_bio_cb_ex(BIO * bio,int oper,const char * argp,size_t len,int cmd,long argl,int ret,size_t * processed)102b0d17251Schristos static long http_bio_cb_ex(BIO *bio, int oper, const char *argp, size_t len,
103b0d17251Schristos                            int cmd, long argl, int ret, size_t *processed)
104b0d17251Schristos {
105b0d17251Schristos     server_args *args = (server_args *)BIO_get_callback_arg(bio);
106b0d17251Schristos 
107b0d17251Schristos     if (oper == (BIO_CB_CTRL | BIO_CB_RETURN) && cmd == BIO_CTRL_FLUSH)
108b0d17251Schristos         ret = mock_http_server(bio, args->out, args->version, args->keep_alive,
109b0d17251Schristos                                (ASN1_VALUE *)x509, x509_it);
110b0d17251Schristos     return ret;
111b0d17251Schristos }
112b0d17251Schristos 
test_http_x509(int do_get)113b0d17251Schristos static int test_http_x509(int do_get)
114b0d17251Schristos {
115b0d17251Schristos     X509 *rcert = NULL;
116b0d17251Schristos     BIO *wbio = BIO_new(BIO_s_mem());
117b0d17251Schristos     BIO *rbio = BIO_new(BIO_s_mem());
118b0d17251Schristos     server_args mock_args = { NULL, '0', 0 };
119b0d17251Schristos     BIO *rsp, *req = ASN1_item_i2d_mem_bio(x509_it, (ASN1_VALUE *)x509);
120b0d17251Schristos     STACK_OF(CONF_VALUE) *headers = NULL;
121b0d17251Schristos     const char content_type[] = "application/x-x509-ca-cert";
122b0d17251Schristos     int res = 0;
123b0d17251Schristos 
124b0d17251Schristos     if (wbio == NULL || rbio == NULL || req == NULL)
125b0d17251Schristos         goto err;
126b0d17251Schristos     mock_args.out = rbio;
127b0d17251Schristos     BIO_set_callback_ex(wbio, http_bio_cb_ex);
128b0d17251Schristos     BIO_set_callback_arg(wbio, (char *)&mock_args);
129b0d17251Schristos 
130b0d17251Schristos     rsp = do_get ?
131b0d17251Schristos         OSSL_HTTP_get("/will-be-redirected",
132b0d17251Schristos                       NULL /* proxy */, NULL /* no_proxy */,
133b0d17251Schristos                       wbio, rbio, NULL /* bio_update_fn */, NULL /* arg */,
134b0d17251Schristos                       0 /* buf_size */, headers, content_type,
135b0d17251Schristos                       1 /* expect_asn1 */,
136b0d17251Schristos                       OSSL_HTTP_DEFAULT_MAX_RESP_LEN, 0 /* timeout */)
137b0d17251Schristos         : OSSL_HTTP_transfer(NULL, NULL /* host */, NULL /* port */, RPATH,
138b0d17251Schristos                              0 /* use_ssl */,NULL /* proxy */, NULL /* no_pr */,
139b0d17251Schristos                              wbio, rbio, NULL /* bio_fn */, NULL /* arg */,
140b0d17251Schristos                              0 /* buf_size */, headers, content_type,
141b0d17251Schristos                              req, content_type, 1 /* expect_asn1 */,
142b0d17251Schristos                              OSSL_HTTP_DEFAULT_MAX_RESP_LEN, 0 /* timeout */,
143b0d17251Schristos                              0 /* keep_alive */);
144b0d17251Schristos     rcert = d2i_X509_bio(rsp, NULL);
145b0d17251Schristos     BIO_free(rsp);
146b0d17251Schristos     res = TEST_ptr(rcert) && TEST_int_eq(X509_cmp(x509, rcert), 0);
147b0d17251Schristos 
148b0d17251Schristos  err:
149b0d17251Schristos     X509_free(rcert);
150b0d17251Schristos     BIO_free(req);
151b0d17251Schristos     BIO_free(wbio);
152b0d17251Schristos     BIO_free(rbio);
153b0d17251Schristos     sk_CONF_VALUE_pop_free(headers, X509V3_conf_free);
154b0d17251Schristos     return res;
155b0d17251Schristos }
156b0d17251Schristos 
test_http_keep_alive(char version,int keep_alive,int kept_alive)157b0d17251Schristos static int test_http_keep_alive(char version, int keep_alive, int kept_alive)
158b0d17251Schristos {
159b0d17251Schristos     BIO *wbio = BIO_new(BIO_s_mem());
160b0d17251Schristos     BIO *rbio = BIO_new(BIO_s_mem());
161b0d17251Schristos     BIO *rsp;
162b0d17251Schristos     server_args mock_args = { NULL, '0', 0 };
163b0d17251Schristos     const char *const content_type = "application/x-x509-ca-cert";
164b0d17251Schristos     OSSL_HTTP_REQ_CTX *rctx = NULL;
165b0d17251Schristos     int i, res = 0;
166b0d17251Schristos 
167b0d17251Schristos     if (wbio == NULL || rbio == NULL)
168b0d17251Schristos         goto err;
169b0d17251Schristos     mock_args.out = rbio;
170b0d17251Schristos     mock_args.version = version;
171b0d17251Schristos     mock_args.keep_alive = kept_alive;
172b0d17251Schristos     BIO_set_callback_ex(wbio, http_bio_cb_ex);
173b0d17251Schristos     BIO_set_callback_arg(wbio, (char *)&mock_args);
174b0d17251Schristos 
175b0d17251Schristos     for (res = 1, i = 1; res && i <= 2; i++) {
176b0d17251Schristos         rsp = OSSL_HTTP_transfer(&rctx, NULL /* server */, NULL /* port */,
177b0d17251Schristos                                  RPATH, 0 /* use_ssl */,
178b0d17251Schristos                                  NULL /* proxy */, NULL /* no_proxy */,
179b0d17251Schristos                                  wbio, rbio, NULL /* bio_update_fn */, NULL,
180b0d17251Schristos                                  0 /* buf_size */, NULL /* headers */,
181b0d17251Schristos                                  NULL /* content_type */, NULL /* req => GET */,
182b0d17251Schristos                                  content_type, 0 /* ASN.1 not expected */,
183b0d17251Schristos                                  0 /* max_resp_len */, 0 /* timeout */,
184b0d17251Schristos                                  keep_alive);
185b0d17251Schristos         if (keep_alive == 2 && kept_alive == 0)
186b0d17251Schristos             res = res && TEST_ptr_null(rsp)
187b0d17251Schristos                 && TEST_int_eq(OSSL_HTTP_is_alive(rctx), 0);
188b0d17251Schristos         else
189b0d17251Schristos             res = res && TEST_ptr(rsp)
190b0d17251Schristos                 && TEST_int_eq(OSSL_HTTP_is_alive(rctx), keep_alive > 0);
191b0d17251Schristos         BIO_free(rsp);
192b0d17251Schristos         (void)BIO_reset(rbio); /* discard response contents */
193b0d17251Schristos         keep_alive = 0;
194b0d17251Schristos     }
195b0d17251Schristos     OSSL_HTTP_close(rctx, res);
196b0d17251Schristos 
197b0d17251Schristos  err:
198b0d17251Schristos     BIO_free(wbio);
199b0d17251Schristos     BIO_free(rbio);
200b0d17251Schristos     return res;
201b0d17251Schristos }
202b0d17251Schristos 
test_http_url_ok(const char * url,int exp_ssl,const char * exp_host,const char * exp_port,const char * exp_path)203b0d17251Schristos static int test_http_url_ok(const char *url, int exp_ssl, const char *exp_host,
204b0d17251Schristos                             const char *exp_port, const char *exp_path)
205b0d17251Schristos {
206b0d17251Schristos     char *user, *host, *port, *path, *query, *frag;
207b0d17251Schristos     int exp_num, num, ssl;
208b0d17251Schristos     int res;
209b0d17251Schristos 
210b0d17251Schristos     if (!TEST_int_eq(sscanf(exp_port, "%d", &exp_num), 1))
211b0d17251Schristos         return 0;
212b0d17251Schristos     res = TEST_true(OSSL_HTTP_parse_url(url, &ssl, &user, &host, &port, &num,
213b0d17251Schristos                                         &path, &query, &frag))
214b0d17251Schristos         && TEST_str_eq(host, exp_host)
215b0d17251Schristos         && TEST_str_eq(port, exp_port)
216b0d17251Schristos         && TEST_int_eq(num, exp_num)
217b0d17251Schristos         && TEST_str_eq(path, exp_path)
218b0d17251Schristos         && TEST_int_eq(ssl, exp_ssl);
219b0d17251Schristos     if (res && *user != '\0')
220b0d17251Schristos         res = TEST_str_eq(user, "user:pass");
221b0d17251Schristos     if (res && *frag != '\0')
222b0d17251Schristos         res = TEST_str_eq(frag, "fr");
223b0d17251Schristos     if (res && *query != '\0')
224b0d17251Schristos         res = TEST_str_eq(query, "q");
225b0d17251Schristos     OPENSSL_free(user);
226b0d17251Schristos     OPENSSL_free(host);
227b0d17251Schristos     OPENSSL_free(port);
228b0d17251Schristos     OPENSSL_free(path);
229b0d17251Schristos     OPENSSL_free(query);
230b0d17251Schristos     OPENSSL_free(frag);
231b0d17251Schristos     return res;
232b0d17251Schristos }
233b0d17251Schristos 
test_http_url_path_query_ok(const char * url,const char * exp_path_qu)234b0d17251Schristos static int test_http_url_path_query_ok(const char *url, const char *exp_path_qu)
235b0d17251Schristos {
236b0d17251Schristos     char *host, *path;
237b0d17251Schristos     int res;
238b0d17251Schristos 
239b0d17251Schristos     res = TEST_true(OSSL_HTTP_parse_url(url, NULL, NULL, &host, NULL, NULL,
240b0d17251Schristos                                         &path, NULL, NULL))
241b0d17251Schristos         && TEST_str_eq(host, "host")
242b0d17251Schristos         && TEST_str_eq(path, exp_path_qu);
243b0d17251Schristos     OPENSSL_free(host);
244b0d17251Schristos     OPENSSL_free(path);
245b0d17251Schristos     return res;
246b0d17251Schristos }
247b0d17251Schristos 
test_http_url_dns(void)248b0d17251Schristos static int test_http_url_dns(void)
249b0d17251Schristos {
250b0d17251Schristos     return test_http_url_ok("host:65535/path", 0, "host", "65535", "/path");
251b0d17251Schristos }
252b0d17251Schristos 
test_http_url_path_query(void)253b0d17251Schristos static int test_http_url_path_query(void)
254b0d17251Schristos {
255b0d17251Schristos     return test_http_url_path_query_ok("http://usr@host:1/p?q=x#frag", "/p?q=x")
256b0d17251Schristos         && test_http_url_path_query_ok("http://host?query#frag", "/?query")
257b0d17251Schristos         && test_http_url_path_query_ok("http://host:9999#frag", "/");
258b0d17251Schristos }
259b0d17251Schristos 
test_http_url_userinfo_query_fragment(void)260b0d17251Schristos static int test_http_url_userinfo_query_fragment(void)
261b0d17251Schristos {
262b0d17251Schristos     return test_http_url_ok("user:pass@host/p?q#fr", 0, "host", "80", "/p");
263b0d17251Schristos }
264b0d17251Schristos 
test_http_url_ipv4(void)265b0d17251Schristos static int test_http_url_ipv4(void)
266b0d17251Schristos {
267b0d17251Schristos     return test_http_url_ok("https://1.2.3.4/p/q", 1, "1.2.3.4", "443", "/p/q");
268b0d17251Schristos }
269b0d17251Schristos 
test_http_url_ipv6(void)270b0d17251Schristos static int test_http_url_ipv6(void)
271b0d17251Schristos {
272b0d17251Schristos     return test_http_url_ok("http://[FF01::101]:6", 0, "[FF01::101]", "6", "/");
273b0d17251Schristos }
274b0d17251Schristos 
test_http_url_invalid(const char * url)275b0d17251Schristos static int test_http_url_invalid(const char *url)
276b0d17251Schristos {
277b0d17251Schristos     char *host = "1", *port = "1", *path = "1";
278b0d17251Schristos     int num = 1, ssl = 1;
279b0d17251Schristos     int res;
280b0d17251Schristos 
281b0d17251Schristos     res = TEST_false(OSSL_HTTP_parse_url(url, &ssl, NULL, &host, &port, &num,
282b0d17251Schristos                                          &path, NULL, NULL))
283b0d17251Schristos         && TEST_ptr_null(host)
284b0d17251Schristos         && TEST_ptr_null(port)
285b0d17251Schristos         && TEST_ptr_null(path);
286b0d17251Schristos     if (!res) {
287b0d17251Schristos         OPENSSL_free(host);
288b0d17251Schristos         OPENSSL_free(port);
289b0d17251Schristos         OPENSSL_free(path);
290b0d17251Schristos     }
291b0d17251Schristos     return res;
292b0d17251Schristos }
293b0d17251Schristos 
test_http_url_invalid_prefix(void)294b0d17251Schristos static int test_http_url_invalid_prefix(void)
295b0d17251Schristos {
296b0d17251Schristos     return test_http_url_invalid("htttps://1.2.3.4:65535/pkix");
297b0d17251Schristos }
298b0d17251Schristos 
test_http_url_invalid_port(void)299b0d17251Schristos static int test_http_url_invalid_port(void)
300b0d17251Schristos {
301*0e2e28bcSchristos     return test_http_url_invalid("https://1.2.3.4:65536/pkix")
302*0e2e28bcSchristos            && test_http_url_invalid("https://1.2.3.4:");
303b0d17251Schristos }
304b0d17251Schristos 
test_http_url_invalid_path(void)305b0d17251Schristos static int test_http_url_invalid_path(void)
306b0d17251Schristos {
307b0d17251Schristos     return test_http_url_invalid("https://[FF01::101]pkix");
308b0d17251Schristos }
309b0d17251Schristos 
test_http_get_x509(void)310b0d17251Schristos static int test_http_get_x509(void)
311b0d17251Schristos {
312b0d17251Schristos     return test_http_x509(1);
313b0d17251Schristos }
314b0d17251Schristos 
test_http_post_x509(void)315b0d17251Schristos static int test_http_post_x509(void)
316b0d17251Schristos {
317b0d17251Schristos     return test_http_x509(0);
318b0d17251Schristos }
319b0d17251Schristos 
test_http_keep_alive_0_no_no(void)320b0d17251Schristos static int test_http_keep_alive_0_no_no(void)
321b0d17251Schristos {
322b0d17251Schristos     return test_http_keep_alive('0', 0, 0);
323b0d17251Schristos }
324b0d17251Schristos 
test_http_keep_alive_1_no_no(void)325b0d17251Schristos static int test_http_keep_alive_1_no_no(void)
326b0d17251Schristos {
327b0d17251Schristos     return test_http_keep_alive('1', 0, 0);
328b0d17251Schristos }
329b0d17251Schristos 
test_http_keep_alive_0_prefer_yes(void)330b0d17251Schristos static int test_http_keep_alive_0_prefer_yes(void)
331b0d17251Schristos {
332b0d17251Schristos     return test_http_keep_alive('0', 1, 1);
333b0d17251Schristos }
334b0d17251Schristos 
test_http_keep_alive_1_prefer_yes(void)335b0d17251Schristos static int test_http_keep_alive_1_prefer_yes(void)
336b0d17251Schristos {
337b0d17251Schristos     return test_http_keep_alive('1', 1, 1);
338b0d17251Schristos }
339b0d17251Schristos 
test_http_keep_alive_0_require_yes(void)340b0d17251Schristos static int test_http_keep_alive_0_require_yes(void)
341b0d17251Schristos {
342b0d17251Schristos     return test_http_keep_alive('0', 2, 1);
343b0d17251Schristos }
344b0d17251Schristos 
test_http_keep_alive_1_require_yes(void)345b0d17251Schristos static int test_http_keep_alive_1_require_yes(void)
346b0d17251Schristos {
347b0d17251Schristos     return test_http_keep_alive('1', 2, 1);
348b0d17251Schristos }
349b0d17251Schristos 
test_http_keep_alive_0_require_no(void)350b0d17251Schristos static int test_http_keep_alive_0_require_no(void)
351b0d17251Schristos {
352b0d17251Schristos     return test_http_keep_alive('0', 2, 0);
353b0d17251Schristos }
354b0d17251Schristos 
test_http_keep_alive_1_require_no(void)355b0d17251Schristos static int test_http_keep_alive_1_require_no(void)
356b0d17251Schristos {
357b0d17251Schristos     return test_http_keep_alive('1', 2, 0);
358b0d17251Schristos }
359b0d17251Schristos 
cleanup_tests(void)360b0d17251Schristos void cleanup_tests(void)
361b0d17251Schristos {
362b0d17251Schristos     X509_free(x509);
363b0d17251Schristos }
364b0d17251Schristos 
365b0d17251Schristos OPT_TEST_DECLARE_USAGE("cert.pem\n")
366b0d17251Schristos 
setup_tests(void)367b0d17251Schristos int setup_tests(void)
368b0d17251Schristos {
369b0d17251Schristos     if (!test_skip_common_options())
370b0d17251Schristos         return 0;
371b0d17251Schristos 
372b0d17251Schristos     x509_it = ASN1_ITEM_rptr(X509);
373b0d17251Schristos     if (!TEST_ptr((x509 = load_cert_pem(test_get_argument(0), NULL))))
374b0d17251Schristos         return 0;
375b0d17251Schristos 
376b0d17251Schristos     ADD_TEST(test_http_url_dns);
377b0d17251Schristos     ADD_TEST(test_http_url_path_query);
378b0d17251Schristos     ADD_TEST(test_http_url_userinfo_query_fragment);
379b0d17251Schristos     ADD_TEST(test_http_url_ipv4);
380b0d17251Schristos     ADD_TEST(test_http_url_ipv6);
381b0d17251Schristos     ADD_TEST(test_http_url_invalid_prefix);
382b0d17251Schristos     ADD_TEST(test_http_url_invalid_port);
383b0d17251Schristos     ADD_TEST(test_http_url_invalid_path);
384b0d17251Schristos     ADD_TEST(test_http_get_x509);
385b0d17251Schristos     ADD_TEST(test_http_post_x509);
386b0d17251Schristos     ADD_TEST(test_http_keep_alive_0_no_no);
387b0d17251Schristos     ADD_TEST(test_http_keep_alive_1_no_no);
388b0d17251Schristos     ADD_TEST(test_http_keep_alive_0_prefer_yes);
389b0d17251Schristos     ADD_TEST(test_http_keep_alive_1_prefer_yes);
390b0d17251Schristos     ADD_TEST(test_http_keep_alive_0_require_yes);
391b0d17251Schristos     ADD_TEST(test_http_keep_alive_1_require_yes);
392b0d17251Schristos     ADD_TEST(test_http_keep_alive_0_require_no);
393b0d17251Schristos     ADD_TEST(test_http_keep_alive_1_require_no);
394b0d17251Schristos     return 1;
395b0d17251Schristos }
396