Commit Graph

34209 Commits

Author SHA1 Message Date
Daniel Stenberg
96ffb57040
docs: bring back ALTSVC.md and HSTS.md
This partly reverts 0e06603b23

These file formats are not properly documented elsewhere, plus the
website uses these files to populate the documentation pages to which
users end up via the URLs that are mentioned within the alt-svc and hsts
files.

Fixes #15705
Reported-by: Jeffrey Bosboom
Closes #15706
2024-12-09 09:32:19 +01:00
Marcel Raad
ebce0e7e4a
test2086: disable MSYS2's POSIX path conversion
Older MSYS2 versions treat the URL as paths list and convert them from
UNIX to Windows format. There's no path here that needs to be
converted, so disable path conversion for this test as done for others.

Fixes https://github.com/curl/curl/pull/15644#issuecomment-2511313206
Closes https://github.com/curl/curl/pull/15677
2024-12-08 23:03:23 +01:00
Daniel Stenberg
59fec5ac43
mprintf: fix the integer overflow checks
When a floating point precision or string width are provided as a
base-10 number, the code could miss to detect integer overflows if the
provided value was exactly 2147483648 or 2147483649 (2147483647 being
the maxium value a signed integer can hold).

The chance that such values would actually ever be used is slim.

This change fixes the detection to also cover those edge cases.

Closes #15699
2024-12-06 16:38:30 +01:00
Daniel Stenberg
ec14be6a4d
RELEASE-NOTES: synced 2024-12-06 09:24:45 +01:00
Daniel Stenberg
8d926c653b
tool_getparam: remove Redundant Condition
Pointed out by CodeSonar

Closes #15698
2024-12-06 09:20:05 +01:00
Jay Satiro
a4458c7ee3 hostip: don't use the resolver for FQDN localhost
- Treat `[<any>.]localhost.` (ie localhost with FQDN period terminator)
  as fixed value 127.0.0.1 and ::1 instead of querying the resolver.

Prior to this change, b5c0fe20 (precedes 7.85.0) did the same for
non-FQDN `<any>.localhost`.

Prior to this change, 1a0ebf66 (precedes 7.78.0) did the same for
non-FQDN `localhost`.

Ref: https://github.com/curl/curl/issues/15628#issuecomment-2515540315

Closes https://github.com/curl/curl/pull/15676
2024-12-05 17:16:34 -05:00
Daniel Stenberg
6755ba593c
http_negotiate: allow for a one byte larger channel binding buffer
The channel binding data dynbuf was not set correctly making it fail with
CURLE_TOO_LARGE too easily.

Reported-by: galen11 on github
Fixes #15685
Closes #15694
2024-12-05 23:09:28 +01:00
chemodax
b6aecd4a98
cmake: set CURL_STATICLIB for static lib when SHARE_LIB_OBJECT=OFF
When compiled with BUILD_STATIC_LIBS=ON and SHARE_LIB_OBJECT=OFF compile
definition CURL_STATICLIB was not set for static library. It seems to be
copy-paste error in the lib/CMakeLists.txt.

This pull request fixes it.

Closes #15695
2024-12-05 20:52:01 +01:00
Stefan Eissing
ce949ba1dc
mime: fix reader stall on small read lengths
The base64 mime encoder stalls when it cannot encode a full 3 byte input
set into the read buffer. The workaround for this limitation was
incomplete and could lead to stalled transfers when the last chunk to
upload was smaller than 4 bytes.

Use a tmp buffer on small reads to allow mime encoders more space to put
their things.

Add test case reproducing the issue and fix.

Reported-by: Alexis Savin
Fixes #15688
Closes #15691
2024-12-05 15:44:51 +01:00
andrewkirillov-ibm
4bba14c35d
dmaketgz: use --no-cache when building docker image
Fixes #15689
Closes #15690
2024-12-05 15:41:53 +01:00
Daniel Stenberg
f707783630
tool_getparam: parse --localport without using sscanf
and switch to str2unummax() for the number parsings

