Commit Graph

34209 Commits

Author SHA1 Message Date
Viktor Szakats
2ff914432c
GHA: replace hard-coded home dir in cache path: with ~
Closes #16056
2025-01-20 18:28:55 +01:00
9cel
c5a736f2c9
docs: document the behavior of -- in the curl command line
Closes #16053
2025-01-20 14:27:05 +01:00
Daniel Stenberg
0f54bfd803
libcurl/opts: do not save files in dirs where attackers have access
libcurl cannot fully protect against attacks where an attacker has write
access to the same directory where it is directed to save files. This is
particularly sensitive if you save files using elevated privileges.

Previously only mentioned in VULN-DISCLOSURE-POLICY.md.

Highlighted-by: Donguk Kim

Closes #16051
2025-01-20 10:34:37 +01:00
Viktor Szakats
f1dbe68172
GHA: tidy up quotes, checkout order, silence Android/CMake warnings
- move checkout step right before use.
- quotes in yaml and bash.
- unfold single-line run commands.
- set `CMAKE_WARN_DEPRECATED=OFF` for CMake with Android NDK to avoid
  a wall of useless deprecation warnings hiding useful output.
  These warnings happen in 3rd-party scripts, and unfixable in curl.

Closes #16042
2025-01-19 15:03:16 +01:00
Viktor Szakats
08e2cceaf1
cmake: drop fseeko() pre-fill and check for Windows
To sync detection code with autotools.

Closes #16041
2025-01-19 15:03:16 +01:00
Daniel Stenberg
0ed36150b6
RELEASE-NOTES: synced 2025-01-19 11:55:02 +01:00
Daniel Stenberg
9ce0bed1ff
curl_multi_waitfds.md: tidy up the example
- remove typecast
- shorten comment

Closes #16050
2025-01-19 11:45:25 +01:00
Daniel Stenberg
8368249907
asyn-ares: initial HTTPS resolve support
Gets the ALPN list the same way DoH does. Needs c-ares 1.28.0 or later.

Thanks-to: Brad House

Closes #16039
2025-01-19 11:25:09 +01:00
Daniel Stenberg
ea76380299
mbedtls: prefix our feature defines with HAS_
Consistent naming helps.

Closes #16046
2025-01-19 11:23:22 +01:00
Jay Satiro
56998277f0 checksrc.bat: remove explicit SNPRINTF bypass
- Remove the command line argument passed to checksrc.pl that accepts
  SNPRINTF violations in docs/examples.

This is a follow-up to c445b742 which introduced a different management
of banned functions and removed the SNPRINTF rule in favor of banning
snprintf in lib. There's no longer a SNPRINTF warning to suppress.

Closes https://github.com/curl/curl/pull/16032
2025-01-19 03:24:31 -05:00
Viktor Szakats
38e7302ae4
cmake: do not store MINGW64_VERSION in cache
Follow-up to e49797abc2 #16022
Closes #16040
2025-01-18 00:18:12 +01:00
Viktor Szakats
2c4bfefe91
build: stop detecting sched_yield() on Windows
On Windows a successful `sched_yield()` detection requires mingw-w64
built with POSIX threads (not Win32 threads) and GCC (not llvm/clang).
(linking to `winpthread` via custom options may also work.)

In CMake builds, it was pre-cached as unavailable before this patch.

When detected (via autotools), it got only used for Windows XP or older
targets combined with a non-GCC, non-clang compiler that doesn't support
`__builtin_ia32_pause()`, or with the Intel C compiler. According to
`lib/easy_lock.h`.

mingw-w64 only supports GCC and clang, leaving a very narrow chance when
`shed_yield()` gets called on Windows. Even then, `sched_yield()` is
implemented in `winpthread` as `Sleep(0)`, which may or not be a useful.
It's also trivial to implement locally if it is, and such rare build
combination is also deemed useful.

