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

3952 Commits

Author SHA1 Message Date
Daniel Stenberg
5c2aac7162
runtests: match keywords case insensitively 2017-08-14 23:05:11 +02:00
Daniel Stenberg
6bde13a531
test1448: verify redirect to IDN using URL
Closes #1772
2017-08-13 00:04:27 +02:00
Daniel Stenberg
47e4a6fa1c
test2032: mark as flaky (again) 2017-08-13 00:00:39 +02:00
Dan Fandrich
2747aec348 test1447: require a curl with http support 2017-08-12 12:53:14 +02:00
Daniel Stenberg
be2a4c1784
test2033: this went flaky again
Suspicion: when we enabled the threaded resolver by default.
2017-08-11 23:53:47 +02:00
Daniel Stenberg
77cd4e7693
test1447: verifies the parse proxy fix in 6e0e152ce5 2017-08-11 11:58:34 +02:00
Adam Sampson
7e949de1d2
dist: Add dictserver.py/negtelnetserver.py to EXTRA_DIST
These weren't included in the 7.55.0 release, but are required in order
to run the full test suite.

Closes #1744
2017-08-09 23:55:14 +02:00
Viktor Szakats
13ef623a81
docs/comments: Update to secure URL versions
Closes #1741
2017-08-08 21:41:07 +02:00
Daniel Stenberg
581011a3d2 test1427: verify command line parser integer overflow detection 2017-08-07 09:38:57 +02:00
Daniel Stenberg
453e7a7a03 glob: do not continue parsing after a strtoul() overflow range
Added test 1289 to verify.

CVE-2017-1000101

Bug: https://curl.haxx.se/docs/adv_20170809A.html
Reported-by: Brian Carpenter
2017-08-07 09:24:30 +02:00
Daniel Stenberg
561e9217c7 test1010: verify that #1718 is fixed
... by doing two transfers in nocwd mode and check that there's no
superfluous CWD command.
2017-08-04 10:01:23 +02:00
Daniel Stenberg
58752b78c7 test130: verify comments in .netrc 2017-08-03 10:04:16 +02:00
Marcel Raad
866e02935d
CMake: set MSVC warning level to 4
The MSVC warning level defaults to 3 in CMake. Change it to 4, which is
consistent with the Visual Studio and NMake builds. Disable level 4
warning C4127 for the library and additionally C4306 for the test
servers to get a clean CURL_WERROR build as that warning is raised in
some macros in older Visual Studio versions.

Ref: https://github.com/curl/curl/pull/1667#issuecomment-314082794
Closes https://github.com/curl/curl/pull/1711
2017-08-03 08:39:23 +02:00
Daniel Stenberg
920f777fc8 tests/server/util: fix curltime mistake from 4dee50b9c8 2017-08-02 11:53:27 +02:00
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
Marcel Raad
f2d5d05893
testpart: remove _MPRINTF_REPLACE
Support for _MPRINTF_REPLACE in mprintf.h was removed in
55452ebdff, replaced with curl_printf.h.
2017-05-02 21:09:41 +02:00
Daniel Stenberg
8ed81f67c2 unit1606: do not print/access buffer
It was a wrong assumption that it could do that!
2017-05-01 22:55:29 +02:00
Marcel Raad
0912a5c760
getpart: use correct variable type
This fixes the following clang warning:
getpart.c:201:17: warning: cast from function call of type 'CURLcode'
to non-matching type 'int' [-Wbad-function-cast]
2017-05-01 13:17:57 +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
092d012441 unit1604: fixed indentation 2017-04-30 15:21:54 +02:00
Dan Fandrich
c0a27c5cee unit1604: fixed compilation under Windows, broken in the previous commit 2017-04-30 13:35:17 +02:00
Dan Fandrich
8089dcfc5d tests: fixed OOM handling of unit tests to abort test
It's dangerous to continue to run the test when a memory alloc fails.
2017-04-30 10:55:20 +02:00
Dan Fandrich
584142892f tests: added --remote-time tests for remaining protocols that support it 2017-04-29 10:16:06 +02:00
Dan Fandrich
2ce86d8509 runtests.pl: support multiline <postcheck> commands 2017-04-29 10:00:15 +02:00
Dan Fandrich
3364de00f7 test1443: test --remote-time 2017-04-27 22:34:12 +02:00
Daniel Stenberg
96ece5c0ee curl: set a 100K buffer size by default
Test command 'time curl http://localhost/80GB -so /dev/null' on a Debian
Linux.

