Commit Graph

5662 Commits

Author SHA1 Message Date
Stefan Eissing
3d53f211e5
pytest: exclude test_03_goaway in CI runs due to timing dependency
Closes #11860
2023-09-21 08:57:57 +02:00
Patrick Monnerat
bbac7c19e5
tftpd: always use curl's own tftp.h
Using the system's provided arpa/tftp.h and optimizing, GCC 12 detects
and reports a stringop-overread warning:

tftpd.c: In function ‘write_behind.isra’:
tftpd.c:485:12: warning: ‘write’ reading between 1 and 2147483647 bytes from a region of size 0 [-Wstringop-overread]
  485 |     return write(test->ofile, writebuf, count);
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from tftpd.c:71:
/usr/include/arpa/tftp.h:58:30: note: source object ‘tu_data’ of size 0
   58 |                         char tu_data[0];        /* data or error string */
      |                              ^~~~~~~

This occurs because writebuf points to this field and the latter
cannot be considered as being of dynamic length because it is not
the last field in the structure. Thus it is bound to its declared
size.

This commit always uses curl's own version of tftp.h where the
target field is last in its structure, effectively avoiding the
warning.

As HAVE_ARPA_TFTP_H is not used anymore, cmake/configure checks for
arpa/tftp.h are removed.

Closes #11897
2023-09-21 08:47:07 +02:00
Dan Fandrich
d6d458b1cf test1474: make precheck more robust on non-Solaris systems
If uname -r returns something odd, perl could return an error code and
the test would be erroneously skipped. The qx// syntax avoid this.

Followup to 08f9b2148
2023-09-20 14:26:32 -07:00
Dan Fandrich
08f9b21483 test1474: disable test on NetBSD, OpenBSD and Solaris 10
These kernels only send a fraction of the requested amount of the first
large block, invalidating the assumptions of the test and causing it to
fail.

Assisted-by: Christian Weisgerber
Ref: https://curl.se/mail/lib-2023-09/0021.html
Closes #11888
2023-09-19 23:49:08 -07:00
Daniel Stenberg
a878864a48
test3103: CURLOPT_COOKIELIST test 2023-09-19 08:26:14 +02:00
Daniel Stenberg
7f225456d1
test498: total header size for all redirects is larger than accepted 2023-09-18 22:57:04 +02:00
Dan Fandrich
589dca761c CI: ignore the "flaky" and "timing-dependent" test results
CI builds will now run these tests, but will ignore the results if they
fail. The relevant tests are ones that are sensitive to timing or
have edge conditions that make them more likely to fail on CI servers,
which are often heavily overloaded and slow.

This change only adds two additional tests to be ignored, since the
others already had the flaky keyword.

Closes #11865
2023-09-16 08:33:59 -07:00
Dan Fandrich
989e1f35e8 runtests: eliminate a warning on old perl versions
The warning "Use of implicit split to @_ is deprecated" showed between
perl versions about 5.8 through 5.11.
2023-09-16 08:33:45 -07:00
Dan Fandrich
06cdfad49f tests: log the test result code after each libtest
This makes it easier to determine the test status. Also, capitalize
FAILURE and ABORT messages in log lines to make them easier to spot.
2023-09-16 08:33:45 -07:00
Harry Sintonen
3aa3cc9b05
misc: better random strings
Generate alphanumerical random strings.

Prior this change curl used to create random hex strings. This was
mostly okay, but having alphanumerical random strings is better: The
strings have more entropy in the same space.

The MIME multipart boundary used to be mere 64-bits of randomness due
to being 16 hex chars. With these changes the boundary is 22
alphanumerical chars, or little over 130 bits of randomness.

Closes #11838
2023-09-16 11:37:57 +02:00
Dan Fandrich
3514a394f3 test2600: remove special case handling for USE_ALARM_TIMEOUT
This was originally added to handle platforms that supported only 1
second granularity in connect timeouts, but after some recent changes
the test currently permafails on several Windows platforms.

The need for this special-case was removed in commit 8627416, which
increased the connect timeout in all cases to well above 1 second.

Fixes #11767
Closes #11849
2023-09-14 11:57:00 -07:00
Dan Fandrich
23c3f81ed7 tests: increase the default server logs lock timeout
This timeout is used to wait for the server to finish writing its logs
before checking them against the expected values. An overloaded machine
could take more than the two seconds previously allocated, so increase
the timeout to 5 seconds.

Ref: #11328
Closes #11834
2023-09-13 11:26:08 -07:00
Dan Fandrich
c725ec72a3 tests: increase TEST_HANG_TIMEOUT in two tests
These tests had a 5 second timeout compared to 60 seconds for all other
tests. Make these consistent with the others for more reliability on
heavily-loaded machines.

