Commit Graph

5702 Commits

Author SHA1 Message Date
Dan Fandrich
023aa7b98a docs: fix fuzzing documentation link
Follow-up to 4c712a1b
2023-05-22 16:16:05 -07:00
Dan Fandrich
02c27bb429 runtests: add a missing \n at the end of a log message 2023-05-22 14:57:15 -07:00
Stefan Eissing
88332049ea
http/2: unstick uploads
- refs #11157 and #11175 where uploads get stuck or lead to RST streams
- fixes our h2 send behaviour to continue sending in the nghttp2 session
  as long as it wants to. This will empty our send buffer as long as
  the remote stream/connection window allows.
- in case the window is exhausted, the data remaining in the send buffer
  will wait for a WINDOW_UPDATE from the server. Which is a socket event
  that engages our transfer loop again
- the problem in the issue was that we did not exhaust the window, but
  left data in the sendbuffer and no further socket events did happen.
  The server was just waiting for us to send more.
- relatedly, there was an issue fixed that closing a stream with KEEP_HOLD
  set kept the transfer from shutting down - as it should have - leading
  to a timeout.

Closes #11176
2023-05-22 16:19:13 +02:00
Jay Satiro
6f93d5f604
lib: fix conversion warnings with gcc on macOS 2023-05-21 14:02:31 +02:00
Emanuele Torre
eef076baa6
Revert "urlapi: respect CURLU_ALLOW_SPACE and CURLU_NO_AUTHORITY for redirects"
This reverts commit df6c2f7b54.
(It only keep the test case that checks redirection to an absolute URL
without hostname and CURLU_NO_AUTHORITY).

I originally wanted to make CURLU_ALLOW_SPACE accept spaces in the
hostname only because I thought
curl_url_set(CURLUPART_URL, CURLU_ALLOW_SPACE) was already accepting
them, and they were only not being accepted in the hostname when
curl_url_set(CURLUPART_URL) was used for a redirection.

That is not actually the case, urlapi never accepted hostnames with
spaces, and a hostname with a space in it never makes sense.
I probably misread the output of my original test when I they were
normally accepted when using CURLU_ALLOW_SPACE, and not redirecting.

Some other URL parsers seems to allow space in the host part of the URL,
e.g. both python3's urllib.parse module, and Chromium's javascript URL
object allow spaces (chromium percent escapes the spaces with %20),
(they also both ignore TABs, and other whitespace characters), but those
URLs with spaces in the hostname are useless, neither python3's requests
module nor Chromium's window.location can actually use them.

There is no reason to add support for URLs with spaces in the host,
since it was not a inconsistency bug; let's revert that patch before it
makes it into release. Sorry about that.

I also reverted the extra check for CURLU_NO_AUTHORITY since that does
not seem to be necessary, CURLU_NO_AUTHORITY already worked for
redirects.

Closes #11169
2023-05-21 13:59:04 +02:00
Dan Fandrich
c95ca8dfeb runtests: use the correct fd after select
The code was using the wrong fd when determining which runner was ready
with a response.

Ref: #10818
Closes #11160
2023-05-20 22:15:15 -07:00
Dan Fandrich
9f87dee556 test425: fix the log directory for the upload
This must be %LOGDIR to let it work with parallel tests.

Ref: #10969
2023-05-20 22:15:15 -07:00
Dan Fandrich
b43915b38f runtests: handle interrupted reads from IPC pipes
These can be interrupted by signals, especially SIGINT to shut down, and
must be restarted so the IPC call arrives correctly. If the read just
returns an error instead, the IPC calling state will go out of sync and
a proper shutdown won't happen.

Ref: #10818
2023-05-20 22:15:15 -07:00
Stefan Eissing
0cab1359a1
http2: upload improvements
Make send buffer smaller to have progress and "upload done" reporting
closer to reality. Fix handling of send "drain" condition to no longer
trigger once the transfer loop reports it is done sending. Also do not
trigger the send "drain" on RST streams.

Background:
- a upload stall was reported in #11157 that timed out
- test_07_33a reproduces a problem with such a stall if the
  server 404s the request and RSTs the stream.
- test_07_33b verifies a successful PUT, using the parameters
  from #11157 and checks success

Ref: #11157
Closes #11165
2023-05-20 23:07:45 +02:00
Stefan Eissing
1886eef7fa
http2: increase stream window size to 10 MB
Reported-by: pandada8 on github

Fixes #11162
Closes #11167
2023-05-20 23:05:07 +02:00
Daniel Stenberg
92772e6d39
urlapi: allow numerical parts in the host name
It can only be an IPv4 address if all parts are all digits and no more than
four parts, otherwise it is a host name. Even slightly wrong IPv4 will now be
passed through as a host name.

Regression from 17a15d8846 shipped in 8.1.0

Extended test 1560 accordingly.

Reported-by: Pavel Kalyugin
Fixes #11129
Closes #11131
2023-05-19 16:01:26 +02:00
Stefan Eissing
408eb87bb3
cf-socket: completely remove the disabled USE_RECV_BEFORE_SEND_WORKAROUND
Closes #11118
2023-05-18 20:55:16 +02:00
Emanuele Torre
df6c2f7b54
urlapi: respect CURLU_ALLOW_SPACE and CURLU_NO_AUTHORITY for redirects
curl_url_set(uh, CURLUPART_URL, redirurl, flags)  was not respecing
CURLU_ALLOW_SPACE and CURLU_NO_AUTHORITY in the host part of redirurl
when redirecting to an absolute URL.

Closes #11136
2023-05-18 20:52:59 +02:00
Emanuele Torre
f198d33e8d
checksrc: disallow spaces before labels
Out of 415 labels throughout the code base, 86 of those labels were
not at the start of the line. Which means labels always at the start of
the line is the favoured style overall with 329 instances.

Out of the 86 labels not at the start of the line:
* 75 were indented with the same indentation level of the following line
* 8 were indented with exactly one space
* 2 were indented with one fewer indentation level then the following
  line
* 1 was indented with the indentation level of the following line minus
  three space (probably unintentional)

Co-Authored-By: Viktor Szakats

Closes #11134
2023-05-18 20:45:04 +02:00
Marcel Raad
e587598534
md4: only build when used
Its only usage in curl_ntlm_core.c is guarded by `USE_CURL_NTLM_CORE`,
so let's use this here too.

Ref: https://github.com/curl/curl/issues/11098
Closes https://github.com/curl/curl/pull/11102
2023-05-13 09:57:35 +02:00
Daniel Stenberg
efa6c644aa
test2306: verify getting a second response with folded headers
Reproduces the isue #11101 and verifies the fix.

Verifies a17b2a503f
2023-05-12 17:50:33 +02:00
Daniel Stenberg
39a33fcac0
tool_operate: refuse (--data or --form) and --continue-at combo
libcurl assumes that a --continue-at resumption is done to continue an
upload using the read callback and neither --data nor --form use
that and thus won't do what the user wants. Whatever the user wants
with this strange combination.

Add test 426 to verify.

Reported-by: Smackd0wn on github
Fixes #11081
Closes #11083
2023-05-08 14:10:44 +02:00
Dan Fandrich
3d75029859 runtests: fix -c option when run with valgrind
The curl binary argument wasn't being quoted properly. This seems to
have broken at some point after quoting was added in commit 606b29fe.

Reported-by: Daniel Stenberg
Ref: #11073
Fixes #11074
Closes #11076
2023-05-05 09:52:38 -07:00
Dan Fandrich
faebcee349 runtests: support creating more than one runner process
The controller currently only creates and uses one, but more are now
possible.

Ref: #10818
2023-05-05 00:45:43 -07:00
Dan Fandrich
38465f9a55 runtests: spawn a new process for the test runner
When the -j option is given, a new process is spawned in which the test
programs are run and from which test servers are started. Only one
process can be started at once, but this is sufficient to test that the
infrastructure can isolate those functions in a new task. There should
be no visible difference between the two modes at the moment.

Ref: #10818
Closes #11064
2023-05-05 00:45:43 -07:00
Dan Fandrich
d4a1b5b60c runtests: turn singletest() into a state machine
This allows it to run in a non-blocking manner.

Ref: #10818
2023-05-05 00:45:43 -07:00
Dan Fandrich
a98277fcc7 runtests: change runner interface to be asynchronous
Program arguments are marshalled and then written to the end of a pipe
which is later read from and the arguments unmarshalled before the
desired function is called normally.  The function return values are
then marshalled and written into another pipe when is later read from
and unmarshalled before being returned to the caller.

The implementation is currently blocking but can be made non-blocking
without any changes to the API.  This allows calling multiple runners
without blocking in the future.

Ref: #10818
2023-05-05 00:45:43 -07:00
Dan Fandrich
0754de758a runtests: call citest_finishtest in singletest
This is where citest_starttest is called.

Ref: #10818
2023-05-05 00:45:43 -07:00
Dan Fandrich
d4d22adf40 runtests: add a runner initialization function
This sets up the runner environment to start running tests.

Ref: #10818
2023-05-05 00:45:43 -07:00
Dan Fandrich
82fa5ca836 runtests: remove directory from server filename variables
There will soon be multiple log directories so the paths will no longer
be static in runtests.pl. Also, get rid of $SERVER2IN which was not
used.

Ref: #10818
2023-05-05 00:45:43 -07:00
Dan Fandrich
b71a0c3ec9 runtests: reduce package exports after refactoring
Some recent refactoring made these export no longer necessary. Also,
stop displaying the Unix socket paths at startup since there will soon
be many of them and they're not that interesting.

Ref: #10818
2023-05-05 00:45:43 -07:00
Dan Fandrich
9fdad9dea1 runtests: use a function to obtain $LOGDIR for a test
This will no longer be static soon.

Ref: #10818
2023-05-05 00:45:43 -07:00
Daniel Stenberg
9ce7eee070
checksrc: find bad indentation in conditions without open brace
If the previous line starts with if/while/for AND ends with a closed
parenthesis and there's an equal number of open and closed parentheses
on that line, verify that this line is indented $indent more steps, if
not a cpp line.

