1
0
mirror of https://github.com/moparisthebest/curl synced 2024-08-13 17:03:50 -04:00
Commit Graph

3788 Commits

Author SHA1 Message Date
Daniel Stenberg
909283ae5a http: fix response code parser to avoid integer overflow
test 1429 and 1433 were updated to work with the stricter HTTP status line
parser.

Closes #1714
Reported-by: Brian Carpenter
2017-07-31 18:37:43 +02:00
Daniel Stenberg
0018221532 test1323: verify curlx_tvdiff 2017-07-28 15:51:36 +02:00
Daniel Stenberg
4dee50b9c8 timeval: struct curltime is a struct timeval replacement
... to make all libcurl internals able to use the same data types for
the struct members. The timeval struct differs subtly on several
platforms so it makes it cumbersome to use everywhere.

Ref: #1652
Closes #1693
2017-07-28 15:51:25 +02:00
Marcel Raad
da6aa3f763
tests/server/resolve.c: fix deprecation warning
MSVC warns that gethostbyname is deprecated. Always use getaddrinfo
instead to fix this when IPv6 is enabled, also for IPv4 resolves. This
is also consistent with what libcurl does.

Closes https://github.com/curl/curl/pull/1682
2017-07-18 10:23:47 +02:00
Marcel Raad
38faf041cf
rtspd: fix GCC warning after MSVC warning fix
Older GCC warns:
/tests/server/rtspd.c:1194:10: warning: missing braces around
initializer [-Wmissing-braces]

Fix this by using memset instead of an initializer.
2017-07-16 15:16:46 +02:00
Marcel Raad
fb3b0f25ef
libtest: fix MSVC warning C4706
With warning level 4, MSVC warns about assignments within conditional
expressions. Change the while loop to a do-while loop to fix this. This
change is also consistent with CODE_STYLE.md.
2017-07-16 14:02:59 +02:00
Marcel Raad
0bdb811250
sockfilt: suppress conversion warning with explicit cast
MSVC warns when implicitly casting -1 to unsigned long.
2017-07-16 13:28:45 +02:00
Marcel Raad
70cbefeb5f
rtspd: fix MSVC level 4 warning
warning C4701: potentially uninitialized local variable 'req' used
2017-07-16 13:26:21 +02:00
Jay Satiro
c5e87fdb7a strerror: Preserve Windows error code in some functions
This is a follow-up to af02162 which removed (SET_)ERRNO macros. That
commit was an earlier draft that I committed by mistake, which was then
remedied by a5834e5 and e909de6, and now this commit. With this commit
there is now no difference between the current code and the changes that
were approved in the final draft.

Thanks-to: Max Dymond, Marcel Raad, Daniel Stenberg, Gisle Vanem
Ref: https://github.com/curl/curl/pull/1589
2017-07-11 01:53:23 -04:00
Max Dymond
e909de65b9
tests: Fix up issues with errno in test files
Closes https://github.com/curl/curl/pull/1671
2017-07-10 16:19:23 +02:00
Daniel Stenberg
be2c999b80 valgrind.supp: supress OpenSSL false positive seen on travis 2017-07-07 16:58:08 +02:00
Max Dymond
06a6feba9d test1452: add telnet negotiation
Add a basic telnet server for negotiating some telnet options before
echoing back any data that's sent to it.

Closes #1645
2017-07-07 11:00:26 +02:00
Daniel Stenberg
23b828b78b test506: skip if threaded-resolver 2017-07-06 11:49:50 +02:00
Daniel Stenberg
759efe7b51 runtests: support "threaded-resolver" as a feature
... to let tests require it or skip if present
2017-07-06 11:49:50 +02:00
Daniel Stenberg
7121a994dd dist: add SMB python deps into the tarball 2017-07-04 10:46:41 +02:00
Max Dymond
a6f8d27efc test1451: add SMB support to the testbed
Add test 1451 which does some very basic SMB testing using the impacket
SMB server.

Closes #1630
2017-07-04 10:41:58 +02:00
Max Dymond
f1609155d5 test: add impacket for SMB testing
Import impacket 0.9.15 for use in SMB testing. This was generated by
doing "pip2.7 install -t . impacket"

Unnecessary files for current testing were deleted.
2017-07-04 10:36:06 +02:00
Daniel Stenberg
b3786f61dc url: make the original string get used on subsequent transfers
... since CURLOPT_URL should follow the same rules as other options:
they remain set until changed or cleared.

Added test 1551 to verify.

Fixes #1631
Closes #1632
Reported-by: Pavel Rochnyak
2017-07-03 23:52:10 +02:00
Ryan Winograd
3a48a13268 unit1399: fix integer overflow
Bug: #1616
Closes #1633
2017-07-03 08:09:02 +02:00
Daniel Stenberg
8d2b1de284 unit1399: add logging to time comparison
... to enable tracking down why autobuilds fail on this

Bug: #1616
2017-07-01 16:41:29 +02:00
Max Dymond
0362c77841 test1450: fix up DICT server in torture mode
As per https://github.com/curl/curl/pull/1615, the DICT server is a
little spammy in torture mode due to the sockets being torn down
unexpectedly. Fix this by adding some error handling to the handling
function.