Before (middle performing run out 9):

 real    0m28.078s
 user    0m11.240s
 sys     0m12.876s

After (middle performing run out 9)

 real    0m26.356s (93.9%)
 user    0m5.324s  (47.4%)
 sys     0m8.368s  (65.0%)

Also, doing SFTP over a 200 millsecond latency link is now about 6 times
faster.

Closes #1446
2017-04-25 11:02:19 +02:00
Daniel Stenberg
cbae73e1dd llist: no longer uses malloc
The 'list element' struct now has to be within the data that is being
added to the list. Removes 16.6% (tiny) mallocs from a simple HTTP
transfer. (96 => 80)

Also removed return codes since the llist functions can't fail now.

Test 1300 updated accordingly.

Closes #1435
2017-04-22 11:25:27 +02:00
Daniel Stenberg
49eee28822 tests: remove the html and PDF versions from the tarball 2017-04-21 16:26:53 +02:00
Daniel Gustafsson
aaa7e05c78 code: fix typos and style in comments
A few random typos, and minor whitespace cleanups, found in comments
while reading code.

Closes #1423
2017-04-17 23:17:50 +02:00
Marcel Raad
c25aba1254
extern-scan.pl: strip trailing CR
This makes test 1135 pass with CRLF checkouts.

Ref: https://github.com/curl/curl/pull/1344#issuecomment-289243166
Closes https://github.com/curl/curl/pull/1422
2017-04-17 08:33:04 +02:00
Marcel Raad
05c9f42e52
unit1303: fix compiler warning
MinGW-w64 complains:
warning: conversion to 'long int' from 'time_t {aka long long int}' may
alter its value [-Wconversion]
Fix this by using the correct type.
2017-04-16 13:54:21 +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
Marcel Raad
fad74ba4cc
tests/server/util: prefer <poll.h> over <sys/poll.h>
Follow-up to aa573c3c55

Ref: https://github.com/curl/curl/pull/1406
2017-04-12 08:45:54 +02:00
Daniel Stenberg
ab6d23278e Curl_expire_latest: ignore already expired timers
If the existing timer is still in there but has expired, the new timer
should be added.

Reported-by: Rainer Canavan
Bug: https://curl.haxx.se/mail/lib-2017-04/0030.html
Closes #1407
2017-04-11 16:53:33 +02:00
Daniel Stenberg
d2bdc98754 test1606: verify speedcheck 2017-04-06 17:38:23 +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
Dániel Bakai
6193770ee1 tests: added test for Curl_splaygetbest to unit1309
This checks the new behavior of Curl_splaygetbest, so that the smallest
node not larger than the key is removed, and FIFO behavior is kept even
when there are multiple nodes with the same key.

Closes #1358
2017-04-04 23:48:14 +02:00
Dániel Bakai
de05bcb706 multi: fix queueing of pending easy handles
Multi handles repeatedly invert the queue of pending easy handles when
used with CURLMOPT_MAX_TOTAL_CONNECTIONS. This is caused by a multistep
process involving Curl_splaygetbest and violates the FIFO property of
the multi handle.
This patch fixes this issue by redefining the "best" node in the
context of timeouts as the "smallest not larger than now", and
implementing the necessary data structure modifications to do this
effectively, namely:
 - splay nodes with the same key are now stored in a doubly-linked
   circular list instead of a non-circular one to enable O(1)
   insertion to the tail of the list
 - Curl_splayinsert inserts nodes with the same key to the tail of
   the same list
 - in case of multiple nodes with the same key, the one on the head of
   the list gets selected
2017-04-04 23:37:18 +02:00
Daniel Stenberg
e60fe20fdf llist: replace Curl_llist_alloc with Curl_llist_init
No longer allocate the curl_llist head struct for lists separately.

Removes 17 (15%) tiny allocations in a normal "curl localhost" invoke.