Closes #15681
2024-12-05 08:22:35 +01:00
Daniel Stenberg
9664d5a547
tool_formparse: remove use of sscanf()
In the function for handling 'type=' in the -F command line arguments,
we make the code more lax to accept more strings and thereby also avoid
the use of sscanf().

Closes #15683
2024-12-05 07:58:45 +01:00
Daniel Stenberg
03669b630e
tool_urlglob: parse character globbing range without sscanf
A step towards a future without sscanf() calls.

Closes #15682
2024-12-05 07:56:55 +01:00
Daniel Stenberg
c948971e83
digest: produce a shorter cnonce in Digest headers
Other programs (Postman, Chrome, Python request) use a 16 byte cnonce
and there are instances of server-side implementations that don't
support the larger lengths curl used previously.

Fixes #15653
Reported-by: Florian Eckert
Closes #15670
2024-12-04 15:34:25 +01:00
Daniel Stenberg
509f50e58d
curl: do more command line parsing in sub functions
This moves argument parsing logic for a number of options into sub
functions to reduce the overall complexity of the single getparameter()
function. pmccabe says it takes complexity down from 234 to 147.

The command line options that now has dedicated parser funtions are:

 --continue-at, --ech, --header, --localport, --output, --quote, --range
 --remote-name, --time-cond, --upload-file, --url, --verbose, --writeout

These parsers were selected for thise because they had more than 15
lines of logic in the main switch(). Detected like this:

 git grep -hn 'case C_' tool_getparam.c |
  cut -d: -f1 |
  awk '{if(($1 - prev) > 15) { printf "%d\n", prev;} prev = $1;}'

Closes #15680
2024-12-04 13:16:29 +01:00
Daniel Stenberg
d95a89266b
openssl: remove three "Useless Assignments"
Pointed out by CodeSonar

Closes #15679
2024-12-04 08:29:24 +01:00
Daniel Pouzzner
c1edfc808a
liub: fixes for wolfSSL OPENSSL_COEXIST
For MD4, MD5, and DES

Assisted-by: Viktor Szakats
Closes #15650
2024-12-04 08:25:14 +01:00
Daniel Stenberg
3856e10445
KNOWN_BUGS: setting a disabled option should return CURLE_NOT_BUILT_IN
Reported-by: Jeroen Ooms
Closes #15472
Closes #15675
2024-12-04 07:07:43 +01:00
Daniel Stenberg
90d937def9
RELEASE-NOTES: synced 2024-12-03 17:21:42 +01:00
Daniel Stenberg
381b275314
http_proxy: move dynhds_add_custom here from http.c
... and make it static. As it is not used anywhere else.

Closes #15672
2024-12-03 15:02:58 +01:00
Daniel Stenberg
8d780f6012
openssl: stop using SSL_CTX_ function prefix for our functions
It is a prefix already taken and is used by OpenSSL

Closes #15673
2024-12-03 15:01:54 +01:00
renovate[bot]
6b65422bcc
Dockerfile: Update debian:bookworm-slim Docker digest to b73bf02
Closes #15671
2024-12-03 09:25:09 +01:00
renovate[bot]
c3181dc5cf
CI: update dependencies
- ngtcp2/ngtcp2 to v1.9.1
- github/codeql-action digest to f09c1c0
- rustls/rustls-ffi to v0.14.1
- awslabs/aws-lc to v1.40.0

Closes #15616
Closes #15619
Closes #15629
Closes #15651
2024-12-03 09:24:04 +01:00
xiaofeng
8b259498be
libssh: use libssh sftp_aio to upload file
Support async sftp upload for curl built with libssh.

Closes #15625
2024-12-02 21:33:24 +01:00
Daniel Stenberg
0169b80e5c
curl: --continue-at is mutually exclusive with --remove-on-error
Test 482 verifies

Fixes #15645
Reported-by: Harry Sintonen
Closes #15668
2024-12-02 21:22:57 +01:00
Daniel Stenberg
ffbcde0022
curl: --continue-at is mutually exclusive with --no-clobber
Test 481 verifies