Closes #1629
2017-06-30 14:58:06 +02:00
Max Dymond
9b387034ab test1450: add simple testing for DICT
Add a new server which provides a DICT interface. This is intended to
begin coverage testing for lib/dict.c

Closes #1615
2017-06-30 11:34:05 +02:00
Dan Fandrich
77970f484d test1521: fix out-of-tree builds, broken with 467da3af
The test.h file is no longer in the same directory as the source file,
so that directory needs to be added to the include path.

Fixes #1627
Closes #1628
2017-06-30 10:51:20 +02:00
Ryan Winograd
f8f040e659 progress: prevent resetting t_starttransfer
Prevent `Curl_pgrsTime` from modifying `t_starttransfer` when invoked
with `TIMER_STARTTRANSFER` more than once during a single request.

When a redirect occurs, this is considered a new request and
`t_starttransfer` can be updated to reflect the `t_starttransfer` time
of the redirect request.

Closes #1616

Bug: https://github.com/curl/curl/pull/1602#issuecomment-310267370
2017-06-30 09:05:53 +02:00
Daniel Stenberg
467da3af0b libtest/make: generate lib1521.c
... instead of having the generated code checked in. This saves space in
the tarball but primarily automatically adapts to newly added options.

Closes #1614
2017-06-27 17:27:25 +02:00
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
Daniel Stenberg
9b167fd090 --request-target: instead of --strip-path-slash
... and CURLOPT_REQUEST_TARGET instead of CURLOPT_STRIP_PATH_SLASH.

This option instead provides the full "alternative" target to use in the
request, instead of extracting the path from the URL.

Test 1298 and 1299 updated accordingly.

Idea-by: Evert Pot
Suggestion: https://daniel.haxx.se/blog/2017/06/19/options-with-curl/comment-page-1/#comment-18373

Closes #1593
2017-06-21 23:39:10 +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
b778ae4c5e http: add --strip-path-slash and CURLOPT_STRIP_PATH_SLASH
... to enable sending "OPTIONS *" which wasn't possible previously.

This option currently only works for HTTP.

Added test cases 1298 + 1299 to verify

Fixes #1280
Closes #1462
2017-06-19 16:39:22 +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
5385450afd curl: prevent binary output spewed to terminal
... unless "--output -" is used. Binary detection is done by simply
checking for a binary zero in early data.

Added test 1425 1426 to verify.

Closes #1512
2017-06-16 23:38:13 +02:00
Daniel Stenberg
01811b6740 http-proxy: fix chunked-encoded CONNECT responses
Regression since 5113ad0424.

... and remove 'flaky' from test 1061 again

Closes #1579
2017-06-16 21:56:56 +02:00
Daniel Stenberg
12ccaed2a5 http-proxy: deal with EAGAIN
... the previous code would reset the header length wrongly (since
5113ad0424). This makes test 1060 reliable again.

Also: make sws send even smaller chunks of data to increase the
likeliness of this happening.
2017-06-16 17:22:32 +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
de4c747544 test1148: verify the -# progressbar
Closes #1569
2017-06-16 09:45:26 +02:00
Daniel Stenberg
6c218252df test1061: mark as flaky
Fails intermittently on travis builds since a few days. Likely due to
5113ad0424.
2017-06-16 09:17:57 +02:00
Daniel Stenberg
615326fd99 dist: add the fuzz dir to the tarball 2017-06-16 00:16:57 +02:00
Daniel Stenberg
7e8247c467 fuzz/README: document how to build
Fixes #1476
2017-06-15 22:12:12 +02:00
Frederik B
fd3aa8da0a fuzz: corpora file structure, initial commit 2017-06-15 22:11:40 +02:00
Frederik B
b9ead67e12 fuzz: bring oss-fuzz initial code converted to C89 2017-06-15 22:11:30 +02:00
Daniel Stenberg
1c32b6e913 test1147: verify -H on a file 2017-06-15 11:09:48 +02:00
Daniel Stenberg
5113ad0424 http-proxy: do the HTTP CONNECT process entirely non-blocking
Mentioned as a problem since 2007 (8f87c15bda) and of course it
existed even before that.

Closes #1547
2017-06-14 23:43:52 +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
Dan Fandrich
b95a07ea59 test1538: added "verbose logs" keyword
These error messages are not displayed with --disable-verbose
2017-06-05 11:26:39 +02:00
Daniel Stenberg
1573ebee8a test1262: verify ftp download with -z for "if older than this" 2017-06-05 10:33:51 +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
cfd3e8f399 dedotdot: fixed output for ".." and "." only input
Found when updating test 1395, which I did to increase test coverage of
this source file...