Ref: #11328
2023-09-13 11:26:08 -07:00
Dan Fandrich
223f601c04 test1056: disable on Windows
This test relies on the IPv6 scope field being ignored when connecting to
ipv6-localhost (i.e. [::1%259999] is treated as [::1]). Maybe this is a bit
dodgy, but it works on all our test platforms except Windows. This
test was disabled manually on all Windows CI builds already, so instead
add an incompatible feature and precheck so it's skipped on Windows
everywhere automatically.
2023-09-13 11:26:08 -07:00
Dan Fandrich
2e2fc007c8 test587: add a slight delay after test
This test is designed to connect to the server, then immediately send a
few bytes and disconnect. In some situations, such as on a loaded
server, this doesn't give the server enough time to write its lock file
before its existence is checked. The test harness then fails to find the
server's input log file (because it hasn't been written yet) and fails
the test. By adding a short delay after the test, the HTTP server has
enough time to write its lock file which gives itself more time to write
its remaining files.

Ref: #11328
2023-09-13 11:26:08 -07:00
Dan Fandrich
d29a62d738 tests: stop overriding the lock timeout
These tests reduce the server lock wait timeout which can increase
flakiness on loaded machines. Since this is merely an optimization,
eliminate them in favour of reliability.

Ref: #11328
2023-09-13 11:26:08 -07:00
Dan Fandrich
2ef67901cc tests: add some --expect100-timeout to reduce timing dependencies
These tests can fail when the test machine is so slow that the test HTTP
server didn't get a chance to complete before the client's one second
100-continue timeout triggered. Increase that 1 second to 999 seconds so
this situation doesn't happen.

Ref: #11328
2023-09-13 11:26:08 -07:00
Dan Fandrich
f0e4fa445d test661: return from test early in case of curl error 2023-09-13 11:26:08 -07:00
Dan Fandrich
381792dfbf tests: add the timing-dependent keyword on several tests
These are ones likely to fail on heavily-loaded machines that alter the
normal test timing. Most of these tests already had the flaky keyword
since this condition makes them more likely to fail on CI.
2023-09-13 11:26:08 -07:00
Dan Fandrich
ae84a52c42 test1592: greatly increase the maximum test timeout
It was too short to be reliable on heavily loaded CI machines, and
as a fail-safe only, it didn't need to be short.

Ref: #11328
2023-09-13 11:26:08 -07:00
Dan Fandrich
7d56d2e50d test: minor test cleanups
Remove an obsolete block of code in tests 2032 & 576.
Add a comment in test 1474.
2023-09-13 11:26:08 -07:00
Dan Fandrich
9db7f17135 tests: quadruple the %FTPTIME2 and %FTPTIME3 timeouts
This gives more of a margin for error when running on overloaded CI
servers.

Ref: #11328
2023-09-13 11:26:07 -07:00
Dan Fandrich
ad3c83599e tests: improve SLOWDOWN test reliability by reducing sent data
These tests are run in SLOWDOWN mode which adds a 10 msec delay after
each character output, which means it takes at least 1.6 seconds (and
320 kernel calls) just to get through the long welcome banner. On an
overloaded system, this can end up taking much more than 1.6 seconds,
and even more than the 7 or 16 second curl timeout that the tests rely
on, causing them to fail. Reducing the size of the welcome banner drops
the total number of characters sent before the transfer starts by more
than half, which reduces the opportunity for test-breaking slowdowns by
the same amount.

Ref: #11328
2023-09-13 11:26:07 -07:00
Dan Fandrich
877e103584 test650: fix an end tag typo 2023-09-13 11:26:07 -07:00
Jay Satiro
b5c65f8b7b http_aws_sigv4: handle no-value user header entries
- Handle user headers in format 'name:' and 'name;' with no value.

The former is used when the user wants to remove an internal libcurl
header and the latter is used when the user actually wants to send a
no-value header in the format 'name:' (note the semi-colon is converted
by libcurl to a colon).

Prior to this change the AWS header import code did not special case
either of those and the generated AWS SignedHeaders would be incorrect.

Reported-by: apparentorder@users.noreply.github.com

Ref: https://curl.se/docs/manpage.html#-H

Fixes https://github.com/curl/curl/issues/11664
Closes https://github.com/curl/curl/pull/11668
2023-09-11 15:24:05 -04:00
Daniel Stenberg
a1532a33b3
aws_sigv4: the query canon code miscounted URL encoded input
Added some extra ampersands to test 439 to verify "blank" query parts

Follow-up to fc76a24c53

Closes #11829
2023-09-11 08:17:39 +02:00
Nathan Moinvaziri
f6700c744b schannel: fix ordering of cert chain info
- Use CERT_CONTEXT's pbCertEncoded to determine chain order.