closes #1381
2017-04-04 15:27:45 +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
Marcel Raad
55f4ababde
tests/server/util: remove in6addr_any for recent MinGW
In ancient MinGW versions, in6addr_any was declared as extern, but not
defined. Because of that, 22a0c57746 added
definitions for in6addr_any when compiling with MinGW. The bug was fixed in
w32api version 3.6 from 2006, so this workaround is not needed anymore for
recent versions.

This fixes the following MinGW-w64 warnings because the MinGW-w64 version of
IN6ADDR_ANY_INIT has the two additional braces inside the macro:
util.c:59:14: warning: braces around scalar initializer
util.c:59:40: warning: excess elements in scalar initializer

Ref: e4803e0da2/tree/w32api/ChangeLog
Closes https://github.com/curl/curl/pull/1379
2017-04-03 11:18:08 +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
Isaac Boukris
7975d10cf8 http: Fix proxy connection reuse with basic-auth
When using basic-auth, connections and proxy connections
can be re-used with different Authorization headers since
it does not authenticate the connection (like NTLM does).

For instance, the below command should re-use the proxy
connection, but it currently doesn't:
curl -v -U alice:a -x http://localhost:8181 http://localhost/
  --next -U bob:b -x http://localhost:8181 http://localhost/

This is a regression since refactoring of ConnectionExists()
as part of: cb4e2be7c6

Fix the above by removing the username and password compare
when re-using proxy connection at proxy_info_matches().

However, this fix brings back another bug would make curl
to re-print the old proxy-authorization header of previous
proxy basic-auth connection because it wasn't cleared.

For instance, in the below command the second request should
fail if the proxy requires authentication, but would succeed
after the above fix (and before aforementioned commit):
curl -v -U alice:a -x http://localhost:8181 http://localhost/
  --next -x http://localhost:8181 http://localhost/

Fix this by clearing conn->allocptr.proxyuserpwd after use
unconditionally, same as we do for conn->allocptr.userpwd.

Also fix test 540 to not expect digest auth header to be
resent when connection is reused.

Signed-off-by: Isaac Boukris <iboukris@gmail.com>

Closes https://github.com/curl/curl/pull/1350
2017-03-28 03:54:43 -04:00
klemens
f7df67cff0 spelling fixes
Closes #1356
2017-03-26 23:56:23 +02:00
Daniel Stenberg
8e65877870 curl: check for end of input in writeout backslash handling
Reported-by: Brian Carpenter

Added test 1442 to verify
2017-03-25 23:48:57 +01:00
Marcel Raad
d14563454a
tests/README: make "Run" section foolproof
curl must be built before building the tests.

Closes https://github.com/curl/curl/pull/1352
2017-03-24 08:20:43 +01:00
Anders Roxell
f355a92cd5 tests/README: mention nroff for --manual tests
Signed-off-by: Anders Roxell <anders.roxell@gmail.com>

Closes #1342
2017-03-23 10:52:10 +01:00
Daniel Stenberg
207f588987 make: introduce 'test-nonflaky' target
Running this in the root build dir will invoke the test suite to only
run tests not marked as 'flaky'.
2017-03-22 10:48:20 +01:00
Daniel Stenberg
96d6942b2d test2033: flaky 2017-03-22 08:55:11 +01:00
Dan Fandrich
de2b31aa5a runtests.pl: fixed display of the Gopher IPv6 port number 2017-03-20 23:37:57 +01:00
Dan Fandrich
1bca868f60 tests: fixed the documented test server port numbers 2017-03-20 23:37:41 +01:00
Dan Fandrich
718709c674 test714/5: added HTTP as a required feature
These tests use an HTTP proxy so require that curl be built with HTTP
support.
2017-03-20 22:24:32 +01:00
Dan Fandrich
25d43d19d5 tests: strip more options from non-HTTP --libcurl tests
The CURLOPT_USERAGENT and CURLOPT_MAXREDIRS options are only set if HTTP
support is available, so ignore them in tests where HTTP is not
guaranteed.
2017-03-20 21:41:17 +01:00
Dan Fandrich
3627769d14 build: removed redundant DEPENDENCIES from makefiles 2017-03-14 12:13:03 +01:00
Dan Fandrich
db900ab732 test1440/1: depend on well-defined file: behaviour
Depend on the known behaviour of URLs for nonexistent files rather than
the undefined behaviour of URLs for directories (which fails on Windows).
The test isn't about file: URLs at all, so the URL used doesn't really
matter.
2017-03-12 23:27:00 +01:00
Dan Fandrich
3863de57f2 tests: clear the SSL_CERT_FILE variable on --libcurl tests
Otherwise, the contents will end up in the output and fail the
verification.
2017-03-12 22:33:56 +01:00
Dan Fandrich
75398731e4 test1287: added verbose logs keyword 2017-03-12 20:32:46 +01:00
Dan Fandrich
1890d59905 tool_writeout: fixed a buffer read overrun on --write-out
If a % ended the statement, the string's trailing NUL would be skipped
and memory past the end of the buffer would be accessed and potentially
displayed as part of the --write-out output. Added tests 1440 and 1441
to check for this kind of condition.