Closes #1535
2017-06-03 00:11:51 +02:00
Daniel Stenberg
61d4870dc9 test1538: fix typo 2017-06-02 15:52:59 +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
Daniel Stenberg
b5e143e7a5 coverage: run event tests too
... the torture ones are commented out only because they are slooooow.
2017-06-02 13:15:06 +02:00
Daniel Stenberg
f6e0f4556e build: provide easy code coverage measuring
Closes #1528
2017-06-02 13:15:06 +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
Dan Fandrich
3aaac8c2f7 tests: removed some redundant empty <stdout> sections 2017-05-28 23:07:35 +02:00
Dan Fandrich
01f9487967 runtests.pl: removed <precommand> feature
This hasn't been used in over a decade. <precheck> can still be used to
run commands before the main test.
2017-05-28 20:57:47 +02:00
Dan Fandrich
14514c9796 runtests.pl: removed unused arguments to valgrindparse 2017-05-27 14:30:24 +02: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
Daniel Stenberg
bba59073c5 redirect: store the "would redirect to" URL when max redirs is reached
Test 1261 added to verify.

Reported-by: Lloyd Fournier

Fixes #1489
Closes #1497
2017-05-23 23:27:58 +02:00
Michael Kaufmann
052a14e3cd tests: stabilize test 1034
Pass the invalid domain name on stdin. On some systems, the test
framework cannot pass invalid UTF-8 sequences on the command line.

Closes #1488
2017-05-20 19:00:16 +02:00
eb16305e6a SecureTransport/DarwinSSL: Implement public key pinning
Closes #1400
2017-05-15 22:54:33 +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
646dc1c42a tests: added missing keywords "chunked Transfer-Encoding" 2017-05-13 22:37:11 +02:00
Dan Fandrich
fa0ac3f4d9 tests: made a couple of prechecks consistent with others
Also removed a TODO suggesting caching the precheck results. Tests
showed this would save about 0.1 sec on the total test run time on a
relatively modern system, an unnoticeable gain at the cost of longer and
more complicated code. There would also be a danger that a cached test
result would be inappropriately returned, such as when other test
dependencies (like environment variables) are different or when the
precheck causes side effects (like filesystem changes).
2017-05-13 19:12:22 +02:00
Richard Hsu
8dfa378e52 tests: remove superfluous test 1399
@MarcelRaad noted that `test1399` causes infinite loop on MinGW.
Looking into this, seems like it is related to how Windows handles
CRLF. See https://github.com/curl/curl/commit/9e093f by @mback2k.
Removing `test1399` as it's identical to `test1326` then with such a
fix.

Test 1399 was broughy by commit 862b02f894

Closes #1478
2017-05-10 09:42:31 +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
Dan Fandrich
f5b71d3a6c tests: removed redundant --trace-ascii arguments
This is already added by the test suite; it's not clear why all these
tests had it, unless it's cargo-culting.
2017-05-09 19:43:22 +02:00
Dan Fandrich
2f6bfd5499 tests: list the primary server first in the server section 2017-05-09 00:40:28 +02:00
Daniel Stenberg
8b2f22ed29 curl: generate the --help output
... using the docs/cmdline-opts/gen.pl script, so that we get all the
command line option documentation from the same source.

The generation of the list has to be done manually and pasted into the
source code.

Closes #1465
2017-05-08 23:30:29 +02:00
Daniel Stenberg
73afcfc0ae tests: updated for modified fake random 2017-05-08 23:24:43 +02:00
Dan Fandrich
9e9509e46a tests: give each stunnel.conf file a unique name
Otherwise, subsequent uses of stunnel overwrite the configuration file
of previous invocations so they can no longer be inspected.
2017-05-08 22:59:12 +02:00
Marcel Raad
e076fdaf5b
tftpd: fix signed/unsigned mismatch warnings
alarm's argument is unsigned.
2017-05-08 20:11:03 +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
Daniel Stenberg
e3f84efc32 runtests: fix "use of undefined value" warning in -R handling 2017-05-08 10:09:06 +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
Dan Fandrich
ba5fa1c7a8 runtests.pl: simplify the datacheck read section
Also, document that numbered datacheck sections are possible.
2017-05-06 09:04:00 +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
Daniel Stenberg
22fdb0954c tests/server: run checksrc by default in debug-builds 2017-05-05 15:51:25 +02:00
Marcel Raad
ad8c1472fe
unit1305: fix compiler warning
calloc and ai_addrlen expect different (usually unsigned) types.
2017-05-05 11:44:22 +02:00
Daniel Stenberg
1ef38a95d2 runtests: use -R for random order
Suggested-by: Dan Fandrich
2017-05-05 08:12:24 +02:00
Daniel Stenberg
067b8f2304 runtests: add -o to run test cases in scrambled order
... instead of numerical order.

Closes #1466
2017-05-04 23:36:57 +02:00
Dan Fandrich
79bb0afddb sockfilt.c: shortened too long line 2017-05-04 22:37:34 +02:00
Marcel Raad
4032c5da84
tests/server: make string literals const
assign string literals to const char * instead of char * in order to
avoid a lot of these warnings:
cast from 'const char *' to 'char *' drops const qualifier
[-Wcast-qual]
2017-05-04 20:26:06 +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
Richard Hsu
862b02f894 Telnet: Write full buffer instead of byte-by-byte
Previous TODO wanting to write in chunks. We should support writing more
at once since some TELNET servers may respond immediately upon first
byte written such as WHOIS servers.

Closes #1389
2017-05-02 23:23:39 +02:00