Commit Graph

31242 Commits

Author SHA1 Message Date
Daniel Stenberg
03a70edc50
multi: use pipe instead of socketpair to *wakeup()
If pipe() is present. Less overhead.

Closes #12142
2023-10-17 15:29:31 +02:00
Jay Satiro
e160d17a02 build: fix 'threadsafe' feature detection for older gcc
- Add 'threadsafe' to the feature list shown during build if POSIX
  threads are being used.

This is a follow-up to 5adb6000 which added support for building a
thread-safe libcurl with older versions of gcc where atomic is not
available but pthread is.

Reported-by: Dan Fandrich
Co-authored-by: Dan Fandrich

Fixes https://github.com/curl/curl/issues/12125
Closes https://github.com/curl/curl/pull/12127
2023-10-17 03:33:42 -04:00
Daniel Stenberg
1a5c0db090
test729: verify socks4a with excessive proxy user name length 2023-10-16 23:47:18 +02:00
Daniel Stenberg
01057d6161
socks: better buffer size checks for socks4a user and hostname
Also limit the proxy user name to 255 bytes, which is the same limit as
in SOCKS5.

Reported-by: sd0 on hackerone
Closes #12139
2023-10-16 23:47:08 +02:00
Daniel Stenberg
0b6d9ac8d9
curl.h: on FreeBSD include sys/param.h instead of osreldate.h
Should things build on Playstation as well

Fixes #12107
Reported-by: Faraz Fallahi
Closes #12123
2023-10-16 19:40:02 +02:00
Marcin Rataj
7f7fa2fd67
tool_operate: fix links in ipfs errors
URL fragment links generated from headers in
https://curl.se/docs/ipfs.html are lowercase.

Closes #12133
2023-10-16 08:42:19 +02:00
Viktor Szakats
84a6579132
cmake: replace check_library_exists_concat()
The idea of `check_library_exists_concat()` is that it detects an
optional component and adds it to the list of libs that we also use in
subsequent component checks. This caused problems when detecting
components with unnecessary dependencies that were not yet built.

CMake offers the `CMAKE_REQUIRED_LIBRARIES` variable to set libs used
for component checks, which we already use in most cases. That left 4
uses of `check_library_exists_concat()`. Only one of these actually
needed the 'concat' feature (ldap/lber).

Delete this function and replace it with standard
`check_library_exists()` and manual management of our `CURL_LIBS`
list we use when linking build targets. And special logic to handle the
ldap/lber case.

(We have a similar function for headers: `check_include_file_concat()`.
It works, but problematic for performance reasons and because it hides
the actual headers required in `check_symbol_exists()` calls.)

Ref: #11537 #11558
Fixes #11285
Fixes #11648
Closes #12070
2023-10-15 20:48:17 +00:00
LoRd_MuldeR
b1b7552803 tool_cb_wrt: fix write output for very old Windows versions
- Pass missing parameter for 'lpNumberOfCharsWritten' to WriteConsoleW()
  function.

Apparently this parameter was *not* optional on older Windows versions.

Issue observed on Windows XP SP2. Issue not observed on Windows 7 SP1.
So at some point between those two Microsoft changed the behavior.

Prior to this change, on those versions if parameter is NULL then the
function call fails with error ERROR_INVALID_ACCESS.

Regression since af3f4e41.

Ref: https://github.com/MicrosoftDocs/Console-Docs/issues/299

Fixes https://github.com/curl/curl/issues/12131
Closes https://github.com/curl/curl/pull/12130
2023-10-15 14:43:11 -04:00
Jay Satiro
82aa0642ec tool_urlglob: fix build for old gcc versions
- Don't use __builtin_mul_overflow for GCC 4 and earlier.

The function was added in GCC 5.

Ref: https://gcc.gnu.org/gcc-5/changes.html

Reported-by: Dan Fandrich

