Commit Graph

3615 Commits

Author SHA1 Message Date
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
Dan Fandrich b5286189b5 test219: Add http as a required feature 2016-08-26 08:32:01 +02:00
Daniel Stenberg cdd61dc35f test1144: verify HEAD with body-only response 2016-08-18 11:45:15 +02:00
Daniel Stenberg fa6b6f1a46 proxy: fix tests as follow-up to 93b0d907d5
This fixes tests that were added after 113f04e664 as the tests would
fail otherwise.

We bring back "Proxy-Connection: Keep-Alive" now unconditionally to fix
regressions with old and stupid proxies, but we could possibly switch to
using it only for CONNECT or only for NTLM in a future if we want to
gradually reduce it.

Fixes #954

Reported-by: János Fekete
2016-08-16 10:15:26 +02:00
Daniel Stenberg 93b0d907d5 Revert "Proxy-Connection: stop sending this header by default"
This reverts commit 113f04e664.
2016-08-16 08:36:04 +02:00
Daniel Stenberg d5fa91b323 tests/README: mention nghttpx for HTTP/2 tests 2016-08-15 11:36:17 +02:00
Daniel Stenberg f1cdcc4c3e test219: verify unsupported scheme for proxies get rejected 2016-08-15 11:11:04 +02:00
Jay Satiro 6b130d6be6 tests: Fix for http/2 feature
Bug: https://curl.haxx.se/mail/lib-2016-07/0070.html
Reported-by: Paul Howarth
2016-07-24 02:49:47 -04:00
Dan Fandrich 47fa8f0dae test558: fix test by stripping file paths from FD lines 2016-07-21 17:06:04 +02:00
Kamil Dudka 5e26d9ceea tests: distribute the http2-server.pl script, too 2016-07-21 13:07:27 +02:00
Daniel Stenberg c6d3fa11e6 test558: updated after ipv6-check move
Follow-up commit to c50980807c to make this test pass.
2016-07-20 23:06:03 +02:00
Daniel Stenberg e89489d8f4 test1244: test different proxy ports same URL 2016-06-29 23:06:32 +02:00
Daniel Stenberg 434f8d0389 internals: rename the SessionHandle struct to Curl_easy 2016-06-22 10:28:41 +02:00
Sergei Nikulov 12e21fab26 cmake: now using BUILD_TESTING=ON/OFF
CMake build now using BUILD_TESTING=ON/OFF (default is OFF) to build
tests and enabling CTest integration. Options BUILD_CURL_TESTS and
BUILD_DASHBOARD_REPORTS was removed.

Closes #882

Reviewed-by: Brad King
2016-06-21 23:04:04 +02:00
Daniel Stenberg 5f2e3b8867 tests: fix the HTTP/2 tests
The HTTP/2 tests brought with commit bf05606ef1 were using the internal
name 'http2' for the HTTP/2 server, while in fact that name was already
used for the second instance of the HTTP server. This made tests using
the second instance (like test 2050) fail after a HTTP/2 test had run.

The server is now known as HTTP/2 internally and within the <server>
section in test cases. 1700, 1701 and 1702 were updated accordingly.
2016-06-19 23:59:52 +02:00
Dan Fandrich 67176e2b84 tests: Added HTTP proxy keywords to tests 1141 & 1142 2016-06-15 23:04:48 +02:00
Daniel Stenberg 9b6d3a662e tests: two more HTTP/2 tests
1701 and 1702
2016-06-06 23:51:49 +02:00
Daniel Stenberg 320905a345 runtests: don't display logs when http2 server fails to start 2016-06-06 23:51:49 +02:00
Daniel Stenberg d3b5c153af runtests: make stripfile work on stdout as well
... and have test 1700 use that to strip out the nghttpx server: headers
2016-06-06 23:51:49 +02:00
Daniel Stenberg bf05606ef1 http2-tests: test1700 is the first real HTTP/2 test
It requires that 'nghttpx' is in the PATH, and it will run the tests
using nghttpx as a front-end proxy in front of the standard HTTP/1 test
server. This uses HTTP/2 over plain TCP.

