Commit Graph

908 Commits

Author SHA1 Message Date
Dan Fandrich bec809cb2e test1537: fixed memory leak on OOM 2017-06-25 22:59:55 +02:00
Marcel Raad e8a4da67f5
test1521: fix compiler warnings
The integer literal 3123123123 doesn't fit into a 32-bit signed
integer, so GCC with 32-bit long warns in C90 mode:
this decimal constant is unsigned only in ISO C90 [enabled by default]
Fix this by using ULONG_MAX, which should fit in any curl_off_t and has
the correct suffix to not issue any warnings.
Also adds the missing CURLOPT_REQUEST_TARGET from commit
9b167fd090.

Closes https://github.com/curl/curl/pull/1611
2017-06-25 13:46:51 +02:00
Daniel Stenberg 2647ad2fe6 libtest/Makefile: remove unused lib1541 variables 2017-06-23 00:14:49 +02:00
Marcel Raad 8de8f4eb7e
lib1521: fix missing-variable-declarations clang warnings
Declare TU-local variables static.
2017-06-21 18:11:11 +02:00
Daniel Stenberg 176ec51382 test1521: test getinfo's OFF_T types too
Closes #1588
2017-06-19 14:01:55 +02:00
Daniel Stenberg 0bd12d1970 lib1521: add curl_easy_getinfo calls to the test set
Also added return value checks to make sure no unexpected return codes
are used.
2017-06-19 14:01:51 +02:00
Daniel Stenberg 6208547002 PIPELINING_SERVER_BL: cleanup the internal list use
The list was freed incorrectly since the llist refactor of
cbae73e1dd. Added test 1550 to verify that it works and avoid future
regressions.

Reported-by: Pascal Terjan

Fixes #1584
Closes #1585
2017-06-19 09:14:49 +02:00
Daniel Stenberg e9422bc193 libtest/libntlmconnect: fix compiler warnings from f94fcdb 2017-06-16 12:18:32 +02:00
Daniel Stenberg f94fcdba6e tests: stabilize test 2032 and 2033
Both these tests run the same underlying test code: libntlmconnect.c -
this test code made some assumptions about socket ordering when it used
curl_easy_fdset() and when we changed timing or got accidental changes
in libcurl the tests would fail.

The tests verify that the different transfers keep using the same
connections, which I now instead made sure by adding the number of bytes
each transfer gets and then verifies that they always get the same
amount as when these tests worked.

Closes #1576
2017-06-16 11:43:26 +02:00
Daniel Stenberg 73a2fcea0b includes: remove curl/curlbuild.h and curl/curlrules.h
Rely entirely on curl/system.h now.

Introduced in Aug 2008 with commit 14240e9e10. Now gone.

Fixes #1456
2017-06-14 11:07:33 +02:00
Dan Fandrich 49ff939034 mk-lib1521.pl: updated to match the test changes in 916ec30a 2017-06-13 22:04:53 +02:00
Dan Fandrich 916ec30a92 test1521: fixed OOM handling 2017-06-11 11:49:31 +02:00
Daniel Stenberg b94a2cdfe6 lib1521: fix compiler warnings on the use of bad 'long' values
Reported-by: Marcel Raad
Bug: cccac4fb2b (commitcomment-22453387)
2017-06-09 01:02:12 +02:00
Daniel Stenberg de0adda78c lib1521: fix compiler warnings 2017-06-06 00:21:38 +02:00
Daniel Stenberg 798b2e1964 test1521: make the code < 80 columns wide 2017-06-05 15:21:26 +02:00
Daniel Stenberg 38125e7f7e test1121: use stricter types to work with typcheck-gcc 2017-06-05 14:56:32 +02:00
Daniel Stenberg cccac4fb2b test1521: test *all* curl_easy_setopt options
mk-lib1521.pl generates a test program (lib1521.c) that calls
curl_easy_setopt() for every known option with a few typical values to
make sure they work (ignoring the return codes).

Some small changes were necessary to avoid asserts and NULL accesses
when doing this.

The perl script needs to be manually rerun when we add new options.

Closes #1543
2017-06-05 14:25:18 +02:00
Marcel Raad a1b275a41e
libtest: fix int-in-bool-context warnings
GCC 7 complained:
‘*’ in boolean context, suggest ‘&&’ instead [-Wint-in-bool-context]
2017-06-03 20:18:34 +02:00
Marcel Raad 0932573e7c
libtest: fix implicit-fallthrough warnings with GCC 7 2017-06-03 20:12:23 +02:00
Daniel Stenberg cef9c9e782 test1538: verify the libcurl strerror API calls 2017-06-02 13:52:55 +02:00
Daniel Stenberg 9b2dfe88bb test1537: dedicated tests of the URL (un)escape API calls
Closes #1530
2017-06-02 13:16:18 +02:00
Marcel Raad 45cecfbd33
lib583: fix compiler warning
Use CURLMcode for variable 'res' and cast to int where necessary
instead of the other way around. Other tests do the same.

This fixes the following clang warning:
lib583.c:68:15: warning: cast from function call of type 'CURLMcode' to
non-matching type 'int' [-Wbad-function-cast]
2017-05-31 19:05:50 +02:00
Daniel Stenberg 69a6cc2e13 libtest/lib574.c: use correct callback proto 2017-05-31 11:56:53 +02:00
Jay Satiro 35682764a9 test557: fix ubsan runtime error due to int left shift
- Test curl_msnprintf negative int width arg using INT_MIN instead of
  1 << 31 which is undefined behavior.

Closes https://github.com/curl/curl/issues/1516
2017-05-29 18:04:53 -04:00
Michael Kaufmann 8ab22a7453 time: fix type conversions and compiler warnings
Fix bugs and compiler warnings on systems with 32-bit long and
64-bit time_t.

Reviewed-by: Daniel Stenberg

Closes #1499
2017-05-24 22:56:22 +02:00
Dan Fandrich b1fa80b84f lib510: don't write past the end of the buffer if it's too small 2017-05-13 23:13:09 +02:00
Dan Fandrich f19baf27eb tests: make test file names more unique
Include the test number in the names of files written out by tests to
reduce the chance of accidental duplication and to make it more clear
which test is associated with which file.
2017-05-09 21:52:05 +02:00
Marcel Raad 141ed8ca09
libtest: fix MinGW-w64 warnings
long is 32 bits while size_t is 64 bits on MinGW-w64, so
typecheck-gcc.h complains when using size_t for a long option.
Also, curl_socket_t is unsigned long long rather than int.
2017-05-08 19:59:46 +02:00
Marcel Raad e2b394106d
test537: use correct variable type
Avoids narrowing conversion warnings because rlim_t is usually
unsigned long.

Closes https://github.com/curl/curl/pull/1469
2017-05-08 09:19:18 +02:00
Marcel Raad 6dc3422d48
tests: fix -Wcast-qual warnings
Avoid casting string literals to non-const char *.
2017-05-05 21:29:50 +02:00
Dan Fandrich 7cb1e1ee01 test557: set a known good numeric locale
Windows does not allow setting the locale with environment variables (as
the test attempted to do), so the test failed when run with a user
locale that has a comma as radixchar. Changed the test to call
setlocale() explicitly to ensure that a known working locale is set even
on Windows.
2017-05-04 18:17:08 +02:00
Daniel Stenberg dfb0595a73 test559: verify use of minimum CURLOPT_BUFFERSIZE 2017-05-04 15:39:04 +02:00
Marcel Raad 7dd89c1cdc
tests: declare TU-local variables static
This fixes missing-variable-declarations warnings when building with
clang.
2017-05-01 12:55:09 +02:00
Dan Fandrich 584142892f tests: added --remote-time tests for remaining protocols that support it 2017-04-29 10:16:06 +02:00
Marcel Raad e50e2850ba
test1541: also test for CURL_PULL_WS2TCPIP_H
Ref: https://github.com/curl/curl/issues/1408
Closes https://github.com/curl/curl/pull/1412
2017-04-12 11:09:00 +02:00
Daniel Stenberg 8761a40fd9 test1541: ignore the curl_off_t variable type name comparison
... the sizes and the formatting strings are what's really important and
avoids problems with int64_t vs "long long".

Bug: https://curl.haxx.se/mail/lib-2017-04/0019.html
2017-04-05 15:14:12 +02:00
Daniel Stenberg 9506d01ee5 include: curl/system.h is a run-time version of curlbuild.h
system.h is aimed to replace curlbuild.h at a later point in time when
we feel confident system.h works sufficiently well.

curl/system.h is currently used in parallel with curl/curlbuild.h

curl/system.h determines a data sizes, data types and include file
status based on available preprocessor defines instead of getting
generated at build-time. This, in order to avoid relying on a build-time
generated file that makes it complicated to do 32 and 64 bit bields from
the same installed set of headers.

Test 1541 verifies that system.h comes to the same conclusion that
curlbuild.h offers.

Closes #1373
2017-04-03 23:24:39 +02:00
Daniel Stenberg 452203341d pause: handle mixed types of data when paused
When receiving chunked encoded data with trailers, and the write
callback returns PAUSE, there might be both body and header to store to
resend on unpause. Previously libcurl returned error for that case.

Added test case 1540 to verify.

