Commit Graph

35949 Commits

Author SHA1 Message Date
Daniel Stenberg
2f00a7d5a7
tool_getparam: add "TLS required" flag for each such option
... and check it early, once.

Closes #16159
2025-02-06 11:39:35 +01:00
Daniel Stenberg
943de21619
netrc: return code cleanup, fix missing file error
Made the netrc parser return a more consistent set of error codes and
error messages, and also return error properly if the .netrc file is
missing.

Add test 697 to verify error on missing netrc file.

Fixes #16163
Reported-by: arlt on github
Closes #16165
2025-02-06 10:34:02 +01:00
Daniel Stenberg
abca1f23a9
RELEASE-NOTES: synced
and bump curlver to 8.12.1 while "cooling off"
2025-02-06 10:30:07 +01:00
Daniel Stenberg
34acdf9986
content_encoding: #error on too old zlib
The previous runtime check using strcmp() risks failing when zlib
reaches 1.10. While this instead changes the logic to a cruder
build-time instead of runtime, it avoids the 1.10 risk.

I verified that ZLIB_VERNUM has been provided since at least the 1.2.0.3
release.

1.2.0.4 was released on 10 August 2003.

Reported-by: Fay Stegerman
Closes #16202
2025-02-06 10:26:23 +01:00
Daniel Stenberg
553248f501
libssh2: raise lowest supported version to 1.2.8
Shipped on April 5 2011

Closes #16199
2025-02-06 10:02:29 +01:00
Jay Satiro
3631c24861 docs: better explain multi-part byte range behavior
- Better explain that if the requested range (--range or CURLOPT_RANGE)
  contains multiple ranges then the response contains meta information
  in addition to the requested bytes.

Prior to this change it was noted that a multiple part response was
returned as-is but not what that meant. In particular, meta information
is returned in addition to the requested bytes and that may have been
unexpected.

Reported-by: Ralf A. Timmermann

Fixes https://github.com/curl/curl/issues/16139
Closes https://github.com/curl/curl/pull/16150
2025-02-06 03:09:45 -05:00
Daniel Stenberg
153453eb78
SPONSORS.md: clarify that we don't promise goods or services
Due to past events

Closes #16196
2025-02-05 23:40:24 +01:00
Viktor Szakats
136bec79a0
GHA/non-native: skip examples in non-unity job
To save time. They are built the same way in the other jobs.

Follow-up to 6fc703904b #16188
Closes #16195
2025-02-05 22:50:29 +01:00
Viktor Szakats
a0d3a32fba
libssh: silence -Wconversion with a cast (Windows 32-bit)
Seen with GCC 13 with Windows x86:
```
lib/vssh/libssh.c: In function 'myssh_statemach_act':
lib/vssh/libssh.c:1851:41: error: conversion from 'curl_off_t' {aka 'long long int'} to 'size_t' {aka 'unsigned int'} may change value [-Werror=conversion]
 1851 |                              data->state.infilesize,
      |                              ~~~~~~~~~~~^~~~~~~~~~~
```
Ref: https://github.com/curl/curl/actions/runs/13161422041/job/36737994642?pr=16182#step:3:5111

Closes #16194
2025-02-05 21:19:36 +01:00
Viktor Szakats
6fc703904b
lib: include necessary headers for inet_ntop/inet_pton
Include `netinet/in.h` for FreeBSD/OpenBSD. Also include `sys/socket.h`
just in case, based on earlier code in `tests/libtest/lib1960.c`.

Also:
- document these in `CMakeLists.txt`.
- add a CI job testing FreeBSD with no unity and no test bundles.
  (without running tests to keep it fast)

FreeBSD (autotools):
```
../../../tests/libtest/lib1960.c:66:22: error: variable has incomplete type 'struct sockaddr_in'
   66 |   struct sockaddr_in serv_addr;
      |                      ^
../../../tests/libtest/lib1960.c:66:10: note: forward declaration of 'struct sockaddr_in'
   66 |   struct sockaddr_in serv_addr;
      |          ^
```
Ref: https://github.com/curl/curl/actions/runs/13159721509/job/36725114118?pr=16188#step:3:5289