Fixes https://github.com/curl/curl/issues/12124
Closes https://github.com/curl/curl/pull/12128
2023-10-15 14:39:42 -04:00
Carlos Henrique Lima Melara
e4de693bf6 docs/libcurl: fix three minor man page format mistakes
Reported-by: Samuel Henrique

Closes https://github.com/curl/curl/pull/12126
2023-10-14 23:19:53 -04:00
Jay Satiro
0dd0bb0d1a tests/server: add more SOCKS5 handshake error checking
- Add additional checking for missing and too-short SOCKS5 handshake
  messages.

Prior to this change the SOCKS5 test server did not check that all parts
of the handshake were received successfully. If those parts were missing
or too short then the server would access uninitialized memory.

This issue was discovered in CI job 'memory-sanitizer' test results.
Test 2055 was failing due to the SOCKS5 test server not running. It was
not running because either it crashed or memory sanitizer aborted it
during Test 728. Test 728 connects to the SOCKS5 test server on a
redirect but does not send any data on purpose. The test server was not
prepared for that.

Reported-by: Dan Fandrich

Fixes https://github.com/curl/curl/issues/12117
Closes https://github.com/curl/curl/pull/12118
2023-10-14 22:42:49 -04:00
Daniel Stenberg
475cf0cc85
RELEASE-NOTES: synced 2023-10-14 23:10:36 +02:00
Sohom Datta
8993efc2a5
tool_getparam: limit --rate to be smaller than number of ms
Currently, curl allows users to specify absurd request rates that might
be higher than the number of milliseconds in the unit (ex: curl --rate
3600050/h http://localhost:8080 does not error out despite there being
only 3600000ms in a hour).

This change adds a conditional check before the millisecond calculation
making sure that the number is not higher than the numerator (the unit)
If the number is higher, curl errors out with PARAM_NUMBER_TOO_LARGE

Closes #12116
2023-10-14 23:05:54 +02:00
Daniel Stenberg
e2006b5d58
opts: fix two minor man page format mistakes 2023-10-14 18:22:24 +02:00
Jay Satiro
f80ab60c27 curl_trc: remove a bad assertion
- Remove DEBUGASSERT that an internal handle must not have user
  private_data set before calling the user's debug callback.

This is a follow-up to 0dc40b2a. The user can distinguish their easy
handle from an internal easy handle by setting CURLOPT_PRIVATE on their
easy handle. I had wrongly assumed that meant the user couldn't then
set CURLOPT_PRIVATE on an internal handle as well.

Bug: https://github.com/curl/curl/pull/12060#issuecomment-1754594697
Reported-by: Daniel Stenberg

Closes https://github.com/curl/curl/pull/12104
2023-10-14 03:19:59 -04:00
Dan Fandrich
a2b4391a1d test613: stop showing an error on missing output file
This test would show an error message if the output was missing during
the log post-processing step, but the message was not captured by the
test harness and wasn't useful since the normal golden log file
comparison would the problem more clearly.
2023-10-13 20:28:58 -07:00
Stefan Eissing
9cc5787577
quic: manage connection idle timeouts
- configure a 120s idle timeout on our side of the connection
- track the timestamp when actual socket IO happens
- check IO timestamp to our *and* the peer's idle timeouts
  in "is this connection alive" checks

Reported-by: calvin2021y on github
Fixes #12064
Closes #12077
2023-10-13 23:15:47 +02:00
Dan Fandrich
f1e05a6e6e CI: ignore test 286 on Appveyor gcc 9 build
This test fails sometimes with a super fast retry loop due to what may
just be a compiler bug. The test results are ignored on the one CI job
where it occurs because there seems to be nothing we can do to fix it.

Fixes #12040
Closes #12106
2023-10-13 09:01:16 -07:00
Viktor Szakats
4e57d0f0cb
lib: fix gcc warning in printf call
Do not pass NULL to printf %s.

Seen with gcc 13.2.0 on Debian:
```
.../curl/lib/connect.c:696:27: warning: '%s' directive argument is null [-Wformat-overflow=]
```
Ref: https://github.com/curl/curl-for-win/actions/runs/6476161689/job/17584426483#step:3:11104