Reported-by: Stephen Toub
Fixes #1354
Closes #1357
2017-03-28 13:27:49 +02:00
klemens f7df67cff0 spelling fixes
Closes #1356
2017-03-26 23:56:23 +02:00
Dan Fandrich 3627769d14 build: removed redundant DEPENDENCIES from makefiles 2017-03-14 12:13:03 +01:00
Michael Kaufmann 8d10520993 tests: fix the authretry tests
Do not call curl_easy_reset() between the requests, because the
auth state must be preserved for these tests.

Follow-up to 0afbcfd
2017-03-11 20:21:56 +01:00
Daniel Gustafsson e695b070a5 test552: Fix typos
Closes https://github.com/curl/curl/pull/1245
2017-02-07 02:39:15 -05:00
Jiří Malák 8805be2cf8 lib506: fix build for Open Watcom
Rename symbol lock to locks to not clash with OW CRTL function name.

Closes #1196
2017-01-08 16:24:30 +01:00
Daniel Stenberg fab16de6e5 lib557.c: use a shorter MAXIMIZE representation
Since several compilers had problems with the previous one

Reported-by: Ray Satiro
Bug: https://curl.haxx.se/mail/lib-2016-12/0098.html
2016-12-22 09:49:02 +01:00
Daniel Stenberg e7458c1bc3 lib557: move the "enable LONGLINE" to allow more long lines
This file is riddled with them...
2016-12-21 23:37:05 +01:00
Jay Satiro c2402b6e02 tests: checksrc compliance 2016-12-19 02:31:59 -05:00
Daniel Stenberg 3ab3c16db6 printf: fix floating point buffer overflow issues
... and add a bunch of floating point printf tests
2016-12-19 07:53:20 +01:00
Michael Kaufmann afff64dbcd curl_easy_recv: Improve documentation and example program
Follow-up to 82245ea: Fix the example program sendrecv.c (handle
CURLE_AGAIN, handle incomplete send). Improve the documentation
for curl_easy_recv() and curl_easy_send().

Reviewed-by: Frank Meier
Assisted-by: Jay Satiro

See https://github.com/curl/curl/pull/1134
2016-12-18 12:56:23 +01:00
Daniel Stenberg 1c3e8bbfed checksrc: warn for assignments within if() expressions
... they're already frowned upon in our source code style guide, this
now enforces the rule harder.
2016-12-14 01:29:44 +01:00
Daniel Stenberg b228d2952b checksrc: stricter no-space-before-paren enforcement
In order to make the code style more uniform everywhere
2016-12-13 23:39:11 +01:00
Jay Satiro 30593d4534 lib1536: checksrc compliance 2016-11-28 03:06:04 -05:00
Frank Gevaerts e38fe7abbf tests: Add some testcases for recent new features.
Add missing tests for CURLINFO_SCHEME, CURLINFO_PROTOCOL, %{scheme},
and %{http_version}

closes #1143
2016-11-26 17:04:55 +01:00
Daniel Stenberg 6832c1d4b2 checksrc: move open braces to comply with function declaration style 2016-11-24 23:58:22 +01:00
Daniel Stenberg 8657c268e1 checksrc: white space edits to comply to stricter checksrc 2016-11-24 23:58:22 +01:00
Daniel Stenberg dbadaebfc4 checksrc: code style: use 'char *name' style 2016-11-24 23:58:22 +01:00
Daniel Stenberg 27302abb94 s/cURL/curl
We're mostly saying just "curl" in lower case these days so here's a big
cleanup to adapt to this reality. A few instances are left as the
project could still formally be considered called cURL.
2016-11-07 10:36:23 +01:00
Jay Satiro 4564636781 easy: Initialize info variables on easy init and duphandle
- Call Curl_initinfo on init and duphandle.

Prior to this change the statistical and informational variables were
simply zeroed by calloc on easy init and duphandle. While zero is the
correct default value for almost all info variables, there is one where
it isn't (filetime initializes to -1).

Bug: https://github.com/curl/curl/issues/1103
Reported-by: Neal Poole
2016-11-05 23:06:28 -04:00
Dan Fandrich 52a2c2fb51 libauthretry: use the external function curl_strequal
The internal version strcasecompare isn't available outside libcurl
2016-10-31 12:44:18 +01:00
Daniel Stenberg 502acba2af strcasecompare: is the new name for strequal()
... to make it less likely that we forget that the function actually
does case insentive compares. Also replaced several invokes of the
function with a plain strcmp when case sensitivity is not an issue (like
comparing with "-").
2016-10-31 08:46:35 +01:00
Daniel Stenberg 96a80b5a26 parsedate: handle cut off numbers better
... and don't read outside of the given buffer!

CVE-2016-8621

bug: https://curl.haxx.se/docs/adv_20161102G.html
Reported-by: Luật Nguyễn
2016-10-31 08:46:35 +01:00
Daniel Stenberg ac8a314913 test557: verify printf() with 128 and 129 arguments 2016-10-08 20:47:44 +02:00
Michael Kaufmann e9e5366193 New libcurl option to keep sending on error
Add the new option CURLOPT_KEEP_SENDING_ON_ERROR to control whether
sending the request body shall be completed when the server responds
early with an error status code.

This is suitable for manual NTLM authentication.

Reviewed-by: Jay Satiro

Closes https://github.com/curl/curl/pull/904
2016-09-22 22:22:31 +02:00
Jay Satiro 22cfeac730 easy: Reset all statistical session info in curl_easy_reset
Bug: https://github.com/curl/curl/issues/1017
Reported-by: Jeroen Ooms
2016-09-20 01:14:01 -04:00
Jakub Zakrzewski 6140dfcf3e CMake: Try to (un-)hide private library symbols
Detect support for compiler symbol visibility flags and apply those
according to CURL_HIDDEN_SYMBOLS option.
It should work true to the autotools build except it tries to unhide
symbols on Windows when requested and prints warning if it fails.