Also adjust the fall-out from this fix.

Closes #11054
2023-04-28 23:11:00 +02:00
Stefan Eissing
a9b7f72bc9
http2: do flow window accounting for cancelled streams
- nghttp2 does not free connection level window flow for
  aborted streams
- when closing transfers, make sure that any buffered
  response data is "given back" to the flow control window
- add tests test_02_22 and test_02_23 to reproduce

Closes #11052
2023-04-28 13:55:39 +02:00
Marcel Raad
da2470de96
tests/http: make curl_setup.h the first include
This is required for the macros there to take effect for system
libraries. Specifically, including the system libraries first led to
warnings about `_FILE_OFFSET_BITS` being redefined in curl_config.h on
the Solaris autobuilds for ws-data.c and ws-pingpong.c.
Also make the curl includes come first for the other source files here
for consistency.

Closes https://github.com/curl/curl/pull/11046
2023-04-28 11:29:19 +02:00
Dan Fandrich
2572e1333e tests/http: fix out-of-tree builds
Add both lib/ directories (src & build) to the search path so
curl_setup.h and its dependencies can be found.

Followup-to acd82c8b

Ref: #11006
Closes #11036
2023-04-27 00:15:41 -07:00
Stefan Eissing
acd82c8bfd
tests/http: more tests with specific clients
- Makefile support for building test specific clients in tests/http/clients
- auto-make of clients when invoking pytest
- added test_09_02 for server PUSH_PROMISEs using clients/h2-serverpush
- added test_02_21 for lib based downloads and pausing/unpausing transfers

curl url parser:
- added internal method `curl_url_set_authority()` for setting the
  authority part of a url (used for PUSH_PROMISE)

http2:
- made logging of PUSH_PROMISE handling nicer

Placing python test requirements in requirements.txt files
- separate files to base test suite and http tests since use
  and module lists differ
- using the files in the gh workflows

websocket test cases, fixes for we and bufq
- bufq: account for spare chunks in space calculation
- bufq: reset chunks that are skipped empty
- ws: correctly encode frames with 126 bytes payload
- ws: update frame meta information on first call of collect
  callback that fills user buffer
- test client ws-data: some test/reporting improvements

Closes #11006
2023-04-26 23:24:46 +02:00
Daniel Stenberg
f98344c4ae
man pages: simplify the .TH sections
- remove the version numbers
- simplify the texts

The date and version number will be put there for releases when maketgz
runs the updatemanpages.pl script.

Closes #11029
2023-04-26 10:17:13 +02:00
Daniel Stenberg
199f2d440d
hostcheck: fix host name wildcard checking
The leftmost "label" of the host name can now only match against single
'*'. Like the browsers have worked for a long time.

- extended unit test 1397 for this
- move some SOURCE variables from unit/Makefile.am to unit/Makefile.inc

Reported-by: Hiroki Kurosawa
Closes #11018
2023-04-26 09:07:27 +02:00
Dan Fandrich
a4aebd73e2 smbserver: remove temporary files before exit
Each execution of test 1451 would leave a file in /tmp before. Since
Windows can't delete a file while it's open, all the temporary file
names are stored and deleted on exit.

Closes #10990
2023-04-25 16:12:20 -07:00
Stefan Eissing
930c00c259
Websocket en-/decoding
- state is fully kept at connection, since curl_ws_send() and
  curl_ws_rec() have lifetime beyond usual transfers
- no more limit on frame sizes

Reported-by: simplerobot on github
Fixes #10962
Closes #10999
2023-04-25 23:16:51 +02:00
Stefan Eissing
cab2d56ea5
h2/h3: replace state.drain counter with state.dselect_bits
- `drain` was used by http/2 and http/3 implementations to indicate
  that the transfer requires send/recv independant from its socket
  poll state. Intended as a counter, it was used as bool flag only.
- a similar mechanism exists on `connectdata->cselect_bits` where
  specific protocols can indicate something similar, only for the
  whole connection.
- `cselect_bits` are cleard in transfer.c on use and, importantly,
  also set when the transfer loop expended its `maxloops` tries.
  `drain` was not cleared by transfer and the http2/3 implementations
  had to take care of that.
- `dselect_bits` is cleared *and* set by the transfer loop. http2/3
  does no longer clear it, only set when new events happen.

This change unifies the handling of socket poll overrides, extending
`cselect_bits` by a easy handle specific value and a common treatment in
transfers.

Closes #11005
2023-04-25 17:49:28 +02:00
Dan Fandrich
189f9e23b6 runtests: support buffering log messages in runner & servers
Log messages generated with logmsg can now be buffered and returned from
the runner as a return value.  This will be needed with parallel testing
to allow all messages for one test to be displayed together instead of
interspersed with messages of multiple tests. Buffering can be disabled
by setting a logging callback function with setlogfunc, which is
currently being done to preserve existing logging behaviour for now.

Some additional output is generated in verbose and debugprotocol modes,
which don't always use logmsg. These modes also impact some servers
which generate extra messages. No attempt is made to buffer everything
if these modes are enabled.

Ref: #10818
Closes #11016
2023-04-24 16:28:23 -07:00
Dan Fandrich
c3453dcb9d runtests: more consistently use logmsg in server control code
Also, display an error when sshversioninfo returns one.

Ref: #10818
2023-04-24 16:04:24 -07:00
Dan Fandrich
b88ea272c1 runtests: create runner functions for clearlocks and stopservers
runtests.pl now uses runner for all server actions beyond the initial
variable configuration.

Ref: #10818
2023-04-24 16:04:24 -07:00
Dan Fandrich
640f4c2267 runtests: tightened servers package exports
The defaults are intended for runtests.pl, whereas runner.pm needs to
explicitly specify them.
2023-04-24 16:04:24 -07:00
Dan Fandrich
8da49c9e38 runtests: display logs on server failure in singletest()
This is closer to the place where logs are displayed on test failure.
Also, only display these logs if -p is given, which is the same flag
that controls display of test failure logs. Some server log files
need to be deleted later so that they stay around long enough to be
displayed on failure.

Ref: #10818
2023-04-24 16:03:44 -07:00
Dan Fandrich
90158f0bab runtests: turn a print into a logmsg
Also enable another couple of useful messages in verbose mode.

Ref: #10818
2023-04-24 12:13:17 -07:00
Dan Fandrich
a8706fd8d0 runtests: move showdiff into runtests.pl
It's not used anywhere else.
2023-04-22 13:07:35 -07:00
Dan Fandrich
20fa5b74a5 devtest: add a new script for testing the test harness
This is currently useful for starting a test server on its own without
an associated test, which can be used for interactive curl testing or
for validating parts of the test harness itself. More commands can be
added to perform additional functions in the future.

Ref: #10818
Closes #11008
2023-04-22 13:07:35 -07:00
Dan Fandrich
a549e046b1 runtests: refactor the main test loop into two
The test loop now has an initial loop that first runs through all
possible tests to build a set of those to attempt on this run based on
features and keywords and only then goes through that new list to run
them.  This actually makes it three loops through all tests cases, as
there is an existing loop that gathers possible test numbers from the
test files on disk.

This has two minor effects on the output: all the tests that will be
skipped are displayed at the start (instead of being interspersed with
other tests) and the -l option no longer shows a count of tests at the
end or a (misleading) statement that tests have run successfully. The
skipped tests are also omitted from the test results sent to AppVeyor
and Azure in CI builds.

Another effect is a reduction in the amount of work considered part of
the "Test definition reading and preparation time" reported with -r
making those figures slightly lower than before.

Ref: #10818
2023-04-22 13:07:35 -07:00
Dan Fandrich
020cf1c117 runtests: track only the current test timings in runner.pm
This avoids passing these data through through global variables, which
soon won't be possible.

Ref: #10818
2023-04-22 12:58:04 -07:00
Dan Fandrich
c6e7f6c61f runtests: skip test preprocessing when doing -l
This speeds up the output tremendously by avoiding unnecessary work.
2023-04-22 12:58:03 -07:00
Dan Fandrich
6210bc0111 runtests: simplify value returned regarding use of valgrind
As a side effect this will now also show in verbose mode that valgrind
is being skipped on tests that explicitly disable it, such as 600.

Ref: #10818
2023-04-22 12:58:03 -07:00
Dan Fandrich
4a41745e21 runtests: fix quoting in Appveyor and Azure test integration
Test 1442's name was not quoted correctly so wasn't registered in
Appveyor and it had the wrong name in Azure. The JSON string quotes were
also invalid, even though both servers happened to accept it regardless.

Closes #11010
2023-04-22 11:50:03 -07:00
Dan Fandrich
47f2e556aa runtests: spread out the port numbers used by servers
The server ports are chosen randomly for each server, but the random
ranges chosen were inconsistently-sized and overlapping. Now, they are
spread out more so at least the first random port chosen for each server
is guaranteed to not also be chosen by another server. The starting port
numbers are also raised to put them in the Ephemeral Port range—not the
range defined by RFC 6335 but the one used by Linux, which starts lower
and gives us more room to work with.

Reported-by: Daniel Stenberg
2023-04-18 13:18:17 -07:00
Dan Fandrich
04113319db runtests: fix problems on <killserver> failure
The verify time must be set in this case, like all cases. An error
message needs to be displayed as well.
2023-04-18 13:18:17 -07:00
Dan Fandrich
1f6a9f48aa runtests: fix perl warning when <tool> is wrong 2023-04-18 13:18:17 -07:00
Dan Fandrich
f9e8c5f578 runtests: don't try to stop stunnel before trying again
Calling stopserver() before retrying stunnel due to an error would stop
the dependent server (such as HTTP) meaning stunnel would have nothing
to talk to when it came up. Don't try to force a stop when it didn't
actually start.  Also, don't mark the server as bad for future use when
it starts up on a retry.