Reported-by: Brian Carpenter
2017-03-12 08:28:31 +01:00
Desmond O. Chang
d2bcf1e3e2 url: add option CURLOPT_SUPPRESS_CONNECT_HEADERS
- Add new option CURLOPT_SUPPRESS_CONNECT_HEADERS to allow suppressing
  proxy CONNECT response headers from the user callback functions
  CURLOPT_HEADERFUNCTION and CURLOPT_WRITEFUNCTION.

- Add new tool option --suppress-connect-headers to expose
  CURLOPT_SUPPRESS_CONNECT_HEADERS and allow suppressing proxy CONNECT
  response headers from --dump-header and --include.

Assisted-by: Jay Satiro
Assisted-by: CarloCannas@users.noreply.github.com
Closes https://github.com/curl/curl/pull/783
2017-03-12 01:32:33 -05:00
Jay Satiro
ec1d0ed1c1 http_proxy: Ignore TE and CL in CONNECT 2xx responses
A client MUST ignore any Content-Length or Transfer-Encoding header
fields received in a successful response to CONNECT.
"Successful" described as: 2xx (Successful). RFC 7231 4.3.6

Prior to this change such a case would cause an error.

In some ways this bug appears to be a regression since c50b878. Prior to
that libcurl may have appeared to function correctly in such cases by
acting on those headers instead of causing an error. But that behavior
was also incorrect.

Bug: https://github.com/curl/curl/issues/1317
Reported-by: mkzero@users.noreply.github.com
2017-03-11 18:22:42 -05: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 Stenberg
26e9fc27ad tests: disabled 1903 now
Test 1903 is doing HTTP pipelining, and that is a timing and ordering
sensitive operation and this fails far too often on the Travis CI
leading to people more or less ignoring test failures there. Not good.

The end of pipelning is probably coming sooner rather than later
anyway...
2017-03-09 23:57:09 +01:00
Dan Fandrich
348f8a3da9 test1260: added http as a required feature 2017-03-08 09:06:56 +01:00
Steve Brokenshire
d960e57029 gitignore: Ignore man page dist files
Ignore man page dist files generated by scripts/updatemanpages.pl
2017-03-07 23:27:31 +01:00
Steve Brokenshire
f5712ca277 Makefile.am: Remove distribution man pages when running 'make clean' 2017-03-07 23:27:31 +01:00
Dan Fandrich
3914c07ed6 test1260: removed errant XML tag 2017-03-06 23:05:51 +01:00
Daniel Stenberg
aadb7c7b62 URL: return error on malformed URLs with junk after port number
... because it causes confusion with users. Example URLs:

"http://[127.0.0.1]:11211:80" which a lot of languages' URL parsers will
parse and claim uses port number 80, while libcurl would use port number
11211.

"http://user@example.com:80@localhost" which by the WHATWG URL spec will
be treated to contain user name 'user@example.com' but according to
RFC3986 is user name 'user' for the host 'example.com' and then port 80
is followed by "@localhost"

Both these formats are now rejected, and verified so in test 1260.