Fixes #15645
Reported-by: Harry Sintonen
Closes #15668
2024-12-02 21:22:47 +01:00
Stefan Eissing
26ee83ab67
curl: use realtime in trace timestamps
Timestamps in trace logs used a mix of realtime and monotonic time
sources, leading to fractional seconds carrying wrong values. Use
realtime only, so the correct nanoseconds are printed.

Fixes #15614
Reported-by: jethrogb on github
Closes #15641
2024-12-02 21:21:18 +01:00
Stefan Eissing
fd4528a8d8
OpenSSL: improvde error message on expired certificate
Fix regression that no longer printed the error messages about expired
certificates in openssl. Add test case for openssl/gnutls/wolfssl.

Fixes #15612
Reported-by: hiimmat on github
Closes #15613
2024-12-02 21:17:59 +01:00
Stefan Eissing
55968fd14b
pytest: add test for use of CURLMOPT_MAX_HOST_CONNECTIONS
Add test_02_33 to run with various values for the multi option
CURLMOPT_MAX_HOST_CONNECTIONS and CURLOPT_FRESH_CONNECT to trigger
connection pool limit handling code.

Closes #15494
2024-12-02 21:16:10 +01:00
Daniel Stenberg
fcb59534e3
curl: --continue-at is mutually exclusive with --range
Allowing both just creates a transfer with behaviors no user can
properly anticipate so better just deny the combo.

Fixes #15646
Reported-by: Harry Sintonen
Closes #15666
2024-12-02 15:36:44 +01:00
Daniel Stenberg
fa1a8e0215
docs: suggest --ssl-reqd instead of --ftp-ssl
Reported-by: SuperStormer on github
Fixes #15658
Closes #15660
2024-12-02 09:07:50 +01:00
Daniel Stenberg
f54966b167
RELEASE-NOTES: synced 2024-12-02 09:05:37 +01:00
Jay Satiro
b1c54e1006 setopt: fix missing options for builds without HTTP & MQTT
- Restore some necessary options for builds without HTTP and MQTT.

The logic to turn off a segment of options in builds without HTTP and
MQTT was too expansive. Those builds (such as FTP-only builds) could not
use options such as CURLOPT_URL or CURLOPT_USERNAME etc.

Prior to this change 30da1f59 (precedes 8.11.0) refactored the options
processing and caused this issue.

Reported-by: Yoshimasa Ohno

Fixes https://github.com/curl/curl/issues/15634
Closes https://github.com/curl/curl/pull/15640
2024-11-29 12:49:55 -05:00
Viktor Szakats
fc680c8145
GHA/windows: extend PATH instead copying libcurl.dll
It was already done in cmake jobs, but not in autotools ones.

Follow-up to 1a2d38c47c #15437
Follow-up to 04184d45ba #15662

Closes #15663
2024-11-29 11:10:11 +01:00
Dan Fandrich
e9de867410 tests: add the ending time stamp in testcurl.pl
This provides better information on the length of the job and when it
completed.
2024-11-29 00:56:52 -08:00
Dan Fandrich
c121f19601 DISTROS: update Alt Linux links 2024-11-29 00:54:47 -08:00
Viktor Szakats
04184d45ba
GHA/windows: avoid libtool wrapper for test and server executables
This makes `runtests.pl` run the final executables directly.
Before this patch it called the autotools/libtool wrapper tool, which
then called the final executables.

This solution was already used for `curl.exe`.

Applies to tests run in the `mingw, AM x86_64 c-ares U` job, which still
shows unexplained flakiness.

Also makes tests finish 45 seconds faster.

Ref: #14854
Follow-up to 1a2d38c47c #15437
Closes #15662
2024-11-29 03:14:52 +01:00
Peter Kokot
4ded2e0ac8
cmake: remove legacy unused IMMEDIATE keyword
This was once supported in CMake 2.x and in current 3.x versions is
ignored.

Closes #15661
2024-11-29 01:11:23 +01:00
Viktor Szakats
a72b479dec
build: fix MSVC UWP builds
The MSVC UWP job in CI did not actually enable UWP. Fix this and
the fallouts discovered after enabling it.