Reported-by: eaglegai at github
Tested-by: eaglegai at github
Fixes #10976
2023-04-18 13:18:17 -07:00
Dan Fandrich
2e0b70b8bc runtests: don't accidentally randomly choose the same port
If a server couldn't be started on a port, a new one is randomly chosen
and the server is tried again. Avoid accidentally using a
randomly-chosen 0 port offset by adding 1 to the random number.

Found-by: Daniel Stenberg
2023-04-18 13:18:17 -07:00
Dan Fandrich
b11840807b runtests: don't attempt to use a port we know is in use
This reduces the startup time when there is a known conflict on the
random port chosen for a server.  This was already done for stunnel, but
now it's done for all servers.
2023-04-18 13:18:17 -07:00
Dan Fandrich
200c409021 http-server: fix server name in a log message
This changed when the file was renamed in commit cbf57176
2023-04-18 13:18:17 -07:00
Dan Fandrich
707f74c04a runtests: refactor into more packages
testutil.pm now contains a few miscellaneous functions that are used in
several places but have no better place to live.  subvariables moves to
servers.pm since most variables that it substitutes relate to servers,
so this is the most appropriate place. Rename a few functions for better
naming consistency.

Ref: #10818
Closes #10995
2023-04-18 13:18:17 -07:00
Dan Fandrich
ba51b39732 runtests: call timestampskippedevents() in singletest
..rather than by the runner
2023-04-18 13:18:17 -07:00
Dan Fandrich
43b876d7df runtests: assume a newer Valgrind by default
The tests for an older Valgrind version should probably just be deleted,
given that they're testing for an 18-year-old version.
2023-04-18 13:18:17 -07:00
Dan Fandrich
390af1ed5e runtests: refactor test runner code into runner.pm
This is code that is directly responsible for running a single test.
This will eventually run in a separate process as part of the parallel
testing project.

Ref: #10818
2023-04-18 13:18:17 -07:00
Dan Fandrich
bfa554b207 runtests: skip unneeded work if test won't be running
This speeds up tests by avoiding unnecessary processing.

Ref: #10818
2023-04-18 13:18:17 -07:00
Dan Fandrich
a3bccb2893 runtests: factor out singletest_postcheck
This will eventually need to be part of the test runner.

Ref: #10818
2023-04-18 13:18:17 -07:00
Dan Fandrich
cb5127e17c test303: kill server after test
Otherwise, an HTTP test closely following this one with a tight time
constraint (e.g. 672) could fail because the test server stays sitting
with the wait command for a while.
2023-04-18 13:18:17 -07:00
Sevan Janiyan
25dcbbcf7d tests/sshserver.pl: Define AddressFamily earlier
As the comment states "Address family must be specified before ListenAddress", otherwise the tests fail to run
`"failed starting SSH server" 52 times (582, 583, 600, 601, 602, 603, 604, 605, 606 and 43 more)`

Closes #10983
2023-04-18 12:50:12 -07:00
Daniel Stenberg
1c5ed24ee0
tests/keywords.pl: remove
This script does not work since the introduction of the test
preprocessing. If we need this functionality, it probably needs to be
moved into the runtests tool or similar.

Reported-by: Dan Fandrich
Fixes #10895
Closes #10987
2023-04-17 19:59:58 +02:00
Stefan Eissing
fc2f1e547a
http2: support HTTP/2 to forward proxies, non-tunneling
- with `--proxy-http2` allow h2 ALPN negotiation to
  forward proxies
- applies to http: requests against a https: proxy only,
  as https: requests will auto-tunnel
- adding a HTTP/1 request parser in http1.c
- removed h2h3.c
- using new request parser in nghttp2 and all h3 backends
- adding test 2603 for request parser
- adding h2 proxy test cases to test_10_*

scorecard.py: request scoring accidentally always run curl
with '-v'. Removed that, expect double numbers.

labeller: added http1.* and h2-proxy sources to detection

Closes #10967
2023-04-17 17:27:49 +02:00
Daniel Stenberg
17c71df421
tests/libtest/lib1900.c: remove
This file was left behind when the rest of the test was previously removed.

Follow-up to e50a877df7
2023-04-17 12:45:14 +02:00
Daniel Stenberg
54ac447b11
curl: do NOT append file name to path for upload when there's a query
Added test 425 to verify.

Reported-by: Dirk Rosenkranz
Bug: https://curl.se/mail/archive-2023-04/0008.html
Closes #10969
2023-04-15 10:52:33 +02:00
Stefan Eissing
5126cbda00
tests: make test_12_01 a bit more forgiving on connection counts 2023-04-13 08:46:53 +02:00
Daniel Stenberg
4cfa5bcc9a
urlapi: cleanups
- move host checks together
- simplify the scheme parser loop and the end of host name parser
- avoid itermediate buffer storing in multiple places
- reduce scope for several variables
- skip the Curl_dyn_tail() call for speed
- detect IPv6 earlier and skip extra checks for such hosts
- normalize directly in dynbuf instead of itermediate buffer
- split out the IPv6 parser into its own funciton
- call the IPv6 parser directly for ipv6 addresses
- remove (unused) special treatment of % in host names
- junkscan() once in the beginning instead of scattered
- make junkscan return error code
- remove unused query management from dedotdotify()
- make Curl_parse_login_details use memchr
- more use of memchr() instead of strchr() and less strlen() calls
- make junkscan check and return the URL length

An optimized build runs one of my benchmark URL parsing programs ~41%
faster using this branch. (compared against the shipped 7.88.1 library
in Debian)

Closes #10935
2023-04-13 08:41:40 +02:00
Dan Fandrich
8e75c4f978 pathhelp: use the cached $use_cygpath when available 2023-04-11 14:55:32 -07:00
Dan Fandrich
def8dc8071 runtests: eliminate unneeded variable 2023-04-11 14:55:32 -07:00
Dan Fandrich
a3605d6a56 runtests: make the # of server start attempts a constant 2023-04-11 14:55:32 -07:00
Dan Fandrich
44256902f3 runtests: on startup failure call displaylogs only in serverfortest
This reduces the number of calls spread throughout the code.

Ref: #10818
Closes #10919
2023-04-11 14:55:32 -07:00
Dan Fandrich
f82a38e0f3 runtests: return an error code with startservers()
The code indicates the kind of failure encountered in starting a server,
which can be used by the caller to tailor the user experience.

Ref: #10818
2023-04-11 14:55:32 -07:00
Dan Fandrich
19b062a492 runtests: abort early if runpingpongserver is given a bad server type 2023-04-11 14:55:32 -07:00
Dan Fandrich
f25627014e runtests: don't use the SMB server verification time as reference
%FTPTIME2 and %FTPTIME3 should be set by the FTP server only, for
consistency.
2023-04-11 14:55:32 -07:00
Dan Fandrich
d39db81192 tests: factor out the test server management code
This now lives in servers.pm with some configuration variables moved to
globalconfig.pm

Ref: #10818
2023-04-11 14:55:32 -07:00
Dan Fandrich
a2ce734e28 runtests: remove an inappropriate use of runclientoutput
This function is intended for running client code, not servers.
2023-04-11 14:55:32 -07:00
Dan Fandrich
fdb24b3916 runtests: only add $LIBDIR to the path for checktestcmd
Since checkcmd is for finding servers, there will never be anything in
this directory of interest to them.

Ref: #10818
2023-04-11 14:55:32 -07:00
Dan Fandrich
dee50c9c51 tests: log sshserver.pl messages to a file
The logmsg messages were thrown away before, so they are now available
for debugging.
2023-04-11 14:55:32 -07:00
Dan Fandrich
25aba1683a runtests: also show DISABLED tests with -l
Other reasons for skipping tests are ignored for -l, so being explicitly
disabled should be too.
2023-04-11 14:55:32 -07:00
Dan Fandrich
89ede3953b runtests: move the UNIX sockets into $PIDDIR
These were missed when the other server files were moved there.

Follow-up to 70d2fca2

Ref: #10818
2023-04-11 14:55:31 -07:00
Dan Fandrich
44677b6565 tests: tighten up perl exports
This reduces namespace pollution a little.

Ref: #10818
2023-04-11 14:55:31 -07:00
Dan Fandrich
efbaa612f7 tests: turn perl modules into full packages
This helps enforce more modularization and encapsulation. Enable and fix
warnings on a few packages.  Also, rename ftp.pm to processhelp.pm since
there's really nothing ftp-specific in it.

Ref: #10818
2023-04-11 14:55:31 -07:00
Dan Fandrich
dc18b40b40 tests: log a too-long Unix socket path in sws and socksd
Ref: #10919
2023-04-11 10:10:16 -07:00
Daniel Stenberg
309a517ffd
lib1560: verify that more bad host names are rejected
when setting the hostname component of a URL

Closes #10922
2023-04-11 11:33:07 +02:00
Dan Fandrich
52d4a41b2f test1169: fix so it works properly everywhere
- Use an absolute path for the -L option since the module isn't in the
  perl path
- Create the needed test file in a <file> section; <precheck> isn't
  intended for this
- Fix the test number in the file name, which was wrong

Follow-up to f754990a

Ref: #10818
Fixes #10889
Closes #10917
2023-04-10 11:50:51 -07:00
Dan Fandrich
6ed0629901 tests: stop using strndup(), which isn't portable
It's not available on Solaris 10, for example. Since this is just test
code that doesn't need to use an optimized system version, replace it
with the implementation copied from tool_cb_hdr.c.
2023-04-10 10:51:07 -07:00
Dan Fandrich
a72a548774 runtests: fix an incorrect comment about the ld_preload feature
Follow-up to 1f631864

Ref: #10818
2023-04-10 10:51:07 -07:00
Daniel Stenberg
826e8011d5
urlapi: prevent setting invalid schemes with *url_set()
A typical mistake would be to try to set "https://" - including the
separator - this is now rejected as that would then lead to
url_get(... URL...) would get an invalid URL extracted.

Extended test 1560 to verify.

Closes #10911
2023-04-09 23:23:54 +02:00
Daniel Stenberg
5f307986a3
lib: remove CURLX_NO_MEMORY_CALLBACKS
The only user of this define was 'chkdecimalpoint' - a special purpose
test tool that was built but not used anymore (since 17c18fbc3 - Apr
2020).