Reported-by: Orange Tsai
2017-03-06 16:08:21 +01:00
Dan Fandrich
97a04145ef tests: fixed a typo in some comments 2017-03-04 12:50:30 +01:00
Dan Fandrich
41388b9ba3 tests: enable HTTP/2 tests to run with non-default port numbers 2017-02-27 22:32:37 +01:00
Dan Fandrich
4fa2de3698 test1139: allow for the possibility that the man page is not rebuilt
This is likely to be the case when building from a tar ball release
package which includes a prebuilt man page. In that case, test the
packaged man page instead. This only makes a difference when building
out-of-tree (in-tree, the location in both cases is identical).
2017-02-26 21:30:31 +01:00
Dan Fandrich
c6ddb606d8 tests: use consistent environment variables for setting charset
The character set in POSIX is set by the locale defined by (in
decreasing order of precedence) the LC_ALL, LC_CTYPE and LANG
environment variables (CHARSET was used by libidn but not libidn2).
LC_ALL is cleared to ensure that LC_CTYPE takes effect, but LC_ALL is
not used to set the locale to ensure that other parts of the locale
aren't overridden.  Since there doesn't seem to be a cross-platform way
of specifying a UTF-8 locale, and not all systems may support UTF-8, a
<precheck> is used to skip the test if UTF-8 can't be verified to be
available.  Test 1035 was also converted to UTF-8 for consistency, as
the actual character set used there is irrelevant to the test.

This patch uses a different UTF-8 locale than the last attempt, namely
en_US.UTF-8. This one has been verified on 7 different Linux and BSD
distributions and is more complete and usable than the locale UTF-8 (on
at least some systems).
2017-02-25 15:33:29 +01:00
Dan Fandrich
832b0105f2 test557: explicitly use the C locale so the numeric output is as expected 2017-02-25 12:05:28 +01:00
Daniel Stenberg
13314ffd65 Revert "tests: use consistent environment variables for setting charset"
This reverts commit ecd1d020ab.

That commit caused test failures on my Debian Linux machine for all
changed test cases. We need to reconsider how that should get done.
2017-02-24 08:41:36 +01:00
Dan Fandrich
ecd1d020ab tests: use consistent environment variables for setting charset
Character set in POSIX is set by the locale defined (in decreasing order
of precedence) by the LC_ALL, LC_CTYPE and LANG environment variables (I
believe CHARSET is only historic). LC_ALL is cleared to ensure that
LC_CTYPE takes effect, but LC_ALL is not used to set the locale to
ensure that other parts of the locale aren't overriden, if set.  Since
there doesn't seem to be a cross-platform way of specifying a UTF-8
locale, and not all systems may support UTF-8, a <precheck> is used
(where relevant) to skip the test if UTF-8 isn't in use.  Test 1035 was
also converted to UTF-8 for consistency, as the actual character set
used there is irrelevant to the test.
2017-02-23 23:14:00 +01:00
İsmail Dönmez
2bfe55037f tests: Set CHARSET & LANG to UTF-8 in 1035, 2046 and 2047
Closes #1283
Fixes #1277
2017-02-23 11:02:59 +01:00
Max Khon
f77dabefd8 digest_sspi: Fix nonce-count generation in HTTP digest
- on the first invocation: keep security context returned by
  InitializeSecurityContext()

- on subsequent invocations: use MakeSignature() instead of
  InitializeSecurityContext() to generate HTTP digest response

Bug: https://github.com/curl/curl/issues/870
Reported-by: Andreas Roth

Closes https://github.com/curl/curl/pull/1251
2017-02-20 00:53:01 -05:00
Dan Fandrich
f45de0e87c tests: removed the obsolete name parameter 2017-02-18 22:19:44 +01:00
Michael Kaufmann
2f8d0df085 proxy: fix hostname resolution and IDN conversion
Properly resolve, convert and log the proxy host names.
Support the "--connect-to" feature for SOCKS proxies and for passive FTP
data transfers.

Follow-up to cb4e2be

Reported-by: Jay Satiro
Fixes https://github.com/curl/curl/issues/1248
2017-02-18 15:04:43 +01:00
Isaac Boukris
13e3a18b34 http: fix missing 'Content-Length: 0' while negotiating auth
- While negotiating auth during PUT/POST if a user-specified
  Content-Length header is set send 'Content-Length: 0'.

This is what we do already in HTTPREQ_POST_FORM and what we did in the
HTTPREQ_POST case (regression since afd288b).