OpenBSD (cmake):
```
/home/runner/work/curl/curl/tests/libtest/lib1960.c:66:22: error: variable has incomplete type 'struct sockaddr_in'
  struct sockaddr_in serv_addr;
                     ^
/home/runner/work/curl/curl/tests/libtest/lib1960.c:66:10: note: forward declaration of 'struct sockaddr_in'
  struct sockaddr_in serv_addr;
         ^
1 error generated.
```
Ref: https://github.com/curl/curl/actions/runs/13159721509/job/36725102004?pr=16188#step:3:2166

Reported-by: CueXXIII on Github
Fixes #16184
Follow-up to a3585c9576 #15543
Closes #16188
2025-02-05 16:29:03 +01:00
Viktor Szakats
14f26f5ee7
smb: silence -Warray-bounds with gcc 13+
The code look correct. The compiler gets confused by the `byte[1]`
struct member mapped into a memory buffer with a variable-sized
payload starting at this member. Perhaps there is a cleaner way
to silence this by changing the code.

First seen with gcc 13.2.0 in curl-for-win builds. Then with 13.2.1 and
the latest 14.2.0.

```
curl/lib/smb.c: In function 'smb_connection_state':
curl/lib/smb.c:895:5: warning: 'memcpy' offset [74, 80] from the object at 'buf' is out of the bounds of referenced subobject 'bytes' with type 'char[1]' at offset 73 [-Warray-bounds=]
  895 |     memcpy(smbc->challenge, nrsp->bytes, sizeof(smbc->challenge));
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
curl/lib/smb.c:130:8: note: subobject 'bytes' declared here
  130 |   char bytes[1];
      |        ^~~~~
```

gcc 14.2.0 debian:testing musl riscv64: https://github.com/curl/curl/actions/runs/13157579253/job/36718140035?pr=16182#step:3:5576
gcc 13.2.1 alpine amd64: https://github.com/curl/curl-for-win/actions/runs/9370491111/job/25797582549#step:3:4869
gcc 13.2.0 debian:testing glibc aarch64: https://github.com/curl/curl-for-win/actions/runs/9370491111/job/25797581315#step:3:6054
gcc 13.2.0 debian:testing glibc amd64: https://github.com/curl/curl-for-win/actions/runs/9370491111/job/25797581315#step:3:10959
gcc 13.2.0 debian:sid glibc riscv64: https://github.com/curl/curl-for-win/actions/runs/9370491111/job/25797580697#step:3:6122
gcc 13.2.0 debian:sid musl riscv64: https://github.com/curl/curl-for-win/actions/runs/9370491111/job/25797583450#step:3:6227

Closes #16187
2025-02-05 16:29:03 +01:00
Daniel Stenberg
e455757346
asyn-thread: fix HTTPS RR crash
By removing 'data' from the thread struct and passing it in as an
argument we avoid the case it could be dereferenced before stored when
shutting down HTTPS RR.

Also reordered the struct fields a little to remove holes.

Closes #16169
2025-02-05 14:05:22 +01:00
Daniel Stenberg
34cf9d54a4
RELEASE-NOTES: synced
curl 8.12.0 release

Also THANKS
2025-02-05 07:42:54 +01:00
Viktor Szakats
86ee64901f
transfer: replace false with FALSE
Follow-up to c9afcecee9 #16170

Closes #16177
2025-02-05 02:56:01 +01:00
Viktor Szakats
ad9a8b7754
cfilters: silence compiler warning
seen with gcc 4.4.0:
```
../../lib/cfilters.c: In function 'Curl_conn_http_version':
../../lib/cfilters.c:523: error: conversion to 'unsigned char' from 'int' may alter its value
```
Ref: https://github.com/curl/curl/actions/runs/13124120573/job/36616761121?pr=15975#step:9:20

Follow-up to e83818cae1 #16073

Closes #16171
2025-02-05 01:12:18 +01:00
Viktor Szakats
c9afcecee9
transfer: fix returning init failures from xfer_recv_shutdown_started()
Before this patch it returned `CURLE_FAILED_INIT` on init failures, with
the value of 2. Fix it to return `false`.