Closes #10908
2023-04-08 17:47:10 +02:00
Daniel Stenberg
4033642930
content_encoding: only do tranfer-encoding compression if asked to
To reduce surprises. Update test 387 and 418 accordingly.

Closes #10899
2023-04-07 13:39:20 +02:00
Daniel Stenberg
3de6b6cfe5
sws: comparison of unsigned expression < 0 is always false
Follow-up to 356dd0b73a

Closes #10903
2023-04-07 12:40:07 +02:00
Stefan Eissing
356dd0b73a
tests: increase sws timeout for more robust testing
- for https CONNECT forwarding, this was fixed at 5 seconds
  which led to spurious CI test failures
- add --keepalive parameter to sws to control this
- let httpserver use 30 seconds

Closes #10898
2023-04-06 16:28:34 +02:00
Stefan Eissing
4ae2d9f24d
proxy: http2 proxy tunnel implementation
- currently only on debug build and when env variable
  CURL_PROXY_TUNNEL_H2 is present.
- will ALPN negotiate with the proxy server and switch
  tunnel filter based on the protocol negotiated.
- http/1.1 tunnel code moved into cf-h1-proxy.[ch]
- http/2 tunnel code implemented in cf-h2-proxy.[ch]
- tunnel start and ALPN set remains in http_proxy.c
- moving all haproxy related code into cf-haproxy.[ch]

VTLS changes
- SSL filters rely solely on the "alpn" specification they
  are created with and no longer check conn->bits.tls_enable_alpn.
- checks on which ALPN specification to use (or none at all) are
  done in vtls.c when creating the filter.

Testing
- added a nghttpx forward proxy to the pytest setup that
  speaks HTTP/2 and forwards all requests to the Apache httpd
  forward proxy server.
- extending test coverage in test_10 cases
- adding proxy tests for direct/tunnel h1/h2 use of basic auth.
- adding test for http/1.1 and h2 proxy tunneling to pytest

Closes #10780
2023-04-06 13:04:46 +02:00
Stefan Eissing
8f50e393ab
vtls and h2 improvements
- eliminate receive loop in vtls to fill buffer. This may
  lead to partial reads of data which is counter productive
- let http2 instead loop smarter to process pending network
  data without transfer switches

scorecard improvements
- do not start caddy when only httpd is requested
- allow curl -v to stderr file on --curl-verbose

Closes #10891
2023-04-06 09:41:54 +02:00
Daniel Stenberg
3da642c4f0
tests: 1078 1288 1297 use valid IPv4 addresses
With the enhanced URL parser, these tests failed because of their bad
IPv4 use.
2023-04-06 09:02:10 +02:00
Daniel Stenberg
17a15d8846
urlapi: detect and error on illegal IPv4 addresses
Using bad numbers in an IPv4 numerical address now returns
CURLUE_BAD_HOSTNAME.

I noticed while working on trurl and it was originally reported here:
https://github.com/curl/trurl/issues/78

Updated test 1560 accordingly.

Closes #10894
2023-04-06 09:02:00 +02:00
Daniel Stenberg
f042e1e75d
urlapi: URL encoding for the URL missed the fragment
Meaning that it would wrongly still store the fragment using spaces
instead of %20 if allowing space while also asking for URL encoding.

Discovered when playing with trurl.

Added test to lib1560 to verify the fix.

Closes #10887
2023-04-05 08:30:12 +02:00
Daniel Stenberg
808cb31756
tool_writeout: add URL component variables
Output specific components from the used URL. The following variables
are added for this purpose:

  url.scheme, url.user, url.password, url.options, url.host, url.port,
  url.path, url.query, url.fragment, url.zoneid

Add the following for outputting parts of the "effective URL":

 urle.scheme, urle.user, urle.password, urle.options, urle.host, urle.port,
 urle.path, urle.query, urle.fragment, urle.zoneid

Added test 423 and 424 to verify.

Closes #10853
2023-04-04 14:42:44 +02:00
Stefan Eissing
e0c3424fb1
tests/http: improved httpd detection
- better error messages when not found/complete
- handling of `--without-test-httpd`

Reported-by: kwind on github
Fixes #10879
Closes #10883
2023-04-04 14:37:08 +02:00
Dan Fandrich
a13ef31d0f unit tests: use the unit test infrastructure better
Allow UNITTEST_STOP to return the error code, use the fail & abort
macros to indicate test failure and return success instead of fail if
the unit test can't test anything because of missing features at
compile-time.  A couple of tests could never fail because they were
overriding the failure return code.
2023-04-01 08:59:38 -07:00
Dan Fandrich
419a745da6 runtests: strip EOL on precheck output on Windows, too
Precheck failures would show on two lines in the test summary output
otherwise.
2023-03-31 23:08:00 -07:00
Dan Fandrich
70d2fca2f6 tests: move server config files under the pid dir
These files are generated by the test servers and must therefore be
found in the log directory to make them available to only those servers
once multiple test runners are executing in parallel. They must also not
be deleted with the log files, so they are stored in the pidfile
directory.

Ref: #10818
Closes #10875
2023-03-31 23:08:00 -07:00
Dan Fandrich
1cffced9c5 runtests: use the ssh key filenames from the sshhelp package 2023-03-31 23:08:00 -07:00
Dan Fandrich
3cc41a2d36 tests: move pidfiles and portfiles under the log directory
This is to segregate all files written by a test process into a single
root to allow for future parallel testing.

Ref: #10818
Closes #10874
2023-03-31 23:08:00 -07:00
Dan Fandrich
ec2a5bc5fc runtests: minor code cleanups 2023-03-31 23:08:00 -07:00
Dan Fandrich
62ba1d6bd9 runtests: call processexists() and pidfromfile()
rather than duplicating the logic in several places.
2023-03-31 23:08:00 -07:00
Stefan Eissing
3797f1a4ca
rustls: fix error in recv handling
- when rustls is told to recieve more TLS data and its internal
  plaintext buffers are full, it returns an IOERROR
- avoid receiving TLS data while plaintext is not read empty

pytest:
- increase curl run timeout when invoking pytest with higher verbosity

Closes #10876
2023-03-31 16:05:15 +02:00
Stefan Eissing
544abeea83
http3: improvements across backends
- ngtcp2: using bufq for recv stream data
- internal stream_ctx instead of `struct HTTP` members
  for quiche, ngtcp2 and msh3
- no more QUIC related members in `struct HTTP`
- experimental use of recvmmsg(), disabled by default
  - testing on my old debian box shows no throughput improvements.
  - leaving it in, but disabled, for future revisit
- vquic: common UDP receive code for ngtcp2 and quiche
- vquic: common UDP send code for ngtcp2 and quiche
- added pytest skips for known msh3 failures
- fix unit2601 to survive torture testing
- quiche: using latest `master` from quiche and enabling large download
  tests, now that key change is supported
- fixing test_07_21 where retry handling of starting a stream
  was faulty
- msh3: use bufq for recv buffering headers and data
- msh3: replace fprintf debug logging with LOG_CF where possible
- msh3: force QUIC expire timers on recv/send to have more than
  1 request per second served

Closes #10772
2023-03-31 15:44:57 +02:00
Dan Fandrich
a094ec1a85 test1471/2: add http as a required feature
curl bails out early with a different error message if http support is
compiled out.

Ref: #10705
2023-03-30 23:55:33 -07:00
Dan Fandrich
2dd471d577 tests: limit return code of unit tests and lib tests
Values greater than 125 have special meanings, so cap it there.  Unit
tests and lib tests use the number of failures as the return code, so a
large number of failures (such as test 2601 as a torture test) can
exceed this causing the test to be erroneously reported as having
failed.

Ref: #10720
2023-03-30 19:16:40 -07:00
Dan Fandrich
9fa018dbf7 test1960: point to the correct path for the precheck tool
Otherwise, it might find the binary in .libs which can cause it to use
the system libcurl which can fail. This error is only visible by
noticing that the test is skipped.

Follow-up to e4dfe6fc

Ref: #10651
2023-03-30 17:40:39 -07:00
Dan Fandrich
f754990acf tests: use the proper %LOGDIR path on two tests
Follow-up to e7a021e1

Ref: #10818
2023-03-30 17:40:24 -07:00
Stefan Eissing
041cf77cbd
tests/http: relax connection check in test_07_02
Only 1 connection will be used when curl is slow, happens when
address-sanitized in CI, for example

Closes #10865
2023-03-30 23:51:16 +02:00
Stefan Eissing
744dcf22fa
http2: flow control and buffer improvements
- use bufq for send/receive of network data
- usd bufq for send/receive of stream data
- use HTTP/2 flow control with no-auto updates to control the
  amount of data we are buffering for a stream
  HTTP/2 stream window set to 128K after local tests, defined
  code constant for now
- elminiating PAUSEing nghttp2 processing when receiving data
  since a stream can now take in all DATA nghttp2 forwards

Improved scorecard and adjuste http2 stream window sizes
- scorecard improved output formatting and options default
- scorecard now also benchmarks small requests / second

Closes #10771
2023-03-30 23:11:26 +02:00
Dan Fandrich
4ced75b7ce runtests: show error message if file can't be written 2023-03-30 09:53:57 -07:00
Dan Fandrich
58e85d6d1d tests: fix remaining servers to run with a dynamic log directory
This final commit in the series is sufficient to allow the tests succeed
if $LOGDIR is changed in runtests.pl.