Thus, this patch marks `sched_yields()` permanently unavailable on the
Windows platform also with autotools, and instead of pre-caching, skip
this feature check with CMake.

This syncs `HAVE_SCHED_YIELDS` between builds methods on Windows.

Follow-up to 9b517c8b69 #11973
Follow-up to 23af112f55 #8680

Closes #16037
2025-01-17 23:31:58 +01:00
Viktor Szakats
e49797abc2
cmake: detect mingw-w64 version, pre-fill HAVE_STRTOK_R
Replace `strtok_r()` detection with detection mingw-w64 version.
The use this version to pre-fill `HAVE_STRTOK_R`.

This gives use mingw-w64 version information for free.

Closes #16022
2025-01-17 23:31:57 +01:00
Viktor Szakats
d5fb2b29d5
cmake: pre-fill HAVE_STDATOMIC_H, HAVE_ATOMIC for mingw-w64
`stdatomic.h` and `_Atomic` were first available in gcc 4.9.0 and
llvm/clang 3.6. Set detection values accordingly and save these two
detections on configure runs.

Closes #16036
2025-01-17 15:11:22 +01:00
Stefan Eissing
25b445e479
TLS: check connection for SSL use, not handler
Protocol handler option PROTOPT_SSL is used to setup a connection
filters. Once that is done, used `Curl_conn_is_ssl()` to check if
a connection uses SSL.

There may be other reasons to add SSL to a connection, e.g. starttls.

Closes #16034
2025-01-17 14:04:20 +01:00
Stefan Eissing
ef3d7877d5
pytest: remove 'repeat' parameter
With the use of the pytest-repeat plugin, this parameter is no
longer necessary.

Closes #16033
2025-01-17 14:03:30 +01:00
Viktor Szakats
2e2c6b0b4e
windows: drop dupe macros, detect CURL_OS for WinCE ARM, indentation
- setup-win32: drop duplicate `WIN32_LEAN_AND_MEAN` and `NOGDI` macros
  (set earlier in `curl_setup.h`)

- config-win32ce: detect ARM for `CURL_OS` macro.
  Based on: https://cegcc.sourceforge.net/docs/details.html
  It should also apply to MSVC. (untested)

- indentation.

Closes #16029
2025-01-17 12:56:43 +01:00
Viktor Szakats
587ce6586c
GHA: update ubuntu-24.04 to ubuntu-latest
`ubuntu-latest` is an alias for `ubuntu-24.04` now.
2025-01-17 04:34:05 +01:00
Viktor Szakats
1f789c5be1
configure: do not inline 'dnl' comments [ci skip]
(Did not cause issues in this particular case.)

Follow-up to a1184525a6 #15971
2025-01-17 02:38:10 +01:00
Viktor Szakats
140790d74d
configure: UWP and Android follow-up fixes
- limit UWP detection to native Windows.
- add missing double-quotes to variable.
- drop interlock and sync order in buildinfo flags.

Follow-up to 56a74fac47 #16014
Follow-up to f7bb6c1f64 #16020

Closes #16027
2025-01-17 01:50:27 +01:00
Viktor Szakats
56a74fac47
android: add CI jobs, buildinfo, cmake docs, disable CURL_USE_PKGCONFIG by default
- GHA/non-native: add Android builds, both cmake and autotools,
  both NDK 21 (oldest available) and 35 (newest available)
  https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.md
  It comes with a maintenance burden to bump the oldest/latest values
  with CI runner updates.

- cmake: disable `CURL_USE_PKGCONFIG` by default for Android.
  To avoid picking up system package by default.

- build: add `ANDROID-<NDK-LEVEL>` flag to `buildinfo.txt`.
  Also detect NDK level with the CMake built-in build method:
  https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html#cross-compiling-for-android

- INSTALL.md: add CMake build instructions for Android.

- INSTALL.md: make NDK levels consistent in `./configure` example.