Seen with clang 18.1.8:
```
../lib/transfer.c(181,12): warning: integer constant not in range of enumerated type 'bool' [-Wassign-enum]
  181 |     return CURLE_FAILED_INIT;
      |            ^
../lib/transfer.c(181,12): warning: implicit conversion from enumeration type 'CURLcode' to different enumeration type 'bool' [-Wenum-conversion]
  181 |     return CURLE_FAILED_INIT;
      |     ~~~~~~ ^~~~~~~~~~~~~~~~~
../lib/transfer.c(183,12): warning: integer constant not in range of enumerated type 'bool' [-Wassign-enum]
  183 |     return CURLE_FAILED_INIT;
      |            ^
../lib/transfer.c(183,12): warning: implicit conversion from enumeration type 'CURLcode' to different enumeration type 'bool' [-Wenum-conversion]
  183 |     return CURLE_FAILED_INIT;
      |     ~~~~~~ ^~~~~~~~~~~~~~~~~
```

Follow-up to 35bf766280 #14253

Closes #16170
2025-02-05 01:12:18 +01:00
MacKenzie
255e3b64df
docs/HTTPSRR.md: Typo fix AAA -> AAAA
Closes #16173
2025-02-04 23:20:18 +01:00
Stefan Eissing
2578dae41b
pop3: revert connection ssl check
As reported in #16166, the STLS hangs with the check for SSL connection
filters, but is working with the old protocol handler way. Revert the
change, although it is unclear why it was no good here.

Fixes #16166
Reported-by: ralfjunker on github
Closes #16172
2025-02-04 23:00:58 +01:00
Daniel Stenberg
1b4e635134
HTTPSRR.md: implement what seems to be deployed
Closes #16158
2025-02-04 10:02:29 +01:00
Viktor Szakats
2ed232a4e6
build: drop macro used to enable -Wsign-conversion warnings in CI
We don't pursue this, and the necessary `#pragma` got in the way of
compiling curl with gcc 4.2 and older. Drop the logic completely.

Follow-up to 8a266ac488 #15939

Reported-by: prpr19xx on Github
Fixes #16152
Closes #16157
2025-02-03 22:28:08 +01:00
Daniel Stenberg
48ced02bff
RELEASE-NOTES: synced 2025-02-03 22:02:16 +01:00
Edoardo Lolletti
e0225f261e
symbols-in-versions: update version for LIBCURL_VERSION and LIBCURL_VERSION_NUM
Those 2 symbols were available since the first 7.1.1 release

Closes #16141
2025-02-03 20:20:49 +01:00
Stefan Eissing
65fca12e63
x509asn1: add parse recursion limit
For ASN.1 tags with indefinite length, curl's own parser for TLS
backends that do not support certificate inspection calls itself
recursively. A malicious server certificate can then lead to high
recursion level exhausting the stack space.

This PR limits the recursion level to 16 which should be safe on all
architectures.

Added unit test 1657 to verify behaviour.

Fixes #16135
Reported-by: z2_
Closes #16137
2025-02-03 20:10:09 +01:00
Calvin Ruocco
dc3252bedd
ws-docs: extend WebSocket documentation
Closes #16118
2025-02-03 20:07:30 +01:00
mauke
bfec1d7165
runtests.pl: fix precedence issue
The condition `!$cmdtype eq "perl"` (introduced in a4765b0551) is always
false. It checks whether a logical negation (giving true/false) is equal
to the string `"perl"`. This is impossible, so the logging never worked.

The intent was probably to negate the result of the string
comparison:`!($cmdtype eq "perl")` or simply `$cmdtype ne "perl"`.

Fixes #16128
Reported-by: Igor Todorovski
Closes #16129
2025-02-03 20:04:12 +01:00
Dan Fandrich
9712db21d1 tests: stop promoting perl warnings to fatal errors
While this is useful on CI to highlight issues in the scripts, it's a
recipe for pain when enabled on users' builds.

