From 59c063dfd38972e06a7f3a0b8f94860a67acdc96 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 11 Nov 2004 23:11:04 +0000 Subject: Fix behaviour when passing NULL to CURLOPT_POSTFIELDS and CURLOPT_HTTPPOST. --- tests/libtest/lib515.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tests/libtest/lib515.c (limited to 'tests/libtest/lib515.c') diff --git a/tests/libtest/lib515.c b/tests/libtest/lib515.c new file mode 100644 index 000000000..ce075110d --- /dev/null +++ b/tests/libtest/lib515.c @@ -0,0 +1,24 @@ +#include "test.h" + +int test(char *URL) +{ + CURL *curl; + CURLcode res=CURLE_OK; + + curl = curl_easy_init(); + if(curl) { + /* First set the URL that is about to receive our POST. */ + curl_easy_setopt(curl, CURLOPT_URL, URL); + curl_easy_setopt(curl, CURLOPT_POSTFIELDS, NULL); + curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, 0); + curl_easy_setopt(curl, CURLOPT_VERBOSE, 1); /* show verbose for debug */ + curl_easy_setopt(curl, CURLOPT_HEADER, 1); /* include header */ + + /* Now, we should be making a zero byte POST request */ + res = curl_easy_perform(curl); + + /* always cleanup */ + curl_easy_cleanup(curl); + } + return (int)res; +} -- cgit v1.2.1 From 384c8f356087178e4779d99d3e0e7f25331293aa Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Wed, 25 Oct 2006 05:59:46 +0000 Subject: Use curl_global_init() and curl_global_cleanup(). Improve cleanup in case of initialization failure. --- tests/libtest/lib515.c | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) (limited to 'tests/libtest/lib515.c') diff --git a/tests/libtest/lib515.c b/tests/libtest/lib515.c index ce075110d..d166c2ab1 100644 --- a/tests/libtest/lib515.c +++ b/tests/libtest/lib515.c @@ -5,20 +5,30 @@ int test(char *URL) CURL *curl; CURLcode res=CURLE_OK; - curl = curl_easy_init(); - if(curl) { - /* First set the URL that is about to receive our POST. */ - curl_easy_setopt(curl, CURLOPT_URL, URL); - curl_easy_setopt(curl, CURLOPT_POSTFIELDS, NULL); - curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, 0); - curl_easy_setopt(curl, CURLOPT_VERBOSE, 1); /* show verbose for debug */ - curl_easy_setopt(curl, CURLOPT_HEADER, 1); /* include header */ - - /* Now, we should be making a zero byte POST request */ - res = curl_easy_perform(curl); + if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) { + fprintf(stderr, "curl_global_init() failed\n"); + return TEST_ERR_MAJOR_BAD; + } - /* always cleanup */ - curl_easy_cleanup(curl); + if ((curl = curl_easy_init()) == NULL) { + fprintf(stderr, "curl_easy_init() failed\n"); + curl_global_cleanup(); + return TEST_ERR_MAJOR_BAD; } + + /* First set the URL that is about to receive our POST. */ + curl_easy_setopt(curl, CURLOPT_URL, URL); + curl_easy_setopt(curl, CURLOPT_POSTFIELDS, NULL); + curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, 0); + curl_easy_setopt(curl, CURLOPT_VERBOSE, 1); /* show verbose for debug */ + curl_easy_setopt(curl, CURLOPT_HEADER, 1); /* include header */ + + /* Now, we should be making a zero byte POST request */ + res = curl_easy_perform(curl); + + /* always cleanup */ + curl_easy_cleanup(curl); + curl_global_cleanup(); + return (int)res; } -- cgit v1.2.1 From b4700f026b732776ba48cc4a941aca4ec42c1bb0 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Wed, 25 Oct 2006 09:20:44 +0000 Subject: Add project notice and file Id --- tests/libtest/lib515.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tests/libtest/lib515.c') diff --git a/tests/libtest/lib515.c b/tests/libtest/lib515.c index d166c2ab1..6086ecb09 100644 --- a/tests/libtest/lib515.c +++ b/tests/libtest/lib515.c @@ -1,3 +1,13 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * $Id$ + */ + #include "test.h" int test(char *URL) -- cgit v1.2.1 From d31da176eb622fb386a3b657d17921403f95e45c Mon Sep 17 00:00:00 2001 From: Dan Fandrich Date: Thu, 22 May 2008 21:49:52 +0000 Subject: Made sure to pass longs in to curl_easy_setopt where necessary in the libtest code. --- tests/libtest/lib515.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests/libtest/lib515.c') diff --git a/tests/libtest/lib515.c b/tests/libtest/lib515.c index 6086ecb09..18df7c938 100644 --- a/tests/libtest/lib515.c +++ b/tests/libtest/lib515.c @@ -29,9 +29,9 @@ int test(char *URL) /* First set the URL that is about to receive our POST. */ curl_easy_setopt(curl, CURLOPT_URL, URL); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, NULL); - curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, 0); - curl_easy_setopt(curl, CURLOPT_VERBOSE, 1); /* show verbose for debug */ - curl_easy_setopt(curl, CURLOPT_HEADER, 1); /* include header */ + curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, 0L); + curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); /* show verbose for debug */ + curl_easy_setopt(curl, CURLOPT_HEADER, 1L); /* include header */ /* Now, we should be making a zero byte POST request */ res = curl_easy_perform(curl); -- cgit v1.2.1 From 7beb473a3dffbd5757b14a99866033ae1391dbd9 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Sat, 20 Sep 2008 04:26:55 +0000 Subject: include "memdebug.h" --- tests/libtest/lib515.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tests/libtest/lib515.c') diff --git a/tests/libtest/lib515.c b/tests/libtest/lib515.c index 18df7c938..c85f2bed1 100644 --- a/tests/libtest/lib515.c +++ b/tests/libtest/lib515.c @@ -10,6 +10,8 @@ #include "test.h" +#include "memdebug.h" + int test(char *URL) { CURL *curl; -- cgit v1.2.1 From cad9c3f55fad5da988144dc83ad76a8544a071a2 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Fri, 5 Feb 2010 18:07:19 +0000 Subject: Addes OOM handling for curl_easy_setopt() calls in test --- tests/libtest/lib515.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'tests/libtest/lib515.c') diff --git a/tests/libtest/lib515.c b/tests/libtest/lib515.c index c85f2bed1..56ee68ead 100644 --- a/tests/libtest/lib515.c +++ b/tests/libtest/lib515.c @@ -29,15 +29,17 @@ int test(char *URL) } /* First set the URL that is about to receive our POST. */ - curl_easy_setopt(curl, CURLOPT_URL, URL); - curl_easy_setopt(curl, CURLOPT_POSTFIELDS, NULL); - curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, 0L); - curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); /* show verbose for debug */ - curl_easy_setopt(curl, CURLOPT_HEADER, 1L); /* include header */ + test_setopt(curl, CURLOPT_URL, URL); + test_setopt(curl, CURLOPT_POSTFIELDS, NULL); + test_setopt(curl, CURLOPT_POSTFIELDSIZE, 0L); + test_setopt(curl, CURLOPT_VERBOSE, 1L); /* show verbose for debug */ + test_setopt(curl, CURLOPT_HEADER, 1L); /* include header */ /* Now, we should be making a zero byte POST request */ res = curl_easy_perform(curl); +test_cleanup: + /* always cleanup */ curl_easy_cleanup(curl); curl_global_cleanup(); -- cgit v1.2.1 From 2309b4e330b96bc2e1f8e36b6184015e59544037 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 24 Mar 2010 11:02:54 +0100 Subject: remove the CVSish $Id$ lines --- tests/libtest/lib515.c | 1 - 1 file changed, 1 deletion(-) (limited to 'tests/libtest/lib515.c') diff --git a/tests/libtest/lib515.c b/tests/libtest/lib515.c index 56ee68ead..2660ae369 100644 --- a/tests/libtest/lib515.c +++ b/tests/libtest/lib515.c @@ -5,7 +5,6 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * $Id$ */ #include "test.h" -- cgit v1.2.1 From 1aeb635cdd296c16acb375a4a83a78f13166ccab Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 10 Mar 2011 11:48:02 +0100 Subject: sources: update source headers All C and H files now (should) feature the proper project curl source code header, which includes basic info, a copyright statement and some basic disclaimers. --- tests/libtest/lib515.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'tests/libtest/lib515.c') diff --git a/tests/libtest/lib515.c b/tests/libtest/lib515.c index 2660ae369..4e96c4a8d 100644 --- a/tests/libtest/lib515.c +++ b/tests/libtest/lib515.c @@ -1,12 +1,24 @@ -/***************************************************************************** +/*************************************************************************** * _ _ ____ _ * Project ___| | | | _ \| | * / __| | | | |_) | | * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - */ - + * Copyright (C) 1998 - 2011, Daniel Stenberg, , 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 http://curl.haxx.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" -- cgit v1.2.1