Commit graph

16005 commits

Author SHA1 Message Date
Viktor Szakats
e2d61a6b30
curlx_win32_fopen: use _fsopen()/_wfsopen() with _SH_DENYNO
Replacing `fopen_s()`/`_wfopen_s()`, to allow customizing share mode,
and keep the sharing mode as was with `fopen()`/`_wopen()` earlier and
as used in `_sopen_s()`/`_wsopen_s()`.

The replaced functions used `_SH_SECURE` internally. Otherwise they are
identical to the replacements.

Ref: https://learn.microsoft.com/cpp/c-runtime-library/reference/fsopen-wfsopen

Reported-by: Jay Satiro
Fixes #20155
Ref: #20156
Follow-up to 1e7d0bafc6 #19643
Closes #20186
2026-01-06 12:20:01 +01:00
Andrew
64350280d3
ldap: fix LDAP version display on IBMi
Fixes #20196
Closes #20197
2026-01-06 12:08:16 +01:00
Andrew
d3def68d3b
multi: fix to build on IBMi
Sync function declaration with definition. Update related local vars.

Follow-up to 4701a6d2ae #19695
Fixes #20190
Closes #20191
2026-01-05 23:16:04 +01:00
Andrew
0343951cb5
ldap: fix Curl_ldap_version() for IBMi/OS400
- `LDAP_OPT_SUCCESS` (== 0) is missing from some LDAP implementations
  and documented to use `LDAP_SUCCESS` (== 0) instead. Use literal zero
  to avoid macro name differences.

- fix freeing `LDAP_OPT_API_INFO` buffers:
  - docs suggest `ldapai_vendor_name` on IBMi is `const char *`.
    Nothing in docs says it need to be freed.
  - `ldapai_extensions` need to be freed, according to docs.
    However, on IBMi there is `ldap_value_free()` function for it.
  Ref: https://www.ibm.com/docs/en/svd/10.0.3?topic=settings-ldap-opt-api-info

Fixing, on OS400 (V7R4M0):
```
CZM1003:  LDAP__819.c, 1028.56: CZM0045(30) Undeclared identifier LDAP_OPT_SUCCESS.
CZM1003:  LDAP__819.c, 1036.21: CZM0280(30) Function argument assignment between types "char*" and "const char*" is not allowed.
CZM1001:  LDAP__819.c, 1037.5: CZM0304(10) No function prototype given for "ber_memvfree".
...
CZS0601:  Module LDAP is not created because statement errors occurred.
```