Suggested-by: Leon Timmermans
Ref: #16128
2025-02-03 10:51:48 -08:00
Viktor Szakats
671e83f0b1
c-ares: fix/tidy-up macro initializations, avoid a deprecated function
- replace deprecated `ares_init()` call with `ares_init_options()`.
  Follow-up to 0d4fdbf15d #16054

- dedupe `CARES_STATICLIB` initalizations into `curl_setup.h`, to
  ensure it's defined before the first (and every) `ares.h` include and
  avoid a potential confusion.

- move `CARES_NO_DEPRECATED` from build level to `curl_setup.h`.
  To work regardless of build system.
  It is necessary because curl calls `ares_getsock()` from two places,
  of which one feeds a chain of wrappers: `Curl_ares_getsock()`,
  `Curl_resolver_getsock()`, `Curl_resolv_getsock()`.

Closes #16131
2025-02-03 19:04:50 +01:00
Viktor Szakats
4f95f32709
INSTALL-CMAKE.md: fix punctuation 2025-01-30 15:51:48 +01:00
Viktor Szakats
b13e9066b3
GHA: tidy up apt commands
- drop `--quiet 2` option where used, to have uniform output.
- replace `apt` with `apt-get` in one job. sync options with rest.
- replace deprecated `apt-key` command with the alternative recommended
  by `apt-key(8)`.
- drop stray `cd /tmp`, no longer needed after migrating to GHA.
- shorten `--option Dpkg::Use-Pty=0` to `-o Dpkg::Use-Pty=0`.
- add `-o Dpkg::Use-Pty=0` to hide `apt-get` progress bars taking
  vertical log space, where missing.
- drop `-y --no-install-suggests --no-install-recommends` `apt-get`
  options. They are the default in the ubuntu-24.04 image.
- GHA/distcheck: move `name:` to top in steps where not there.
- scripts/cijobs.pl: catch `apt-get` lines with the `-o` option.

Closes #16127
2025-01-30 02:36:43 +01:00
Michael Schuster
11ea10355a
mbedtls: PSA can be used independently of TLS 1.3 (avoid runtime errors)
Closes #16044
2025-01-29 08:54:10 +01:00
Dan Fandrich
23ec39c3b5 test1960: don't close the socket too early
The socket was closed while the handle was still in use, so
curl_easy_cleanup ended up setting nonblocking mode on a closed handle.

Closes #16123
2025-01-28 09:43:31 -08:00
Viktor Szakats
34c1c653fc
cmake: warn for OpenSSL versions missing TLS 1.3 support
To match existing warnings for Secure Transport and BearSSL.

OpenSSL 1.1.1 or upper are offering TLS 1.3 support.

Ref: https://wiki.openssl.org/index.php/TLS1.3

Closes #16120
2025-01-28 18:05:40 +01:00
Daniel Stenberg
b0009d0216
cd2nroff: do not insist on quoted <> within backticks
Ref: #16118
Closes #16121
2025-01-28 17:36:55 +01:00
Viktor Szakats
4519a9c887
gitignore: add lib/Makefile.soname.cmake 2025-01-28 16:04:29 +01:00
Stefan Eissing
f6ea54af32
https-connect: start next immediately on failure
When parallel connects are attempted, the second one is started on a
delay. Start it right away when the first one failed.

Closes #16114
2025-01-28 15:40:33 +01:00
Viktor Szakats
9eae606dfd
gitignore: restore explicit lists and fix them
Range matches are not supported with `+`: https://git-scm.com/docs/gitignore

Also sync `.gitignore` file lists with source files and alphasort them.

Follow-up to 5c31c2e670 #16093
Reported-by: Stefan Eissing
Fixes #16112
Fixes #16115
Closes #16116
2025-01-28 14:44:35 +01:00
Stefan Eissing
399ca56be5
ngtcp2: fix memory leak on connect failure
When a QUIC connection using ngtcp2 failed immediately, the TLS
instances were not always released.

Closes #16113
2025-01-28 14:12:42 +01:00
Martin Harrigan
f6da27052e
docs/cmdline-opts/location.md: fix typos for location flag
Closes #16110
2025-01-28 14:07:39 +01:00
Viktor Szakats
f3920c7924
INTERNALS.md: sync wolfSSL version requirement with source code
`lib/vtls/wolfssl.c` enforces it via a hard #error.