- GHA/windows: make sure to enable UWP in MSVC vcpkg UWP job.
  Use the CMake options and C flags already used for mingw-w64, but use
  `WINAPI_FAMILY_PC_APP` instead of the deprecated `WINAPI_FAMILY_APP`.
  (The former is not supported by mingw-w64, so leave it there as-is.)
  Follow-up to cb22cfca69 #14077

- GHA/windows: by default the MSVC UWP job became 2x-3x slower than
  others after actually enabling UWP. Most of it is caused by
  CMake/MSBuild automatically building full APPX containers for each
  `.exe` target. This includes 21 CMake feature detections. Each
  detection app is built into a 15MB APPX project, with code signing,
  logos, etc. Example:
    https://github.com/curl/curl/actions/runs/12056968170/job/33620610958
  Disable this overhead for curl build targets via custom
  `CMAKE_VS_GLOBALS` options. I've found no way to apply them to feature
  detection targets, so those remain slow.

- cmake: automatically enable Unicode for UWP builds. It's required.
  Also stop enabling it manually in the existing CI job.

- tests: fix `getpid()` use for Windows UWP:
  ```
  tests\server\util.c(281,21): warning C4013: 'getpid' undefined; assuming extern returning int
  ```
  Ref: https://github.com/curl/curl/actions/runs/12061215311/job/33632904249#step:11:38

- src/tool_doswin: disable `GetLoadedModulePaths()` for UWP.
  mingw-w64 UWP was okay with this, but MS SDK headers are not.
  This makes `--dump-module-paths` return empty for UWP builds.
  ```
  src\tool_doswin.c(620,3): error C2065: 'MODULEENTRY32': undeclared identifier
  src\tool_doswin.c(626,11): warning C4013: 'CreateToolhelp32Snapshot' undefined; assuming extern returning int
  src\tool_doswin.c(626,36): error C2065: 'TH32CS_SNAPMODULE': undeclared identifier
  src\tool_doswin.c(632,7): warning C4013: 'Module32First' undefined; assuming extern returning int
  ```
  Ref: https://github.com/curl/curl/actions/runs/12055081933/job/33614629930#step:9:35

- examples: fix `websocket.c` to include `winsock2.h` before `windows.h`
  to make it build with MSVC UWP:
  ```
  include\curl\curl.h(143,16): error C2061: syntax error: identifier 'curl_socket_t'
  include\curl\curl.h(143,16): error C2059: syntax error: ';'
  include\curl\curl.h(417,52): error C2146: syntax error: missing ')' before identifier 'curlfd'
  include\curl\curl.h(417,38): error C2081: 'curl_socket_t': name in formal parameter list illegal
  ```
  Ref: https://github.com/curl/curl/actions/runs/12055317910/job/33615644427#step:14:126

- GHA/windows: silence linker warning with MSVC UWP builds:
  ```
  LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/OPT:ICF' specification
  ```
  Ref: https://github.com/curl/curl/actions/runs/12055696808/job/33616629610#step:11:38

- GHA/windows: set `/INCREMENTAL:NO` for all MSVC jobs to improve
  performance a little.

- cmake: show `UWP` platform flag.

Ref: #15652
Closes #15657
2024-11-28 14:24:03 +01:00
Viktor Szakats
2f03242316
build: fix ECH to always enable HTTPS RR
The ECH feature cannot be built without HTTPS RR.

ECH automatically implied HTTPS RR in `./configure` but not in CMake,
winbuild, documentation.

Also update documentation and CI configs.

Follow-up to a362962b72 #11922
Closes #15648
2024-11-28 11:55:05 +01:00
Viktor Szakats
96f7547d9a
tests: re-enable 2086, and 472, 1299, 1613 for Windows
- GHA/windows: un-ignore tests 472 1299 1613.
  They were ignored for the mingw-w64 c-ares U job.
  They do run fine now:
  https://github.com/curl/curl/actions/runs/12032875421/job/33547724780?pr=15644