Closes #16014
2025-01-17 00:44:11 +01:00
Viktor Szakats
911f003db8
GHA: start using ARM Linux runners
- GHA/linux: allow per-job runner image override.
- GHA/linux: add an arm version of an existing job.
  Add workaround for broken `PATH` in the arm runner image.
- GHA/non-native: add CPU arch to job name where missing.
- GHA/checkdocs: switch a linter job to arm.

Performance looks a little bit better than Intel
(presumably with lower power consumption).

Test jobs, with openssl, tests, pytests, examples:
- arm:
  - https://github.com/curl/curl/actions/runs/12816430794/job/35737374521 4m7s
  - https://github.com/curl/curl/actions/runs/12816201136/job/35736615144 4m5s
- Intel:
  - https://github.com/curl/curl/actions/runs/12816430794/job/35737374118 4m32s
  - https://github.com/curl/curl/actions/runs/12816201136/job/35736614764 4m13s

Ref: https://github.blog/changelog/2025-01-16-linux-arm64-hosted-runners-now-available-for-free-in-public-repositories-public-preview/

Closes #16023
2025-01-17 00:28:12 +01:00
Viktor Szakats
c89bc11267
GHA/linux: enable wolfSSH in a wolfSSL job
With tests. (Most SFTP tests fail with wolfSSH.)

Also:
- disable pseudo-terminal in wolfSSH builds (also in CircleCI).
  Not needed for curl.
- test642: add "compressed" to the description.
  To avoid being the same as test600.
  Follow-up to b7b4dc0d49 #1735

Closes #16025
2025-01-17 00:20:54 +01:00
Stefan Eissing
02edae54e8 websocket: fix message send corruption
- Fix a bug in EAGAIN handling when sending frames that led to a
  corrupted last byte of the frame sent.

- Restore sanity to curl_ws_send() behaviour:

  - Partial writes are reported as OK with the actual number of
    payload bytes sent.

  - CURLE_AGAIN is only returned when none of the payload bytes
    (or for 0-length frames, not all of the frame header bytes)
    could be sent.

  - curl_ws_send() now behaves like a common send() call.

- Change 'ws-data' test client to allow concurrent send/recv
  operations and vary frame sizes and repeat count.

- Add DEBUG env var CURL_WS_CHUNK_EAGAIN to simulate blocking
  after a chunk of an encoded websocket frame has been sent.

- Add tests.


Prior to this change data corruption may occur when sending websocket
messages due to two bugs:

1) 3e64569a (precedes 8.10.0) caused a data corruption bug in the last
   byte of frame of large messages.

2) curl_ws_send had non-traditional send behavior and could return
   CURLE_AGAIN with bytes sent and expect the caller to adjust buffer
   and buflen in a subsequent call. That behavior was not documented.


Reported-by: na-trium-144@users.noreply.github.com

Fixes https://github.com/curl/curl/issues/15865
Fixes https://github.com/curl/curl/issues/15865#issuecomment-2569870144
Closes https://github.com/curl/curl/pull/15901
2025-01-16 16:19:07 -05:00
Daniel Stenberg
86f5653721
TODO: write an SMB test server to replace impacket
Closes #15697
Closes #16024
2025-01-16 20:51:00 +01:00
Daniel Stenberg
13afb1128f
asyn-ares: acknowledge CURLOPT_DNS_SERVERS set to NULL
Since c-ares has no function to restore this value to default, it
instead closes and re-inits the c-ares channel.

Reported-by: Deniz Sökmen
Fixes #16015
Closes #16016
2025-01-16 20:22:12 +01:00
Viktor Szakats
f241ccf714
GHA/labeler: fix INSTALL-CMAKE.md references
Follow-up to 0f4c19b66a #12772

Closes #16021
2025-01-16 19:42:13 +01:00
Viktor Szakats
f7bb6c1f64
autotools: add support for mingw UWP builds
To match cmake builds.

- GHA/windows: allow autotools UWP builds.
- detect UWP and add to `buildinfo.txt`.
  Consider it enabled if `CPPFLAGS` contains `-DWINSTORECOMPAT`.