Cherry-picked from #16104
2025-01-28 12:06:41 +01:00
Viktor Szakats
8b8ec574bc
openssl: define HAVE_KEYLOG_CALLBACK before use
Before this patch this macro was used in `vtls/openssl.h` without
setting it first, causing the `keylog_done` member be present in
struct `ossl_ctx` while the code did not use it.

Follow-up to 3210101088 #13172
Closes #16105
2025-01-28 11:15:10 +01:00
Viktor Szakats
1dce2a1746
openssl: drop unused HAVE_SSL_GET_SHUTDOWN macro
Follow-up to c31041b17e #13904
Closes #16103
2025-01-28 11:15:09 +01:00
Daniel Stenberg
58c22dda66
tool_getparam: fail --hostpubsha256 if libssh2 is not used
Reported-by: Harry Sintonen
Closes #16109
2025-01-28 10:30:40 +01:00
Andrew Kaster
1b740aedcd
ws: Reject frames with unknown reserved bits set
RFC 6455 Section 5.2 notes that for bits RSV1, RSV2, and RSV3 of the
framing header, a non-zero value that is not defined by a negotiated
extension MUST Fail the WebSocket connection.

Test 2310 verifies

Closes #16069
2025-01-28 10:19:39 +01:00
Jay Satiro
e2ec7bf1b4 vtls: fix default SSL backend as a fallback
- Use build-time CURL_DEFAULT_SSL_BACKEND as a fallback when environment
  variable CURL_SSL_BACKEND contains a backend that is unavailable.

Prior to this change if CURL_SSL_BACKEND was set then
CURL_DEFAULT_SSL_BACKEND was ignored even if the backend of the former
was unavailable. In that case libcurl would instead select the first
available backend in the list of backends.

Bug: https://github.com/curl/curl/issues/16076#issuecomment-2617354254
Reported-by: Jeroen Ooms

Closes https://github.com/curl/curl/pull/16108
2025-01-28 03:29:35 -05:00
Jay Satiro
4f99efb192 easy: allow connect-only handle reuse with easy_perform
- Detach and disconnect an attached connection before performing.

Prior to this change it was not possible to safely reuse an easy handle
with an attached connection in a second call to curl_easy_perform. The
only known case of this is a connect-only type handle where the
connection was detached when curl_easy_perform returned, only to be
reattached by either curl_easy_send/recv.

This commit effectively reverts 2f8ecd5d and be82a360, the latter of
which treated the reuse as an error. Prior to that change undefined
behavior may occur in such a case.

Bug: https://curl.se/mail/lib-2025-01/0044.html
Reported-by: Aleksander Mazur

Closes https://github.com/curl/curl/pull/16008
2025-01-28 03:27:04 -05:00
Dexter Gerig
f25a807a7d
asyn-ares: fix memory leak
Closes #16107
2025-01-28 09:23:48 +01:00
Dexter Gerig
afb3fd7112
asyn-thread: fix HTTPS RR resolution
Store the received data correctly.

Closes #16107
2025-01-28 09:23:33 +01:00
Viktor Szakats
fd12b56832
gitignore: add generated unity sources for lib and src
Follow-up to 71cf0d1fca #14772
2025-01-27 22:55:39 +01:00
Viktor Szakats
81e271f45c
checksrc: exclude generated bundle files to avoid race condition
Necessary to catch rare cases when `checksrc` hits these files when they
are not populated yet:
```
./curltool_unity.c:1:1: error: Missing copyright statement (COPYRIGHT)
 ^
```
https://github.com/curl/curl/actions/runs/12995546740/job/36242556713?pr=16094#step:37:123

Follow-up to 71cf0d1fca #14772
Closes #16102
2025-01-27 20:59:47 +01:00
Viktor Szakats
23b41224e3
msvc: add missing push/pop for warning pragmas
Also fix indentation/formatting around similar pragmas.

Closes #16101
2025-01-27 20:59:47 +01:00