- globally re-enable test 2086.
  Comment says it only affected Windows.
  Seems to be running fine now. Example:
  Windows:
  https://github.com/curl/curl/actions/runs/12032875421/job/33547718309?pr=15644#step:13:3856
  Linux:
  https://github.com/curl/curl/actions/runs/12032875397/job/33545739712#step:41:3650

- update comments for disabled tests 1184, 1801.
  They affect all operating systems, likely all CIs.

  FAIL 1801: 'HTTP/2 upgrade with lying server' HTTP, HTTP/2
  https://github.com/curl/curl/actions/runs/12032362497/job/33544053001#step:14:4265
  FAIL 1184: 'HTTP 1.1 CONNECT with redirect and set -H user-agent' HTTP, HTTP CONNECT, HTTP proxy, proxytunnel
  https://github.com/curl/curl/actions/runs/12032362497/job/33544051415#step:14:5252

Closes #15644
2024-11-27 11:19:17 +01:00
Viktor Szakats
7660a28093
tool_getpass: replace getch() call with _getch() on Windows
`getch()` is deprecated according to MSDN:
https://learn.microsoft.com/cpp/c-runtime-library/reference/getch
"The Microsoft-specific function name `getch` is a deprecated alias
for the `_getch` function."

Ref: https://learn.microsoft.com/cpp/c-runtime-library/reference/getch-getwch

Follow-up to 72edb22b8a #15638
Closes #15642
2024-11-27 11:19:16 +01:00
Tal Regev
4341df5040
GHA/windows: enable ECH in vcpkg wolfSSL job
Enable ECH feature on wolfSSL

Closes #15649
2024-11-26 19:15:31 +01:00
Viktor Szakats
2aa6d1a208
GHA/windows: merge cmake/autotools steps
Merge cmake and autotools build steps for cygwin, msys2 and
cross-linux jobs.

Advantages:
- makes it easier to keep the two build tracks in sync.
- uses the same steps across jobs.
- avoids scrolling through greyed out steps.
- syncs steps with other workflows already merged like this.
- less code.

Also:
- stop ignoring WebSockets tests results for msys2/mingw-w64 cmake jobs,
  except for 2301 2302 that were also ignored for autotools. Syncing the
  two build methods.
- drop 'cmake' from step names where cmake was the only build tool.
  This was redundant as "CM" already indicates it in the job name.

Closes #15643
2024-11-26 15:05:44 +01:00
Viktor Szakats
72edb22b8a
tool_getpass: restore UWP getpass_r(), fixup CI builds, fix UWP -Wnull-dereference
- GHA/windows: switch mingw-w64 UWP CI job to use UCRT.
  `msvcr120_app` was missing `getch()` for example.
  Follow-up to f988842d85 #15637
  This job tests compiling for UWP correctly, but the the resulting
  `curl.exe` still doesn't look like a correct UWP app, now exiting
  on startup with: `curl: error initializing curl library`.

- tool_getpass: restore `getch()` for UWP builds.
  Follow-up to f988842d85 #15637

- schannel: silence `-Werror=null-dereference` warning in mingw-w64 UWP:
  ```
  lib/vtls/schannel_verify.c: In function 'Curl_verify_host':
  lib/vtls/schannel_verify.c:558:33: error: null pointer dereference [-Werror=null-dereference]
    558 |     for(i = 0; i < alt_name_info->cAltEntry; ++i) {
        |                    ~~~~~~~~~~~~~^~~~~~~~~~~
  lib/vtls/schannel_verify.c:559:50: error: null pointer dereference [-Werror=null-dereference]
    559 |       PCERT_ALT_NAME_ENTRY entry = &alt_name_info->rgAltEntry[i];
        |                                     ~~~~~~~~~~~~~^~~~~~~~~~~~
  ```
  Ref: https://github.com/curl/curl/actions/runs/12022656065/job/33515255397?pr=15638#step:19:27
  Follow-up to 9640a8ef6f #15421

- GHA/windows: fix `find` command in MSVC job step.
  Follow-up to 5f9411f953 #15380