Ref: #10284
Co-authored-by: Jay Satiro
Closes #12082
2023-10-13 09:19:05 +00:00
Alex Klyubin
465f02bf17
http2: safer invocation of populate_binsettings
populate_binsettings now returns a negative value on error, instead of a
huge positive value. Both places which call this function have been
updated to handle this change in its contract.

The way populate_binsettings had been used prior to this change the huge
positive values -- due to signed->unsigned conversion of the potentially
negative result of nghttp2_pack_settings_payload which returns negative
values on error -- are not possible. But only because http2.c currently
always provides a large enough output buffer and provides H2 SETTINGS
IVs which pass the verification logic inside nghttp2.  If the
verification logic were to change or if http2.c started passing in more
IVs without increasing the output buffer size, the overflow could become
reachable, and libcurl/curl might start leaking memory contents to
servers/proxies...

Closes #12101
2023-10-13 11:07:28 +02:00
Daniel Stenberg
b9f832edcc
openssl: avoid BN_num_bits() NULL pointer derefs
Reported-by: icy17 on github
Fixes #12099
Closes #12100
2023-10-13 11:00:18 +02:00
Daniel Stenberg
4dbc2ad467
wolfssl: require WOLFSSL_SYS_CA_CERTS for loading system CA
This define is set in wolfssl's options.h file when this function and
feature is present. Handles both builds with the feature explicitly
disabled and wolfSSL versions before 5.5.2 - which introduced this API
call.

Closes #12108
2023-10-13 10:58:23 +02:00
Daniel Stenberg
8a45a495af
tool_urlglob: make multiply() bail out on negative values
- Does not work correctly with negative values
- use __builtin_mul_overflow() on gcc

Reported-by: Torben Dury
Closes #12102
2023-10-13 10:18:09 +02:00
Loïc Yhuel
732d8ef758 cmake: fix CURL_DISABLE_GETOPTIONS
- Add CURL_DISABLE_GETOPTIONS to curl_config.h.cmake.

Prior to this change the option had no effect because it was missing
from that file.

Closes https://github.com/curl/curl/pull/12091
2023-10-13 00:57:09 -04:00
Loïc Yhuel
5adb6000ff easy_lock: add a pthread_mutex_t fallback
This allows to keep the init threadsafe with gcc < 4.9.0 (no C11
atomics).

Closes https://github.com/curl/curl/pull/12090
2023-10-12 23:40:08 -04:00
Viktor Szakats
2e283c69e0
CI: add autotools, out-of-tree, debug build to distro check job
Add a job that builds curl from a generated source tarball sample, with
autotools, out-of-tree, in debug mode.

Ref: #12085
Closes #12088
2023-10-12 23:29:39 +00:00
Daniel Stenberg
f2de575242
http: avoid Expect: 100-continue if Upgrade: is used
Reported-by: Daniel Jelinski
Fixes #12022
Closes #12062
2023-10-12 16:31:41 +02:00
Jan Alexander Steffens (heftig)
1f7d8cd478
docs: use SOURCE_DATE_EPOCH for generated manpages
This should make builds from Git reproducible.

Closes #12092
2023-10-12 09:45:41 +02:00
Daniel Stenberg
a20d7bd974
RELEASE-NOTES: synced
Bumped to 8.4.1
2023-10-12 09:09:49 +02:00
Viktor Szakats
104767ae48
cmake: fix HAVE_H_ERRNO_ASSIGNABLE detection
Fix `HAVE_H_ERRNO_ASSIGNABLE` to not run, only compile its test snippet,
aligning this with autotools. This fixes an error when doing
cross-builds and also actually detects this feature. It affected systems
not allowlisted into this, e.g. SerenityOS.

We used this detection result to enable `HAVE_GETADDRINFO_THREADSAFE`.

Follow-up to 04a3a377d8 #11979
Ref: #12095 (closed in favour of this patch)
Ref: #11964 (effort to sync cmake detections with autotools)