Prior to this change no Content-Length header would be sent in such a
case.

Bug: https://curl.haxx.se/mail/lib-2017-02/0006.html
Reported-by: Dominik Hölzl

Closes https://github.com/curl/curl/pull/1242
2017-02-17 02:32:16 -05:00
Jay Satiro
7a9f5748bc tool_urlglob: Allow a glob range with the same start and stop
For example allow ranges like [1-1] and [a-a] etc.

Regression since 5ca96cb.

Bug: https://github.com/curl/curl/issues/1238
Reported-by: R. Dennis Steed
2017-02-15 02:31:09 -05:00
Daniel Stenberg
c5c4e816b4 URL: only accept ";options" in SMTP/POP3/IMAP URL schemes
Fixes #1252
2017-02-10 14:51:53 +01:00
Dan Fandrich
3cc2229c13 test1139: Added the --manual keyword since the manual is required 2017-02-07 18:49:50 +01:00
Daniel Gustafsson
e695b070a5 test552: Fix typos
Closes https://github.com/curl/curl/pull/1245
2017-02-07 02:39:15 -05:00
Dan Fandrich
edb2d02855 cmdline-opts: Fixed build and test in out of source tree builds 2017-02-06 23:37:05 +01:00
Daniel Stenberg
cbd4e1fa0d cookies: do not assume a valid domain has a dot
This repairs cookies for localhost.

Non-PSL builds will now only accept "localhost" without dots, while PSL
builds okeys everything not listed as PSL.

Added test 1258 to verify.

This was a regression brought in a76825a5ef
2017-01-27 13:32:02 +01:00
Daniel Stenberg
81cb255cb3 sws: use SOCKERRNO, not errno
Reported-by: Gisle Vanem
2017-01-19 23:04:53 +01:00
Alessandro Ghedini
9ad034e5a1 http2: disable server push if not requested
Ref: https://github.com/curl/curl/pull/1160
2017-01-15 11:45:32 +00:00
ERAMOTO Masaya
2ac1942c72 url: --noproxy option overrides NO_PROXY environment variable
Under condition using http_proxy env var, noproxy list was the
combination of --noproxy option and NO_PROXY env var previously. Since
this commit, --noproxy option overrides NO_PROXY environment variable
even if use http_proxy env var.

Closes #1140
2017-01-13 11:18:29 +01:00
ERAMOTO Masaya
1b57557882 url: Fix NO_PROXY env var to work properly with --proxy option.
The combination of --noproxy option and http_proxy env var works well
both for proxied hosts and non-proxied hosts.

However, when combining NO_PROXY env var with --proxy option,
non-proxied hosts are not reachable while proxied host is OK.

This patch allows us to access non-proxied hosts even if using NO_PROXY
env var with --proxy option.
2017-01-13 11:18:11 +01:00
Jay Satiro
1d4202ade6 url: Fix parsing for when 'file' is the default protocol
Follow-up to 3463408.

Prior to 3463408 file:// hostnames were silently stripped.

Prior to this commit it did not work when a schemeless url was used with
file as the default protocol.

Ref: https://curl.haxx.se/mail/lib-2016-11/0081.html
Closes https://github.com/curl/curl/pull/1124

Also fix for drive letters:

- Support --proto-default file c:/foo/bar.txt

- Support file://c:/foo/bar.txt

- Fail when a file:// drive letter is detected and not MSDOS/Windows.

Bug: https://github.com/curl/curl/issues/1187
Reported-by: Anatol Belski
Assisted-by: Anatol Belski
2017-01-12 15:37:11 -05:00
Daniel Stenberg
62e67c7772 sws: retry send() on EWOULDBLOCK
Fixes spurious test 1060 and 1061 failures on OpenBSD, Solaris and more.