- GHA/windows: drop unnecessary `windowsappcompat` lib from mingw-w64
  UWP job. Also drop related MSYS2 package.

- GHA/windows: cmake 3.31.0 still invokes `windres` with wrong options
  with mingw-w64 UPW. Update curl version in comment accordingly.

- GHA/windows: tidy up mingw-w64 UWP spec logic, limit it to gcc.

- GHA/windows: update comments on `curl.exe` UWP startup errors.

Closes #15638
2024-11-26 13:01:57 +01:00
renovate[bot]
f988842d85
tool_getpass: make local getpass_r() a dummy for UWP
The CRT call `getch()` isn't supported on Windows UWP. This function is
used to implement `getpass_r()` for reading a password from the console,
for platforms not supporting it natively. This patch makes this function
a dummy, so password entry from the command-line is no longer supported
for UWP apps. Though it probably did not work before this patch, due to:

CRT headers do declare `getch()`, but it's missing from the CRT DLL.

MSDN documents it as unsupported for UWP:
https://learn.microsoft.com/cpp/c-runtime-library/reference/getch
https://learn.microsoft.com/cpp/c-runtime-library/reference/getch-getwch

Same is true for the non-deprecated `_getch()` function.

After mingw-w64 synced its implib with `msvcr120_app.dll`, the CI job
`mingw, CM x86_64 schannel R uwp` broke with:
```
[16/16] Linking C executable src\curl.exe
FAILED: src/curl.exe
[...]
D:/a/_temp/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe:
  src/CMakeFiles/curl.dir/Unity/unity_0_c.c.obj:unity_0_c.c:(.text+0x4d05): undefined reference to `getch'
```
Ref: https://github.com/curl/curl/actions/runs/11873795410/job/33089008727?pr=15597#step:19:25

Also:
- GHA/windows: bump `msys2/setup-msys2` action to
  https://github.com/msys2/setup-msys2/commit/c52d1fa
  This triggered the build failure above.
  Closes #15597

Ref: d408f51e5a/tree/mingw-w64-crt/def-include/crt-aliases.def.in

Closes #15637
2024-11-25 23:57:20 +01:00
Vladislavs Sokurenko
4cded6deac
multi: fix callback for CURLMOPT_TIMERFUNCTION not being called again when...
Issue is reproducible for me if I have made request with multi handle,
then I make request that will take very long and then I make request
that should be fast again, however what happens it is that it seems
to think that timeout was not changed and it makes it not call initial
`CURLMOPT_TIMERFUNCTION`.

Closes #15627
2024-11-25 18:36:42 +01:00
Deng Jianfeng
e243e73363
rtsp: check EOS in the RTSP receive and return an error code
This helps the caller detect disconnection events.

Fixes #15624
Closes #15626
2024-11-25 18:36:41 +01:00
Viktor Szakats
ae016b0cce
GHA: source mbedTLS from official tarball
Instead of the Git repo tag which requires downloading the tip of
a dependency repository at the time of bumping version:
https://github.com/Mbed-TLS/mbedtls-framework

The official source tarball ships with this dependency, making
the CI builds reproducible.

Also: fold long download commands for other dependencies.

Closes #15632
2024-11-24 17:59:47 +01:00
Viktor Szakats
b13078d6c5
GHA: speed up 3 openssl/quictls builds 3x
Build in parallel first, then install with `-j1`. This makes the build
part 3x quicker, while avoiding parallellism issues at the install
phase.

```
                       before   after  after
                              1da198d   this
aws-lc:                 1m55s    ~40s
libressl:               1m16s  ~1m20s
openssl-tsan:           5m47s   3m43s  1m48s (clang)
openssl:                6m38s   4m49s  2m13s (quic)
quictls-no-deprecated:  2m28s   1m51s
quictls:               ~6m08s   4m16s  1m55s
wolfssl-all:            1m36s     52s
wolfssl-master:         1m34s     53s
wolfssl-opensslextra:     50s     32s
```

Follow-up to 1da198d18e #15622

Closes #15630
2024-11-24 03:50:35 +01:00