From 2c0b65d37b62e4a089d1816197126f5a3f36a09a Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Fri, 30 Oct 2009 22:38:21 +0000 Subject: Added test case 566 in an attempt to repeat bug 2884561 (http://curl.haxx.se/bug/view.cgi?id=2884561) but it seems to work for me... --- tests/data/test566 | 57 ++++++++++++++++++++++++++++++++++++++++++++++ tests/libtest/Makefile.inc | 5 ++-- tests/libtest/lib566.c | 54 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 114 insertions(+), 2 deletions(-) create mode 100644 tests/data/test566 create mode 100644 tests/libtest/lib566.c 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 @@ + + + +HTTP +HTTP GET + + +# +# Server-side + + +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 + + + + +# Client-side + + +http + +# tool is what to use instead of 'curl' + +lib566 + + + +HTTP GET with CURLINFO_CONTENT_LENGTH_DOWNLOAD and 0 bytes transfer + + +http://%HOSTIP:%HTTPPORT/566 log/ip566 + + + +# +# Verify data after the test has been "shot" + + +CL: 0 + + +GET /566 HTTP/1.1 +Host: %HOSTIP:%HTTPPORT +Accept: */* + + + + 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; +} + -- cgit v1.2.3