- disable telnet with UWP.
- enable Unicode with UWP.
- do not use `wldap32` with UWP.
- do not enable `USE_WIN32_CRYPTO` with UWP.
- make sure to link to `ws2_32` in UWP builds.
  To fix `undefined reference to `in6addr_any'` when linking
  `tests/server` programs. More in the comment.

Closes #16020
2025-01-16 19:42:13 +01:00
Daniel Stenberg
fb881abd72
docs/EXPERIMENTAL.md: add a mention of HTTPSRR as experimental
Closes #16017
2025-01-16 19:41:42 +01:00
Viktor Szakats
5902e18844
cmake: move mingw UWP workaround from GHA to CMakeLists.txt
CMake (as of 3.31.2) doesn't fully recognize mingw-w64 with
`CMAKE_SYSTEM_NAME=WindowsStore`.
The manual logic works around it.

Also move existing DJGPP workaround to the same block.

Closes #16019
2025-01-16 16:44:53 +01:00
Viktor Szakats
f07612cd9a
tidy-up: extend CURL_O_BINARY to lib and tests
Move `CURL_O_BINARY` definition from src to lib and use it from lib and
tests code.

Closes #16009
2025-01-16 12:36:07 +01:00
Daniel Stenberg
c5bb4e77e4
RELEASE-NOTES: synced 2025-01-16 09:27:49 +01:00
sftcd
ca1594e707
tool_getparam: ECH param parsing refix
Regression.

Fixes #16006
Reported-by: Milon Renatus
Closes #16010
2025-01-16 09:17:01 +01:00
Stefan Eissing
a6eac83481
cf-https-connect: look into httpsrr alpns when available
Improved the filter implementation to be flexible in which order h3 and
h2/h1 are attempted. When HTTPSRR is enabled, look at the ALPNs it found
and use the order given for connecting in default setups.

Closes #16012
2025-01-16 08:23:02 +01:00
Viktor Szakats
bbb91b22ee
GHA/non-native: lower job timeouts
New values have a 2-3x headroom.
2025-01-15 21:39:30 +01:00
Daniel Stenberg
bb93536270
doh: send HTTPS RR requests for all HTTP(S) transfers
When enabled in the build.

Update test2100: verify with HTTPS RR included

Adjust runtests and server/disabled.c to include "HTTPSRR" as a feature
in the test suite.

Also, decode the ALPN list in HTTPS records straight into IDs. There's
no point in storing everything in string format. Skip ALPNs we do not
support.

Closes #16007
2025-01-15 12:55:15 +01:00
Daniel Stenberg
5d70a5c5a4
doh: cleanups and extended HTTPS RR code
In preparation for using HTTPS outside of ECH, the parser now also
extracts the port number.

Plus other minor cleanups.

Closes #16007
2025-01-15 12:55:04 +01:00
Viktor Szakats
f739a6867b
INSTALL.md: tweak to the MSVC version line [ci skip]
Follow-up to 308437ac53 #15992
2025-01-15 02:33:54 +01:00
Viktor Szakats
55f3ba447f
CI: add/extend curl binary info, VS2010 32-bit, misc improvements
- fix `find` commands to not miss items.

- call `file` on the built files in `curl -V` steps.
  To give more feedback on what was built.

- add `curl info` step for cross-jobs that can't do a `curl -V`.
  It lists the files built and calls `file` on them.

- appveyor: make a VS2010 32-bit to match the VS2008 job it replaced.
  Follow-up to d34aeecb08 #15934

- GHA/windows: drop the word "old" from standalone mingw-w64 jobs to not
  conflate it with "old mingw" we no longer support (while also keeping
  it short).

Cherry-picked from #15975
Closes #16001
2025-01-14 17:46:49 +01:00
Daniel Stenberg
be82a3605a
easy: make curl_easy_perform() return error if connection still there
This typically happens if CURL_CONNECT_ONLY is used and a second
curl_easy_perform() is attempted.