Follow-up to 859ce48de1 #19832
Fixes #20188
Closes #20189
2026-01-05 23:10:47 +01:00
Daniel Stenberg
193397bf4e
progress: narrower time display, multiple fixes
- Each time field is now 7 characters wide, so that the total width
  never exceeds 79 columns so that it works correctly also in Windows
  terminals. The title lines are adjusted accordingly.

  This is accomplished by using h:mm:ss style up to 10 hours, and for
  longer periods switch to "nnX nnY" style output. For hours, days,
  months and years.

  For less than one hour, the hour field is now dropped.

  When no time info is provided, the field is now space-only. No more
  `-:--:--`.

  Also fixed the output for really long times which previously was
  completely broken. The largest time now shows as ">99999y". (Becase
  I can't figure out a better way).

- For sizes, the widths are now properly fixed to 6 characters. When
  displaying a unit with less than 3 digits, it shows two decimal
  precision like "16777215 => 15.99M" and one decmal otherwise: "262143
  => 255.9k"

  Also fixes the decimal math. 131071 is 127.9k, which it previously did
  not show.

- The time and size field outputs are now properly verified in test
  1636.

Fixes #20122
Closes #20173

fixup use only space when no time exists

Drop the hour from the display when zero
2026-01-04 14:42:08 +01:00
Daniel Stenberg
3c8f9c9247
setopt: free the previous STRING_ENCODING before storing the new
Follow-up to 6b9c75e219

Fixes #20179
Reported-by: correctmost on github
Closes #20180
2026-01-04 14:32:28 +01:00
Stefan Eissing
2c32ab12a0
pytest: test 07_70 stabilize (curl_ngtcp2)
We recently allowed a larger send buffer in ngtcp2 streams. This allowed
curl to send more early data then previously when the server was slow in
performing the handshake. This led to flaky test failures when the
amount of early data was larger than expected.

Change test expectations to allow for varying amount of early data.

Ref: #20112
Closes #20161
2026-01-03 00:48:54 +01:00
Stefan Eissing
ac06643f71
pytest: test 03_02 stabilize (curl_ngtcp2)
The special handling for draining server connections during a connect
attempt was only done on CURLE_RECV_ERROR. But it may also happen when
ngtcp2 errors on writing data. Check for CURLE_SEND_ERROR also.

Ref: #20112
Closes #20162
2026-01-03 00:48:54 +01:00
Daniel Stenberg
03c9215e62
altsvc: accept ma/persist per alternative entry
The 'ma' and 'persist' keywords should be considered per list entry, not
once per header.

Expand test 1654 to verify such headers

Reported-by: Hunt Darlener
Closes #20160
2026-01-02 23:50:21 +01:00
Daniel Stenberg
ce423079dc
progress: make it one column narrower
To make it fit 80 columns appropriately

Reported-by: Jay Satiro
Fixes #20122
Closes #20124
2026-01-02 11:44:33 +01:00
Viktor Szakats
438ba94461
vtls: drop unused use_alpn from ssl_connect_data struct
Closes #20154
2026-01-02 10:45:12 +01:00
Viktor Szakats
74c4bdc244
ws: replace a cast by matching the format string
Closes #20151
2026-01-02 10:45:12 +01:00
Daniel Stenberg
84e43eefc8
mqtt: return error when a too large packet is decoded
Closes #20148
2026-01-01 23:30:10 +01:00
Daniel Stenberg
f7d8725a55
inet_ntop: avoid the strlen()
Also, skip adding the terminating null that is not used.

Closes #20139
2026-01-01 18:06:39 +01:00
Daniel Stenberg
d3eddf4761
source: misc typos
Found by typos-cli

Closes #20138
2026-01-01 12:43:59 +01:00
Viktor Szakats
e4f4eeb0c5
libssh: fix indent
Closes #20135
2025-12-31 18:49:53 +01:00
Viktor Szakats
258521e170
hostip.h: drop redundant setjmp.h include
Already included directly via `hostip.c`, and other header users do not
use it.

Also add comment about why `setjmp.h` is used.

Cherry-picked from #20106

Closes #20132
2025-12-31 17:00:57 +01:00
Viktor Szakats
7ad830bb58
openssl: stop checking for OPENSSL_NO_SHA* macros
Macros have been deleted upstream and never defined in OpenSSL 1.1.0+:
474e469bbd

BoringSSL deleted the last internals uses in 2014:
457112e197

LibreSSL refers to them internally and in two public headers, but never
set them via `openssl/opensslfeatures.h` / `openssl/opensslconf.h`.

Follow-up to 69c89bf3d3 #18330

Closes #20130
2025-12-31 17:00:03 +01:00
Viktor Szakats
0d0ac29cdd
openssl: stop checking for OPENSSL_NO_TLSEXT macro
The macro has been deleted upstream and never defined in OpenSSL 1.1.0+:
e481f9b90b

BoringSSL and LibreSSL deleted the last uses in 2014:
6dbd73db5d
7b2f3298f7

Also:
- drop internal guard `HAS_ALPN_OPENSSL`. It's always set.

Follow-up to 69c89bf3d3 #18330

Closes #20129
2025-12-31 16:55:52 +01:00
Viktor Szakats
c7b25e6e82
lib: drop unused or duplicate curlx/timeval.h includes
Note: This patch doesn't aim to add `timeval.h` includes missing from
local headers using `curltime` type. They remain relying on `urldata.h`
being included first. This patch also doesn't delete existing, used
includes already present in local headers (as internal users may rely
on them).

Ref: #20106
Closes #20126
2025-12-31 15:59:19 +01:00
Viktor Szakats
def95e3bbc
openssl: fix building against no-ocsp openssl with Apple SecTrust
(Not tested in CI. Regression in 8.17.0.)

Fixing:
```
lib/vtls/openssl.c:4750:8: error: variable 'sectrust_verified' set but not used [-Werror,-Wunused-but-set-variable]
 4750 |   bool sectrust_verified = FALSE;
      |        ^
1 error generated.
```

Follow-up to b4630ed8fa #19308

Closes #20128
2025-12-31 15:51:02 +01:00
Viktor Szakats
be675eeb6d
openssl: fix building against no-dsa openssl
(Not tested in CI. Regression within this release cycle.)

Fixing:
```
lib/vtls/openssl.c:304:48: error: unused parameter 'data' [-Werror,-Wunused-parameter]
  304 | static CURLcode get_pkey_dsa(struct Curl_easy *data,
      |                                                ^
lib/vtls/openssl.c:305:40: error: unused parameter 'pubkey' [-Werror,-Wunused-parameter]
  305 |                              EVP_PKEY *pubkey, BIO *mem, int i)
      |                                        ^
lib/vtls/openssl.c:305:53: error: unused parameter 'mem' [-Werror,-Wunused-parameter]
  305 |                              EVP_PKEY *pubkey, BIO *mem, int i)
      |                                                     ^
lib/vtls/openssl.c:305:62: error: unused parameter 'i' [-Werror,-Wunused-parameter]
  305 |                              EVP_PKEY *pubkey, BIO *mem, int i)
      |                                                              ^
```

Follow-up to 833efb437d #19471

Closes #20127
2025-12-31 15:51:01 +01:00
Yedaya Katsman
660600c747
badwords: add fist -> first, fix fallouts
There are still `curl_fistrgs` in packages/OS400/curl.inc.in but
I'm not sure what that's supposed to be exactly.

Closes #20066
2025-12-31 12:21:42 +01:00
trxvorr
f81e7197c1
digest: fix OWS and escaped quote handling
The migration to the strparse API introduced regressions in Digest
authentication parsing where Optional Whitespace (OWS) after commas was
not skipped, and escaped quotes in values were not correctly parsed.

This change ensures whitespace is skipped before key lookups and escaped
characters are properly handled and unescaped in quoted values.

Reported-by: herdiyanitdev on hackerone
Closes #20102
2025-12-30 23:22:26 +01:00
Stefan Eissing
52ac8104e1
ratelimit blocking: fix busy loop
Fix the pollset in perform state to not add sockets for directions
that are blocked. This otherwise will lead to busy loops for a
transfer that cannot be progressed.

Reported-by: Fizn-Ahmd on github
Fixes #20091
Closes #20109
2025-12-29 22:44:34 +01:00
Harry Sintonen
16d5f2a566
libssh: require private key or user-agent for public key auth
Closes #20110
2025-12-29 17:28:22 +01:00
Daniel Stenberg
bc9ab557df
telnet: abort on bad suboption sequence
Instead of trying to repair.

Reported-by: Huseyin Tintas

Closes #20108
2025-12-29 10:49:30 +01:00
Daniel Stenberg
7fc78c2c1c
urlapi: set uncondtional return code
Curl_parse_login_details() can only return a single return code so
adjust accordingly.

Pointed out by CodeSonar

Closes #20107
2025-12-29 10:17:49 +01:00
Daniel Stenberg
2754e0f3d3
url: return error at once when OOM in netrc handling
Closes #20103
2025-12-29 10:16:48 +01:00
Daniel Stenberg
5c0cdd26d6
strcopy: minor comment edit to avoid matching a grep for strcpy use 2025-12-27 23:25:13 +01:00
Daniel Stenberg
6842d4ec4d
curl_quiche: refuse headers with CR, LF or null bytes
Also renamed the struct field to 'h1hdr' from 'scratch' to better say
what its purpose is.

Closes #20101
2025-12-27 16:27:11 +01:00
Daniel Stenberg
0e054134b7
urlapi: return OOM correctly from parse_hostname_login()
Closes #20100
2025-12-27 16:25:55 +01:00
Daniel Stenberg
0ccd16d29a
ftp: return from ftp_state_use_port immediately on OOM
Closes #20100
2025-12-27 16:25:52 +01:00
Daniel Stenberg
19ca87d4e2
cf-socket: return OOM error if socket() failes due to OOM
Closes #20100
2025-12-27 16:25:38 +01:00
Viktor Szakats
7032982896
tidy-up: miscellaneous
- asyn-thrdd.c: scope an include.
- apply more clang-format suggestions.
- tidy-up PP guard comments.
- delete empty line from the top of headers.
- add empty line after `curl_setup.h` include where missing.
- fix indent.
- CODE_STYLE.md: add `strcpy`.
  Follow-up to 8636ad55df #20088
- lib1901.c: drop unnecessary line.
  Follow-up to 436e67f65b #20076

Closes #20070
2025-12-26 22:06:09 +01:00
Daniel Stenberg
abcb10f3ac
ftp: return better on OOM in two places
Found with strict torture testing.

Closes #20099
2025-12-26 10:48:41 +01:00
Daniel Stenberg
a585cc35e5
memdebug: stop tracking send and recv
- they rarely catch any problems
- we have other ways to test different send/recv problems
- the number of such calls vary much more per invoke than others, making
  memdebugging harder
- reducing the total number of fallible functions per test is good
- they were not used as intended anyway

Closes #20097
2025-12-26 10:27:27 +01:00
Daniel Stenberg
d4b62bff64
curl_threads: don't do another malloc if the first fails
Closes #20095
2025-12-25 22:14:39 +01:00
Daniel Stenberg
18af4e4e10
cookie: flush better
The cookie flushing (saving to a cookie jar) should only be done if a
transfer has been started. This is now done by checking the
cookies->running field, which is not reset in curl_easy_reset() so the
saving works correctly even after a call to that.

Follow-up to fd6eb8d6e7

Verified by test 1920

Reported-by: Alexander Batischev
Fixes #20090
Closes #20094
2025-12-25 12:05:23 +01:00
Viktor Szakats
e78a466ebd
lib: drop unused protocol headers
- drop unused `http.h` includes.
- drop unused `http1.h` include.
- drop unused `http2.h` includes.
- vssh/ssh.h: drop unused `vssh.h` include.
- urldata.h: drop unused protocol includes.
- url: include `smtp.h` directly.
- rtsp.h: include directly where used.
- imap, smtp: drop redundant include, move another from .h to .c.

Verified with an all non-unity CI run.

Closes #20093
2025-12-25 12:00:22 +01:00
Daniel Stenberg
adca486c12
libssh: set both knownhosts options to the same file
Reported-by: Harry Sintonen

Closes #20092
2025-12-25 11:01:41 +01:00
Daniel Stenberg
ca46112991
curl_ntlm_core: fix DES_* symbols for some wolfSSL builds
Recent wolfSSL with OPENSSL_COEXIST enabled does not provide the DES_*
symbols, so we do.

Reported-by: Daniel Pouzzner
Closes #20083
2025-12-24 22:49:43 +01:00
Daniel Stenberg
76e7d496b6
escape: add a length check in curl_easy_escape
Only accept up to SIZE_MAX/16 input bytes. To avoid overflows, mistakes
and abuse.

Follow-up to 9bfc7f9234

Reported-by: Daniel Santos

Closes #20086
2025-12-24 22:47:26 +01:00
Viktor Szakats
532d134767
build: stop disabling strcpy checks with clang-tidy
Follow-up to 436e67f65b #20076

Closes #20084
2025-12-24 00:02:40 +01:00
Viktor Szakats
436e67f65b
tests: replace strcpy() with curlx_strcopy()
Also:
- examples/hsts-preload: apply the same change as it's based on lib1915
  in tests. Make a local clone of `curlx_strcopy()`. Then drop the
  `_CRT_SECURE_NO_WARNINGS` hack, that's no longer necessary.
- curl_setup.h: delete `strcpy()` from the `_CRT_SECURE_NO_WARNINGS`
  list.

Closes #20076
2025-12-23 22:25:39 +01:00
Daniel Stenberg
7e064d0756
cf-h1-proxy: support folded headers in CONNECT responses
Update test 1941 to verify this

Remove unused code from dynhds for handling folded headers, and the
associated unit tests of those functions in test 2602 and 2603.

Closes #20080
2025-12-23 17:12:14 +01:00
Viktor Szakats
17628b15ec
vquic: initialize new callback in nghttp3 1.14.0+
Fixing (seen in curl-for-win production build):
```
lib/vquic/curl_ngtcp2.c:1257:1: error: missing field 'recv_settings2' initializer [-Werror,-Wmissing-field-initializers]
 1257 | };
      | ^
1 error generated.
```
Ref: https://ci.appveyor.com/project/curlorg/curl-for-win/builds/53281785#L6752
Ref: https://github.com/curl/curl/actions/runs/20459295003/job/58788229134#step:3:5513

Also:
- Mark previous callback deprecated.
- Document ngtcp2, nghttp3 versions for callback entry feature guards.

Refs:
https://github.com/ngtcp2/nghttp3/releases/tag/v1.14.0
https://github.com/ngtcp2/nghttp3/pull/432
1616ab8350

Closes #20077
2025-12-23 13:34:07 +01:00
Daniel Stenberg
a535be4ea0
curlx: curlx_strcopy() instead of strcpy()
This function REQUIRES the size of the target buffer as well as the
length of the source string. Meant to make it harder to do a bad
strcpy().

Removes 23 calls to strcpy().

Closes #20067
2025-12-22 23:01:05 +01:00
Stefan Eissing
f099c2ca55
apple sectrust: fix ancient evaluation
On versions before macOS 10.14, ios 12 and watchos 5, check the
evaluation code to return the error from evaluation.

Reported-by: Stanislav Fort
Closes #20074
2025-12-22 23:00:08 +01:00
Daniel Stenberg
6b9c75e219
content_encoding: avoid strcpy
Build list with dynbuf.

Closes #20072
2025-12-22 14:17:21 +01:00