Reported-by: Kartatz on Github
Assisted-by: Kartatz on Github
Fixes #12093
Closes #12094
2023-10-12 06:46:21 +00:00
Viktor Szakats
fac90bd5c1
build: add src/.checksrc to source tarball
Regression from e5bb88b8f8 #11958

Bug: https://github.com/curl/curl/pull/11958#issuecomment-1757079071
Reported-by: Romain Geissler
Fixes #12084
Closes #12085
2023-10-11 14:04:33 +00:00
Daniel Stenberg
d755a5f7c0
RELEASE-NOTES: synced 2023-10-11 07:34:19 +02:00
Daniel Stenberg
9ff73274df
THANKS: add contributors from 8.4.0 2023-10-11 07:34:19 +02:00
Jay Satiro
fb4415d8ae
socks: return error if hostname too long for remote resolve
Prior to this change the state machine attempted to change the remote
resolve to a local resolve if the hostname was longer than 255
characters. Unfortunately that did not work as intended and caused a
security issue.

Bug: https://curl.se/docs/CVE-2023-38545.html
2023-10-11 07:34:19 +02:00
Stefan Eissing
09e25b9d94 CI: remove slowed-network tests
- remove these tests as they are currently not reliable in our CI
  setups.

curl handles the test cases, but CI sometimes fails on these due to
additional conditions. Rather than mix them in, an additional CI job
will be added in the future that is specific to them.

Closes https://github.com/curl/curl/pull/12075
2023-10-10 16:29:01 -04:00
Jay Satiro
ba8c5c49a3 libcurl-env-dbg.3: move debug variables from libcurl-env.3
- Move documentation of libcurl environment variables used only in debug
  builds from libcurl-env into a separate document libcurl-env-dbg.

- Document more debug environment variables.

Previously undocumented or missing a description:

CURL_ALTSVC_HTTP, CURL_DBG_SOCK_WBLOCK, CURL_DBG_SOCK_WPARTIAL,
CURL_DBG_QUIC_WBLOCK, CURL_DEBUG, CURL_DEBUG_SIZE, CURL_GETHOSTNAME,
CURL_HSTS_HTTP, CURL_FORCETIME, CURL_SMALLREQSEND, CURL_SMALLSENDS,
CURL_TIME.

Closes https://github.com/curl/curl/pull/11811
2023-10-10 15:37:16 -04:00
Dan Fandrich
f64ecb2bc0 test670: increase the test timeout
This should make it more immune to loaded servers.

Ref: #11328
2023-10-09 14:15:29 -07:00
Stefan Eissing
b0f3d71c1f
MQTT: improve receive of ACKs
- add `mq->recvbuf` to provide buffering of incomplete
  ACK responses
- continue ACK reading until sufficient bytes available
- fixes test failures on low network receives

Closes #12071
2023-10-09 18:34:17 +02:00
Viktor Szakats
5032f04ee9
quic: fix BoringSSL build
Add guard around `SSL_CTX_set_ciphersuites()` use.

Bug: https://github.com/curl/curl/pull/12065#issuecomment-1752171885

Follow-up to aa9a6a1770

Co-authored-by: Jay Satiro
Reviewed-by: Daniel Stenberg
Closes #12067
2023-10-09 12:43:56 +00:00
Stefan Eissing
a383d1372f
test1540: improve reliability
- print that bytes have been received on pausing, but not how many

Closes #12069
2023-10-09 14:07:59 +02:00
Stefan Eissing
56d373033d
test2302: improve reliability
- make result print collected write data, unless
  change in meta flags is detected
- will show same result even when data arrives via
  several writecb invocations

Closes #12068
2023-10-09 14:07:08 +02:00
Daniel Stenberg
dc4e885f35
curl_easy_pause: set "in callback" true on exit if true
Because it might have called another callback in the mean time that then
set the bit FALSE on exit.