A connection "taken over" with CURL_CONNECT_ONLY cannot be ended any
other way than a curl_easy_cleanup() on the easy handle that holds it.

Add test 696 to verify.

Closes #16003
2025-01-14 16:32:46 +01:00
Daniel Stenberg
2f8ecd5dbd
CURLOPT_CONNECT_ONLY.md: an easy handle with this option set cannot be reused
Closes #16002
2025-01-14 16:26:34 +01:00
Viktor Szakats
308437ac53
INSTALL.md: document VS2008 and mingw-w64
Ref: #15972
Closes #15992
2025-01-14 15:58:39 +01:00
Daniel Stenberg
b9c173ebad
sha256/hmac: use these with TLS builds now
Used by the SSL session cache code.

Bug: https://curl.se/mail/lib-2025-01/0041.html
Reported-by: Aleksander Mazur
Closes #15994
2025-01-14 12:13:59 +01:00
Viktor Szakats
5474d70c3e
tidy-up: drop parenthesis around return expression
Closes #15990
2025-01-14 12:11:42 +01:00
Stefan Eissing
06d4456a21
CI: run pytest in github CI colored
Add colors to pytest runs in github workflows and see how test clutch
copes with it!

Closes #15998
2025-01-14 11:34:56 +01:00
Stefan Eissing
fa5d5ac1c9
pytest: use httpd/apache2 directly, no apachectl
Since the script 'apachectl' from the httpd project is severly mutilated
on several distros, use the executable httpd/apache2 directly in pytest
runs.

Remove detection of apachectl form autoconf and cmake.

Closes #16000
2025-01-14 11:33:49 +01:00
Daniel Stenberg
862244636e
cmdline-opts/version.md: describe multissl, mention SSLS-EXPORT
Closes #15996
2025-01-14 11:08:24 +01:00
Jay Satiro
5ffc73c78e transfer: fix CURLOPT_CURLU override logic
- Change setopt and pretransfer to always reset URL related variables
  for a CURLU handle set CURLOPT_CURLU.

This change is to ensure we are in compliance with the doc which says
CURLU handles must be able to override a URL set via CURLOPT_URL and
that if the contents of the CURLU handle changes between transfers then
the updated contents must be used.

Prior to this change, although subsequent transfers appear to be
performed correctly in those cases, the work URL `data->state.url` was
not updated. CURLINFO_EFFECTIVE_URL returns data->state.url to the user
so it would return the URL from the initial transfer which was the wrong
URL. It's likely there are other cases as well.

Ref: https://curl.se/libcurl/c/CURLOPT_CURLU.html

Reported-by: Nicolás San Martín

Fixes https://github.com/curl/curl/issues/15984
Closes https://github.com/curl/curl/pull/15985
2025-01-14 04:36:13 -05:00
Jay Satiro
8ab468c8aa mprintf: terminate snprintf output on windows
- Null terminate the end of the snprintf output buffer on Windows.

Old versions of the Windows CRT (which are often found on later versions
of Windows) do not terminate the snprintf output buffer if the output
reaches the max size.

This is a follow-up to parent 7e32f656 which made the same change but
limited it to mingw, however it is a CRT version issue irrespective of
compiler.

Ref: https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/snprintf-snprintf-snprintf-l-snwprintf-snwprintf-l?view=msvc-170#remarks

Closes https://github.com/curl/curl/pull/15997
2025-01-14 04:33:51 -05:00
Daniel Stenberg
7e32f65687
mprintf: fix integer handling in float precision
In the double output function when an extremely large width and
precision is set that reaches the libcurl maximum (325), the handling of
the precision part would do wrong which could lead to bad output.

Also: work-around for single-byte buffer snprintf overflow with mingw.

Extend test 557 to verify.

Coverity CID 1638751.

Closes #15988
2025-01-13 23:41:38 +01:00