CERT_CONTEXT from SECPKG_ATTR_REMOTE_CERT_CONTEXT contains
end-entity/server certificate in pbCertEncoded. We can use this pointer
to determine the order of certificates when enumerating hCertStore using
CertEnumCertificatesInStore.

This change is to help ensure that the ordering of the certificate chain
requested by the user via CURLINFO_CERTINFO has the same ordering on all
versions of Windows.

Prior to this change Schannel certificate order was reversed in 8986df80
but that was later reverted in f540a39b when it was discovered that
Windows 11 22H2 does the reversal on its own.

Ref: https://github.com/curl/curl/issues/9706

Closes https://github.com/curl/curl/pull/11632
2023-09-08 03:47:13 -04:00
Chris Talbot
7703ca7f86 digest: Use hostname to generate spn instead of realm
In https://www.rfc-editor.org/rfc/rfc2831#section-2.1.2

digest-uri-value should be serv-type "/" host , where host is:

      The DNS host name or IP address for the service requested.  The
      DNS host name must be the fully-qualified canonical name of the
      host. The DNS host name is the preferred form; see notes on server
      processing of the digest-uri.

Realm may not be the host, so we must specify the host explicitly.

Note this change only affects the non-SSPI digest code. The digest code
used by SSPI builds already uses the hostname to generate the spn.

Ref: https://github.com/curl/curl/issues/11369

Closes https://github.com/curl/curl/pull/11395
2023-09-08 03:23:44 -04:00
Daniel Stenberg
656610160f
test439: verify query canonization for aws-sigv4 2023-09-07 17:50:43 +02:00
Wyatt O'Day
e92edfbef6
lib: add ability to disable auths individually
Both with configure and cmake

Closes #11490
2023-09-07 17:45:06 +02:00
Stefan Eissing
3b30cc1a0d
pytest: improvements
- set CURL_CI for pytest runs in CI environments
- exclude timing sensitive tests from CI runs
- for failed results, list only the log and stat of
  the failed transfer

- fix type in http.c comment

Closes #11812
2023-09-07 10:30:14 +02:00
Stefan Eissing
2485547da0
http: fix sending of large requests
- refs #11342 where errors with git https interactions
  were observed
- problem was caused by 1st sends of size larger than 64KB
  which resulted in later retries of 64KB only
- limit sending of 1st block to 64KB
- adjust h2/h3 filters to cope with parsing the HTTP/1.1
  formatted request in chunks

- introducing Curl_nwrite() as companion to Curl_write()
  for the many cases where the sockindex is already known

Fixes #11342 (again)
Closes #11803
2023-09-05 16:36:03 +02:00
Stefan Eissing
a8a82140aa
pytest: fix check for slow_network skips to only apply when intended
Closes #11801
2023-09-05 14:10:01 +02:00
Dan Fandrich
876278935f tests: fix a type warning on 32-bit x86 2023-09-04 17:10:07 -07:00
Viktor Szakats
205d686ce1
tests: delete stray .orig file
Follow-up to 331b89a319
Closes #11797
2023-09-04 22:20:16 +00:00
Stefan Eissing
331b89a319
http2: polish things around POST
- added test cases for various code paths
- fixed handling of blocked write when stream had
  been closed inbetween attempts
- re-enabled DEBUGASSERT on send with smaller data size

- in debug builds, environment variables can be set to simulate a slow
  network when sending data. cf-socket.c and vquic.c support
  * CURL_DBG_SOCK_WBLOCK: percentage of send() calls that should be
    answered with a EAGAIN. TCP/UNIX sockets.
    This is chosen randomly.
  * CURL_DBG_SOCK_WPARTIAL: percentage of data that shall be written
    to the network. TCP/UNIX sockets.
    Example: 80 means a send with 1000 bytes would only send 800
    This is applied to every send.
  * CURL_DBG_QUIC_WBLOCK: percentage of send() calls that should be
    answered with EAGAIN. QUIC only.
    This is chosen randomly.

Closes #11756
2023-09-04 19:48:49 +02:00
Dave Cottlehuber
a86fcb284f
ws: fix spelling mistakes in examples and tests
Closes #11784
2023-09-03 18:01:58 +02:00
Dan Fandrich
5949369c9f build: fix portability of mancheck and checksrc targets
At least FreeBSD preserves cwd across makefile lines, so rules
consisting of more than one "cd X; do_something" must be explicitly run
in a subshell to avoid this. This problem caused the Cirrus FreeBSD
build to fail when parallel make jobs were enabled.
2023-09-01 15:08:39 -07:00
Stefan Eissing
40f3ee0db3 wolfssl, use master again in CI
- with the shared session update fix landed in master, it
  is time to use that in our CI again