Reported-by: Jay Satiro
Fixes #12059
Closes #12061
2023-10-09 08:21:51 +02:00
Viktor Szakats
0e4bef0862
h3: add support for ngtcp2 with AWS-LC builds
```
curl 8.4.0-DEV (x86_64-apple-darwin) libcurl/8.4.0-DEV (SecureTransport) AWS-LC/1.15.0 nghttp2/1.56.0 ngtcp2/0.19.1 nghttp3/0.15.0
Release-Date: [unreleased]
Protocols: dict file ftp ftps gopher gophers http https imap imaps ldap ldaps mqtt pop3 pop3s rtsp smb smbs smtp smtps telnet tftp ws wss
Features: alt-svc AsynchDNS HSTS HTTP2 HTTP3 HTTPS-proxy IPv6 Largefile MultiSSL NTLM SSL threadsafe UnixSockets
```

Also delete an obsolete GnuTLS TODO and update the header comment in
`FindNGTCP2.cmake`.

Reviewed-by: Daniel Stenberg
Closes #12066
2023-10-08 22:35:04 +00:00
Viktor Szakats
58a95b6a49
build: do not publish HAVE_BORINGSSL, HAVE_AWSLC macros
Syncing this up with CMake.

Source code uses the built-in `OPENSSL_IS_AWSLC` and
`OPENSSL_IS_BORINSSL` macros to detect BoringSSL and AWS-LC. No help is
necessary from the build tools.

The one use of `HAVE_BORINGSSL` in the source turned out to be no longer
necessary for warning-free BoringSSL + Schannel builds. Ref: #1610 #2634

autotools detects this anyway for display purposes.
CMake detects this to decide whether to use the BoringSSL-specific
crypto lib with ngtcp2. It detects AWS-LC, but doesn't use the detection
result just yet (planned in #12066).

Ref: #11964

Reviewed-by: Daniel Stenberg
Reviewed-by: Jay Satiro
Closes #12065
2023-10-08 22:29:45 +00:00
Marc Hoersken
2e93c07c87
CI: move distcheck job from Azure Pipelines to GitHub Actions
This will allow for more trigger excludes within Azure Pipelines.

Also fixes seemingly broken check with scripts/installcheck.sh.
Ref: 190374c74e

Assisted-by: Philip Heiduck
Closes #9532
2023-10-08 19:36:16 +02:00
Daniel Stenberg
43215842f2
url: fall back to http/https proxy env-variable if ws/wss not set
Reported-by: Craig Andrews
Fixes #12031
Closes #12058
2023-10-08 11:29:10 +02:00
Stefan Eissing
b9c78eeac1
cf-socket: simulate slow/blocked receives in debug
add 2 env variables for non-UDP sockets:
1. CURL_DBG_SOCK_RBLOCK: percentage of receive calls that randomly
   should return EAGAIN
2. CURL_DBG_SOCK_RMAX: max amount of bytes read from socket

Closes #12035
2023-10-08 11:04:09 +02:00
Stefan Eissing
ba1e559bd8
http2: refused stream handling for retry
- answer HTTP/2 streams refused via a GOAWAY from the server to
  respond with CURLE_RECV_ERROR in order to trigger a retry
  on another connection

Reported-by: black-desk on github
Ref #11859
Closes #12054
2023-10-08 11:01:47 +02:00
Jay Satiro
0dc40b2a0f CURLOPT_DEBUGFUNCTION.3: warn about internal handles
- Warn that the user's debug callback may be called with the handle
  parameter set to an internal handle.

Without this warning the user may assume that the only handles their
debug callback receives are the easy handles on which they set
CURLOPT_DEBUGFUNCTION.

This is a follow-up to f8cee8cc which changed DoH handles to inherit
the debug callback function set in the user's easy handle. As a result
those handles are now passed to the user's debug callback function.

Closes https://github.com/curl/curl/pull/12034
2023-10-08 00:21:10 -04:00
Jay Satiro
cf577bca84 url: fix typo 2023-10-07 18:43:14 -04:00