diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/data/test566 | 57 | ||||
-rw-r--r-- | tests/libtest/Makefile.inc | 5 | ||||
-rw-r--r-- | tests/libtest/lib566.c | 54 |
3 files changed, 114 insertions, 2 deletions
diff --git a/tests/data/test566 b/tests/data/test566 new file mode 100644 index 000000000..95da61d2d --- /dev/null +++ b/tests/data/test566 @@ -0,0 +1,57 @@ +<testcase> +<info> +<keywords> +HTTP +HTTP GET +</keywords> +</info> +# +# Server-side +<reply> +<data mode="text"> +HTTP/1.1 200 OK +Date: Thu, 09 Nov 2010 14:49:00 GMT +Server: test-server/fake +Last-Modified: Tue, 13 Jun 2000 12:10:00 GMT +ETag: "21025-dc7-39462498" +Accept-Ranges: bytes +Content-Length: 0 +Connection: close +Content-Type: text/html +Funny-head: yesyes + +</data> +</reply> + +# Client-side +<client> +<server> +http +</server> +# tool is what to use instead of 'curl' +<tool> +lib566 +</tool> + + <name> +HTTP GET with CURLINFO_CONTENT_LENGTH_DOWNLOAD and 0 bytes transfer + </name> + <command> +http://%HOSTIP:%HTTPPORT/566 log/ip566 +</command> +</client> + +# +# Verify data after the test has been "shot" +<verify> +<file name="log/ip566" mode="text"> +CL: 0 +</file> +<protocol> +GET /566 HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
+Accept: */*
+
+</protocol> +</verify> +</testcase> diff --git a/tests/libtest/Makefile.inc b/tests/libtest/Makefile.inc index aa7e9bd01..087758d73 100644 --- a/tests/libtest/Makefile.inc +++ b/tests/libtest/Makefile.inc @@ -10,8 +10,7 @@ noinst_PROGRAMS = lib500 lib501 lib502 lib503 lib504 lib505 lib506 \ lib517 lib518 lib519 lib520 lib521 lib523 lib524 lib525 lib526 lib527 \ lib529 lib530 lib532 lib533 lib536 lib537 lib540 lib541 lib542 lib543 \ lib544 lib545 lib547 lib548 lib549 lib552 lib553 lib554 lib555 lib556 \ - lib539 lib557 lib558 lib559 lib560 lib562 lib564 lib565 - + lib539 lib557 lib558 lib559 lib560 lib562 lib564 lib565 lib566 lib500_SOURCES = lib500.c $(SUPPORTFILES) @@ -130,3 +129,5 @@ lib564_SOURCES = lib564.c $(SUPPORTFILES) $(TESTUTIL) lib565_SOURCES = lib510.c $(SUPPORTFILES) lib565_CFLAGS = -DLIB565 + +lib566_SOURCES = lib566.c $(SUPPORTFILES) diff --git a/tests/libtest/lib566.c b/tests/libtest/lib566.c new file mode 100644 index 000000000..143a67b71 --- /dev/null +++ b/tests/libtest/lib566.c @@ -0,0 +1,54 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * $Id$ + */ + +#include "test.h" + +#include "memdebug.h" + +int test(char *URL) +{ + CURLcode res; + CURL *curl; + + long content_length; + + if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + fprintf(stderr, "curl_global_init() failed\n"); + return TEST_ERR_MAJOR_BAD; + } + + if ((curl = curl_easy_init()) == NULL) { + fprintf(stderr, "curl_easy_init() failed\n"); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; + } + + curl_easy_setopt(curl, CURLOPT_URL, URL); + curl_easy_setopt(curl, CURLOPT_HEADER, 1L); + + res = curl_easy_perform(curl); + + if(!res) { + FILE *moo; + res = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD, + &content_length); + moo = fopen(libtest_arg2, "wb"); + if(moo) { + fprintf(moo, "CL: %ld\n", content_length); + fclose(moo); + } + } + + curl_easy_cleanup(curl); + curl_global_cleanup(); + + return (int)res; +} + |