Ref: #10818
Closes #10866
2023-03-30 09:53:57 -07:00
Dan Fandrich
0bdb95ecbf tests: fix fake_ntlm to run with a dynamic log directory
Ref: #10818
2023-03-30 09:53:57 -07:00
Dan Fandrich
8a298119f1 tests: fix http servers to run with a dynamic log directory
Ref: #10818
2023-03-30 09:53:57 -07:00
Dan Fandrich
c753418d8b tests: fix ftpserver to run with a dynamic log directory
Ref: #10818
2023-03-30 09:53:57 -07:00
Dan Fandrich
c102502eae tests: fix C servers to run with a dynamic log directory
Ref: #10818
2023-03-30 09:53:57 -07:00
Dan Fandrich
1fe081ab42 tests: fix lib tests to run with a dynamic log directory
Ref: #10818
2023-03-30 09:53:57 -07:00
Dan Fandrich
6e3734f74f tests: fix unit tests to run with a dynamic log directory
Ref: #10818
2023-03-30 09:53:57 -07:00
Dan Fandrich
e7a021e135 tests: use %LOGDIR to refer to the log directory
This will allow it be set dynamically.

Ref: #10818
2023-03-30 09:53:57 -07:00
Dan Fandrich
0c82fcde79 runtests: track verification time even if no files to compare 2023-03-30 09:53:57 -07:00
Dan Fandrich
07ab5bdd3b getpart: better handle case of file not found 2023-03-30 09:53:57 -07:00
Dan Fandrich
88f1b70546 testcurl: bump version date
It hadn't been updated in 9 years; it's time.
2023-03-30 09:53:57 -07:00
Dan Fandrich
0e3ae25337 tests: switch to 3-argument open in test suite
The perl 2-argument open has been considered not-quite-deprecated since
the 3-argument form was introduced almost a quarter century ago.
2023-03-30 09:53:57 -07:00
Dan Fandrich
b133f70a52 tests: silence some Perl::Critic warnings in test suite
Not all warnings are fixed; many are as much stylistic suggestions than
anything and IMHO don't do much to actually improve the code.

Ref: #10818
Closes #10861
2023-03-30 09:12:52 -07:00
Dan Fandrich
b5cb9a5a36 docs: bump the minimum perl version to 5.6
It's actually been this way since at least 2012 (when a 3-argument open
was added to runtests.pl). Given the lack of complaints in the interim,
it's safe to call this 23 year old perl version the minimum.
2023-03-30 09:12:52 -07:00
Dan Fandrich
2039253c6e runtests: memoize the getpart* subroutines to speed up access
The refactored code calls these functions with the same arguments more
often, so this prevents redundant test case file parsing.

Approved-by: Daniel Stenberg
Ref: #10818
Closes #10833
2023-03-30 09:12:52 -07:00
Dan Fandrich
1f631864f4 runtests: remove duplicated feature variables
Use the feature map stored in the hash table instead. Most of the
variables were only used only once, to set the value in the hash table.

Ref: #10818
2023-03-30 09:12:52 -07:00
Dan Fandrich
e06eb85b3d runtests: also ignore test file problems when ignoring results
This simplifies error handling in the test verification code and makes
it more consistent.

Ref: #10818
2023-03-30 09:12:52 -07:00
Dan Fandrich
d792cd103c runtests: more refactoring for clarity
Ref: #10818
2023-03-30 09:12:52 -07:00
Dan Fandrich
1ae94c0930 runtests: don't start servers if -l is given 2023-03-30 09:12:52 -07:00
Dan Fandrich
44ec1986da runtests: fix typos 2023-03-30 09:12:52 -07:00
Dan Fandrich
53abe3809d runtests: refactor singletest() into separate functions
This takes it from a 1200 line behemoth into something more manageable.
The content and order of the functions is taken almost directly from
singletest() so the diff sans whitespace is quite short.

Ref: #10818
2023-03-30 09:12:52 -07:00
Dan Fandrich
6c0ee77c8a runtests: refactor singletest() into distinct sections
Namely:
- Verify that this test case should be run
- Start the servers needed to run this test case
- Check that test environment is fine to run this test case
- Prepare the test environment to run this test case
- Run the test command
- Clean up after test command
- Verify test succeeded

Ref: #10818
2023-03-30 09:12:52 -07:00
Dan Fandrich
1dc3088de3 runtests: stop copying a few arrays where not needed
Unlike some other languages that just copy a pointer, perl copies the
entire array contents which takes time for a large array.

Ref: #10818
2023-03-30 09:12:52 -07:00
Dan Fandrich
d428f00db0 runtests: reduce redundant calls to getpart/getpartattr
These functions scan through the entire test file every time to find the
right section, so they can be slow for large test files.

Ref: #10818
2023-03-30 09:12:52 -07:00
Dan Fandrich
dfeda77573 tests: document that the unittest keyword is special
Also, add other features that were missing.
2023-03-30 09:12:52 -07:00
Matt Jolly
0ae0abbe72
hostip: refuse to resolve the .onion TLD
RFC 7686 states that:

> Applications that do not implement the Tor
> protocol SHOULD generate an error upon the use of .onion and
> SHOULD NOT perform a DNS lookup.

Let's do that.

https://www.rfc-editor.org/rfc/rfc7686#section-2

Add test 1471 and 1472 to verify

Fixes #543
Closes #10705
2023-03-30 15:51:06 +02:00
Stefan Eissing
f8f010e469
tests/http: fix log formatting on wrong exit code
Closes #10868
2023-03-30 13:09:12 +02:00
dengjfzh
6c6306f300
rtsp: skip malformed RTSP interleaved frame data
Some IP cameras send malformed RTSP interleaved frames sometimes, which
can cause curl_easy_perform return 1 (CURLE_UNSUPPORTED_PROTOCOL).  This
change attempts to skip clearly incorrect RTSP interleaving frame data.

Closes #10808
2023-03-30 09:59:09 +02:00
Stefan Eissing
61f52a97e9
lib: add bufq and dynhds
Adding `bufq`:
- at init() time configured to hold up to `n` chunks of `m` bytes each.
- various methods for reading from and writing to it.
- `peek` support to get access to buffered data without copy
- `pass` support to allow buffer flushing on write if it becomes full
- use case: IO buffers for dynamic reads and writes that do not blow up
- distinct from `dynbuf` in that:
  - it maintains a read position
  - writes on a full bufq return CURLE_AGAIN instead of nuking itself
- Init options:
  - SOFT_LIMIT: allow writes into a full bufq
  - NO_SPARES: free empty chunks right away
- a `bufc_pool` that can keep a number of spare chunks to
  be shared between different `bufq` instances

Adding `dynhds`:
- a straightforward list of name+value pairs as used for HTTP headers
- headers can be appended dynamically
- headers can be removed again
- headers can be replaced
- headers can be looked up
- http/1.1 formatting into a `dynbuf`
- configured at init() with limits on header counts and total string
  sizes
- use case: pass a HTTP request or response around without being version
  specific
- express a HTTP request without a curl easy handle (used in h2 proxy
  tunnels)
- future extension possibilities:
  - conversions of `dynhds` to nghttp2/nghttp3 name+value arrays

Closes #10720
2023-03-30 09:08:05 +02:00
Stefan Eissing
8cabef6fc3
pytest: improvements for suitable curl and error output
- will check built curl for http and https support and
  skip all tests if not there
- will dump stdout/stderr/trace output on errored responses

Closes #10829
2023-03-29 13:25:18 +02:00
Daniel Stenberg
baeaeecb0a
test1592: add flaky keyword
Closes #10860
2023-03-29 09:11:50 +02:00
Arne Soete
2eadae8673
tests: update tests/httpd references to tests/http
tests/httpd was renamed to tests/http in #10654. This patch updates some
references in the README

Closes #10854
2023-03-28 17:50:59 +02:00
Stefan Eissing
9d107b6954
tests/http: add timeout to running curl in test cases
- we had a CI case once where `curl` seemingly did not
  return and it was hard to guess what happened.
- make curl execution in test cases time out after 60 seconds

Closes #10783
2023-03-26 17:41:46 +02:00
Daniel Stenberg
8963c25db3
server/getpart: clear the buffer before load
Fixes msan warnings:

==54195==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x55ece35e57cb in line_length /home/runner/work/curl/curl/tests/server/getpart.c:111:25
    #1 0x55ece35e3b83 in readline /home/runner/work/curl/curl/tests/server/getpart.c:164:24
    #2 0x55ece35e0269 in getpart /home/runner/work/curl/curl/tests/server/getpart.c:347:18
    #3 0x55ece36180b6 in parse_servercmd /home/runner/work/curl/curl/tests/server/sws.c:283:13

Closes #10822
2023-03-23 14:46:07 +01:00
Daniel Stenberg
70afa0d251
runtests: die if curl version can be found
Closes #10813
2023-03-22 14:01:45 +01:00
Stefan Eissing
b00289843a
tests/http: do not save files for downloads in scorecard testing
Closes #10788
2023-03-17 23:01:04 +01:00
Daniel Stenberg
ba1fba9cad
test422: verify --next used without a prior URL
Closes #10782
2023-03-17 14:07:20 +01:00
Daniel Stenberg
f24014c3eb
lib2305: deal with CURLE_AGAIN
The test does a slightly ugly busy-loop for this case but should be
managable due to it likely being a very short moment.

Mention CURLE_AGAIN in curl_ws_recv.3

Fixes #10760
Reported-by: Jay Satiro
Closes #10781
2023-03-16 23:29:12 +01:00
Daniel Stenberg
5ec15ea48f
lib643: LIB644 is never defined, this is dead code
Closes #10765
2023-03-15 00:08:09 +01:00
Daniel Stenberg
7ce1a6ae75
libtest/Makefile.inc: remove superfluous variables
Rely on the defaults when possible.

Closes #10765
2023-03-15 00:08:01 +01:00
Daniel Stenberg
c46761bd8b
tests/http: remove year ranges from copyrights
Closes #10763
2023-03-15 00:05:29 +01:00
Casey Bodley
495d09810a
aws_sigv4: fall back to UNSIGNED-PAYLOAD for sign_as_s3
all s3 requests default to UNSIGNED-PAYLOAD and add the required
x-amz-content-sha256 header. this allows CURLAUTH_AWS_SIGV4 to correctly
sign s3 requests to amazon with no additional configuration

Signed-off-by: Casey Bodley <cbodley@redhat.com>

