diff options
author | Vladimir Panteleev <git@cy.md> | 2021-12-20 17:55:33 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2021-12-21 08:45:06 +0100 |
commit | 2c1dbc1af0a774ae5dce08150131a01e862c13b5 (patch) | |
tree | 303babc2c11c62f325ab9227acc9e3993a93752d | |
parent | 1b9f1f60559979a644cc9cf26f851c4416f20248 (diff) | |
download | curl-2c1dbc1af0a774ae5dce08150131a01e862c13b5.tar.gz |
tests: Add test for CURLOPT_HTTP200ALIASES
-rw-r--r-- | tests/data/Makefile.inc | 2 | ||||
-rw-r--r-- | tests/data/test3025 | 47 | ||||
-rw-r--r-- | tests/libtest/Makefile.inc | 6 | ||||
-rw-r--r-- | tests/libtest/lib3025.c | 59 |
4 files changed, 112 insertions, 2 deletions
diff --git a/tests/data/Makefile.inc b/tests/data/Makefile.inc index 2e317173c..75f6397ea 100644 --- a/tests/data/Makefile.inc +++ b/tests/data/Makefile.inc @@ -236,4 +236,4 @@ test2200 test2201 test2202 test2203 test2204 test2205 \ test3000 test3001 test3002 test3003 test3004 test3005 test3006 test3007 \ test3008 test3009 test3010 test3011 test3012 test3013 test3014 test3015 \ test3016 test3017 test3018 test3019 test3020 test3021 test3022 test3023 \ -test3024 +test3024 test3025 diff --git a/tests/data/test3025 b/tests/data/test3025 new file mode 100644 index 000000000..eaff47ce7 --- /dev/null +++ b/tests/data/test3025 @@ -0,0 +1,47 @@ +<testcase> +<info> +<keywords> +HTTP +HTTP GET +</keywords> +</info> + +# +# Server-side +<reply> +<data> +ICY 200 OK +Content-Length: 7 + +MooMoo +</data> +</reply> + +# +# Client-side +<client> +<server> +http +</server> +<features> +!hyper +</features> +<name> +CURLOPT_HTTP200ALIASES +</name> +<tool> +lib%TESTNUMBER +</tool> +<command> +http://%HOSTIP:%HTTPPORT/%TESTNUMBER +</command> +</client> + +# +# Verify data after the test has been "shot" +<verify> +<errorcode> +0 +</errorcode> +</verify> +</testcase> diff --git a/tests/libtest/Makefile.inc b/tests/libtest/Makefile.inc index cbd16f5a4..8721d550c 100644 --- a/tests/libtest/Makefile.inc +++ b/tests/libtest/Makefile.inc @@ -62,7 +62,7 @@ noinst_PROGRAMS = chkhostname libauthretry libntlmconnect \ lib1905 lib1906 lib1907 lib1908 lib1910 lib1911 lib1912 lib1913 \ lib1915 lib1916 lib1917 lib1918 lib1933 lib1934 lib1935 lib1936 \ lib1937 lib1938 lib1939 \ - lib3010 + lib3010 lib3025 chkdecimalpoint_SOURCES = chkdecimalpoint.c ../../lib/mprintf.c \ ../../lib/curl_ctype.c ../../lib/dynbuf.c ../../lib/strdup.c @@ -727,3 +727,7 @@ lib1939_CPPFLAGS = $(AM_CPPFLAGS) lib3010_SOURCES = lib3010.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS) lib3010_LDADD = $(TESTUTIL_LIBS) lib3010_CPPFLAGS = $(AM_CPPFLAGS) + +lib3025_SOURCES = lib3025.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS) +lib3025_LDADD = $(TESTUTIL_LIBS) +lib3025_CPPFLAGS = $(AM_CPPFLAGS) diff --git a/tests/libtest/lib3025.c b/tests/libtest/lib3025.c new file mode 100644 index 000000000..57f89da24 --- /dev/null +++ b/tests/libtest/lib3025.c @@ -0,0 +1,59 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#include "test.h" + +#include "memdebug.h" + +int test(char *URL) +{ + CURLcode res; + CURL *curl; + struct curl_slist *icy = NULL; + + if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + fprintf(stderr, "curl_global_init() failed\n"); + return TEST_ERR_MAJOR_BAD; + } + + curl = curl_easy_init(); + if(!curl) { + fprintf(stderr, "curl_easy_init() failed\n"); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + icy = curl_slist_append(icy, "ICY 200 OK"); + test_setopt(curl, CURLOPT_HTTP200ALIASES, icy); + test_setopt(curl, CURLOPT_VERBOSE, 1L); + test_setopt(curl, CURLOPT_HEADER, 1L); + test_setopt(curl, CURLOPT_URL, URL); + + res = curl_easy_perform(curl); + +test_cleanup: + + curl_easy_cleanup(curl); + curl_slist_free_all(icy); + curl_global_cleanup(); + + return (int)res; +} |