Bug: https://curl.haxx.se/mail/lib-2017-01/0009.html
Reported-by: Christian Weisgerber
2017-01-09 23:43:15 +01: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
913312f414 test1282: verify the ftp-gss check 2016-12-24 23:35:54 +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
5c823f51db runtests: remove the valgrind parser
Old legacy parsing that 1) hid problems for us and 2) probably isn't
needed anymore.
2016-12-21 23:42:43 +01:00
Daniel Stenberg
7a01b33c31 tests/Makefile: run checksrc on debug builds
... just like we already do in src/ and lib/
2016-12-21 23:40:41 +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
7618e60c27 manpage-scan.pl: allow deprecated options to get removed from curl.1
--krb4, --ftp-ssl and --ftp-ssl-reqd no longer need to be documented in the
man page
2016-12-17 23:48:13 +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
Dan Fandrich
dacfecb7b6 test2032: Mark test as flaky 2016-12-05 21:38:15 +01:00
Dan Fandrich
7117a9a6c6 test1281: added http as a required feature 2016-12-02 15:17:47 +01:00
Daniel Stenberg
cee0fb3247 curl: support zero-length argument strings in config files
... like 'user-agent = ""'

Adjusted test 71 to verify.
2016-12-02 11:25:35 +01:00
Daniel Stenberg
3b77aa6b28 tests: fix CONNECT test cases to be more strict
... as they broke with the cleaned up CONNECT handling
2016-12-01 16:18:52 +01:00
Daniel Stenberg
c50b878c15 CONNECT: reject TE or CL in 2xx responses
A server MUST NOT send any Transfer-Encoding or Content-Length header
fields in a 2xx (Successful) response to CONNECT. (RFC 7231 section
4.3.6)

Also fixes the three test cases that did this.
2016-12-01 16:18:36 +01:00
Daniel Stenberg
aab33215af URL parser: reject non-numerical port numbers
Test 1281 added to verify
2016-12-01 10:36:37 +01:00
Dan Fandrich
42253ad943 runtests: made Servers: output be more consistent by removing OFF 2016-11-30 22:39:39 +01:00
Michael Kaufmann
b34ea05d9d CURLOPT_CONNECT_TO: Skip non-matching "connect-to" entries properly
If a port number in a "connect-to" entry does not match, skip this
entry instead of connecting to port 0.

If a port number in a "connect-to" entry matches, use this entry
and look no further.

Reported-by: Jay Satiro
Assisted-by: Jay Satiro, Daniel Stenberg

Closes #1148
2016-11-30 12:02:44 +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
Jay Satiro
c34fa31f3a test1135: Fix curl_easy_duphandle prototype for code style
Follow-up to dbadaeb which changed the style.
2016-11-24 19:52:36 -05: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
Jay Satiro
2ece147cc2 tests: Fix HTTP2-Settings header for huge window size
Follow-up to a4d8888. Changing the window size in that commit resulted
in a different HTTP2-Settings upgrade header, causing test 1800 to fail.
2016-11-17 01:04:00 -05:00
Daniel Stenberg
8c630ef059 glob: fix [a-c] globbing regression
Brought in ee4f76606c

Added test case 1280 to verify

Reported-by: Dave Reisner

Bug: ee4f76606c (commitcomment-19823146)
2016-11-15 08:22:54 +01:00
Daniel Stenberg
f82bbe01c8 curl: add --fail-early
Exit with an error on the first transfer error instead of continuing to
do the rest of the URLs.