Closes #9995
2023-03-14 17:04:47 +01:00
Dan Fandrich
7caaeca6f6 tests: fix control code that hid some text in runtests.1 2023-03-13 17:21:02 -07:00
Dan Fandrich
caf5fd1759 tests: sync option lists in runtests.pl & its man page 2023-03-13 17:13:08 -07:00
Stefan Eissing
7fa6e36583
tests/http: add pytest to GHA and improve tests
- added to: ngtcp2-quictls, ngtcp2-gnutls and the linux varians
  quiche, bearssl, libressl, mbedtls, openssl3, rustls
- added disabled in ngtcp2-wolfssl due to weird SSL_connect() errors
  not reproducable locally

Improvements on pytest:

-  handling of systems with nghttpx in $PATH
   - configure will seach $PATH got nghttpx used in pytest
   - pytest fixes for managing nghttpx without h3 support
   - ngtcp2-wolfssl: use a fully enabled wolfssl build

- lower parallel count for http/1.1 tests, since we do not
   want to test excessive connections.
- check built curl for HTTPS-proxy support in proxy tests
- bearssl does not like one of our critical cert extensions, making
  it non-critical now
- bearssl is too slow for test_12, skipping
- making sure we do h3 tests only when curl and server support is there

Closes #10699
2023-03-13 14:06:57 +01:00
Dan Fandrich
0cbfe32fb1 tests: make first.c the same for both lib tests and unit tests
The only difference used to be global variable used in unittest tests.
After cb7ed5a removed individual flag overrides for the unittests, first.c
was no longer recompiled for unit tests to include the flag, so whether it
worked or gave a link error depended on whether it was compiled in
libtest or unittest first. This way also speeds up the build by
eliminating 40 identical compile invocations.

Fixes #10749
2023-03-12 19:14:59 -07:00
Dan Fandrich
4e4a082eff tests: use AM_CPPFILES to modify flags in unit tests
Using CPPFLAGS sometimes caused odd compile issues when building tests
with parallel make and AM_CPPFILES is the right flag, anyway.

Follow-up to cb7ed5a

Ref #10749
2023-03-12 19:04:12 -07:00
Dan Fandrich
ee521a1c88 http: don't send 100-continue for short PUT requests
This is already how curl is documented to behave in Everything curl, but
in actuality only short POSTs skip this. This should knock 30 seconds
off a full run of the test suite since the 100-continue timeout will no
longer be hit.

Closes #10740
2023-03-11 18:57:19 -08:00
Dan Fandrich
970330bded tests: add DELAY keyword to more tests using waits 2023-03-11 18:57:19 -08:00
Dan Fandrich
13b4d050aa tests: hack to build most unit tests under cmake
These are only built when a libcurl static library is available, since
we're not building a special libcurlu library yet and these tests rely
on private symbols that aren't available in the shared library. A few
unit tests do require libcurlu, so those are not built.

Closes #10722
2023-03-11 18:54:21 -08:00
Dan Fandrich
29d7c3bdbd tests: fix MSVC unreachable code warnings in unit tests
Switch unit1654 to use the proper test macros as well.
2023-03-11 18:54:21 -08:00
Dan Fandrich
cb7ed5acf7 tests: make CPPFLAGS common to all unit tests
There's no need to specify them individually.
2023-03-11 18:54:21 -08:00
Dan Fandrich
a76322137b tests: keep cmake unit tests names in sync
Put only the test names into Makefile.inc so they can be used by both
cmake and automake. This will prevent the list of tests from becoming
out of date when they are also built under cmake.
2023-03-11 18:54:21 -08:00
Daniel Stenberg
fcee070cb1
CURLOPT_PROXY.3: curl+NSS does not handle HTTPS over unix domain socket
It results in error "NSS error -5985 (PR_ADDRESS_NOT_SUPPORTED_ERROR)"

Disabled test 1470 for NSS builds and documented the restriction.

Reported-by: Dan Fandrich
Fixes #10723
Closes #10734
2023-03-10 17:50:20 +01:00
Daniel Stenberg
674a0662cf test1903: test use of COOKIEFILE - reset - COOKIEFILE
This also tests for the memory leak bug fixed by parent commit b559ef6f.

Ref: #10694

Closes https://github.com/curl/curl/pull/10712
2023-03-10 03:56:59 -05:00
Dan Fandrich
297ad6ae18 tests: fix some keywords and unused sections 2023-03-10 00:17:29 -08:00
Dan Fandrich
c10c0c0578 tests: fix test1301 to call the right binary
It was refactored in commit 480ac6e5 but this step was missed.
2023-03-10 00:17:29 -08:00
Dan Fandrich
b5d955bc79 tests: add timeout, SLOWDOWN and DELAY keywords to tests
These are tests that are testing timing and end up being quite slow.
2023-03-10 00:17:29 -08:00
Dan Fandrich
37a3c63427 tests: fix tag markup issues in some tests 2023-03-09 10:27:39 -08:00
Marcel Raad
29a19369ec
tests: add cookies features
These tests don't work with `--disable-cookies`.

Closes https://github.com/curl/curl/pull/10713
2023-03-09 14:33:05 +01:00
Marcel Raad
387dbe53c4
test420: add cookies keyword
It fails with `--disable-cookies`.

Closes https://github.com/curl/curl/pull/10713
2023-03-09 14:33:03 +01:00
Daniel Stenberg
3bef98f615
test1671: fix after fix 2023-03-09 00:13:41 +01:00
Daniel Stenberg
27a7600871
test421: -w %{header_json} test with multiple same header names
To reproduce the issue in #10704
2023-03-09 00:13:41 +01:00
Daniel Stenberg
0a0c9b6dfa
urlapi: '%' is illegal in host names
Update test 1560 to verify

Ref: #10708
Closes #10711
2023-03-08 15:33:43 +01:00
Stefan Eissing
7c5637b8b4
url: fix logic in connection reuse to deny reuse on "unclean" connections
- add parameter to `conn_is_alive()` cfilter method that returns
  if there is input data waiting on the connection
- refrain from re-using connnection from the cache that have
  input pending
- adapt http/2 and http/3 alive checks to digest pending input
  to check the connection state
- remove check_cxn method from openssl as that was just doing
  what the socket filter now does.
- add tests for connection reuse with special server configs

Closes #10690
2023-03-07 12:50:31 +01:00
Stefan Eissing
48cd032623
http2: fix handling of RST and GOAWAY to recognize partial transfers
- a reset transfer (HTTP/2 RST) did not always lead to the proper
  error message on receiving its response, leading to wrong reports
  of a successful transfer
- test_05_02 was able to trigger this condition with increased transfer
  count. The simulated response errors did not carry a 'Content-Length'
  so only proper RST handling could detect the abort
- When doing such transfers in parallel, a connection could enter the
  state where
  a) it had been closed (GOAWAY received)
  b) the RST had not been "seen" for the transfer yet
  or c) the GOAWAY announced an error and the last successful
  stream id was not checked against ongoing transfers

Closes #10693
2023-03-06 23:58:24 +01:00
Stefan Eissing
b0564c1d54
tests: use dynamic ports numbers in pytest suite
- necessary ports are bound at start of test suite and then
  given to server fixtures for use.
- this make parallel use of pytest (in separate directories),
  practically safe for use as OS tend to not reuse such port numbers
  for a while

Closes #10692
2023-03-06 23:44:45 +01:00
Stefan Eissing
257416023d
connect: fix time_connect and time_appconnect timer statistics
- time_connect was not updated when the overall connection failed,
  e.g. when SSL verification was unsuccessful, refs #10670
- rework gather those values to interrogate involved filters,
  also from all eyeballing attempts, to report the maximum of
  those values.
- added 3 test cases in test_06 to check reported values on
  successful, partially failed and totally failed connections.

Reported-by: Master Inspire
Fixes #10670
Closes #10671
2023-03-06 20:16:43 +01:00
Daniel Stenberg
93eefa6ba1
test1905: update output cookie order
After the #10685 update
2023-03-06 15:52:00 +01:00
Daniel Stenberg
076764c5d7
test420: verify expiring cookies
Cookies that are loaded fine from a jar but then are expired in headers.
2023-03-06 15:52:00 +01:00
Jay Satiro
c12e8bfa89 tests: fix gnutls-serv check
- If gnutls-serv doesn't exist then don't try to execute it.

Follow-up to 2fdc1d81.

Closes https://github.com/curl/curl/pull/10688
2023-03-06 03:52:46 -05:00
Daniel Stenberg
54605666ed
lib1560: fix enumerated type mixed with another type
Follow-up to c84c0f9aa3

Closes #10684
2023-03-06 08:14:42 +01:00
Daniel Stenberg
c84c0f9aa3
lib1560: test parsing URLs with ridiculously large fields
In the order of 120K.

Closes #10665
2023-03-03 23:23:53 +01:00
Brad Spencer
ad4997e5b2
urlapi: parse IPv6 literals without ENABLE_IPV6
This makes the URL parser API stable and working the same way
independently of libcurl supporting IPv6 transfers or not.

Closes #10660
2023-03-03 10:05:08 +01:00
Balakrishnan Balasubramanian
351ea4ff53
test1470: test socks proxy using unix sockets and connect to https
Similar to test1468 except using https instead of http

Closes #10662
2023-03-03 09:18:21 +01:00
Daniel Stenberg
e4dfe6fc2f
test1960: verify CURL_SOCKOPT_ALREADY_CONNECTED
When returned from the CURLOPT_SOCKOPTFUNCTION, like when we have a
custom socket connected in the app, passed in to libcurl.

Verifies the fix in #10648

Closes #10651
2023-03-03 08:36:25 +01:00
Stefan Eissing
e497a96a0e
tests: rename tests/tests-httpd to tests/http
- httpd is only one server we test with
 - the suite coveres the HTTP protocol in general where
   the default test cases need a more beefy environment

Closes #10654
2023-03-02 14:05:19 +01:00
Stefan Eissing
d9ccc75b00 http2: fix upload busy loop
- Set KEEP_SEND_PAUSE when exhausting remote HTTP/2 window size of a
  stream.