If you like me have nghttpx installed in a custom path, you can run test 1700
like this:

$ PATH=$PATH:$HOME/build-nghttp2/bin/ ./runtests.pl 1700
2016-06-06 23:51:49 +02:00
Daniel Stenberg 5409e1d793 URL parser: allow URLs to use one, two or three slashes
Mostly in order to support broken web sites that redirect to broken URLs
that are accepted by browsers.

Browsers are typically even more leniant than this as the WHATWG URL
spec they should allow an _infinite_ amount. I tested 8000 slashes with
Firefox and it just worked.

Added test case 1141, 1142 and 1143 to verify the new parser.

Closes #791
2016-05-30 23:13:55 +02:00
Daniel Stenberg 54e4c6c396 test/Makefile.am: include manpage-scan.pl and nroff-scan.pl in dist
Reported-by: Ray Satiro
Bug: https://curl.haxx.se/mail/lib-2016-05/0113.html
2016-05-18 09:17:53 +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 1135340214 nroff-scan.pl: verify that references are made with \fI 2016-05-02 09:09:59 +02:00
Daniel Stenberg 9291e2b9d0 test1140: run nroff-scan to verify man pages 2016-05-01 23:24:09 +02:00
Daniel Stenberg 2a6c34c8ad nroff-scan.pl: verify the .BR references as well 2016-05-01 23:24:09 +02:00
Daniel Stenberg 100c7b478f nroff-scan.pl: verifies nroff pages
... not used by any test yet but can be used stand-alone.
2016-05-01 16:41:35 +02:00
Karlson2k 50129e6a96 tests: Use 'pathhelp' for paths conversions in secureserver.pl
Closes #675
2016-04-29 23:43:18 +02:00
Karlson2k 4c5d5e5e55 tests: Use 'pathhelp' for paths conversions in sshserver.pl 2016-04-29 23:42:55 +02:00
Karlson2k 221deef580 tests: Use 'pathhelp' for current path in runtests.pl 2016-04-29 23:42:44 +02:00
Karlson2k 315f06f569 tests: pathhelp.pm to process paths on Msys/Cygwin 2016-04-29 23:42:28 +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
Jay Satiro 0dc4d8e42e curl -J: make it work even without http:// scheme on URL
It does open up a miniscule risk that one of the other protocols that
libcurl could use would send back a Content-Disposition header and then
curl would act on it even if not HTTP.

A future mitigation for this risk would be to allow the callback to ask
libcurl which protocol is being used.

Verified with test 1312

Closes #760
2016-04-29 15:24:10 +02:00
Daniel Stenberg 9dbcab3a0c manpage-scan.pl: also verify the command line option docs
This script now also scans src/tool_getparam.c, docs/curl.1 and
src/tool_help.c and will warn if any of them lists a command line option
not mentioned in one of the other places.
2016-04-29 00:31:37 +02:00
Daniel Stenberg 6a9abbd4d4 test1139: verifies libcurl option man page presence
- checks that each option has its own man page present

- checks that each option is mentioned in its corresponding index man
  page
2016-04-28 16:30:22 +02:00
Daniel Stenberg e504f03f8c test1322: verify stripping of trailing dot from host name
While being debated (in #716) and a violation of RFC 7230 section 5.4,
this test verifies that the existing functionality works as intended. It
strips the dot from the host name and uses the host without dot
throughout the internals.
2016-04-25 23:51:33 +02:00
Daniel Stenberg 62e3e75b80 test148: fixed after the --ftp-create-dirs retry change
follow-up commit to 3c1e84f569 as it made curl try a little harder
2016-04-25 23:10:13 +02:00
Daniel Stenberg 6de32d916f lib1517: checksrc compliance 2016-04-24 12:27:39 +02:00