2023-09-01 11:43:55 +02:00
Nicholas Nethercote
49664d6afc tests: fix formatting errors in FILEFORMAT.md.
Without the surrounding backticks, these tags get swallowed when the
markdown is rendered.

Closes #11777
2023-08-31 16:50:44 -07:00
Viktor Szakats
ce3dce9015
tidy-up: mostly whitespace nits
- delete completed TODO from `./CMakeLists.txt`.
- convert a C++ comment to C89 in `./CMake/CurlTests.c`.
- delete duplicate EOLs from EOF.
- add missing EOL at EOF.
- delete whitespace at EOL (except from expected test results).
- convert tabs to spaces.
- convert CRLF EOLs to LF in GHA yaml.
- text casing fixes in `./CMakeLists.txt`.
- fix a codespell typo in `packages/OS400/initscript.sh`.

Closes #11772
2023-08-31 23:02:10 +00:00
Stefan Eissing
3f283e90c3 test_07_upload.py: fix test_07_34 curl args
- Pass correct filename to --data-binary.

Prior to this change --data-binary was passed an incorrect filename due
to a missing separator in the arguments list. Since aacbeae7 curl will
error on incorrect filenames for POST.

Fixes https://github.com/curl/curl/issues/11761
Closes https://github.com/curl/curl/pull/11763
2023-08-30 11:32:15 -04:00
Nicholas Nethercote
9254c7b344
tests: document which tests fail due to hyper's lack of trailer support.
Closes #11762
2023-08-30 11:41:04 +02:00
Patrick Monnerat
aafe43a715
os400: build test servers
Also fix a non-compliant main prototype in disabled.c.

Closes #11547
2023-08-30 11:38:57 +02:00
Patrick Monnerat
36d656fe57
tests: fix compilation error for os400
OS400 uses BSD 4.3 setsockopt() prototype by default: this does not
define parameter as const, resulting in an error if actual parameter is
const. Remove the const keyword from the actual parameter cast: this
works in all conditions, even if the formal parameter uses it.

Closes #11547
2023-08-30 11:38:46 +02:00
Matthias Gatto
b137634ba3 lib: fix aws-sigv4 having date header twice in some cases
When the user was providing the header X-XXX-Date, the header was
re-added during signature computation, and we had it twice in the
request.

Reported-by: apparentorder@users.noreply.github.com

Signed-off-by: Matthias Gatto <matthias.gatto@outscale.com>

Fixes: https://github.com/curl/curl/issues/11738
Closes: https://github.com/curl/curl/pull/11754
2023-08-30 03:41:29 -04:00
Jay Satiro
aacbeae7bb tool: change some fopen failures from warnings to errors
- Error on missing input file for --data, --data-binary,
  --data-urlencode, --header, --variable, --write-out.

Prior to this change if a user of the curl tool specified an input file
for one of the above options and that file could not be opened then it
would be treated as zero length data instead of an error. For example, a
POST using `--data @filenametypo` would cause a zero length POST which
is probably not what the user intended.

Closes https://github.com/curl/curl/pull/11677
2023-08-30 03:11:17 -04:00
Jay Satiro
51686e0054 secureserver.pl: fix stunnel version parsing
- Allow the stunnel minor-version version part to be zero.

Prior to this change with the stunnel version scheme of <major>.<minor>
if either part was 0 then version parsing would fail, causing
secureserver.pl to fail with error "No stunnel", causing tests that use
the SSL protocol to be skipped. As a practical matter this bug can only
be caused by a minor-version part of 0, since the major-version part is
always greater than 0.

Closes https://github.com/curl/curl/pull/11722
2023-08-28 15:10:48 -04:00
Jay Satiro
f2bc51a0bd secureserver.pl: fix stunnel path quoting
- Store the stunnel path in the private variable $stunnel unquoted and
  instead quote it in the command strings.

Prior to this change the quoted stunnel path was passed to perl's file
operators which cannot handle quoted paths. For example:

$stunnel = "\"/C/Program Files (x86)/stunnel/bin/tstunnel\"";
if(-x $stunnel or -x "$stunnel")
# false even if path exists and is executable

Our other test scripts written in perl, unlike this one, use servers.pm
which has a global $stunnel variable with the path stored unquoted and
therefore those scripts don't have this problem.

Closes https://github.com/curl/curl/pull/11721
2023-08-28 15:01:50 -04:00
Daniel Stenberg
25ca79df1e
altsvc: accept and parse IPv6 addresses in response headers
Store numerical IPv6 addresses in the alt-svc file with the brackets
present.

Verify with test 437 and 438

Fixes #11737
Reported-by: oliverpool on github
Closes #11743
2023-08-28 17:08:42 +02:00