- Clear KEEP_SEND_PAUSE when receiving HTTP/2 window updates on a paused
  stream.

- Also fix http2 send compiler warnings reported in #10449.

Prior to this change, starting in 71b7e016 which precedes 7.88.0,
libcurl may eat CPU during HTTP/2 upload.

Reported-by: Jay Satiro

Fixes https://github.com/curl/curl/issues/10449
Fixes https://github.com/curl/curl/issues/10618
Closes https://github.com/curl/curl/pull/10627
2023-03-01 04:13:49 -05:00
Stefan Eissing
cbe9d82c22
http2: fix for http2-prior-knowledge when reusing connections
- refs #10634 where errors in the HTTP/2 framing layer are observed.
- the bug was that on connection reuse, the code attempted to switch
  in yet another layer of HTTP/2 handling instead of detecting that
  this was already in place.
- added pytest testcase reproducing the issue.

Reported-by: rwmjones on github
Fixes #10634
Closes #10643
2023-02-28 23:04:00 +01:00
Stefan Eissing
a4d015e69f
http: fix unix domain socket use in https connects
- when h2/h3 eyeballing was involved, unix domain socket
  configurations were not honoured
- configuring --unix-socket will disable HTTP/3 as candidate for eyeballing
- combinatino of --unix-socket and --http3-only will fail during initialisation
- adding pytest test_11 to reproduce

Reported-by: Jelle van der Waa
Fixes #10633
Closes #10641
2023-02-28 22:59:19 +01:00
Patrick Monnerat
90756d33d8
tests: test secure mail protocols with explicit SSL requests
New tests 987, 988 and 989, disabled for rustls (hanging).

Closes #10077
2023-02-25 11:49:31 +01:00
Patrick Monnerat
5855c478cb
tests: support for imaps/pop3s/smtps protocols
Closes #10077
2023-02-25 11:49:31 +01:00
Patrick Monnerat
8bfa4d66de
runtests: use a hash table for server port numbers
Closes #10077
2023-02-25 11:49:31 +01:00
Daniel Stenberg
835682661c
misc: remove support for curl_off_t < 8 bytes
Closes #10597
2023-02-24 17:05:33 +01:00
Daniel Stenberg
5da5684cec
test978: mark file as text mode
Follow-up to 4ea5702980

To fix test failures on Windows

Closes #10594
2023-02-23 16:32:43 +01:00
Daniel Stenberg
4ea5702980
test978: verify that --stderr works for -w's stderr as well 2023-02-23 10:05:13 +01:00
Stefan Eissing
463158bfe5
test2600: detect when ALARM_TIMEOUT is in use and adjust
- use higher timeout values > 1s
- skip duration checks

Assisted-by: Marcel Raad
Closes #10513
2023-02-22 16:42:36 +01:00
Daniel Stenberg
0338eb85d3
test686: verify return code for no URL after --next 2023-02-22 08:44:54 +01:00
Daniel Stenberg
2e3da51550
test1278: verify that an extra --no-remote-name cause no warning 2023-02-22 08:43:19 +01:00
Daniel Stenberg
bb11969838
lib1560: add a test using %25 in the userinfo in a URL
Closes #10578
2023-02-21 16:10:13 +01:00
Stefan Eissing
821f6e2a89
CURLOPT_PIPEWAIT: allow waited reuse also for subsequent connections
As tested in test_02_07, when firing off 200 urls with --parallel, 199
wait for the first connection to be established. if that is multiuse,
urls are added up to its capacity.

The first url over capacity opens another connection. But subsequent
urls found the same situation and open a connection too. They should
have waited for the second connection to actually connect and make its
capacity known.

This change fixes that by

- setting `connkeep()` early in the HTTP setup handler. as otherwise
  a new connection is marked as closeit by default and not considered
  for multiuse at all
- checking the "connected" status for a candidate always and continuing
  to PIPEWAIT if no alternative is found.

pytest:
- removed "skip" from test_02_07
- added test_02_07b to check that http/1.1 continues to work as before

Closes #10456
2023-02-21 11:12:48 +01:00
Daniel Stenberg
d79c3af259
test419: verify --dump-header to file that cannot be created
Closes #10571
2023-02-21 10:35:17 +01:00
Daniel Stenberg
f074602072
lib517: verify time stamps without leading zeroes plus some more 2023-02-20 23:48:25 +01:00
Matt Jolly
cbf5717615
tests: HTTP server fixups
- httpserver.pl -> http-server.pl for consistency
- add http3-server.pl to EXTRA_DIST; alphabetise for maintainability
- nghttpx proxy invocation scripts should not use getcwd

Closes #10568
2023-02-20 12:59:27 +01:00
Jacob Hoffman-Andrews
30411d7278
GHA: update rustls dependency to 0.9.2
This allows re-enabling test 312 for the rustls backend.

Closes #10553
2023-02-18 09:53:58 +01:00
Daniel Stenberg
b30b0c3840
lib1560: add IPv6 canonicalization tests
Closes #10552
2023-02-17 23:22:05 +01:00
Daniel Stenberg
8b27799f8c
urlapi: do the port number extraction without using sscanf()
- sscanf() is rather complex and slow, strchr() much simpler

- the port number function does not need to fully verify the IPv6 address
  anyway as it is done later in the hostname_check() function and doing
  it twice is unnecessary.

Closes #10541
2023-02-17 16:21:26 +01:00
Stefan Eissing
216e4b1fb6
tests-httpd: add proxy tests
for direct and tunneling checks on http: and https:

Closes #10519
2023-02-17 11:40:57 +01:00
Stefan Eissing
4437e3e344
test: add test for HTTP/2 corruption as reported in #10525
- adding test_02_20 for reproducing the situation
- using recently released mod_h2 Apache module
- skipping test if an older version is installed
- adding installation of current mod_h2 to github pytest workflow

This reproduces the error reliable (for me) on the lib/http2.c version
of curl 7.88.0. And passes with the recent curl master.

Closes #10534
2023-02-17 09:17:04 +01:00
Stefan Eissing
cc52bc45f6
connnect: fix timeout handling to use full duration
- connect timeout was used at half the configured value, if the
  destination had 1 ip version 4 and other version 6 addresses
  (or the other way around)
- extended test2600 to reproduce these cases

Reported-by: Michael Kaufmann
Fixes #10514
Closes #10517
2023-02-16 11:24:29 +01:00
Stefan Eissing
79d0b3c0c0
tests: make the telnet server shut down a socket gracefully
- test 1452 failed occasionally with ECONNRESET errnos in curl when the
  server closed the connection in an unclean state.

Closes #10509
2023-02-16 10:05:54 +01:00
Daniel Stenberg
2fdc1d816e
tests: make sure gnuserv-tls has SRP support before using it
Reported-by: fundawang on github
Fixes #10522
Closes #10524
2023-02-15 23:42:42 +01:00
Daniel Stenberg
f1d09231ad
runtests: fix "uninitialized value $port"
by using a more appropriate variable

Reported-by: fundawang on github
Fixes #10518
Closes #10520
2023-02-15 16:09:05 +01:00
Stefan Eissing
ce0cad713d
openssl: test and fix for forward proxy handling (non-tunneling).
- adding pytest test_10 cases for proxy httpd setup tests
- fixing openssl bug in https: proxy hostname verification that
  used the hostname of the request and not the proxy name.

Closes #10498
2023-02-13 20:54:57 +01:00
Stefan Eissing
c74bad29fd
tests: add tests for HTTP/2 and HTTP/3 to verify the header API
Test 2403 and 2503 check "header_json" output and therefore use of
header-api

Closes #10495
2023-02-13 17:14:21 +01:00
Patrick Monnerat
119fb18719
content_encoding: do not reset stage counter for each header
Test 418 verifies

Closes #10492
2023-02-13 17:06:19 +01:00
Daniel Stenberg
36fca647a4
libtest: build lib2305 with multibyte as well
Fixes a build regression.

Follow-up to 5a9a04d556
Reported-by: Viktor Szakats
Ref: https://github.com/curl/curl/pull/10475#issuecomment-1426831800

Closes #10477
2023-02-12 11:20:34 +01:00
Stefan Eissing
ca95d391ea
pytest: add a test case for PUSH related things.
- checking that "103 Early Hints" are visible in curl's header dump file

Closes #10452
2023-02-10 10:30:22 +01:00
Stefan Eissing
c96f982166
vquic: stabilization and improvements
vquic stabilization
- udp send code shared between ngtcp2 and quiche
- quiche handling of data and events improved

ngtcp2 and pytest improvements
- fixes handling of "drain" situations, discovered in scorecard
  tests with the Caddy server.
- improvements in handling transfers that have already  data or
  are already closed to make an early return on recv

pytest
- adding caddy tests when available

scorecard improvemnts.
- using correct caddy port
- allowing tests for only httpd or caddy

Closes #10451
2023-02-10 10:26:40 +01:00
Daniel Stenberg
5a9a04d556
test2305: send 3 frames, 4097 bytes each, as one message
Receive them using a 256 bytes buffer in a loop.
2023-02-10 08:28:59 +01:00
Daniel Stenberg
8360d58ac7
sws: fix typo, indentation add more ws logging 2023-02-10 08:28:58 +01:00
Daniel Stenberg
f2fa4112ad
test2304: remove stdout verification
This cripples the test somewhat but the check was bad since depending on
timing it could exit before the output was done, making the test flaky.
2023-02-10 08:28:25 +01:00
Stefan Eissing
3de3ea6a64
HTTP/[23]: continue upload when state.drain is set
- as reported in #10433, HTTP/2 uploads may stall when a response is
  received before the upload is done. This happens when the
  data->state.drain is set for such a transfer, as the special handling
  in transfer.c from then on only cared about downloads.
- add continuation of uploads, if applicable, in this case.
- add pytest case test_07_12_upload_seq_large to reproduce this scenario
  (although, current nghttp2 implementation is using drain less often)

Reported-by: Lucas Pardue