Discussion: https://curl.haxx.se/mail/archive-2016-11/0038.html
2016-11-14 08:35:40 +01:00
Dan Fandrich
56bb7b1a3c tests: fixed variable might be clobbered warning
This stops the compiler from potentially making invalid assumptions
about the immutability of sdp and sap across the longjmp boundary.
2016-11-12 12:37:24 +01:00
Daniel Stenberg
8c15e0de6f test558: adapt to 0649433da 2016-11-11 15:32:07 +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
Jakub Zakrzewski
8ed52bde06 dist: add CMakeLists.txt to the tarball 2016-11-04 20:21:48 +01:00
Daniel Stenberg
07b95ea268 tests/util: get a private strncasecompare clone
... since the curlx_* code no longer provides one and we don't link
libcurl to these test servers.
2016-10-31 23:49:54 +01: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
06bc2100d2 unit1301: keep testing curl_strequal
as that is still part of the API, fix from 8fe4bd0844
2016-10-31 09:53:34 +01:00
Daniel Stenberg
44c53cc38b strcase: s/strequal/strcasecompare
some more follow-ups to 811a693b80
2016-10-31 09:37:54 +01:00
Daniel Stenberg
ad16f89791 test165: adapted to the libidn2 use and IDNA2008 fix 2016-10-31 08:46:35 +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
42b650b9ea test1246: verify URL parsing with host name ending with '#' 2016-10-31 08:46:35 +01:00
Daniel Stenberg
fc458679ca testcurl.1: fix the URL to the autobuild summary 2016-10-22 15:15:34 +02:00
Daniel Stenberg
a84e0713e8 testcurl.1: update URLs 2016-10-22 14:57:20 +02:00
Daniel Stenberg
f36f8c1455 test14xx: fixed --libcurl output tests again after 8e8afa82cb 2016-10-18 14:15:03 +02:00
Daniel Stenberg
ac8a314913 test557: verify printf() with 128 and 129 arguments 2016-10-08 20:47:44 +02:00
Daniel Gustafsson
4f43236a40 tests: Fix a small typo in the tests README (#1060)
The subdirectory for logs in tests/ is named log/ without an 's'
at the end.
2016-10-08 11:39:12 +02:00
Sergei Kuzmin
54e48b14e1 cookies: same domain handling changed to match browser behavior
Cokie with the same domain but different tailmatching property are now
considered different and do not replace each other.  If header contains
following lines then two cookies will be set: Set-Cookie: foo=bar;
domain=.foo.com; expires=Thu Mar 3 GMT 8:56:27 2033 Set-Cookie: foo=baz;
domain=foo.com; expires=Thu Mar 3 GMT 8:56:27 2033

This matches Chrome, Opera, Safari, and Firefox behavior. When sending
stored tokens to foo.com Chrome, Opera, Firefox store send them in the
stored order, while Safari pre-sort the cookies.

Closes #1050
2016-10-03 16:49:35 +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
36e53ec6ff docs: Remove that --proto is just used for initial retrieval
.. and add that --proto-redir and CURLOPT_REDIR_PROTOCOLS do not
override protocols denied by --proto and CURLOPT_PROTOCOLS.

- Add a test to enforce: --proto deny must override --proto-redir allow

Closes https://github.com/curl/curl/pull/1031
2016-09-21 17:23:24 -04: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
Jay Satiro
19445f35ba test2048: fix url 2016-09-18 15:33:15 -04:00
Daniel Stenberg
8dcc074f36 test1605: verify negative input lengths to (un)escape functions 2016-09-14 07:49:43 +02:00
Daniel Stenberg
a8e751a51a http: refuse to pass on response body with NO_NODY was set
... like when a HTTP/0.9 response comes back without any headers at all
and just a body this now prevents that body from being sent to the
callback etc.

Adapted test 1144 to verify.

Fixes #973

Assisted-by: Ray Satiro
2016-09-11 12:02:07 +02:00
Jakub Zakrzewski
257bf3ac67 CMake: Don't build unit tests if private symbols are hidden
This only excludes building unit tests from default build ( 'all' Make
target or "Build Solution" in VisualStudio). The projects and Make
targets will still be generated and shown in supporting IDEs.

Fixes https://github.com/curl/curl/issues/981
Reported-by: Randy Armstrong

Closes https://github.com/curl/curl/pull/990
2016-09-10 00:35:38 +02: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
Jay Satiro
af2d679e14 errors: new alias CURLE_WEIRD_SERVER_REPLY (8)
Since we're using CURLE_FTP_WEIRD_SERVER_REPLY in imap, pop3 and smtp as
more of a generic "failed to parse" introduce an alias without FTP in
the name.

Closes https://github.com/curl/curl/pull/975
2016-09-07 21:24:27 -04:00
Mark Hamilton
5d563a10b3 libtest/test.h: fix typo (#988) 2016-09-03 23:12:22 +02:00
Daniel Stenberg
3533def3d5 http2: make sure stream errors don't needlessly close the connection
With HTTP/2 each transfer is made in an indivial logical stream over the
connection, making most previous errors that caused the connection to get
forced-closed now instead just kill the stream and not the connection.

Fixes #941
2016-08-28 16:44:49 +02:00
Daniel Stenberg
152e5c2105 test161: add comment for the exit code 2016-08-26 09:12:01 +02:00