Ref: https://github.com/curl/curl/issues/981#issuecomment-242665951
Reported-by: Daniel Stenberg
2016-09-10 00:35:38 +02:00
Mark Hamilton 5d563a10b3 libtest/test.h: fix typo (#988) 2016-09-03 23:12:22 +02:00
Jay Satiro 68701e51c1 mprintf: Fix processing of width and prec args
Prior to this change a width arg could be erroneously output, and also
width and precision args could not be used together without crashing.

"%0*d%s", 2, 9, "foo"

Before: "092"
After: "09foo"

"%*.*s", 5, 2, "foo"

Before: crash
After: "   fo"

Test 557 is updated to verify this and more
2016-05-13 00:06:50 +02:00
Daniel Stenberg 4f45240bc8 lib: include curl_printf.h as one of the last headers
curl_printf.h defines printf to curl_mprintf, etc. This can cause
problems with external headers which may use
__attribute__((format(printf, ...))) markers etc.

To avoid that they cause problems with system includes, we include
curl_printf.h after any system headers. That makes the three last
headers to always be, and we keep them in this order:

 curl_printf.h
 curl_memory.h
 memdebug.h

None of them include system headers, they all do funny #defines.

Reported-by: David Benjamin

Fixes #743
2016-04-29 22:32:49 +02:00
Daniel Stenberg 6de32d916f lib1517: checksrc compliance 2016-04-24 12:27:39 +02:00
Karlson2k 4fbd576930 tests: added test1517
... for checking ability to receive full HTTP response when POST request
is used with slow read callback function.

This test checks for bug #657 and verifies the work-around from
72d5e144fb.

Closes #720
2016-04-20 10:02:22 +02:00
Daniel Stenberg a07727005a make/checksrc: use $srcdir, not $top_srcdir 2016-04-19 08:56:06 +02:00
Daniel Stenberg ab493af731 checksrc/makefile.am: use $top_srcdir to find source files
... to properly support out of source tree builds.
2016-04-18 14:58:11 +02:00
Steve Holme 066b224672 tests: Fixed header files to comply with our code style 2016-04-03 21:57:38 +01:00
Daniel Stenberg a71012c03e code: style updates 2016-04-03 22:38:36 +02:00
Daniel Stenberg d3252e000c checksrc: run checksrc in tests when 'make checksrc' in root 2016-04-03 22:38:36 +02:00
Daniel Stenberg adeaf95e20 lib557: allow too long lines 2016-04-03 22:38:36 +02:00
Daniel Stenberg 365322b8bc tests/libtest: follow our code style guidelines better
... checksrc of all test code is pending.
2016-04-03 11:57:34 +02:00
Daniel Stenberg 55452ebdff curl/mprintf.h: remove support for _MPRINTF_REPLACE
The define is not in our name space and is therefore not protected by
our API promises.

It was only really used by libcurl internals but was mostly erased from
there already in 8aabbf5 (March 2015). This is supposedly the final
death blow to that define from everywhere.

As a side-effect, making sure _MPRINTF_REPLACE is gone and not used, I
made the lib tests in tests/libtest/ use curl_printf.h for its redefine
magic and then subsequently the use of sprintf() got banned in the tests
as well (as it is in libcurl internals) and I then replaced them all
with snprintf().

In the unlikely event that any users is actually using this define and
gets sad by this change, it is very easily copied to the user's own
code.
2016-04-01 10:46:36 +02:00
Daniel Stenberg 4af40b3646 URLs: change all http:// URLs to https:// 2016-02-03 00:19:02 +01:00
Marc Hoersken 38b055446a test 1515: add MSYS support by passing a relative path
MSYS would otherwise turn a /-style path into a C:\-style path.
2015-12-26 17:25:42 +01:00
Marc Hoersken 520bd9e49f tests first.c: fix calculation of sleep timeout on Windows
Not converting to double caused small timeouts to be skipped.
2015-12-23 15:03:40 +01:00
Marc Hoersken 24cf20ec68 test 573: add more debug output 2015-12-23 15:02:43 +01:00
Daniel Stenberg facf2925c7 test1513: make sure the callback is only called once 2015-11-24 23:33:37 +01:00
Daniel Stenberg ca5f9341ef formadd: support >2GB files on windows
Closes #425
2015-11-02 08:41:46 +01:00
Dan Fandrich 854976ad7b test1531: case the size to fix the test on non-largefile builds 2015-10-14 22:00:09 +02:00
Jay Satiro 9518139c73 gitignore: Sort for readability
find . -name .gitignore -print0 | xargs -i -0 sort -o '{}' '{}'
2015-08-18 01:03:05 -04:00
Kamil Dudka cd20e81e89 libtest: call PR_Cleanup() on exit if NSPR is used
This prevents valgrind from reporting possibly lost memory that NSPR
uses for file descriptor cache and other globally allocated internal
data structures.

Reported-by: Štefan Kremeň
2015-07-14 21:52:33 +02:00
Roger Leigh e3e06e1aee tests: Distribute CMakeLists.txt files in subdirectories 2015-06-25 07:48:50 -07:00
Daniel Stenberg 5156982377 test1531: verify POSTFIELDSIZE set after add_handle
Following the fix made in 903b6e0556.
2015-06-23 17:51:03 -07:00
Daniel Stenberg 20ac345806 CURLOPT_OPENSOCKETFUNCTION: return error at once
When CURL_SOCKET_BAD is returned in the callback, it should be treated
as an error (CURLE_COULDNT_CONNECT) if no other socket is subsequently
created when trying to connect to a server.

Bug: http://curl.haxx.se/mail/lib-2015-06/0047.html
2015-06-09 00:22:02 +02:00
Daniel Stenberg 6ba2e88a64 CURLOPT_HEADEROPT: default to separate
Make the HTTP headers separated by default for improved security and
reduced risk for information leakage.

Bug: http://curl.haxx.se/docs/adv_20150429.html
Reported-by: Yehezkel Horowitz, Oren Souroujon
2015-04-28 21:02:37 +02:00
Markus Elfring 29c655c0a6 Bug #149: Deletion of unnecessary checks before calls of the function "free"
The function "free" is documented in the way that no action shall occur for
a passed null pointer. It is therefore not needed that a function caller
repeats a corresponding check.
http://stackoverflow.com/questions/18775608/free-a-null-pointer-anyway-or-check-first

This issue was fixed by using the software Coccinelle 1.0.0-rc24.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
2015-03-16 12:13:56 +01:00
Sergei Nikulov 43eb8b2874 libtest: fixed linker errors on msvc
Bug: https://github.com/bagder/curl/pull/144
2015-03-03 14:33:11 +01:00
Daniel Stenberg da39f380a4 lib530: make it less timing sensible
... by making sure the first request is completed before doing the
remainder.
2015-02-24 11:50:19 +01:00
Daniel Stenberg 83bb07027d unit1600: unit test for Curl_ntlm_core_mk_nt_hash 2015-02-03 21:03:11 +01:00
Daniel Stenberg 3df8e78860 tests: make sure CRLFs can't be used in URLs passed to proxy
Bug: http://curl.haxx.se/docs/adv_20150108B.html
2015-01-07 22:55:56 +01:00
Julien Nabet ee0941a0b7 lib1900.c: Fixed cppcheck error
lib1900.c:182: (style) Array index 'handlenum' is used before limits
               check

Bug: https://github.com/bagder/curl/pull/133
2014-12-31 12:45:36 +00:00
Steve Holme d8273e198c test1509: Fixed compilation warning
lib1509.c:93:18: warning: conversion to 'long int' from 'size_t' may
                 alter its value
2014-12-28 21:47:20 +00:00
Steve Holme 8f40145384 test556: Fixed compilation warning
lib556.c:90: warning: conversion to 'unsigned int' from 'size_t' may
             alter its value
2014-12-28 20:32:46 +00:00
Steve Holme 0d037cfdce test1520: Fixed initial teething problems
* Missing initialisation of upload status caused a seg fault
* Missing data termination caused corrupt data to be uploaded
* Data verification should be performed in <upload> element
* Added missing recipient list cleanup
2014-12-28 13:04:15 +00:00
Steve Holme 9459ee99ae test1520: Fixed compilation errors 2014-12-28 12:48:22 +00:00
Steve Holme 29726951b0 tests: Added test for bug #1456 2014-12-28 12:17:32 +00:00
Dan Fandrich 41f1f6e830 cookies: Improved OOM handling in cookies
This fixes the test 506 torture test. The internal cookie API really
ought to be improved to separate cookie parsing errors (which may be
ignored) with OOM errors (which should be fatal).
2014-12-09 23:58:30 +01:00
Peter Wu 17d27805f9 cmake: add ENABLE_THREADED_RESOLVER, rename ARES
Fix detection of the AsynchDNS feature which not just depends on
pthreads support, but also on whether USE_POSIX_THREADS is set or not.
Caught by test 1014.

This patch adds a new ENABLE_THREADED_RESOLVER option (corresponding to
--enable-threaded-resolver of autotools) which also needs a check for
HAVE_PTHREAD_H.

For symmetry with autotools, CURL_USE_ARES is renamed to ENABLE_ARES
(--enable-ares). Checks that test for the availability actually use
USE_ARES instead as that is the result of whether a-res is available or
not (in practice this does not matter as CARES is marked as required
package, but nevertheless it is better to write the intent).

Signed-off-by: Peter Wu <peter@lekensteyn.nl>
2014-11-10 09:09:25 +01:00
Peter Wu 767aaf587c cmake: build libhostname for test suite
Used by some test cases via LD_PRELOAD in order to fake the host name.

Signed-off-by: Peter Wu <peter@lekensteyn.nl>
2014-11-10 09:08:46 +01:00
Peter Wu 7bdfdd09e4 tests: fix libhostname visibility
I noticed that a patched cmake build would pass tests with a fake local
hostname, but the autotools build skips them:

    got unexpected host name back, LD_PRELOAD failed

It turns out that -fvisibility=hidden hides the symbol, and since the
tests are not part of libcurl, it fails too. Just remove the LIBCURL
guard.

Broken since cURL 7.30 (commit 83a42ee20e,
"curl.h: stricter CURL_EXTERN linkage decorations logic").

Signed-off-by: Peter Wu <peter@lekensteyn.nl>
2014-11-10 09:06:48 +01:00
Daniel Stenberg d997c8b2f6 lib544.c: use duphandle for test 545
To verify that curl_easy_duphandle() works fine on a handle that has
gotten data stored with *_COPYPOSTFIELDS.
2014-11-05 08:05:14 +01:00
Daniel Stenberg d938d5e6f8 test545: make it not use a trailing zero
CURLOPT_COPYPOSTFIELDS with a given CURLOPT_POSTFIELDSIZE does not
require a trailing zero of the data and by making sure this test doesn't
use one we know it works (combined with valgrind).
2014-10-16 23:40:49 +02:00
Jakub Zakrzewski a3154295c5 Cmake: Got rid of setup_curl_dependencies
There is no need for such function. Include_directories propagate by
themselves and having a function with one simple link statement makes
little sense.
2014-10-09 13:48:30 +02:00
Dan Fandrich 46d71e7fd2 test506: Fixed a couple of memory leaks in test 2014-09-26 06:57:52 +02:00
Yousuke Kimoto b10a838a7a CURLOPT_COOKIELIST: Added "RELOAD" command 2014-09-25 16:28:17 +02:00
Brandon Casey 6beb0eeea1 Ensure progress.size_dl/progress.size_ul are always >= 0
Historically the default "unknown" value for progress.size_dl and
progress.size_ul has been zero, since these values are initialized
implicitly by the calloc that allocates the curl handle that these
variables are a part of.  Users of curl that install progress
callbacks may expect these values to always be >= 0.

Currently it is possible for progress.size_dl and progress.size_ul
to by set to a value of -1, if Curl_pgrsSetDownloadSize() or
Curl_pgrsSetUploadSize() are passed a "size" of -1 (which a few
places currently do, and a following patch will add more).  So
lets update Curl_pgrsSetDownloadSize() and Curl_pgrsSetUploadSize()
so they make sure that these variables always contain a value that
is >= 0.

Updates test579 and test599.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
2014-09-07 23:23:12 +02:00
Daniel Stenberg 4e11bd156e test1013.pl: GSS-Negotiate doesn't exist as a feature anymore 2014-07-24 23:46:11 +02:00
Sergey Nikulov 64010d603c libtest: fixed duplicated line in Makefile
Bug: https://github.com/bagder/curl/pull/105
2014-07-24 15:19:46 +02:00
Daniel Stenberg a8206adcad test1013.pl: remove SPNEGO/GSS-API tweaks
No longer necessary after Michael Osipov's rework
2014-07-23 00:01:39 +02:00
Daniel Stenberg 4cb2521595 test506: verify aa68848451
After the fixed cookie lock deadlock, this test now passes and it
detects double-locking and double-unlocking of mutexes.
2014-07-16 00:09:58 +02:00
Dan Fandrich a6d666e1a6 tests: Use CURLOPT_READDATA instead of the obsolete CURLOPT_INFILE 2014-06-18 01:17:23 +02:00
Daniel Stenberg 71ea31ae74 test1014: GSS-API is only in curl-config. not in curl
Follow-up to commit 121bcfee5d. curl-config --features now lists
GSS-API but it is not a listed feature in curl -V. This should probably
be synchronized.
2014-05-18 17:07:29 +02:00
Daniel Stenberg 22ee67a1ca lib1506: make sure the transfers are not within the same ms
Just to make sure the test is properly repeatable.

Bug: http://curl.haxx.se/mail/lib-2014-05/0081.html
Reported-by: Henrik
2014-05-09 16:50:42 +02:00
Daniel Stenberg 9e4f6c5809 libtests: add a wait_ms() function
This allows a libcurl test to portably sleep for a given number of
milliseconds.
2014-05-09 16:50:42 +02:00
Dan Fandrich e673f55c45 tests: Use standard libtest return codes when relevant 2014-05-05 15:30:05 +02:00
Dan Fandrich 40e6af893b test1513: Don't return an uninitialized variable on init failure 2014-05-05 15:29:23 +02:00
Dan Fandrich c303107345 test585: Fixed NULL pointer dereference in fopen 2014-05-01 11:00:30 +02:00
Dan Fandrich c1d6158789 tests: Fixed torture test for tests 1526 & 1527 2014-04-22 22:43:57 +02:00
Daniel Stenberg 74851340bd PROXYHEADER: send these headers in "normal" proxy requests too
Updated the docs to clarify and the code accordingly, with test 1528 to
verify:

When CURLHEADER_SEPARATE is set and libcurl is asked to send a request
to a proxy but it isn't CONNECT, then _both_ header lists
(CURLOPT_HTTPHEADER and CURLOPT_PROXYHEADER) will be used since the
single request is then made for both the proxy and the server.
2014-04-04 17:03:43 +02:00
Daniel Stenberg ef6be35bae CURLOPT_HEADEROPT: added
Modified the logic so that CURLOPT_HEADEROPT now controls if PROXYHEADER
is actually used or not.
2014-04-04 17:03:43 +02:00
Daniel Stenberg ac887eedbc CURLOPT_PROXYHEADER: set headers for proxy-only
Includes docs and new test cases: 1525, 1526 and 1527

Co-written-by: Vijay Panghal
2014-04-04 17:03:43 +02:00
Daniel Stenberg 713402982f lib1513: fix callback proto to silence warning 2014-03-29 23:14:42 +01:00
Steve Holme 873178a657 lib1515.c: Fixed #include path in commit 647f83e809 2014-02-19 20:36:36 +00:00
Maks Naumov 647f83e809 test1515: fix compilation with msvc
... or any other systems lacking a native snprintf
2014-02-19 13:50:17 +01:00
Marc Hoersken 8451623b45 lib1515.c: Added support for Windows using the Sleep function 2014-02-14 22:17:54 +01:00
Marc Hoersken 75f00de55c testsuite: use binary output mode for custom curl test tools
Do not try to convert line-endings to CRLF on Windows by setting stdout
to binary mode, just like the curl tool does if --ascii is not specified.

This should prevent corrupted stdout line-ending output like CRCRLF.

In order to make the previously naive text-aware tests work with
binary mode on Windows, text-mode is disabled for them if it is not
actually part of the test case and line-endings are corrected.
2014-02-14 20:12:27 +01:00
Steve Holme 6c492f34e5 lib1515.c: Fixed various compilation warnings
lib1515.c:38:26 warning: unused parameter 'curl'
lib1515.c:38:81 warning: unused parameter 'ptr'
lib1515.c:38:5 warning: no previous prototype for 'debug_callback'
lib1515.c:46:5 warning: no previous prototype for 'do_one_request'
lib1515.c:120:3  warning: ISO C90 forbids mixed declarations and code

As well as some code policing such as white space and braces.
2014-02-07 15:15:17 +00:00
Romulo A. Ceccon 1505e4612b tests: add test for bug #1303 (dns cache timeout)
Test-case 1515 reproduces bug #1303, where libcurl
would incorrectly prune DNS entries added via
CURLOPT_RESOLVE after the DNS_CACHE_TIMEOUT had
expired.
2014-02-06 23:03:34 +01:00
Marc Hoersken e5acae0052 test 500: workaround low timer resolution on Windows
Since the timer resolution is lower, there are actually cases that
the compared values are equal. Therefore we check for previous
timestamps being greater than the current one instead.
2014-02-01 14:04:47 +01:00
Dan Fandrich be9cc620b5 tests: make the authorization retry tests pass the torture tests 2014-01-30 23:18:20 +01:00
Dan Fandrich 9873fd5317 tests: make a few lib15?? tests pass the OOM torture tests 2014-01-29 00:40:33 +01:00
Dan Fandrich d735d3e803 lib1900: make the test pass the OOM torture tests 2014-01-29 00:19:34 +01:00
Dan Fandrich 6c014e4283 test1514: Got rid of a non-const initializer C99ism 2014-01-22 01:49:55 +01:00
Cédric Deltheil 6217cf6ba3 test1514: added - no more negative Content-Length (HTTP POST)
This covers changes from commit afd288b2.
2014-01-20 12:52:07 +01:00
Steve Holme 84a9f092dc Updated copyright year for recent changes 2014-01-04 17:41:10 +00:00
Daniel Stenberg 62da1e7458 test1513: added - verify early progress callback return fail
Verify the change brought in commit 8e11731653061. It makes sure that
returning a failure from the progress callback even very early results
in the correct return code.
2014-01-03 14:09:59 +01:00
Steve Holme 60bd22620a mprintf: Replaced internal usage of FORMAT_OFF_T and FORMAT_OFF_TU
Following commit 0aafd77fa4, replaced the internal usage of
FORMAT_OFF_T and FORMAT_OFF_TU with the external versions that we
expect API programmers to use.

This negates the need for separate definitions which were subtly
different under different platforms/compilers.
2013-12-31 11:10:42 +00:00
Steve Holme ed4ce23c23 lib1507.c: Added missing set of CURLOPT_UPLOAD option
Although this option should have already been set, the SMTP module can
now download information from and send instructional commands to, an
SMTP server, requiring the option to be set in order to perform a mail
transfer.
2013-11-15 21:01:10 +00:00
Steve Holme f73f052010 lib1512.c: Fixed compilation warning
An enumerated type is mixed with another type.

...as well as a small coding style error.
2013-09-02 20:39:53 +01:00
Guenter Knauf 97ed1ac905 Killed warning 'res' might be used uninitialized. 2013-09-01 23:08:29 +02:00
Daniel Stenberg d2b36e466a global dns cache: didn't work [regression]
CURLOPT_DNS_USE_GLOBAL_CACHE broke in commit c43127414d (been
broken since the libcurl 7.29.0 release). While this option has been
documented as deprecated for almost a decade and nobody even reported
this bug, it should remain functional.

Added test case 1512 to verify
2013-08-08 16:28:46 +02:00
Yang Tse 0f4ba89ffd libtest: fix data type of some *_setopt() 'long' arguments 2013-07-22 21:40:45 +02:00
Sergei Nikulov 448d55ef0a cmake: Fix for MSVC2010 project generation
Fixed issue with static build for MSVC2010.

After some investigation I've discovered known issue
http://public.kitware.com/Bug/view.php?id=11240 When .rc file is linked
to static lib it fails with following linker error

LINK : warning LNK4068: /MACHINE not specified; defaulting to X86
file.obj : fatal error LNK1112: module machine type 'x64' conflicts with
target machine type 'X86'

Fix add target property /MACHINE: for MSVC generation.

Also removed old workarounds - it caused errors during msvc build.

Bug: http://curl.haxx.se/mail/lib-2013-07/0046.html
2013-07-17 00:26:58 +02:00
Yang Tse c983aa9efc test 1511: fix enumerated type mixed with another type 2013-07-11 17:01:02 +02:00
Marc Hoersken 009d2336fe lib506.c: Fixed possible use of uninitialized variables 2013-07-01 21:42:15 +02:00
Benjamin Gilbert 03a3dd9ee3 test506: verify that CURLOPT_COOKIELIST takes share lock
It doesn't right now: http://curl.haxx.se/bug/view.cgi?id=1215
2013-06-17 23:28:35 +02:00
Sergei Nikulov 9e10963c20 lib1900: use tutil_tvnow instead of gettimeofday
Makes it build on windows
2013-06-12 10:52:23 +02:00
Daniel Stenberg 87cf677eca lib1500: remove bad check
After curl_multi_wait() returns, this test checked that we got exactly
one file descriptor told to read from, but we cannot be sure that is
true. curl_multi_wait() will sometimes return earlier without any file
descriptor to handle, just just because it is a suitable time to call
*perform().

This problem showed up with commit 29bf0598.

Bug: http://curl.haxx.se/mail/lib-2013-06/0029.html
Reported-by: Fabian Keil
2013-06-06 22:22:14 +02:00
Daniel Stenberg a45e3f93e4 libtest: gitignore more binary files 2013-05-08 14:35:45 +02:00
Alessandro Ghedini d791179d7f tests: add test1511 to check timecond clean-up
Verifies the timecond fix in commit c49ed0b6c0
2013-04-22 22:46:47 +02:00
Paul Howarth 1c40685d32 Add extra libs for lib1900 and lib2033 test programs
These are needed in cases where clock_gettime is used, from librt.
2013-04-15 23:06:10 +02:00
Yang Tse a6eade56ca lib1509.c: fix compiler warnings 2013-04-04 16:31:27 +02:00
Linus Nielsen Feltzing e87e76e2dc easy: Fix the broken CURLOPT_MAXCONNECTS option
Copy the CURLOPT_MAXCONNECTS option to CURLMOPT_MAXCONNECTS in
curl_easy_perform().

Bug: http://curl.haxx.se/bug/view.cgi?id=1212
Reported-by: Steven Gu
2013-04-04 10:33:39 +02:00
Daniel Stenberg 1e29d275c6 test1509: verify proxy header response headers count
Modified sws to support and use custom CONNECT responses instead of the
previously naive hard-coded version. Made the HTTP test server able to
extract test case number from the host name in a CONNECT request by
finding the number after the last dot. It makes 'machine.moo.123' use
test case 123.

Adapted a larger amount of tests to the new <connect> style.

Bug: http://curl.haxx.se/bug/view.cgi?id=1204
Reported by: Martin Jansen
2013-03-27 15:30:46 +01:00
Steve Holme b8a986be06 lib1900.c: fix compilation warning
warning: declaration of 'time' shadows a global declaration
2013-03-20 23:32:48 +00:00
Yang Tse 1700668d78 tests: add #96 #558 and #1330
These verfy that the 'memory tracking' subsystem is actually doing its
job when using curl tool (#96), a test in libtest (#558) and also a unit
test (#1330), in order to prevent regressions in this functionallity.
2013-03-15 19:59:51 +01:00
Linus Nielsen Feltzing 0f147887b0 Multiple pipelines and limiting the number of connections.
Introducing a number of options to the multi interface that
allows for multiple pipelines to the same host, in order to
optimize the balance between the penalty for opening new
connections and the potential pipelining latency.

Two new options for limiting the number of connections:

CURLMOPT_MAX_HOST_CONNECTIONS - Limits the number of running connections
to the same host. When adding a handle that exceeds this limit,
that handle will be put in a pending state until another handle is
finished, so we can reuse the connection.

CURLMOPT_MAX_TOTAL_CONNECTIONS - Limits the number of connections in total.
When adding a handle that exceeds this limit,
that handle will be put in a pending state until another handle is
finished. The free connection will then be reused, if possible, or
closed if the pending handle can't reuse it.

Several new options for pipelining:

CURLMOPT_MAX_PIPELINE_LENGTH - Limits the pipeling length. If a
pipeline is "full" when a connection is to be reused, a new connection
will be opened if the CURLMOPT_MAX_xxx_CONNECTIONS limits allow it.
If not, the handle will be put in a pending state until a connection is
ready (either free or a pipe got shorter).

CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE - A pipelined connection will not
be reused if it is currently processing a transfer with a content
length that is larger than this.

CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE - A pipelined connection will not
be reused if it is currently processing a chunk larger than this.

CURLMOPT_PIPELINING_SITE_BL - A blacklist of hosts that don't allow
pipelining.

CURLMOPT_PIPELINING_SERVER_BL - A blacklist of server types that don't allow
pipelining.

See the curl_multi_setopt() man page for details.
2013-03-13 23:55:24 +01:00
Yang Tse ba7fbd0960 test509: libcurl initialization with memory callbacks and actual usage 2013-03-13 21:50:40 +01:00
Yang Tse 83a42ee20e curl.h: stricter CURL_EXTERN linkage decorations logic
No API change involved.

Info: http://curl.haxx.se/mail/lib-2013-02/0234.html
2013-03-12 00:27:47 +01:00
Yang Tse 09b2db2dfd Makefile.am: empty AM_LDFLAGS definition for automake 1.7 compatibility 2013-03-09 16:23:52 +01:00
Yang Tse 70b5173410 configure: use XC_LIBTOOL for portability across libtool versions 2013-03-08 13:27:45 +01:00
Linus Nielsen Feltzing da3fc1ee91 Fix NULL pointer reference when closing an unused multi handle. 2013-02-10 22:57:58 +01:00
Daniel Stenberg 72688317ad DONE: consider callback-aborted transfers premature
This bug report properly identified that when doing SMTP and aborting
the transfer with a callback, it must be considered aborted prematurely
by the code to avoid QUIT etc to be attempted as that would cause a
hang.

The new test case 1507 verifies this behavior.

Reported by: Patricia Muscalu
Bug: http://curl.haxx.se/bug/view.cgi?id=1184
2013-02-08 13:57:01 +01:00
Linus Nielsen Feltzing bd1f170a5a CURLMOPT_MAXCONNECTS: restore functionality
When a connection is no longer used, it is kept in the cache. If the
cache is full, the oldest idle connection is closed. If no connection is
idle, the current one is closed instead.
2013-02-05 09:17:52 +01:00
Yang Tse 63605d281f Makefile.inc: fix $(top_srcdir) not allowed in _SOURCES variables 2013-01-20 04:20:02 +01:00
Daniel Stenberg c43127414d always-multi: always use non-blocking internals
Remove internal separated behavior of the easy vs multi intercace.
curl_easy_perform() is now using the multi interface itself.

Several minor multi interface quirks and bugs have been fixed in the
process.

Much help with debugging this has been provided by: Yang Tse
2013-01-17 19:40:35 +01:00
Yang Tse 4b401b2d99 build: use per-target '_CPPFLAGS' for those currently using default
Automake documents that doing this will make it choose a different name
for intermediate object files even when sharing source files across
targets of same Makefile.am.

Up to automake 1.13.1 target's intermediate object files were placed
in the build subdirectory of the target. We depended on this, probably
undocumented behavior, to achieve same behavior as if a per-target flag
had been specified when building targets that actually belong to
different Makefile.am files.

It seems automake 1.13.2 is going to break behavior mentioned above.

So, lets use a documented behavior in order to achieve same purpose,
across automake versions, no matter where automake wishes to place
intermediate object files.

Our build targets that already were using a per-target '_CFLAGS' or
'_CPPFLAGS' need no 'fixing', these were already 'fixed'. The only
Makefile.am or Makefile.in files in libcurl's source tree touched by
this 'fix' are tests/libtest/Makefile.inc and tests/unit/Makefile.inc.
2013-01-15 16:31:50 +01:00
Yang Tse d7f2c3af5f tests/libtest/Makefile.inc: sort build targets 2013-01-15 16:31:49 +01:00
Yang Tse 5a053ffe80 build: fix circular header inclusion with other packages
This commit renames lib/setup.h to lib/curl_setup.h and
renames lib/setup_once.h to lib/curl_setup_once.h.

Removes the need and usage of a header inclusion guard foreign
to libcurl. [1]

Removes the need and presence of an alarming notice we carried
in old setup_once.h [2]

----------------------------------------

1 - lib/setup_once.h used __SETUP_ONCE_H macro as header inclusion guard
    up to commit ec691ca3 which changed this to HEADER_CURL_SETUP_ONCE_H,
    this single inclusion guard is enough to ensure that inclusion of
    lib/setup_once.h done from lib/setup.h is only done once.

    Additionally lib/setup.h has always used __SETUP_ONCE_H macro to
    protect inclusion of setup_once.h even after commit ec691ca3, this
    was to avoid a circular header inclusion triggered when building a
    c-ares enabled version with c-ares sources available which also has
    a setup_once.h header. Commit ec691ca3 exposes the real nature of
    __SETUP_ONCE_H usage in lib/setup.h, it is a header inclusion guard
    foreign to libcurl belonging to c-ares's setup_once.h

    The renaming this commit does, fixes the circular header inclusion,
    and as such removes the need and usage of a header inclusion guard
    foreign to libcurl. Macro __SETUP_ONCE_H no longer used in libcurl.

2 - Due to the circular interdependency of old lib/setup_once.h and the
    c-ares setup_once.h header, old file lib/setup_once.h has carried
    back from 2006 up to now days an alarming and prominent notice about
    the need of keeping libcurl's and c-ares's setup_once.h in sync.

    Given that this commit fixes the circular interdependency, the need
    and presence of mentioned notice is removed.

    All mentioned interdependencies come back from now old days when
    the c-ares project lived inside a curl subdirectory. This commit
    removes last traces of such fact.
2013-01-09 00:49:50 +01:00
Yang Tse 4a5aa6682d Revert changes relative to lib/*.[ch] recent renaming
This reverts renaming and usage of lib/*.h header files done
28-12-2012, reverting 2 commits:

  f871de0... build: make use of 76 lib/*.h renamed files
  ffd8e12... build: rename 76 lib/*.h files

This also reverts removal of redundant include guard (redundant thanks
to changes in above commits) done 2-12-2013, reverting 1 commit:

  c087374... curl_setup.h: remove redundant include guard

This also reverts renaming and usage of lib/*.c source files done
3-12-2013, reverting 3 commits:

  13606bb... build: make use of 93 lib/*.c renamed files
  5b6e792... build: rename 93 lib/*.c files
  7d83dff... build: commit 13606bbfde follow-up 1

Start of related discussion thread:

  http://curl.haxx.se/mail/lib-2013-01/0012.html

Asking for confirmation on pushing this revertion commit:

  http://curl.haxx.se/mail/lib-2013-01/0048.html

Confirmation summary:

  http://curl.haxx.se/mail/lib-2013-01/0079.html

NOTICE: The list of 2 files that have been modified by other
intermixed commits, while renamed, and also by at least one
of the 6 commits this one reverts follows below. These 2 files
will exhibit a hole in history unless git's '--follow' option
is used when viewing logs.

  lib/curl_imap.h
  lib/curl_smtp.h
2013-01-06 18:20:27 +01:00
Yang Tse 13606bbfde build: make use of 93 lib/*.c renamed files
93 *.c source files renamed to use our standard naming scheme.

This change affects 77 files in libcurl's source tree.
2013-01-03 05:50:26 +01:00
Yang Tse f871de0064 build: make use of 76 lib/*.h renamed files
76 private header files renamed to use our standard naming scheme.

This change affects 322 files in libcurl's source tree.
2012-12-28 19:37:11 +01:00
Daniel Stenberg d49531dd3a lib556: enable VERBOSE to ease debugging on failures 2012-12-25 20:30:39 +01:00
Yang Tse e125eea5a6 test 1504 and 1505: same as 1502 but with different cleanup sequences 2012-12-25 13:34:43 +01:00
Yang Tse 5ed03ebe52 test 1503: same as 1502 but with a different cleanup sequence 2012-12-23 21:50:41 +01:00
Yang Tse 3456bbc4cc test 1502: OOM handling fixes 2012-12-23 21:50:40 +01:00
Yang Tse c59c5e8ea2 lib543.c: OOM handling fixes 2012-12-21 18:32:20 +01:00
Yang Tse b7a1eccce8 libntlmconnect.c: fix compiler warnings and OOM handling 2012-12-19 19:53:16 +01:00
Yang Tse a0b207164c setup_once.h: refactor inclusion of <unistd.h> and <sys/socket.h>
Inclusion of top two most included header files now done in setup_once.h
2012-12-14 17:38:18 +01:00
Yang Tse 60edbf65b6 libtest: fix some compiler warnings 2012-12-05 17:28:32 +01:00
Yang Tse b908376bef build: explain current role of LIBS in our Makefile.am files
BLANK_AT_MAKETIME may be used in our Makefile.am files to blank
LIBS variable used in generated makefile at makefile processing
time. Doing this functionally prevents LIBS from being used for
all link targets in given makefile.
2012-12-04 23:32:05 +01:00
Yang Tse 91b57cd6e5 build: prevent global LIBS from influencing libtest build targets 2012-11-30 14:34:48 +01:00
Yang Tse 4abf4fbaac build: fix Windows build targets damaged since commit 550e403f00 2012-11-28 20:51:13 +01:00
Yang Tse 16a8281f71 build: avoid linkage of directly unused libraries 2012-11-28 18:31:23 +01:00
Yang Tse 79954a1b07 avoid mixing of enumerated type with another type 2012-11-26 16:23:48 +01:00
Fabian Keil 52af6e69f0 Get test 2032 working when using valgrind
If curl_multi_fdset() sets maxfd to -1, the socket detection
loop is skipped and thus !found_new_socket is no cause for alarm.
2012-11-19 13:36:28 +01:00
Kamil Dudka 32be348af2 test2032: spurious failure caused by premature termination
Bug: http://curl.haxx.se/mail/lib-2012-11/0095.html
2012-11-19 13:36:10 +01:00
Daniel Stenberg 409f2a041f fixed memory leak: CURLOPT_RESOLVE with multi interface
DNS cache entries populated with CURLOPT_RESOLVE were not properly freed
again when done using the multi interface.

Test case 1502 added to verify.

Bug: http://curl.haxx.se/bug/view.cgi?id=3575448
Reported by: Alex Gruz
2012-11-18 16:39:31 +01:00
Fabian Keil 32afaaef93 Fix the libauthretry changes from 7c0cbcf2f6
They broke the NTLM tests from 2023 to 2031.
2012-11-16 20:09:02 +01:00
Sergei Nikulov 7c0cbcf2f6 fixed Visual Studio 2010 compilation 2012-11-13 11:17:20 +01:00
Fabian Keil 6d1b493f3d Fix compilation of lib1501 2012-11-08 18:33:47 +01:00
Dave Reisner 550e403f00 uniformly use AM_CPPFLAGS, avoid deprecated INCLUDES
Since automake 1.12.4, the warnings are issued on running automake:

  warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')

Avoid INCLUDES and roll these flags into AM_CPPFLAGS.

Compile tested on:
  Ubuntu 10.04 (automake 1:1.11.1-1)
  Ubuntu 12.04 (automake 1:1.11.3-1ubuntu2)
  Arch Linux (automake 1.12.4)
2012-11-06 00:32:21 +01:00
Daniel Stenberg f99430d89e libauthretry.c: shorten lines to fit within 80 cols 2012-11-06 00:06:21 +01:00
Daniel Stenberg b2954e66e8 FTP: prevent the multi interface from blocking
As pointed out in Bug report #3579064, curl_multi_perform() would
wrongly use a blocking mechanism internally for some commands which
could lead to for example a very long block if the LIST response never
showed.

The solution was to make sure to properly continue to use the multi
interface non-blocking state machine.

The new test 1501 verifies the fix.

Bug: http://curl.haxx.se/bug/view.cgi?id=3579064
Reported by: Guido Berhoerster
2012-11-04 19:05:39 +01:00
Sara Golemon b78944146a curl_multi_wait: Add parameter to return number of active sockets
Minor change to recently introduced function.  BC breaking, but since
curl_multi_wait() doesn't exist in any releases that should be fine.
2012-09-16 19:58:02 +02:00
Marc Hoersken c8846c0907 libntlmconnect.c: Fixed typo and conversion 2012-09-11 12:58:08 +02:00
Marc Hoersken f9da9a0edb libntlmconnect.c: Fixed warning: curl_easy_getinfo expects long pointer
Fixed tests/libtest/libntlmconnect.c:52: warning: call to
'_curl_easy_getinfo_err_long' declared with attribute warning:
curl_easy_getinfo expects a pointer to long for this info
2012-09-11 12:19:05 +02:00
Marc Hoersken ef753b710b libntlmconnect.c: Fixed warning: comparison of signed/unsigned integer
Windows does not use -1 to represent invalid sockets and the
SOCKET type is unsigned.
2012-09-11 11:02:09 +02:00
Sara Golemon 09d9dd8873 Unit test for curl_multi_wait() 2012-09-01 23:27:11 +02:00
Joe Mason 40153716a3 Use MAX_EASY_HANDLES instead of hardcoding the number of handles twice 2012-09-01 20:21:30 +02:00
Daniel Stenberg 7735141e73 test2032: bail out after last transfer
The test would hang and get aborted with a "ABORTING TEST, since it
seems that it would have run forever." until I prevented that from
happening.

I also fixed the data file which got broken CRLF line endings when I
sucked down the path from Joe's repo == my fault.

Removed #37 from KNOWN_BUGS as this fix and test case verifies exactly
this.
2012-08-31 23:23:40 +02:00
Joe Mason 3b7d31c1ed NTLM: verify multiple connections work
Add test2032 to test that NTLM does not switch connections in the middle
of the handshake
2012-08-31 22:53:17 +02:00
Guenter Knauf 69f5fe070d Fixed compiler warning - argument is type long. 2012-08-06 11:45:06 +02:00
Joe Mason 24c43e9d34 Add tests of auth retries 2012-08-03 17:01:54 -04:00
Guenter Knauf 0f15ed1617 Fixed CR issue with Win32 version on MSYS.
Previous fix didnt work on Linux ...
2012-07-20 17:22:10 +02:00
Guenter Knauf 5d80017fd6 Fixed CR issue with Win32 version on MSYS. 2012-07-20 15:39:28 +02:00
Daniel Stenberg c5de48b56c lib503: enable verbose to ease debugging this 2012-07-05 11:24:23 +02:00
Yang Tse dd707b746f lib582.c: fix conversion warning 2012-06-28 17:14:41 +02:00
Daniel Stenberg 2e48139fbf lib554.c: use curl_formadd() properly
The length/size options take longs so make sure to pass on such types.

Reported by: Neil Bowers
Bug: http://curl.haxx.se/mail/lib-2012-06/0001.html
2012-06-07 23:10:40 +02:00
Yang Tse 2b56e4c1bb tests 1334 to 1363 revisited.
Add a postcheck section to verify unintended file creation.

Remove needless <file> checks in verify section. Renumbering where appropriate.
2012-06-05 20:20:40 +02:00
Daniel Stenberg a03100c357 test1013.pl: filter out Metalink
Since it isn't a feature supported by curl-config we can't compare that
with the --version output
2012-05-27 23:43:23 +02:00
Yang Tse ce8a321dd0 Some explicit conversion to 'long' of curl_easy_setopt() third argument
Explicit conversion to 'long' of curl_easy_setopt() third argument for options
CURLOPT_HTTPAUTH and CURLOPT_PROXYAUTH given that this is how its bitmasks are
docummented to be used.
2012-04-18 21:03:20 +02:00
Yang Tse 3833765ba5 build adjustments: commit 9e24b9c7 follow-up 2012-04-17 13:29:12 +02:00
Yang Tse 9e24b9c7af build adjustments: CURL_HIDDEN_SYMBOLS no longer defined in config files
configure script now provides conditional definitions for Makefile.am
that result in CURL_HIDDEN_SYMBOLS being defined by resulting makefiles
when appropriate.

Additionally, configure script option for symbol hiding control is now
named --enable-symbol-hiding --disable-symbol-hiding. While still valid,
old option name --enable-hidden-symbols --disable-hidden-symbols will
be deprecated in some future release.
2012-04-11 19:33:54 +02:00
Yang Tse a144bb8b76 build adjustments: functionally revert commits 4d3fb91f and bbfe1182
Undefining CURL_HIDDEN_SYMBOLS in source files isn't the proper fix.
2012-04-11 19:28:40 +02:00
Yang Tse bbfe118209 libtests: build adjustment
Undefine CURL_HIDDEN_SYMBOLS libcurl private preprocessor macro that might
leak from lib/setup.h into source files where this should not be defined.
2012-04-10 17:29:37 +02:00
Yang Tse 21423497ef configure: Windows cross-compilation fixes
BUILDING_LIBCURL and CURL_STATICLIB are no longer defined in curl_config.h,
configure will generate appropriate conditionals so that mentioned symbols
get defined and used in Makefiles at compilation time
2012-04-09 21:24:16 +02:00
Yang Tse e7661d198f lib599.c: fix compiler warning 2012-04-04 17:24:29 +02:00
Daniel Stenberg c44d45db86 HTTP: reset expected DL/UL sizes on redirects
With FOLLOWLOCATION enabled. When a 3xx page is downloaded and the
download size was known (like with a Content-Length header), but the
subsequent URL (transfered after the 3xx page) was chunked encoded, then
the previous "known download size" would linger and cause the progress
meter to get incorrect information, ie the former value would remain
being sent in. This could easily result in downloads that were WAY
larger than "expected" and would cause >100% outputs with the curl
command line tool.

Test case 599 was created and it was used to repeat the bug and then
verify the fix.

Bug: http://curl.haxx.se/bug/view.cgi?id=3510057
Reported by: Michael Wallner
2012-04-01 00:07:24 +02:00
Yang Tse 3aab542e77 test #598: OOM handling fixes 2012-03-22 04:58:38 +01:00
Yang Tse 3c80309c27 fix several compiler warnings 2012-03-22 04:54:04 +01:00
Yang Tse c6825b7a6b fix several compiler warnings 2012-03-20 18:28:24 +01:00
Daniel Stenberg ea055407fa curl_easy_reset: reset the referer string
When CURLOPT_REFERER has been used, curl_easy_reset() did not properly
clear it.

Verified with the new test 598

Bug: http://curl.haxx.se/bug/view.cgi?id=3481551
Reported by: Michael Day
2012-02-07 23:07:43 +01:00
Yang Tse a7e8f4aabc testtrace.c: fix compiler warning 2012-01-19 22:54:57 +01:00
Yang Tse 24526d0c0f tests: enable time tracing on tests 500, 573 and 585 2012-01-17 21:33:17 +01:00
Yang Tse a752850acc tests: testtrace.[ch] provides debug callback for libtest usage
Allows tests from the libtest subdir to generate log traces
similar to those of curl with --tracetime and --trace-ascii
options but with output going to stderr.
2012-01-17 21:32:05 +01:00
Yang Tse ed0364343d removed trailing whitespace 2011-12-30 03:36:18 +01:00
Gokhan Sengun c834213ad5 FTP: perform active connections non-blocking
1- Two new error codes are introduced.

CURLE_FTP_ACCEPT_FAILED to be set whenever ACCEPTing fails because of
FTP server connected.

CURLE_FTP_ACCEPT_TIMEOUT to be set whenever ACCEPTing timeouts.

Neither of these errors are considered fatal and control connection
remains OK because it could just be a firewall blocking server to
connect to the client.

2- One new setopt option was introduced.

CURLOPT_ACCEPTTIMEOUT_MS

It sets the maximum amount of time FTP client is going to wait for a
server to connect. Internal default accept timeout is 60 seconds.
2011-12-20 20:30:02 +01:00
Daniel Stenberg e9040f2954 lib500: verify timers relative each other
As commit ce896875f8 fixed a timer that accidentally had been moved in
code and then returned a bad timer, the lib500.c code (used in test 500
and some others) now verifies 5 timers against each other to verify that
they have the correct relative values. We cannot compare against
absolute values as the timings will vary a lot.
2011-12-20 15:41:43 +01:00
Gokhan Sengun 2b24dd870e multi interface: fix block when CONNECT_ONLY option is used 2011-12-07 15:37:05 +01:00
Daniel Stenberg 5971d401d4 test: verify the opensocket callback for FTP
test 595: for passive FTP
test 596: for active FTP
2011-12-04 23:10:12 +01:00
Yang Tse 97d7a9260e tvdiff_secs(): sub-zero time difference adjustment
Skip a floating point addition operation when integral part of time difference
is zero. This avoids potential floating point addition rounding problems while
preserving decimal part value.
2011-11-25 13:51:55 +01:00
Yang Tse c482e946f7 lib573.c: fix double data type variable comparison with zero 2011-11-24 18:18:42 +01:00
Alejandro Alvarez Ayllon 97b73fec7a libtest build: add the missing lib586 2011-11-17 23:33:42 +01:00
Yang Tse 082e8a3b03 Active mode FTP test cases with server not establishing data connection
591 -> FTP multi PORT and 425 on upload
592 -> FTP multi PORT and 421 on upload
593 -> FTP multi PORT upload, no data conn and no transient neg. reply
594 -> FTP multi PORT upload, no data conn and no positive prelim. reply

1206 -> FTP PORT and 425 on download
1207 -> FTP PORT and 421 on download
1208 -> FTP PORT download, no data conn and no transient negative reply
1209 -> FTP PORT download, no data conn and no positive preliminary reply
2011-11-11 19:46:44 +01:00
Daniel Stenberg 2c09d21fdf test 590: verify the bug fix in 4851dafcf1
This test is created to verify Rene Bernhardt's patch which makes sure
libcurl properly _not_ deals with Negotiate if not asked to even if the
proxy says it can serve it.
2011-11-06 17:28:28 +01:00
Yang Tse 8ccf7bf8d7 lib589.c: add CURLOPT_READDATA missing stuff 2011-10-27 22:00:23 +02:00
Yang Tse 692f344118 test 589: active FTP upload using multi timeout and EPRT disabled server 2011-10-26 18:57:14 +02:00
Yang Tse 51e5a2bf3f multi tests: OOM handling fixes - commit 629d2e34 follow-up 2011-10-26 18:57:14 +02:00
Yang Tse 629d2e3450 multi tests: OOM handling fixes
Additionally, improved error checking and logging.
2011-10-21 16:52:14 +02:00
Dan Fandrich cf0f6729e7 Silenced a compiler warning about an unused variable 2011-10-19 21:18:52 -07:00
Daniel Stenberg 840eff44f2 formdata: ack read callback abort
When doing a multipart formpost with a read callback, and that callback
returns CURL_READFUNC_ABORT, that return code must be properly
propagated back and handled accordingly. Previously it would be handled
as a zero byte read which would cause a hang!

Added test case 587 to verify. It uses the lib554.c source code with a
small ifdef.

Reported by: Anton Bychkov
Bug: http://curl.haxx.se/mail/lib-2011-10/0097.html
2011-10-16 01:09:56 +02:00
Yang Tse a84b8a3922 lib540.c: OOM handling fixes making test 540 pass torture testing 2011-10-10 12:27:17 +02:00
Yang Tse 17f48fe879 libcurl: some OOM handling fixes 2011-10-07 20:50:57 +02:00
Alejandro Alvarez 5793bc370c SSL session sharing support added
With locking, plus test, plus documentation
2011-09-28 23:06:34 +02:00
Yang Tse 28d09cb0f5 lib582.c: fix segfault triggered when torture testing test case 582 2011-09-08 01:22:47 +02:00
Yang Tse 6539047694 test case 583: ensure that test failures don't go unnoticed - follow-up 2011-09-06 19:59:42 +02:00
Yang Tse 774ad4e31d test suite: libtest header inclusion cleanup - follow-up
Adjust tests/libtest/Makefile.inc and remove a couple of unused headers from
tests/libtest/lib583.c
2011-09-06 18:11:11 +02:00
Yang Tse f764da8afb test case 583: ensure that test failures don't go unnoticed 2011-09-06 17:56:39 +02:00
Yang Tse c8ba8740b9 test suite: libtest header inclusion cleanup
Added missing memoryTracking to test cases 560 and 583. If this triggers
leak detection on these, it only means that previously it was going unnoticed.
2011-09-06 17:47:54 +02:00
Yang Tse 6b75d2c2df fix a bunch of MSVC compiler warnings 2011-09-03 16:07:09 +02:00
Kamil Dudka 3445fa2e3f tests: break busy loops in tests 502, 555, and 573 2011-08-29 15:14:39 +02:00
Yang Tse 838dd8f594 MemoryTracking: adjust initialization calling - followup
Fix macro definition
2011-08-21 06:10:52 +02:00
Yang Tse aaab5fa299 MemoryTracking: adjust initialization calling
Calling of curl_memdebug() was still done with a pending free()
2011-08-20 17:26:42 +02:00
Daniel Stenberg 45d883d88d CURLFORM_BUFFER: insert filename as documented
A regression where CURLFORM_BUFFER stopped to properly insert the file
name part in the formpart. Bug introduced in commit f851f76857.

Added CURLFORM_BUFFER use to test 554 to verify this.

Bug: http://curl.haxx.se/mail/lib-2011-07/0176.html
Reported by: Henry Ludemann
2011-08-08 18:45:03 +02:00
Yang Tse 78bbd0eecf fix compiler warning 2011-07-26 19:42:16 +02:00
Yang Tse ef2176109f errno.h inclusion conditionally done in setup_once.h 2011-07-24 04:39:43 +02:00
Daniel Stenberg fb48e2050b libtests: stop checking for CURLM_CALL_MULTI_PERFORM
CURLM_CALL_MULTI_PERFORM stopped being a valid return code from
curl_multi_perform back in 7.20.0. All the libcurl tests are ajusted to
this and no longer check for this return code. Makes them simpler.
2011-06-27 16:01:41 +02:00
Dan Fandrich 43ce5580a8 Added a leap second test to test517 2011-06-23 21:20:29 -07:00
Daniel Stenberg 57d51be60c parsedate: detect more invalid dates better 2011-06-23 13:49:29 +02:00
Daniel Stenberg f851f76857 CURLFORM_STREAM: acknowledge CURLFORM_FILENAME
The CURLFORM_STREAM is documented to only insert a file name (and thus
look like a file upload) in the part if CURLFORM_FILENAME is set, but in
reality it always inserted a filename="" and if CURLFORM_FILENAME wasn't
set, it would insert insert rubbish (or possibly crash).

This is now fixed to work as documented, and test 554 has been extended
to verify this.

Reported by: Sascha Swiercy
Bug: http://curl.haxx.se/mail/lib-2011-06/0070.html
2011-06-17 22:23:42 +02:00
Daniel Stenberg 950fb3efcc write: add return code checks when used
These were just warnings in test code but it still makes it nicer to not
generate them.
2011-06-11 23:01:09 +02:00
Yang Tse 685359d4c3 makefile: avoid preprocessor definition usage when linking 2011-06-01 14:43:25 +02:00
Yang Tse 5d39dea3b3 compiler warning: fix
Fix compiler warning: variable was set but never used

Fix compiler warning: clobber ignored
2011-05-26 12:40:04 +02:00
Yang Tse 9f390a356e unit tests: build adjustment
Also define UNITTESTS macro when building unit test sources.

Fixing compiler warning: external definition with no prior declaration
2011-05-25 20:24:03 +02:00
Yang Tse 2ea31b0e6f compiler warning: fix
Fix compiler warning: external definition with no prior declaration
2011-05-24 17:29:50 +02:00
Yang Tse de70ddb749 compiler warning: fix
Fix compiler warning: argument is incompatible with corresponding format
string conversion
2011-05-24 17:24:59 +02:00
Yang Tse b578534508 tests: verify OPEN/CLOSESOCKETFUNCTION
Test 585: Fix opensocket return type, and avoid function name clash.
2011-05-19 22:28:28 +02:00
Daniel Stenberg 873d70a6d8 tests: verify OPEN/CLOSESOCKETFUNCTION
Test 585 and 586 were added. Using a modified lib500.c
2011-05-18 22:56:46 +02:00
Dan Fandrich d8373cb992 Fixed test 1023 when using daily snapshots 2011-04-21 14:47:35 -07:00
Dan Fandrich 1b6df743f6 Fixed test 1022 when using daily snapshots 2011-04-20 14:11:12 -07:00
Daniel Stenberg 82ecc85d9e curl-config: fix --version
curl-config --version didn't output the correct version string (bug
introduced in commit 0355e33b5f), and unfortunately the test
case 1022 that was supposed to check for this was broken.

This change fixes the test to detect this problem and it fixes the
output.

Bug: http://curl.haxx.se/bug/view.cgi?id=3288727
2011-04-18 09:03:12 +02:00
Daniel Stenberg 14e8b13a45 lib582: use curl_socket_t for portability 2011-03-15 18:37:35 +01:00
Guenter Knauf 5a433a033f Removed unused var. 2011-03-15 12:21:58 +01:00
Daniel Stenberg 0718b7e31e test583: verify early SSH multi remove handle
This test case is meant to verify that the logic in commit
60172a0446 actually works. This test failed for me before that
change and it works after it.
2011-03-13 00:18:04 +01:00
Daniel Stenberg 7612ca2a7e test582: improved info messages 2011-03-12 23:01:16 +01:00
Daniel Stenberg 1aeb635cdd 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.
2011-03-10 12:04:33 +01:00
Daniel Stenberg 3d3735d9a1 lib582: used for test 582
Accidentally not included in commit 0e74e1d8d8
2011-03-08 08:22:06 +01:00
Henry Ludemann 0e74e1d8d8 sftp-multi: test 582 added
Add test 582 for uploading a file using sftp and the multi interface.

(Patch and test slightly tweaked by Daniel Stenberg)

Initially marked as disabled until it is fixed in the source.
2011-03-08 00:20:48 +01:00
Dan Fandrich c60a6153be Moved test 577 into the unit test framework as test 1307 2011-03-04 15:56:40 -08:00
Dan Fandrich fb199cd29d Converted tests 558 & 559 to use the unit test framework as 1305
Test 558 was just a subset of 559 which is something that can be
easily added later.
2011-03-04 14:32:58 -08:00
Daniel Stenberg dbcaa00657 HTTP: memory leak on multiple Location:
The HTTP parser allocated memory on each received Location: header
without properly freeing old data. Starting now, the code only considers
the first Location: header and will blissfully ignore subsequent ones.

Bug: http://curl.haxx.se/bug/view.cgi?id=3165129
Reported by: Martin Lemke
2011-01-25 12:06:50 +01:00
Daniel Stenberg 35e1d6538a unittest: framework for unit-testing
This is the first approach at doing fairly clean and easy to write and
debug unit tests.
2011-01-03 19:38:10 +01:00
Yang Tse 5db0a412ff atoi: remove atoi usage 2010-11-28 23:11:14 +01:00
Daniel Stenberg 1786950759 test: remove test 580
Test 580 is removed again for two reasons:

1) Some compilers aren't satisfied by just a data variable called 'test'
when first.o wants a function called 'test'. The Solaris compiler says
"ld: warning: symbol `test' has differing types:" while the AIX compiler
downright rejects it.

2) Test case 1119 that was added after this test is way more complete
and cover everything test 580 does and more without introducing the same
problems.
2010-11-05 11:26:26 +01:00
Dan Fandrich 96945c98d5 Allow building test 580 out of tree 2010-11-03 19:03:02 -07:00
Dan Fandrich 282b41c69b Added mk580.pl to the tar ball 2010-11-02 23:17:36 -07:00
Daniel Stenberg 36420330de ignore: lib580.c is generated by mk580.pl 2010-11-02 23:34:37 +01:00
Daniel Stenberg cc87913294 test: added test 580 - verifies symbols-in-versions
The new perl script mk580.pl generates a C table in a fresh source file
named lib580.c and if that compiles fine we know that the file
docs/libcurl/symbols-in-versions at least doesn't include any symbols
that are misspelled.

An additional feature would be to somehow scan curl/curl.h and compare
with symbols-in-versions to see if there are symbols missing.
2010-11-02 22:27:33 +01:00
Daniel Stenberg 4d58f97f60 parsedate: allow time specified without seconds
The date format in RFC822 allows that the seconds part of HH:MM:SS is
left out, but this function didn't allow it. This change also includes a
modified test case that makes sure that this now works.

Reported by: Matt Ford
Bug: http://curl.haxx.se/bug/view.cgi?id=3076529
2010-09-27 16:54:02 +02:00
Dan Fandrich 8e2f16e66f Link curl and the test apps with -lrt explicitly when necessary
When curl calls a function from that library then it needs to
explicitly link to the library instead of piggybacking on
libcurl's own dependency.  Without this, GNU ld with the
--no-add-needed flag fails when linking (which Fedora now does
by default).

Reported by: Quanah Gibson-Mount
Bug: http://curl.haxx.se/mail/lib-2010-09/0085.html
2010-09-11 17:08:23 -07:00
Dan Fandrich ebbe694e78 Removed a C99ism & made an array const 2010-08-18 22:16:46 -07:00
Julien Chaffraix 70baf46d8d test: added test 579 to verify progress callback for chunked post
The 66 bytes checked are those 38 bytes with the chunked encoding
headers added: 8+8+10+35+5 = 66

The three-letter words become 8 bytes on the wire because they are sent
like: "3\r\none\r\n"

... and there's the trailing 5 bytes write after the four lines since
the final chunk is sent (which is "0\r\n\r\n").
2010-08-19 00:27:04 +02:00
Julien Chaffraix 6b490ed33c progress: callback for POSTs less than MAX_INITIAL_POST_SIZE
Add a call to Curl_pgrsSetUploadSize in this case valided by a test
case.

Reported by: Никита Дорохин.
Bug: http://curl.haxx.se/mail/lib-2010-04/0173.html
2010-08-16 22:56:43 +02:00
Yang Tse b24e872502 build: don't build libhostname unless shared libcurl is built 2010-08-09 09:33:53 +02:00