Fixes #10433
Closes #10443
2023-02-09 09:13:30 +01:00
Stefan Eissing
8c762f5998
http2: minor buffer and error path fixes
- use memory buffer in full available size
- fail receive of reset/errored streams early

pytest:
- make test_05 error cases more reliable

Closes #10444
2023-02-09 08:38:01 +01:00
Jay Satiro
b4b6e4f1fa curl_setup: Disable by default recv-before-send in Windows
Prior to this change a workaround for Windows to recv before every send
was enabled by default. The way it works is a recv is called before
every send and saves the received data, in case send fails because in
Windows apparently that can wipe out the socket's internal received
data buffer.

This feature has led to several bugs because the way libcurl operates
it waits on a socket to read or to write, and may not at all times
check for buffered receive data.

Two recent significant bugs this workaround caused:
- Broken Schannel TLS 1.3 connections (#9431)
- HTTP/2 arbitrary hangs (#10253)

The actual code remains though it is disabled by default. Though future
changes to connection filter buffering could improve the situation IMO
it's just not tenable to manage this workaround.

Ref: https://github.com/curl/curl/issues/657
Ref: https://github.com/curl/curl/pull/668
Ref: https://github.com/curl/curl/pull/720

Ref: https://github.com/curl/curl/issues/9431
Ref: https://github.com/curl/curl/issues/10253

Closes https://github.com/curl/curl/pull/10409
2023-02-09 01:30:10 -05:00
John Bampton
0065b146eb
misc: fix spelling
Closes #10437
2023-02-08 08:30:05 +01:00
Dan Fandrich
349c5391f2
tool_operate: Fix error codes on bad URL & OOM
curl would erroneously report CURLE_OUT_OF_MEMORY in some cases instead
of CURLE_URL_MALFORMAT. In other cases, it would erroneously return
CURLE_URL_MALFORMAT instead of CURLE_OUT_OF_MEMORY.  Add a test case to
test the former condition.

Fixes #10130
Closes #10414
2023-02-07 08:20:04 +01:00
Daniel Stenberg
51e9cff268
unit2600: make sure numerical curl_easy_setopt sets long
Follow-up to 671158242d

Reported-by: Marcel Raad
Fixes #10410
Closes #10419
2023-02-06 17:26:18 +01:00
Gisle Vanem
62097a7ea4 libtest: add a sleep macro for Windows
.. because sleep() is used in some libtests.

Closes https://github.com/curl/curl/pull/10295
2023-02-05 03:15:07 -05:00
Daniel Stenberg
63c53ea627
urlapi: skip the extra dedotdot alloc if no dot in path
Saves an allocation for many/most URLs.

Updates test 1395 accordingly

Closes #10403
2023-02-02 22:34:32 +01:00
Stefan Eissing
671158242d
connections: introduce http/3 happy eyeballs
New cfilter HTTP-CONNECT for h3/h2/http1.1 eyeballing.
- filter is installed when `--http3` in the tool is used (or
  the equivalent CURLOPT_ done in the library)
- starts a QUIC/HTTP/3 connect right away. Should that not
  succeed after 100ms (subject to change), a parallel attempt
  is started for HTTP/2 and HTTP/1.1 via TCP
- both attempts are subject to IPv6/IPv4 eyeballing, same
  as happens for other connections
- tie timeout to the ip-version HAPPY_EYEBALLS_TIMEOUT
- use a `soft` timeout at half the value. When the soft timeout
  expires, the HTTPS-CONNECT filter checks if the QUIC filter
  has received any data from the server. If not, it will start
  the HTTP/2 attempt.

HTTP/3(ngtcp2) improvements.
- setting call_data in all cfilter calls similar to http/2 and vtls filters
  for use in callback where no stream data is available.
- returning CURLE_PARTIAL_FILE for prematurely terminated transfers
- enabling pytest test_05 for h3
- shifting functionality to "connect" UDP sockets from ngtcp2
  implementation into the udp socket cfilter. Because unconnected
  UDP sockets are weird. For example they error when adding to a
  pollset.

HTTP/3(quiche) improvements.
- fixed upload bug in quiche implementation, now passes 251 and pytest
- error codes on stream RESET
- improved debug logs
- handling of DRAIN during connect
- limiting pending event queue

HTTP/2 cfilter improvements.
- use LOG_CF macros for dynamic logging in debug build
- fix CURLcode on RST streams to be CURLE_PARTIAL_FILE
- enable pytest test_05 for h2
- fix upload pytests and improve parallel transfer performance.

GOAWAY handling for ngtcp2/quiche
- during connect, when the remote server refuses to accept new connections
  and closes immediately (so the local conn goes into DRAIN phase), the
  connection is torn down and a another attempt is made after a short grace
  period.
  This is the behaviour observed with nghttpx when we tell it to  shut
  down gracefully. Tested in pytest test_03_02.

TLS improvements
- ALPN selection for SSL/SSL-PROXY filters in one vtls set of functions, replaces
  copy of logic in all tls backends.
- standardized the infof logging of offered ALPNs
- ALPN negotiated: have common function for all backends that sets alpn proprty
  and connection related things based on the negotiated protocol (or lack thereof).

- new tests/tests-httpd/scorecard.py for testing h3/h2 protocol implementation.
  Invoke:
    python3 tests/tests-httpd/scorecard.py --help
  for usage.

Improvements on gathering connect statistics and socket access.
- new CF_CTRL_CONN_REPORT_STATS cfilter control for having cfilters
  report connection statistics. This is triggered when the connection
  has completely connected.
- new void Curl_pgrsTimeWas(..) method to report a timer update with
  a timestamp of when it happend. This allows for updating timers
  "later", e.g. a connect statistic after full connectivity has been
  reached.
- in case of HTTP eyeballing, the previous changes will update
  statistics only from the filter chain that "won" the eyeballing.
- new cfilter query CF_QUERY_SOCKET for retrieving the socket used
  by a filter chain.
  Added methods Curl_conn_cf_get_socket() and Curl_conn_get_socket()
  for convenient use of this query.
- Change VTLS backend to query their sub-filters for the socket when
  checks during the handshake are made.

HTTP/3 documentation on how https eyeballing works.

TLS improvements
- ALPN selection for SSL/SSL-PROXY filters in one vtls set of functions, replaces
  copy of logic in all tls backends.
- standardized the infof logging of offered ALPNs
- ALPN negotiated: have common function for all backends that sets alpn proprty
  and connection related things based on the negotiated protocol (or lack thereof).

Scorecard with Caddy.
- configure can be run with `--with-test-caddy=path` to specify which caddy to use for testing
- tests/tests-httpd/scorecard.py now measures download speeds with caddy

pytest improvements
- adding Makfile to clean gen dir
- adding nghttpx rundir creation on start
- checking httpd version 2.4.55 for test_05 cases where it is needed. Skipping with message if too old.
- catch exception when checking for caddy existance on system.

Closes #10349
2023-02-02 09:57:34 +01:00
Daniel Stenberg
b1e8cd52d9
unit2600: avoid error: ‘TEST_CASES’ defined but not used
Follow-up to d55de24dce

Closes #10379
2023-01-31 18:20:13 +01:00
Stefan Eissing
91eb197a9e
CI: add pytest github workflow to CI test/tests-httpd on a HTTP/3 setup
Closes #10317
2023-01-31 12:04:23 +01:00
Stefan Eissing
d55de24dce
connect: fix strategy testing for attempts, timeouts and happy-eyeball
- add test2600 as a unit test that triggers various connect conditions
  and monitors behaviour, available in a debug build only.

- this exposed edge cases in connect.c that have been fixed

Closes #10312
2023-01-31 11:28:14 +01:00
Daniel Stenberg
be5f6c3124
zuul: stop using this CI service
The important jobs have already transitioned. The remaining ones we can
skip for now.

Closes #10368
2023-01-30 15:42:15 +01:00
Sergey Bronnikov
11708d6f00 lib: fix typos
Closes https://github.com/curl/curl/pull/10307
2023-01-17 03:39:25 -05:00
Stefan Eissing
d6b5d9f4ae
tests: document the cfilter debug logging options
Closes #10283
2023-01-12 14:08:31 +01:00
Stefan Eissing
33ac97e1cb
tests-httpd: basic infra to run curl against an apache httpd plus nghttpx for h3
- adding '--with-test-httpd=<path>' to configure non-standard apache2
  install
- python env and base classes for running httpd
- basic tests for connectivity with h1/h2/h3
- adding test cases for truncated responses in http versions.
- adding goaway test for HTTP/3.
- adding "stuttering" tests with parallel downloads in chunks with
  varying delays between chunks.

- adding a curltest module to the httpd server, adding GOAWAY test.
    - mod_curltest now installs 2 handlers
      - 'echo': writing as response body what came as request body
      - 'tweak': with query parameters to tweak response behaviour
- marked known fails as skip for now

Closes #10175
2023-01-09 17:40:04 +01:00
Patrick Monnerat
f22cd67b7d
runtests: fix detection of TLS backends
Built-in TLS backends are detected at test time by scanning for their
names in the version string line returned by the cli tool: as this line
may also list the libssh configuration that mentions its own backend,
the curl backend may be wrongly determined.

In example, if the version line contains "libssh/0.10.4/openssl/zlib",
OpenSSL is detected as a curl-configured backend even if not.

This fix requires the backend names to appear as full words preceded by
spacing in the version line to be recognized as curl TLS backends.

Closes #10236
2023-01-05 23:49:10 +01:00
Daniel Stenberg
4cfab52721
test363: make even smaller writes to loop more 2023-01-05 23:43:02 +01:00
Jay Satiro
602964ec5e scripts: set file mode +x on all perl and shell scripts
- Set all scripts +x, ie 644 => 755.

Prior to this change some scripts were not executable and therefore
could not be called directly.

~~~
git ls-files -s \*.{sh,pl,py} | grep -v 100755
~~~

Closes https://github.com/curl/curl/pull/10219
2023-01-05 02:34:24 -05:00