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/libtest/Makefile.inc | 5 +++-- tests/libtest/lib566.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 2 deletions(-) create mode 100644 tests/libtest/lib566.c (limited to 'tests/libtest') 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