Commit Graph

5264 Commits

Author SHA1 Message Date
Evgeny Grin
3a6fe0c767
digest: unquote realm and nonce before processing
RFC 7616 (and 2617) requires values to be "unquoted" before used for
digest calculations. The only place where unquoting can be done
correctly is header parsing function (realm="DOMAIN\\host" and
realm=DOMAN\\host are different realms).

This commit adds unquoting (de-escaping) of all values during header
parsing and quoting of the values during header forming. This approach
should be most straightforward and easy to read/maintain as all values
are processed in the same way as required by RFC.

Closes #8912
2022-06-02 08:18:34 +02:00
Daniel Stenberg
f810047f9d
headers: handle unfold of space-cleansed headers
Detected by OSS-fuzz

Bug: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=47767

Updated test 1274

Closes #8947
2022-06-01 15:24:49 +02:00
Daniel Stenberg
bb130871c0
DISABLED: disable 1021 for hyper again
due to flakiness in the CI builds
2022-06-01 09:43:48 +02:00
Daniel Stenberg
ef94c972bc
test681: verify --no-remote-name
Follow-up to 83ee5c428d (from #8931)

Closes #8942
2022-05-31 16:09:53 +02:00
Daniel Stenberg
472831256d
test680: require 'http' since it uses such a URL
Follow-up to d1b376c035
2022-05-31 13:14:28 +02:00
Daniel Stenberg
d1b376c035
test680: verify rejection of malformatted .netrc quoted password 2022-05-31 09:05:01 +02:00
Daniel Stenberg
19f981b4ff
test679: verify netrc quoted string 2022-05-31 09:05:01 +02:00
Daniel Stenberg
4d94fac9f0
headers api: remove EXPERIMENTAL tag
Closes #8900
2022-05-30 14:13:48 +02:00
Marc Hoersken
2d7044a191
tests/data/test1940: use binary mode for expected stdout
The generated stdout data is written in binary mode with [LF]
line endings, therefore we also need to do a binary comparison.

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

Follow up to c9b60f0053
Fixes #8920
Closes #8936
2022-05-30 09:23:41 +02:00
Daniel Stenberg
ba6a3fd3ee
DISABLED: add six tests that fail with hyper
1117 1274 1940 1941 1942 1943
2022-05-25 13:07:12 +02:00
Marc Hoersken
2d5b8048a5
tests/data/test1501: kill ftp server after slow LIST response
This test is contributing to flakiness on the Windows CI runs.
Killing the ftp server after the test run like other slowness
tests already do may help resolve or reduce the flakiness.

Closes #8907
2022-05-25 12:39:52 +02:00
Daniel Stenberg
c9b60f0053
http: restore header folding behavior
Folded header lines will now get passed through like before. The headers
API is adapted and will provide the content unfolded.

Added test 1274 and extended test 1940 to verify.

Reported-by: Petr Pisar
Fixes #8844
Closes #8899
2022-05-24 23:33:47 +02:00
Daniel Gustafsson
a8a1b666c4 ntlm: fix one more hostname test fallout
This fixup was missed in commit 5a41abef6d.

Closes: #8901
Reviewed-by: Daniel Stenberg <daniel@haxx.se>
2022-05-24 12:51:28 +02:00
Daniel Gustafsson
5a41abef6d ntlm: copy NTLM_HOSTNAME to host buffer
Commit 709ae2454f added a fake hostname to avoid leaking the local
hostname, but omitted copying it to the host buffer.  Fix by copying
and adjust the test fallout.

Closes: #8895
Fixes: #8893
Reported-by: Patrick Monnerat <patrick@monnerat.net>
Reviewed-by: Daniel Stenberg <daniel@haxx.se>
2022-05-22 23:26:24 +02:00
Daniel Stenberg
cb41a0169c
tests: update NTLM tests to use new host name
Also drop the debug requirement, remove the setenv sections, remove
prechecks and add NTLM to the top keywords.

Closes #8889
2022-05-20 16:24:13 +02:00
Balakrishnan Balasubramanian
dfa84a0450
socks: support unix sockets for socks proxy
Usage:
  curl -x "socks5h://localhost/run/tor/socks" "https://example.com"

Updated runtests.pl to run a socksd server listening on unix socket

Added tests test1467 test1468

Added documentation for proxy command line option and socks proxy
options

Closes #8668
2022-05-19 15:35:03 +02:00
Daniel Stenberg
b6487eb3d4
test1561: adjusted for the cookie fix 2022-05-19 14:48:26 +02:00
Daniel Stenberg
9ec22e4fe6
test414: verify secure cookie domain overlay 2022-05-19 14:48:26 +02:00
Daniel Stenberg
8d86718f3f
opts: deprecate RANDOM_FILE and EGDSOCKET
These two options were only ever used for the OpenSSL backend for
versions before 1.1.0. They were never used for other backends and they
are not used with recent OpenSSL versions. They were never used much by
applications.

The defines RANDOM_FILE and EGD_SOCKET can still be set at build-time
for ancient EOL OpenSSL versions.

Closes #8670
2022-05-17 11:05:54 +02:00
Daniel Gustafsson
d17db5713a test412/413: Use version macro for User-Agent
Commit 46d45ea3a incorrectly hardcoded the User-Agent in the test
output file which breaks when curlver is updated. Shift to using
the %VERSION macro instead.

Closes: #8856
2022-05-16 10:45:41 +02:00
Daniel Stenberg
3ead914303
test1635: verify --fail-with-body with --retry
Almost a dupe of 1634

Closes #8847
2022-05-16 10:04:21 +02:00
Daniel Stenberg
5227367903
test1919: verify CURLOPT_XOAUTH2_BEARER leak fix 2022-05-14 18:05:20 +02:00
Fabian Keil
75e9035921
tests 266, 116 and 1540: add a small write delay
This makes it more likely that the trailer is received
seperately from the last-chunk.

curl doesn't seem to care about this but it makes the tests
more useful when testing external proxies like Privoxy.
2022-05-11 11:14:18 +02:00
Fabian Keil
9e6ec8b6d5
tests 1117,1238,1523: adjust writedelay servercmds
... so the delays are the same now that the unit
is in milliseconds.
2022-05-11 11:14:18 +02:00
Fabian Keil
fc3a0a872f
tests/server/sws.c: change the HTTP writedelay unit to milliseconds
This allows to use write delays for large responses without
resulting in the test taking an unreasonable amount of time.

In many cases delaying writes by a whole second or more isn't
necessary for the desired effect.

Closes #8827
2022-05-11 11:14:18 +02:00
Daniel Stenberg
f8cb6c610a
test977: reproduce ability to set cookie on TLD
When PSL is not enabled
2022-05-09 16:47:28 +02:00
Daniel Stenberg
43cec1d4f8
test379: verify --remove-on-error with --no-clobber 2022-05-09 12:56:30 +02:00
Daniel Stenberg
ff3ee510c3
test440/441: verify HSTS with trailing dots 2022-05-09 12:54:39 +02:00
Daniel Stenberg
cfa47974fe
libtest/lib1560: verify the host name percent decode fix 2022-05-09 12:50:41 +02:00
Daniel Stenberg
46d45ea3af
test412/413: verify alt-svc with trailing dots 2022-05-09 09:39:22 +02:00
Garrett Squire
652fd3fab8
hyper: fix test 357
This change fixes the hyper API such that PUT requests that receive a
417 response can retry without the Expect header.

Closes #8811
2022-05-08 23:19:05 +02:00
Daniel Stenberg
a8a1dd8ecc
http_proxy/hyper: handle closed connections
Enable test 1021 for hyper builds.

Patched-by: Prithvi MK
Fixes #8700
Closes #8806
2022-05-06 11:01:54 +02:00
Daniel Gustafsson
5d3c57bfaa tests: fix markdown formatting in README
The asterisk in the abbreviation *NIX (for UNIX/Linux) needs to be
escaped to not mean start of italic formatting. This is consistent
with docs/RELEASE-PROCEDURE.md.

Closes: #8802
Reviewed-by: Daniel Stenberg <daniel@haxx.se>
2022-05-05 16:43:38 +02:00
Fabian Keil
4f0bc19bc7 tests/server: declare variable 'reqlogfile' static
Silences the warning:

     CC       socksd-socksd.o
   socksd.c:143:13: warning: no previous extern declaration for
    non-static variable 'reqlogfile' [-Wmissing-variable-declarations]
   const char *reqlogfile = DEFAULT_REQFILE;
               ^
   socksd.c:143:7: note: declare 'static' if the variable is not
    intended to be used outside of this translation unit
   const char *reqlogfile = DEFAULT_REQFILE;
         ^
   1 warning generated.

... when compiling with clang 13.

Closes: #8799
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
2022-05-05 11:55:06 +02:00
Fabian Keil
6db4ef1242
test{898,974,976}: add 'HTTP proxy' keywords
... so the tests can be automatically skipped when
testing external HTTP proxies like Privoxy.

Closes #8791
2022-05-04 23:34:50 +02:00
Philip H
5e9a703cf2
misc: use "autoreconf -fi" instead buildconf
Signed-off-by: Philip H <47042125+pheiduck@users.noreply.github.com>
Closes #8777
2022-05-02 17:53:06 +02:00
Daniel Stenberg
685170b729
data/test376: set a proper name 2022-04-29 09:50:33 +02:00
Daniel Stenberg
cb60b2ccd7
test 898/974/976: require proxy to run
Fixes #8755
Reported-by: Marc Hörsken
Closes #8756
2022-04-27 00:51:12 +02:00
Liam Warfield
aad7d9f9a6
hyper: fix tests 580 and 581 for hyper
Hyper now has the ability to preserve header order. This commit adds a
few lines setting the connection options for this feature.

Related to issue #8617
Closes #8707
2022-04-25 17:33:08 +02:00
Daniel Stenberg
5295e8d64a
tests: verify the fix for CVE-2022-27774
- Test 973 redirects from HTTP to FTP, clear auth
 - Test 974 redirects from HTTP to HTTP different port, clear auth
 - Test 975 redirects from HTTP to FTP, permitted to keep auth
 - Test 976 redirects from HTTP to HTTP different port, permitted to keep
   auth
2022-04-25 16:24:33 +02:00
Daniel Stenberg
afe752e050
test898: verify the fix for CVE-2022-27776
Do not pass on Authorization headers on redirects to another port
2022-04-25 13:05:47 +02:00
Daniel Stenberg
a09a12806e
tool_getparam: error out on missing -K file
Add test 411 to verify.

Reported-by: Median Median Stride
Bug: https://hackerone.com/reports/1542881
Closes #8731
2022-04-25 11:38:50 +02:00
Daniel Stenberg
4ec0549c39
misc: update copyright year ranges 2022-04-25 09:31:09 +02:00
Daniel Stenberg
60452236fa
c_escape: escape '?' in generated --libcurl code
In order to avoid the risk of it being used in an accidental trigraph in
the generated code.

Reported-by: Harry Sintonen
Bug: https://hackerone.com/reports/1548535
Closes #8742
2022-04-25 00:29:22 +02:00
Daniel Stenberg
25d7b5f39a
tests/FILEFORMAT.md: spellfix 2022-04-21 17:01:45 +02:00
Daniel Gustafsson
93cfed2b73 misc: fix typos
Fix a few random typos is comments and workflow names.
2022-04-21 09:43:35 +02:00
Gisle Vanem
6019d652b5 unit1620: call global_init before calling Curl_open
Curl_open calls the resolver init and on Windows if the resolver backend
is c-ares then the Windows sockets library (winsock) must already have
been initialized (via global init).

Ref: https://github.com/curl/curl/pull/8540#issuecomment-1059771800

Closes https://github.com/curl/curl/pull/8719
2022-04-20 02:26:43 -04:00
Marc Hoersken
68035af29d
timediff.[ch]: add curlx helper functions for timeval conversions
Also move timediff_t definitions from timeval.h to timediff.h and
then make timeval.h include the new standalone-capable timediff.h.

Reviewed-by: Jay Satiro
Reviewed-by: Daniel Stenberg

Supersedes #5888
Closes #8595
2022-04-17 13:11:27 +02:00
Balakrishnan Balasubramanian
80eb71a3f5
tests: refactor server/socksd.c to support --unix-socket
Closes #8687
2022-04-17 11:43:57 +02:00
Daniel Stenberg
01a1697a79
curl: error out if -T and -d are used for the same URL
As one implies PUT and the other POST, both cannot be used
simultaneously.

Add test 378 to verify.

Reported-by: Boris Verkhovskiy
Fixes #8704
Closes #8715
2022-04-17 11:18:17 +02:00
Daniel Stenberg
36e09dc302
fail.d: tweak the description
Reviewed-by: Daniel Gustafsson
Suggested-by: Robert Charles Muir
Ref: https://twitter.com/rcmuir/status/1514915401574010887

Closes #8714
2022-04-15 23:50:35 +02:00
Matteo Baccan
0a6eebfc14 perl: removed a double semicolon at end of line
Remove double semicolons at end of line in Perl code.

Closes: #8709
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
2022-04-14 13:55:32 +02:00
Daniel Stenberg
9e8c8b145b
data/DISABLED: disable test 313 on bearssl builds
Closes #8684
2022-04-07 08:36:35 +02:00
Daniel Stenberg
71a0e053e9
runtests: add 'bearssl' as testable feature
Closes #8684
2022-04-07 08:36:27 +02:00
Daniel Stenberg
4a8f6869db
English: use American spelling consistently
Authorization, Initialization, Organization etc.

Closes #8673
2022-04-05 14:55:47 +02:00
Daniel Stenberg
0239a5fbfb
tests/libtest/lib670.c: fixup the copyright year range
follow-up to b54e18640e
2022-03-31 16:04:00 +02:00
Leandro Coutinho
b54e18640e
lib670: avoid double check result
Closes #8660
2022-03-31 14:27:13 +02:00
Daniel Stenberg
5a9d7c4e68
pop3/smtp: return *WEIRD_SERVER_REPLY when not understood
This leaves the CURLE_RECV_ERROR error code for explicit failure to
receive network data and allows users to better separate the problems.

Ref #8356
Reported-by: Rianov Viacheslav
Closes #8506
2022-03-29 14:01:53 +02:00
Daniel Stenberg
e7793cb57b
curl/header_json: output the header names in lowercase
To better allow json[“header”].

Reported-by: Peter Korsgaard
Bug: https://daniel.haxx.se/blog/2022/03/24/easier-header-picking-with-curl/comment-page-1/#comment-25878
Closes #8633
2022-03-25 11:24:27 +01:00
Daniel Stenberg
8e22fc68e7
scripts: move three scripts from lib/ to scripts/
Move checksrc.pl, firefox-db2pem.sh and mk-ca-bundle.pl since they don't
particularly belong in lib/

Also created an EXTRA_DIST= in scripts/Makefile.am instead of specifying
those files in the root Makefile.am

Closes #8625
2022-03-23 15:26:11 +01:00
Marc Hoersken
24f0fec405
tests/server/util.h: align WIN32 condition with util.c
There is no need to test for both _WIN32 and WIN32 as curl_setup.h
automatically defines the later if the first one is defined.

Also tests/server/util.c is only checking for WIN32 arouund the
implementation of win32_perror, so just defining _WIN32
would not be sufficient for a successful compilation.

Reviewed-by: Daniel Stenberg
Reviewed-by: Jay Satiro

Closes #8594
2022-03-23 05:00:04 +01:00
Daniel Stenberg
ba4a8fa4d1
lib1945: fix compiler warning 4706 on MSVC
Follow-up from d1e4a67734

Closes #8623
2022-03-22 16:40:03 +01:00
Daniel Stenberg
23540923e1
test1459: disable for oldlibssh
This test with libssh 0.9.3 works fine on github but fails on circleci.
Might as well disable this test for oldlibssh installations.

Closes #8622
2022-03-22 16:36:10 +01:00
Daniel Stenberg
2e1ef61560
test1135: sync with recent API updates
This test verifies that the order of functions in public headers remain
the same but hasn't been updated to care for recently added header
files. The order is important for some few platforms - or VERSIONINFO
needs to updated.

This fix also updates VERSIONINFO to be sure.

Closes #8620
2022-03-22 14:28:18 +01:00
Daniel Stenberg
7c8c723682
configure: add --enable-headers-api to enable the headers API
Defaults to disabled while labeled EXPERIMENTAL.

Make all the headers API tests require 'headers-api' to run.
2022-03-22 08:24:26 +01:00
Daniel Stenberg
160b640a8b
test1671: verify -w '%{header_json} 2022-03-22 08:24:25 +01:00
Daniel Stenberg
62b60ed1a0
test1670: verify -w %header{} 2022-03-22 08:24:25 +01:00
Daniel Stenberg
d1e4a67734
header api: add curl_easy_header and curl_easy_nextheader
Add test 1940 to 1946 to verify.

Closes #8593
2022-03-22 08:24:22 +01:00
Daniel Stenberg
bdc664a640
test1459: remove the different exit code for oldlibssh
When using libssh/0.9.3/openssl/zlib, we seem to be getting the "right"
error code.

Closes #8490
2022-03-21 17:41:30 +01:00
Daniel Stenberg
dcdf2e8a36
http: return error on colon-less HTTP headers
It's a protocol violation and accepting them leads to no good.

Add test case 398 to verify

Closes #8610
2022-03-21 08:37:24 +01:00
Daniel Stenberg
33fe8251cb
test718: edited slightly to return better HTTP
Since hyper is picky and won't play ball otherwise.

Bug: https://github.com/hyperium/hyper/issues/2783
Reported-by: Daniel Valenzuela
Closes #8614
2022-03-20 22:54:49 +01:00
Daniel Stenberg
7e145dd270
hyper: no h2c support
Make tests require h2c feature present to run, and only set h2c if
nghttp2 is used in the build. Hyper does not support it.

Remove those tests from DISABLED

Fixes #8605
Closes #8613
2022-03-20 16:45:08 +01:00
Marcel Raad
265c50b2f8
test375: fix line endings on Windows
Closes https://github.com/curl/curl/pull/8599
2022-03-17 14:24:14 +01:00
Daniel Stenberg
526e0ef4cb
http: reject header contents with nul bytes
They are not allowed by the protocol and allowing them risk that curl
misbehaves somewhere where C functions are used but won't work on the
full contents. Further, they are not supported by hyper and they cause
problems for the new coming headers API work.

Updated test 262 to verify and enabled it for hyper as well

Closes #8601
2022-03-17 10:17:31 +01:00
Marc Hoersken
8b42d7b9d4
tool and tests: force flush of all buffers at end of program
On Windows data can be lost in buffers in case of abnormal program
termination, especially in process chains as seen due to flaky tests.
Therefore flushing all buffers manually should avoid this data loss.

In the curl tool we play the safe game by only flushing write buffers,
but in the testsuite where we manage all buffers, we flush everything.

This should drastically reduce Windows CI and testsuite flakiness.

Reviewed-by: Daniel Stenberg

Supersedes #7833 and #6064
Closes #8516
2022-03-13 13:29:28 +01:00
HexTheDragon
1831a6e7f1
curl: add --no-clobber
Does not overwrite output files if they already exist

Closes #7708
Co-authored-by: Daniel Stenberg
2022-03-11 08:38:01 +01:00
Daniel Stenberg
08a96c6e4e
curl: add --remove-on-error
If a transfer returns an error, using this option makes curl remove the
leftover downloded (partial) local file before exiting.

Added test 376 to verify

Closes #8503
2022-03-10 19:57:55 +01:00
Daniel Stenberg
3e842078f3
test375: verify that --proxy errors out if proxy is disabled in the build
Closes #8565
2022-03-10 08:31:07 +01:00
Daniel Stenberg
95e8515ca0
curl: error out when options need features not present in libcurl
Trying to use a proxy when libcurl was built with proxy support disabled
should make curl error out properly.

Remove knowledge of disabled features from the tool code and instead
make it properly respond to what libcurl returns. Update all tests to
properly require the necessary features to be present/absent so that the
test suite can still be run even with libcurl builds with disabled
features.

Ref: https://curl.se/mail/archive-2022-03/0013.html
Closes #8565
2022-03-10 08:30:45 +01:00
Dan Fandrich
2583c3d1ce test386: Fix an incorrect test markup tag 2022-03-09 09:49:20 -08:00
Paul Howarth
4b01a57c95
runtests: make 'oldlibssh' be before 0.9.4
The 'oldlibssh' feature indicates that the error code returned by libssh
for a broken known_hosts file should be 67 rather than 60 (test1459).
This feature was added as part of #8444 with 'oldlibssh' mapping to
libssh versions prior to 0.9.6, and then refined as part of #8511 to map
to versions prior to 0.9.5.

In Red Hat Enterprise Linux 8.5 there is a patched version of libssh
version 0.9.4 (https://git.centos.org/rpms/libssh/blob/c8/f/SOURCES) in
which test1459 fails because it returns the "new" value rather than the
"old" one. It's plausible that one of the patches is responsible for
this rather than the underlying code but I don't think so.

This change therefore drops the 'oldlibssh' version check to map to
libssh versions older than 0.9.4, which fixes builds on RHEL-8.

Closes #8548
2022-03-07 08:59:03 +01:00
Jay Satiro
522e46c973 unit1610: init SSL library before calling SHA256 functions
The SSL library must be initialized (via global initialization) because
libcurl's SHA256 functions may call SHA256 functions in the SSL library.

Reported-by: Gisle Vanem

Fixes https://github.com/curl/curl/issues/8538
Closes https://github.com/curl/curl/pull/8540
2022-03-05 03:36:09 -05:00
Daniel Stenberg
c3c736c061
runtests: make 'oldlibssh' be before 0.9.5
Closes #8511
2022-02-26 23:44:53 +01:00
Daniel Stenberg
7c140f6b2d
runtests: set 'oldlibssh' for libssh versions before 0.9.6
... and make test 1459 check for the different return code then.

Closes #8444
2022-02-14 08:26:44 +01:00
Henrik Holst
65c6e37fe3
hostcheck: reduce strlen calls on chained certificates
Closes #8428
2022-02-13 11:42:47 +01:00
Daniel Stenberg
d15692ebba
hostcheck: pass in pattern length too, to avoid a strlen call
Removes one strlen() call per SAN name in a cert-check.

Closes #8418
2022-02-10 08:53:34 +01:00
Daniel Stenberg
ff4bf6bfb5
configure: remove support for "embedded ares"
In March 2010 (commit 4259d2df7d) we removed the embedded 'ares'
directory from the curl source tree but we have since supported
especially detecting and using that build directory. The time has come
to remove that kludge and ask users to specify the c-ares dir correctly
with --enable-ares.

Closes #8397
2022-02-07 23:27:57 +01:00
Daniel Stenberg
47fc8a4be6
CI: move the NSS job from zuul to GHA
Closes #8396
2022-02-07 22:53:23 +01:00
Daniel Stenberg
ba4e67bfc5
tests/unit/Makefile.am: add NSS_LIBS to build with NSS fine
Closes #8396
2022-02-07 22:53:18 +01:00
Daniel Stenberg
9478a97035
lib: move hostcheck and x509sn1 sources to vtls/
... since they are used strictly by TLS code.

Closes #8386
2022-02-05 00:11:33 +01:00
Daniel Stenberg
60d076cee1
tests/disable-scan.pl: properly detect multiple symbols per line
Test 1165 would fail on some systems because it didn't detect
CURL_DISABLE_* symbols that were used to the right of another one on the
same line! The script would only detect and extract the first one.

Reported-by: Marcel Raad
Fixes #8384
Closes #8388
2022-02-04 16:41:57 +01:00
Daniel Stenberg
2610142139
lib: remove support for CURL_DOES_CONVERSIONS
TPF was the only user and support for that was dropped.

Closes #8378
2022-02-04 08:05:35 +01:00
Daniel Stenberg
da15443ddd
TPF: drop support
There has been no TPF related changes done since September 2010 (commit
7e1a45e224) and since this is a platform that is relatively different
than many others (== needs attention), I draw the conclusion that this
build is broken since a long time.

Closes #8378
2022-02-04 08:05:35 +01:00
Fabian Keil
2cb0eaba75 runtests.pl: tolerate test directories without Makefile.inc
Silences the following warnings when using a Makefile.inc-free
TESTDIR using the "-o" argument:

   readline() on closed filehandle D at ./runtests.pl line 592.
   Use of uninitialized value $disttests in pattern match (m//) at
   ./runtests.pl line 3602.

Closes https://github.com/curl/curl/pull/8379
2022-02-03 16:38:36 -05:00
Daniel Stenberg
32160cae84
tool_getparam: initial --json support
Adds these test cases:

 383 - simple single command line option
 384 - reading it from stdin
 385 - getting two --json options on command line
 386 - --next works after --json

Closes #8314
2022-02-01 10:39:55 +01:00
Daniel Stenberg
3b16575ae9
netware: remove support
There are no current users and no Netware related changes done in the
code for over 13 years is a clear sign this is abandoned.

Closes #8358
2022-01-31 13:40:26 +01:00
Jay Satiro
9b8ed6bc3e test3021: disable all msys2 path transformation
- Disable all MSYS2 path transformation in test3021 and test3022.

Prior to this change path transformation in those tests was disabled
only for arguments that start with forward slashes. However arguments
that are in base64 contain forward slashes at any position and caused
unwanted translations.

== Info: Denied establishing ssh session: mismatch sha256 fingerprint.
Remote +/EYG2YDzDGm6yiwepEMSuExgRRMoTi8Di1UN3kixZw= is not equal to
+C:/msys64/EYG2YDzDGm6yiwepEMSuExgRRMoTi8Di1UN3kixZw

In the above example an argument containing a base64 sha256 fingerprint
was passed to curl after MSYS2 translated +/ into +C:/msys64/, and then
the fingerprint didn't match what was expected.

Ref: https://www.msys2.org/wiki/Porting/

Fixes https://github.com/curl/curl/issues/8084
Closes https://github.com/curl/curl/pull/8325
2022-01-28 02:40:16 -05:00
Daniel Stenberg
b27ad8e1d3
url: revert the removal of trailing dot from host name
Reverts 5de8d84098 (May 2014, shipped in 7.37.0) and the
follow-up changes done afterward.

Keep the dot in names for everything except the SNI to make curl behave
more similar to current browsers. This means 'name' and 'name.' send the
same SNI for different 'Host:' headers.

Updated test 1322 accordingly

Fixes #8290
Reported-by: Charles Cazabon
Closes #8320
2022-01-27 08:35:18 +01:00
Daniel Stenberg
4bf593a0de
tests/memanalyze.pl: also count and show "total allocations"
This is the total number of bytes allocated, increasing for new
allocations and never reduced when freed. The existing "Maximum
allocated" is the high water mark.

Closes #8330
2022-01-26 14:34:40 +01:00
Patrick Monnerat
52826d3b79
runtests.pl: disable debuginfod
Valgrind and gdb implement this feature: as this highly slows down tests,
disable it.

Closes #8291
2022-01-17 22:26:52 +01:00
Daniel Stenberg
f6088822ce
misc: remove the final watcom references
Follow-up to bbf8cae44d

We removed support for the watcom builds files back in September
2020. This removes all remaining watcom references and ifdefs.

Closes #8287
2022-01-17 08:49:25 +01:00
Daniel Stenberg
f974bee623
curl: remove "separators" (when using globbed URLs)
Unless muted (with -s) When doing globbing, curl would output mime-like
separators between the separate transfers. This is not documented
anywhere, surprises users and clobbers the output. Gone now.

Updated test 18 and 1235

Reported-by: jonny112 on github
Bug: https://github.com/curl/curl/discussions/8257
Closes #8278
2022-01-15 23:41:28 +01:00
Fabian Keil
e1e9d5af73
test374: gif data without new line at the end
Closes #8239
2022-01-10 15:54:54 +01:00
Fabian Keil
736847611a
runtests.pl: support the nonewline attribute for the data part
Added to FILEFORMAT

Closes #8239
2022-01-10 15:54:54 +01:00
Daniel Stenberg
223f26c28a
mesalink: remove support
Mesalink has ceased development. We can no longer encourage use of it.
It seems to be continued under the name TabbySSL, but no attempts have
(yet) been to make curl support it.

Fixes #8188
Closes #8191
2022-01-10 11:27:59 +01:00
Daniel Stenberg
7edb0fcf3f
ldap: return CURLE_URL_MALFORMAT for bad URL
For consistency, use the same return code for URL malformats,
independently of what scheme that is used. Previously this would return
CURLE_LDAP_INVALID_URL, but starting now that error cannot be returned.

Closes #8170
2022-01-10 09:37:47 +01:00
Daniel Stenberg
1f7234a290
data/DISABLED: disable test 313 for wolfssl builds
It was previously disabled only in the CI jobs yaml

Closes #8252
2022-01-09 18:08:33 +01:00
Daniel Stenberg
cfb4f8b626
runtests: make 'wolfssl' a testable feature
Closes #8252
2022-01-09 18:08:14 +01:00
Daniel Stenberg
4c843fddcf
DISABLE: disable a dozen tests in the rustls build
Disables tests that don't yet work with the rustls backend.

Fixes #8004
Closes #8250
2022-01-09 16:06:19 +01:00
Daniel Stenberg
1fefa1a856
runtests: make 'rustls' a testable feature 2022-01-09 16:06:19 +01:00
Daniel Stenberg
d1237ac906
url: given a user in the URL, find pwd for that user in netrc
Add test 380 and 381 to verify, edited test 133

Reported-by: Manfred Schwarb
Fixes #8241
Closes #8243
2022-01-09 14:16:41 +01:00
Daniel Stenberg
764e4f066d
tool_findfile: check ~/.config/curlrc too
... after the initial checks for .curlrc and if XDG_CONFIG_HOME is not
set, use $HOME and $CURL_HOME to check if ~/.config/curlrc is present.

Add test 436 to verify

Reported-by: Sandro Jaeckel
Fixes #8208
Closes #8213
2022-01-07 10:10:49 +01:00
Daniel Stenberg
4432234aca
runtests: allow client/file to specify multiple directories
... and make sure to mkdir them all
2022-01-07 10:08:35 +01:00
Fabian Keil
8742729827
tests/FILEFORMAT.md: fix typo 2022-01-07 10:01:44 +01:00
Fabian Keil
5da22337fe
Add test373: multiple chunks with binary zeros 2022-01-07 10:01:44 +01:00
Fabian Keil
33d0503103
Add test372: binary zero in data element 2022-01-07 10:01:44 +01:00
Fabian Keil
592880a3ca
tests/server/getpart.c: properly deal with binary data containing NUL bytes 2022-01-07 10:01:44 +01:00
Fabian Keil
43eef423d6
runtests.pl: properly print the test if it contains binary zeros 2022-01-07 10:01:44 +01:00
Daniel Stenberg
99c42919d0
test719-721: require "proxy" feature present to run
Bug: https://github.com/curl/curl/pull/8223#issuecomment-1005188696
Reported-by: Marc Hörsken

Closes #8226
2022-01-05 00:35:21 +01:00
Daniel Stenberg
47f03aa2c6
test719: require ipv6 support to run
Follow-up to effd2bd7ba
Reported-by: Marc Hörsken
Bug: https://github.com/curl/curl/pull/8217#issuecomment-1004681145

Closes #8223
2022-01-04 11:47:44 +01:00
Daniel Stenberg
dbbf3609f3
test719-721: verify SOCKS details
Using the new verify/socks details
2022-01-03 22:32:05 +01:00
Daniel Stenberg
d2f712ddd0
runtests: add verify/socks check
If used, this data is compared with the data in log/socksd-request.log
which the socksd server logs.

Added to FILEFORMAT.md
2022-01-03 22:32:05 +01:00
Daniel Stenberg
61cbb4b626
server/socksd: log atyp + address in a separate log
To allow the test suite to verify that the right data arrived
2022-01-03 22:32:05 +01:00
Daniel Stenberg
effd2bd7ba
socks5: use appropriate ATYP for numerical IP address host names
When not resolving the address locallly (known as socks5h).

Add test 719 and 720 to verify.

Reported-by: Peter Piekarski
Fixes #8216
Closes #8217
2022-01-03 22:32:05 +01:00
Daniel Stenberg
c1a4f3e815
libtest: avoid "assignment within conditional expression"
In lib530, lib540 and lib582

Closes #8218
2022-01-03 17:05:36 +01:00
Daniel Stenberg
ee2ca5826b
tool_operate: warn if too many output arguments were found
More output instructions than URLs is likely a user error.

Add test case 371 to verify

Closes #8210
2022-01-03 15:55:38 +01:00
Daniel Stenberg
eec5ce4ab4
urlapi: if possible, shorten given numerical IPv6 addresses
Extended test 1560 to verify

Closes #8206
2022-01-02 22:59:08 +01:00
Daniel Stenberg
d8f6e5dc8e
misc: update copyright year range 2021-12-30 14:17:47 +01:00
Daniel Stenberg
21248e052d
checksrc: detect more kinds of NULL comparisons we avoid
Co-authored-by: Jay Satiro
Closes #8180
2021-12-27 23:39:26 +01:00
Vladimir Panteleev
2c1dbc1af0
tests: Add test for CURLOPT_HTTP200ALIASES 2021-12-21 08:45:06 +01:00
Daniel Stenberg
7a92f865b4
misc: s/e-mail/email
Consistency is king. Following the lead in everything curl.

Closes #8159
2021-12-19 23:48:13 +01:00
Daniel Stenberg
c9e0549113
x509asn1: return early on errors
Overhaul to make sure functions that detect errors bail out early with
error rather than trying to continue and risk hiding the problem.

Closes #8147
2021-12-15 08:19:29 +01:00
Marc Hoersken
52202691d1
tests/data/test302[12]: fix MSYS2 path conversion of hostpubsha256
Ref: https://www.msys2.org/wiki/Porting/#filesystem-namespaces

Reviewed-by: Marcel Raad
Reviewed-by: Jay Satiro

Fixes #8084
Closes #8138
2021-12-14 07:43:16 +01:00
Daniel Stenberg
254f7bd78a
hash: lazy-alloc the table in Curl_hash_add()
This makes Curl_hash_init() infallible which saves error paths.

Closes #8132
2021-12-10 23:16:43 +01:00
Daniel Stenberg
439aa50211
test1156: fixup the stdout check for Windows
It is not text mode.

Follow-up to 6f73e68d18

Closes #8134
2021-12-10 17:00:37 +01:00
Daniel Stenberg
96c815c22e
test1528: enable for hyper
Closes #8128
2021-12-09 23:32:39 +01:00
Daniel Stenberg
b63bb77c79
test1527: enable for hyper
Closes #8128
2021-12-09 23:32:36 +01:00
Daniel Stenberg
34f090a5cc
test1526: enable for hyper
Closes #8128
2021-12-09 23:32:33 +01:00
Daniel Stenberg
8d0d5859e0
test1525: slightly tweaked for hyper
Closes #8128
2021-12-09 23:32:25 +01:00
Daniel Stenberg
6f73e68d18
test1156: enable for hyper
Minor reorg of the lib1156 code and it works fine for hyper.

Closes #8127
2021-12-09 23:30:34 +01:00
Daniel Stenberg
fde1f1bfe9
test661: enable for hyper
Closes #8126
2021-12-09 23:29:04 +01:00
Daniel Stenberg
f443834c7a
lib530: abort on curl_multi errors
This makes torture tests run more proper.

Also add an assert to trap situations where it would end up with no
sockets to wait for.

Closes #8121
2021-12-09 10:16:24 +01:00
Daniel Stenberg
45c6448e68
test1556: adjust for hyper
Closes #8105
2021-12-07 17:11:51 +01:00
Daniel Stenberg
1bea122114
test1554: adjust for hyper
Closes #8104
2021-12-07 17:09:14 +01:00
Daniel Stenberg
2b3dd01b77
multi: handle errors returned from socket/timer callbacks
The callbacks were partially documented to support this. Now the
behavior is documented and returning error from either of these
callbacks will effectively kill all currently ongoing transfers.

Added test 530 to verify

Reported-by: Marcelo Juchem
Fixes #8083
Closes #8089
2021-12-06 14:55:52 +01:00
Daniel Stenberg
92d1aee8b1
urlapi: accept port number zero
This is a regression since 7.62.0 (fb30ac5a2d).

Updated test 1560 accordingly

Reported-by: Brad Fitzpatrick
Fixes #8090
Closes #8091
2021-12-03 22:58:41 +01:00
Dan Fandrich
48cbd8f713 tests: Add some missing keywords to tests
These are needed to skip some tests when configure options have disabled
certain features.
2021-11-30 18:32:53 -08:00
Glenn Strauss
aae235b6ba
digest: compute user:realm:pass digest w/o userhash
https://datatracker.ietf.org/doc/html/rfc7616#section-3.4.4
  ... the client MUST calculate a hash of the username after
      any other hash calculation ...

Signed-off-by: Glenn Strauss <gstrauss@gluelogic.com>
Closes #8066
2021-11-30 13:57:46 +01:00
Daniel Stenberg
230bb3e278
docs: consistent manpage SYNOPSIS
Make all libcurl related options use .nf (no fill) for the SYNOPSIS
section - for consistent look. roffit then renders that section using
<pre> (monospace font) in html for the website.

Extended manpage-syntax (test 1173) with a basic check for it.

Closes #8062
2021-11-26 16:51:23 +01:00
Daniel Stenberg
4183b8fe9a
urlapi: provide more detailed return codes
Previously, the return code CURLUE_MALFORMED_INPUT was used for almost
30 different URL format violations. This made it hard for users to
understand why a particular URL was not acceptable. Since the API cannot
point out a specific position within the URL for the problem, this now
instead introduces a number of additional and more fine-grained error
codes to allow the API to return more exactly in what "part" or section
of the URL a problem was detected.

Also bug-fixes curl_url_get() with CURLUPART_ZONEID, which previously
returned CURLUE_OK even if no zoneid existed.

Test cases in 1560 have been adjusted and extended. Tests 1538 and 1559
have been updated.

Updated libcurl-errors.3 and curl_url_strerror() accordingly.

Closes #8049
2021-11-25 08:36:04 +01:00
Kevin Burke
cc2870e275
tests/CI.md: add more information on CI environments
Fixes #8012
Closes #8022
2021-11-23 09:38:44 +01:00
Daniel Stenberg
3e6eb18fce
urlapi: reject short file URLs
file URLs that are 6 bytes or shorter are not complete. Return
CURLUE_MALFORMED_INPUT for those. Extended test 1560 to verify.

Triggered by #8041
Closes #8042
2021-11-23 08:45:21 +01:00
Daniel Stenberg
6e061ae63a
http: enable haproxy support for hyper backend
This is done by having native code do the haproxy header output before
hyper issues its request. The little downside with this approach is that
we need the entire Curl_buffer_send() function built, which is otherwise
not used for hyper builds.

If hyper ends up getting native support for the haproxy protocols we can
backpedal on this.

Enables test 1455 and 1456

Closes #8034
2021-11-19 14:06:42 +01:00
Patrick Monnerat
b20b364764
mime: use percent-escaping for multipart form field and file names
Until now, form field and file names where escaped using the
backslash-escaping algorithm defined for multipart mails. This commit
replaces this with the percent-escaping method for URLs.

As this may introduce incompatibilities with server-side applications, a
new libcurl option CURLOPT_MIME_OPTIONS with bitmask
CURLMIMEOPT_FORMESCAPE is introduced to revert to legacy use of
backslash-escaping. This is controlled by new cli tool option
--form-escape.

New tests and documentation are provided for this feature.

Reported by: Ryan Sleevi
Fixes #7789
Closes #7805
2021-11-15 10:40:03 +01:00
Daniel Stenberg
b7e1443a1d
test1939: require proxy support to run
Follow-up to f0b7099a10

Closes #8011
2021-11-14 16:14:52 +01:00
Daniel Stenberg
4825d0cd3a
test302[12]: run only with the libssh2 backend
... as the others don't support --hostpubsha256

Reported-by: Paul Howarth
Fixes #8009
Closes #8010
2021-11-14 16:13:50 +01:00
Daniel Stenberg
f4cafa4f0d
runtests: make the SSH library a testable feature
libssh2, libssh and wolfssh
2021-11-14 16:13:44 +01:00
Daniel Stenberg
26247a0d7e
lib1939: make it endure torture tests
Follow-up to f0b7099a10

Closes #8007
2021-11-13 22:44:34 +01:00
Daniel Stenberg
f0b7099a10
multi: shut down CONNECT in Curl_detach_connnection
... to prevent a lingering pointer that would lead to a double-free.

Added test 1939 to verify.

Reported-by: Stephen M. Coakley
Fixes #7982
Closes #7986
2021-11-11 08:42:31 +01:00
Marc Hoersken
b3e1ed3160
tests: add Schannel-specific tests and disable unsupported ones
Adds Schannel variants of SSLpinning tests that include the option
--ssl-revoke-best-effort to ignore certificate revocation check
failures which is required due to our custom test CA certificate.

Disable the original variants if the Schannel backend is enabled.

Also skip all IDN tests which are broken while using an msys shell.

This is a step to simplify test exclusions for Windows and MinGW.

Reviewed-by: Jay Satiro
Reviewed-by: Marcel Raad
Reviewed-by: Daniel Stenberg
Closes #7968
2021-11-09 06:34:33 +01:00
Daniel Stenberg
eccaa83cee
test1173: make manpage-syntax.pl spot \n errors in examples 2021-11-05 08:28:30 +01:00
Daniel Stenberg
cc71d35265
tool_operate: a failed etag save now only fails that transfer
When failing to create the output file for saving an etag, only fail
that particular single transfer and allow others to follow.

In a serial transfer setup, if no transfer at all is done due to them
all being skipped because of this error, curl will output an error
message and return exit code 26.

Added test 369 and 370 to verify.

Reported-by: Earnestly on github
Ref: #7942
Closes #7945
2021-11-04 13:56:15 +01:00
Marc Hoersken
d52316e460
tests/smbserver.py: fix compatibility with impacket 0.9.23+
impacket now performs sanity checks if the requested and to
be served file path actually is inside the real share path.

Ref: https://github.com/SecureAuthCorp/impacket/pull/1066

Fixes #7924
Closes #7935
2021-11-01 20:50:35 +01:00
Marc Hoersken
33dc399474
tests: kill some test servers afterwards to avoid locked logfiles
Reviewed-by: Daniel Stenberg
Closes #7925
2021-11-01 12:11:17 +01:00
Marc Hoersken
9121032fe3
CI/runtests.pl: restore -u flag, but remove it from CI runs
This makes it possible to use -u again for local testing,
but removes the flag from CI config files and make targets.

Reviewed-by: Daniel Stenberg

Partially reverts #7841
Closes #7921
2021-10-31 11:28:25 +01:00
Daniel Stenberg
6204aab43a
test1160: edited to work with hyper
Closes #7912
2021-10-27 22:58:21 +02:00
Daniel Stenberg
3b24b91019
data/DISABLED: enable tests that now work with hyper
Closes #7911
2021-10-27 22:57:29 +02:00
Daniel Stenberg
ba9477345e
test559: add 'HTTP' in keywords
Makes it run fine with hyper

Closes #7911
2021-10-27 22:57:26 +02:00
Daniel Stenberg
df84a79711
test552: updated to work with hyper
Closes #7911
2021-10-27 22:57:17 +02:00
Daniel Stenberg
c67a32fc56
http: reject HTTP response codes < 100
... which then also includes negative ones as test 1430 uses.

This makes native + hyper backend act identically on this and therefore
test 1430 can now be enabled when building with hyper. Adjust test 1431
as well.

Closes #7909
2021-10-27 10:26:15 +02:00
Daniel Stenberg
8d9af7062b
hyper: disable test 1294 since hyper doesn't allow such crazy headers
Closes #7905
2021-10-25 23:32:45 +02:00
Daniel Stenberg
bc8674d87d
c-hyper: make CURLOPT_SUPPRESS_CONNECT_HEADERS work
Verified by the enabled test 1288

Closes #7905
2021-10-25 23:32:45 +02:00
Daniel Stenberg
f9910e85fa
test1287: make work on hyper
Closes #7905
2021-10-25 23:32:45 +02:00
Daniel Stenberg
5c26764cd5
test1266/1267: disabled on hyper: no HTTP/0.9 support
Closes #7905
2021-10-25 23:32:44 +02:00
Daniel Stenberg
24155569d8
man pages: require all to use the same section header order
This is the same order we already enforce among the options' man pages:
consistency is good. Add lots of previously missing examples.

Adjust the manpage-syntax script for this purpose, used in test 1173.

Closes #7904
2021-10-25 12:57:01 +02:00
Daniel Stenberg
7c7b32db2b
tests: enable more tests with hyper
Adjusted 1144, 1164 and 1176.

Closes #7900
2021-10-25 10:47:00 +02:00
Samuel Henrique
352077b4d3
tests: use python3 in test 1451
This is a continuation of commit ec91b5a690 in which
changing this test was missed.  There are no other python2 leftovers
now.

Based on a Debian patch originally written by Alessandro Ghedini
<ghedo@debian.org>

Closes #7899
2021-10-24 21:19:40 +02:00
Daniel Stenberg
1732502cb0
hyper: does not support disabling CURLOPT_HTTP_TRANSFER_DECODING
Simply because hyper doesn't have this ability. Mentioned in docs now.

Skip test 326 then

Closes #7889
2021-10-22 12:54:08 +02:00
Daniel Stenberg
f852f908a9
test262: don't attempt with hyper
This test verifies that curl works with binary zeroes in HTTP response
headers and hyper refuses such. They're not kosher http.

Closes #7889
2021-10-22 12:54:04 +02:00
Daniel Stenberg
cf088201a9
c-hyper: make test 217 run
Closes #7889
2021-10-22 12:54:00 +02:00
Daniel Stenberg
a76f3c592b
DISABLED: enable test 209+213 for hyper
Follow-up to 823d3ab855

Closes #7889
2021-10-22 12:53:57 +02:00
Daniel Stenberg
7b4d44e045
test207: accept a different error code for hyper
It returns HYPERE_UNEXPECTED_EOF for this case which we convert to the
somewhat generic CURLE_RECV_ERROR.

Closes #7889
2021-10-22 12:53:46 +02:00
Daniel Stenberg
823d3ab855
http_proxy: multiple CONNECT with hyper done better
Enabled test 206

Closes #7888
2021-10-21 17:28:27 +02:00
Daniel Stenberg
c75f14cb9d
test1185: verify checksrc
Closes #7866
2021-10-18 23:52:30 +02:00
Daniel Stenberg
53418dbc84
checksrc: ignore preprocessor lines
In order to check the actual code better, checksrc now ignores
everything that look like preprocessor instructions. It also means
that code in macros are now longer checked.

Note that some rules then still don't need to be followed when code is
exactly below a cpp instruction.

Removes two checksrc exceptions we needed previously because of
preprocessor lines being checked.

Reported-by: Marcel Raad
Fixes #7863
Closes #7864
2021-10-17 11:19:49 +02:00
Daniel Stenberg
efffa66f65
urlapi: skip a strlen(), pass in zero
... to let curl_easy_escape() itself do the strlen. This avoids a (false
positive) Coverity warning and it avoids us having to store the strlen()
return value in an int variable.

Reviewed-by: Daniel Gustafsson
Closes #7862
2021-10-15 23:22:14 +02:00
Daniel Stenberg
ccb466fd36
misc: update copyright years 2021-10-15 17:07:19 +02:00
Abhinav Singh
8c6f126279
aws-sigv4: make signature work when post data is binary
User sets the post fields size for binary data.  Hence, we should not be
using strlen on it.

Added test 1937 and 1938 to verify.

Closes #7844
2021-10-15 08:46:23 +02:00
Jay Satiro
afd489885e sws: fix memory leak on exit
- Free the allocated http request struct on cleanup.

Prior to this change if sws was built with leak sanitizer it would
report a memory leak error during testing.

Closes https://github.com/curl/curl/pull/7849
2021-10-14 03:24:18 -04:00
Борис Верховский
3aead057a1
curl: correct grammar in generated libcurl code
Closes #7802
2021-10-13 00:33:20 +02:00
Daniel Stenberg
3723ba62a5
tests: disable test 2043
It uses revoked.badssl.com which now is expired and therefor this now
permafails. We should not use external sites for tests, this test should
be converted to use our own infra.

Closes #7845
2021-10-13 00:02:30 +02:00
Daniel Stenberg
8a534f8838
runtests: split out ignored tests
Report ignore tests separately from the actual fails.

Don't exit non-zero if test servers couldn't get killed.

Assisted-by: Jay Satiro

Fixes #7818
Closes #7841
2021-10-12 17:00:50 +02:00
Daniel Stenberg
e38d2e5a50
test368: verify dash is appended for "-r [num]"
Follow-up to 8758a26f88
2021-10-11 22:52:30 +02:00
Daniel Stenberg
9a8564a920
urlapi: URL decode percent-encoded host names
The host name is stored decoded and can be encoded when used to extract
the full URL. By default when extracting the URL, the host name will not
be URL encoded to work as similar as possible as before. When not URL
encoding the host name, the '%' character will however still be encoded.

Getting the URL with the CURLU_URLENCODE flag set will percent encode
the host name part.

As a bonus, setting the host name part with curl_url_set() no longer
accepts a name that contains space, CR or LF.

Test 1560 has been extended to verify percent encodings.

Reported-by: Noam Moshe
Reported-by: Sharon Brizinov
Reported-by: Raul Onitza-Klugman
Reported-by: Kirill Efimov
Fixes #7830
Closes #7834
2021-10-11 17:04:14 +02:00
Marc Hoersken
ab1671cafe
CI/makefiles: introduce dedicated test target
Make it easy to use the same set of test flags
throughout all current and future CI builds.

Reviewed-by: Jay Satiro

Follow up to #7690
Closes #7785
2021-10-08 20:16:15 +02:00
Daniel Stenberg
87907d56f0
http: fix Basic auth with empty name field in URL
Add test 367 to verify.

Reported-by: Rick Lane
Fixes #7819
Closes #7820
2021-10-06 22:45:52 +02:00
Jeffrey Tolar
5f563495f1
CURLOPT_MAXLIFETIME_CONN: maximum allowed lifetime for conn reuse
... and close connections that are too old instead of reusing them.

By default, this behavior is disabled.

Bug: https://curl.se/mail/lib-2021-09/0058.html
Closes #7751
2021-10-06 14:38:59 +02:00
Daniel Stenberg
24ffdc8826
print_category: print help descriptions aligned
Adjust the description position to make an aligned column when doing
help listings, which is more pleasing to the eye.

Suggested-by: Gisle Vanem
Closes #7792
2021-10-01 08:35:59 +02:00
Daniel Stenberg
ffb634d4ef
tool_listhelp: easier to generate with gen.pl
tool_listhelp.c is now a separate file with only the command line --help
output, exactly as generated by gen.pl. This makes it easier to generate
updates according to what's in the docs/cmdline-opts docs.

  cd $srcroot/docs/cmdline-opts
  ./gen.pl listhelp *.d > $srcroot/src/tool_listhelp.c

With a configure build, this also works:

  make -C src listhelp

Closes #7787
2021-09-30 17:50:48 +02:00
Daniel Stenberg
acfe94c08f
scripts/copyright: .muse is .lift now
And update 5 files with old copyright year range
2021-09-28 16:42:18 +02:00
Max Dymond
a517378de5
CURLOPT_PREREQFUNCTION: add new callback
Triggered before a request is made but after a connection is set up

Changes:

- callback: Update docs and callback for pre-request callback
- Add documentation for CURLOPT_PREREQDATA and CURLOPT_PREREQFUNCTION,
- Add redirect test and callback failure test
- Note that the function may be called multiple times on a redirection
- Disable new 2086 test due to Windows weirdness

Closes #7477
2021-09-27 17:16:43 +02:00
Sergey Markelov
4b997626b1
urlapi: support UNC paths in file: URLs on Windows
- file://host.name/path/file.txt is a valid UNC path
  \\host.name\path\files.txt to a non-local file transformed into URI
  (RFC 8089 Appendix E.3)

- UNC paths on other OSs must be smb: URLs

Closes #7366
2021-09-27 08:32:41 +02:00
i-ky
3363eeb262
urlapi: add curl_url_strerror()
Add curl_url_strerror() to convert CURLUcode into readable string and
facilitate easier troubleshooting in programs using URL API.
Extend CURLUcode with CURLU_LAST for iteration in unit tests.
Update man pages with a mention of new function.
Update example code and tests with new functionality where it fits.

Closes #7605
2021-09-27 08:28:46 +02:00
Mats Lindestam
d1e7d9197b
libssh2: add SHA256 fingerprint support
Added support for SHA256 fingerprint in command line curl and in
libcurl.

Closes #7646
2021-09-26 23:20:53 +02:00
Rikard Falkeborn
e75be2c4b2
cleanup: constify unmodified static structs
Constify a number of static structs that are never modified. Make them
const to show this.

Closes #7759
2021-09-23 12:54:35 +02:00
Daniel Stenberg
883cf374d8
test897: verify delivery of IMAP post-body header content
The "content" is delivered as "body" by curl, but the envelope continues
after the body and the rest of it should be delivered as header.

The IMAP server can now get 'POSTFETCH' set to include more data to
include after the body and test 897 is done to verify that such "extra"
header data is in fact delivered by curl as header.

Ref: #7284 but fails to reproduce the issue

Closes #7748
2021-09-21 08:18:42 +02:00
Daniel Stenberg
beb8990d93
http: fix the broken >3 digit response code detection
When the "reason phrase" in the HTTP status line starts with a digit,
that was treated as the forth response code digit and curl would claim
the response to be non-compliant.

Added test 1466 to verify this case.

Regression brought by 5dc594e44f
Reported-by: Glenn de boer
Fixes #7738
Closes #7739
2021-09-17 17:52:00 +02:00
Daniel Stenberg
da2598f823
hsts: CURLSTS_FAIL from hsts read callback should fail transfer
... and have CURLE_ABORTED_BY_CALLBACK returned.

Extended test 1915 to verify.

Reported-by: Jonathan Cardoso
Fixes #7726
Closes #7729
2021-09-16 12:36:12 +02:00
Daniel Stenberg
5b7aaefc07
test1184: disable
The test should be fine and it works for me repeated when run manually,
but clearly it causes CI failures and it needs more research.

Reported-by: RiderALT on github
Fixes #7725
Closes #7732
2021-09-16 12:16:48 +02:00
Kamil Dudka
ab78d2c679 tests/sshserver.pl: make it work with openssh-8.7p1
... by not using options with no argument where an argument is required:

=== Start of file tests/log/ssh_server.log
curl_sshd_config line 6: no argument after keyword "DenyGroups"
curl_sshd_config line 7: no argument after keyword "AllowGroups"
curl_sshd_config line 10: Deprecated option AuthorizedKeysFile2
curl_sshd_config line 29: Deprecated option KeyRegenerationInterval
curl_sshd_config line 39: Deprecated option RhostsRSAAuthentication
curl_sshd_config line 40: Deprecated option RSAAuthentication
curl_sshd_config line 41: Deprecated option ServerKeyBits
curl_sshd_config line 45: Deprecated option UseLogin
curl_sshd_config line 56: no argument after keyword "AcceptEnv"
curl_sshd_config: terminating, 3 bad configuration options
=== End of file tests/log/ssh_server.log

=== Start of file log/sftp_server.log
curl_sftp_config line 33: Unsupported option "rhostsrsaauthentication"
curl_sftp_config line 34: Unsupported option "rsaauthentication"
curl_sftp_config line 52: no argument after keyword "sendenv"
curl_sftp_config: terminating, 1 bad configuration options
Connection closed.
Connection closed
=== End of file log/sftp_server.log

Closes #7724
2021-09-16 08:37:25 +02:00
Daniel Stenberg
54f6d836d8
hsts: handle unlimited expiry
When setting a blank expire string, meaning unlimited, curl would pass
TIME_T_MAX to getime_r() when creating the output, while on 64 bit
systems such a large value cannot be convetered to a tm struct making
curl to exit the loop with an error instead. It can't be converted
because the year it would represent doesn't fit in the 'int tm_year'
field!

Starting now, unlimited expiry is instead handled differently by using a
human readable expiry date spelled out as "unlimited" instead of trying
to use a distant actual date.

Test 1660 and 1915 have been updated to help verify this change.

Reported-by: Jonathan Cardoso
Fixes #7720
Closes #7721
2021-09-15 14:37:36 +02:00
Patrick Monnerat
8ef147c436
ftp,imap,pop3,smtp: reject STARTTLS server response pipelining
If a server pipelines future responses within the STARTTLS response, the
former are preserved in the pingpong cache across TLS negotiation and
used as responses to the encrypted commands.

This fix detects pipelined STARTTLS responses and rejects them with an
error.

CVE-2021-22947

Bug: https://curl.se/docs/CVE-2021-22947.html
2021-09-13 16:51:31 +02:00
Patrick Monnerat
364f174724
ftp,imap,pop3: do not ignore --ssl-reqd
In imap and pop3, check if TLS is required even when capabilities
request has failed.

In ftp, ignore preauthentication (230 status of server greeting) if TLS
is required.

Bug: https://curl.se/docs/CVE-2021-22946.html

CVE-2021-22946
2021-09-13 16:51:31 +02:00
Daniel Stenberg
4a8fa48946
http_proxy: fix the User-Agent inclusion in CONNECT
It should not refer to the uagent string that is allocated and created
for the end server http request, as that pointer may be cleared on
subsequent CONNECT requests.

Added test case 1184 to verify.

Reported-by: T200proX7 on github
Fixes #7705
Closes #7707
2021-09-13 12:29:59 +02:00
Marc Hoersken
60efeb1e0d
runtests: add option -u to error on server unexpectedly alive
Let's try to actually handle the server unexpectedly alive
case by first making them visible on CI builds as failures.

This is needed to detect issues with killing of the test
servers completely including nested process chains with
multiple PIDs per test server (including bash and perl).

On Windows/cygwin platforms this is especially helpful with
debugging PID mixups due to cygwin using its own PID space.

Reviewed-by: Daniel Stenberg
Closes #7180
2021-09-09 21:28:26 +02:00
Daniel Stenberg
d9b2d1d90f
copyrights: update copyright year ranges 2021-09-08 09:36:49 +02:00
Daniel Stenberg
eb2a5171da
curl: stop retry if Retry-After: is longer than allowed
If Retry-After: specifies a period that is longer than what fits within
--retry-max-time, then stop retrying immediately.

Added test 366 to verify.

Reported-by: Kari Pahula
Fixes #7675
Closes #7676
2021-09-06 14:46:45 +02:00
Daniel Stenberg
8fbdf8331e
test1173: check references to libcurl options
... that they refer to actual existing libcurl options.

Reviewed-by: Daniel Gustafsson
Closes #7656
2021-09-04 11:27:56 +02:00
Daniel Stenberg
12a2ed970f
opt-docs: verify man page sections + order
In every libcurl option man page there are now 8 mandatory sections that
must use the right name in the correct order and test 1173 verifies
this. Only 14 man pages needed adjustments.

The sections and the order is as follows:

 - NAME
 - SYNOPSIS
 - DESCRIPTION
 - PROTOCOLS
 - EXAMPLE
 - AVAILABILITY
 - RETURN VALUE
 - SEE ALSO

Reviewed-by: Daniel Gustafsson
Closes #7656
2021-09-04 11:27:46 +02:00
Daniel Stenberg
1731a77989
opt-docs: make sure all man pages have examples
Extended manpage-syntax.pl (run by test 1173) to check that every man
page for a libcurl option has an EXAMPLE section that is more than two
lines. Then fixed all errors it found and added examples.

Reviewed-by: Daniel Gustafsson
Closes #7656
2021-09-04 11:27:04 +02:00
Daniel Stenberg
424051d78b
connect: get local port + ip also when reusing connections
Regression. In d6a37c23a3 (7.75.0) we removed the duplicated storage
(connection + easy handle), so this info needs be extracted again even
for re-used connections.

Add test 435 to verify

Reported-by: Max Dymond
Fixes #7660
Closes #7662
2021-09-02 23:42:18 +02:00
Daniel Stenberg
3f4b1b4ee5
tests: adjust the tftpd output to work with hyper mode
By making them look less like http headers, the hyper mode "tweak"
doesn't interfere.

Enable test 2002 and 2003 in hyper builds (and 1280 which is unrelated
but should be enabled).

Closes #7658
2021-09-01 23:40:28 +02:00
Daniel Stenberg
e8c8775eaa
test365: verify response with chunked AND Content-Length headers 2021-08-31 10:04:03 +02:00
Daniel Stenberg
8a16e54c0c
http: ignore content-length if any transfer-encoding is used
Fixes #7643
Closes #7649
2021-08-31 10:04:03 +02:00
Daniel Stenberg
5dc594e44f
http: disallow >3-digit response codes
Make the built-in HTTP parser behave similar to hyper and reject any
HTTP response using more than 3 digits for the response code.

Updated test 1432 accordingly.
Enabled test 1432 in the hyper builds.

Closes #7641
2021-08-26 22:43:38 +02:00
Daniel Stenberg
9df52bf17a
test1280: CRLFify the response to please hyper
Closes #7639
2021-08-26 16:17:10 +02:00
Daniel Stenberg
9a30ac0957
tests: enable test 1129 for hyper builds
Closes #7638
2021-08-26 16:15:48 +02:00
Daniel Stenberg
e5d77dc2ca
c-hyper: handle HTTP/1.1 => HTTP/1.0 downgrade on reused connection
Enable test 1074

Closes #7617
2021-08-23 16:12:33 +02:00
Daniel Stenberg
38941ad6f3
c-hyper: deal with Expect: 100-continue combined with POSTFIELDS
Enable test 1130 and 1131

Closes #7616
2021-08-23 16:10:15 +02:00
a1346054
ec91b5a690
tests: be explicit about using 'python3' instead of 'python'
This fixes running tests in virtualenvs (or on distros) that no longer
have a symlink from python to python2 or python3.

Closes #7602
2021-08-23 15:59:43 +02:00
Daniel Stenberg
473b893c7e
DISABLED: enable 11 more tests for hyper builds
Closes #7612
2021-08-23 11:24:25 +02:00
Daniel Stenberg
46d4373ea7
setopt: enable CURLOPT_IGNORE_CONTENT_LENGTH for hyper
Since this option is also used for FTP, it needs to work to set for
applications even if hyper doesn't support it for HTTP. Verified by test
1137.

Updated docs to specify that the option doesn't work for HTTP when using
the hyper backend.

Closes #7614
2021-08-23 11:23:17 +02:00
Daniel Stenberg
0854781c18
test1138: remove trailing space to make work with hyper
Closes #7613
2021-08-23 11:21:38 +02:00
Daniel Stenberg
4e53b9430c
man pages: remove trailing whitespaces
Extended test 1173 (via the manpage-syntax.pl script) to detect and warn
for them.

Ref: #7602
Reported-by: a1346054 on github
Closes #7604
2021-08-21 16:44:03 +02:00
Daniel Stenberg
059379d20c
http_proxy: fix user-agent and custom headers for CONNECT with hyper
Enable test 287

Closes #7598
2021-08-20 13:51:06 +02:00
Daniel Stenberg
f46b83fc94
c-hyper: initial support for "dumping" 1xx HTTP responses
With the use hyper_request_on_informational()

Enable test 155 and 158

Closes #7597
2021-08-20 13:37:43 +02:00
Marc Hoersken
5b1c2dd1db
tests/*server.pl: flush output before executing subprocess
Also avoid shell processes staying around by using exec.
This is necessary to avoid output data being buffering
inside the process chain of Perl, Bash/Shell and our
test server binaries. On non-Windows systems the exec
will also make the subprocess replace the intermediate
shell, but on Windows it will at least bind the processes
together since there is no real fork or exec available.

See: https://cygwin.com/cygwin-ug-net/highlights.html
and: https://docs.microsoft.com/cpp/c-runtime-library/exec-wexec-functions
Ref: https://github.com/curl/curl/pull/7530#issuecomment-900949010

Reviewed-by: Daniel Stenberg
Reviewed-by: Jay Satiro
Closes #7530
2021-08-18 20:59:36 +02:00
Marc Hoersken
b5abbc3d57
tests/server/*.c: align handling of portfile argument and file
1. Call the internal variable portname (like pidname) everywhere.
2. Have a variable wroteportfile (like wrotepidfile) everywhere.
3. Make sure the file is cleaned up on exit (like pidfile).
4. Add parameter --portfile to usage outputs everywhere.

Reviewed-by: Daniel Stenberg

Replaces #7523
Closes #7574
2021-08-17 21:43:31 +02:00
Daniel Stenberg
8c9722bb1c
misc: update incorrect copyright year ranges
Closes #7577
2021-08-16 11:21:47 +02:00
Daniel Stenberg
32f6812b5a
c-hyper: initial step for 100-continue support
Enabled test 154

Closes #7568
2021-08-13 23:18:21 +02:00
Daniel Stenberg
c495dcd02e
http: consider cookies over localhost to be secure
Updated test31.
Added test 392 to verify secure cookies used for http://localhost

Reviewed-by: Daniel Gustafsson
Fixes #6733
Closes #7263
2021-08-10 11:20:21 +02:00
Jay Satiro
26f93cf038 test1565: fix windows build errors
- Use our wait_ms() instead of sleep() since Windows doesn't have the
  latter.

- Use a separate variable to keep track of whether the pthread_t thread
  id is valid.

On Windows pthread_t is not an integer type. pthread offers no macro for
invalid pthread_t thread id, so validity is kept track of separately.

Closes https://github.com/curl/curl/pull/7527
2021-08-10 03:29:40 -04:00
Bin Lan
5b9fedb461
tool/tests: fix potential year 2038 issues
The length of 'long' in a 32-bit system is 32 bits, which cannot be used
to save timestamps after 2038. Most operating systems have extended
time_t to 64 bits.

Remove the castings to long.

Closes #7466
2021-07-30 16:06:37 +02:00
Bernhard M. Wiedemann
8d0c1137c1
tests: make three tests pass until 2037
after 2038 something in test1915 fails on 32-bit OSes

Closes #7512
2021-07-30 12:39:34 +02:00
Marc Hoersken
c34bd93f60
tests/*server.py: remove pidfile on server termination
Avoid pidfile leaking/laying around after server already exited.

Reviewed-by: Daniel Stenberg
Closes #7506
2021-07-29 08:08:07 +02:00
Marc Hoersken
4a7bf79fcc
tests/servers: remove obsolete pid variable
Variable is not used since pidfile handling moved to util.[ch]

Reviewed-by: Jay Satiro
Closes #7482
2021-07-25 20:00:18 +02:00
Marc Hoersken
d9d26a6b2c
tests/servers: use our platform-aware pid for server verification
The pid used for server verification is later stored as pid2 in
the hash of running test servers and therefore used for shutdown.

The pid used for shutdown must be the platform-aware (Win32) pid
to avoid leaking test servers while running them using Cygwin/msys.

Reviewed-by: Jay Satiro
Closes #7481
2021-07-25 19:59:58 +02:00
Marc Hoersken
893f39c596
tests/runtests.pl: cleanup copy&paste mistakes and unused code
Reviewed-by: Jay Satiro
Part of #7481
2021-07-25 19:59:14 +02:00
Josh Soref
de1004eb0f
cleanup: spell DoH with a lowercase o
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

Closes #7413
2021-07-16 23:53:13 +02:00
Daniel Stenberg
9053dbbf62
msnprintf: return number of printed characters excluding null byte
... even when the output is "capped" by the maximum length argument.

Clarified in the docs.

Closes #7361
2021-07-08 10:05:39 +02:00