Commit Graph

31317 Commits

Author SHA1 Message Date
Jay Satiro
cdac7cd3f3 CURLOPT_CAINFO_BLOB.3: explain what CURL_BLOB_COPY does
- Add an explanation of the CURL_BLOB_COPY flag to CURLOPT_CAINFO_BLOB
  and CURLOPT_PROXY_CAINFO_BLOB docs.

All the other _BLOB option docs already have the same explanation.

Closes https://github.com/curl/curl/pull/12277
2023-11-12 14:29:01 -05:00
Viktor Szakats
ff1fdfecb1
tidy-up: dedupe Windows system libs in cmake
Reviewed-by: Daniel Stenberg
Closes #12307
2023-11-11 23:09:22 +00:00
Junho Choi
a621418995
ci: test with latest quiche release (0.19.0)
Closes #12180
2023-11-11 23:44:54 +01:00
Junho Choi
93c7943583
quiche: use quiche_conn_peer_transport_params()
In recent quiche, transport parameter API is separated
with quiche_conn_peer_transport_params().
(https://github.com/cloudflare/quiche/pull/1575)
It breaks with bulding with latest(post 0.18.0) quiche.

Closes #12180
2023-11-11 23:44:43 +01:00
Daniel Stenberg
74423b5df4
Makefile: generate the VC 14.20 project files at dist-time
Follow-up to 28287092cc (#12282)

Closes #12290
2023-11-11 23:42:36 +01:00
Sam James
bc8509a748
misc: fix -Walloc-size warnings
GCC 14 introduces a new -Walloc-size included in -Wextra which gives:

```
src/tool_operate.c: In function ‘add_per_transfer’:
src/tool_operate.c:213:5: warning: allocation of insufficient size ‘1’ for type ‘struct per_transfer’ with size ‘480’ [-Walloc-size]
  213 |   p = calloc(sizeof(struct per_transfer), 1);
      |     ^
src/var.c: In function ‘addvariable’:
src/var.c:361:5: warning: allocation of insufficient size ‘1’ for type ‘struct var’ with size ‘32’ [-Walloc-size]
  361 |   p = calloc(sizeof(struct var), 1);
      |     ^
```

The calloc prototype is:
```
void *calloc(size_t nmemb, size_t size);
    ```

So, just swap the number of members and size arguments to match the
prototype, as we're initialising 1 struct of size `sizeof(struct
...)`. GCC then sees we're not doing anything wrong.

Closes #12292
2023-11-11 23:35:47 +01:00
Mark Gaiser
d06643812c
IPFS: bugfixes
- Fixed endianness bug in gateway file parsing
- Use IPFS_PATH in tests where IPFS_DATA was used
- Fixed typos from traling -> trailing
- Fixed broken link in IPFS.md

Follow-up to 859e88f653

Reported-by: Michael Kaufmann
Bug: https://github.com/curl/curl/pull/12152#issuecomment-1798214137
Closes #12305
2023-11-11 23:28:13 +01:00
Daniel Stenberg
9588528a0b
VULN-DISCLOSURE-POLIC: remove broken link to hackerone
It should ideally soon not be done from hackerone anyway

Closes #12308
2023-11-11 23:16:52 +01:00
Andrew Kurushin
1af46f2f93 schannel: add CA cache support for files and memory blobs
- Support CA bundle and blob caching.

Cache timeout is 24 hours or can be set via CURLOPT_CA_CACHE_TIMEOUT.

Closes https://github.com/curl/curl/pull/12261
2023-11-11 04:11:11 -05:00
Daniel Stenberg
ad6fc6414d
RELEASE-NOTES: synced 2023-11-10 23:26:21 +01:00
Charlie C
aace27b096
cmake: option to disable install & drop curlu target when unused
This patch makes the following changes:
- adds the option `CURL_DISABLE_INSTALL` - to disable 'install' targets.
- Removes the target `curlu` when the option `BUILD_TESTING` is set to
  `OFF` - to prevent it from being loaded in Visual Studio.

Closes #12287
2023-11-10 18:24:14 +00:00
Kai Pastor
45d2ff6f85
cmake: fix multiple include of CURL package
Fixes errors on second `find_package(CURL)`. This is a frequent case
with transitive dependencies:
```
CMake Error at ...:
  add_library cannot create ALIAS target "CURL::libcurl" because another
  target with the same name already exists.
```

Test to reproduce:
```cmake
cmake_minimum_required(VERSION 3.27)  # must be 3.18 or higher

project(curl)

set(CURL_DIR "example/lib/cmake/CURL/")
find_package(CURL CONFIG REQUIRED)
find_package(CURL CONFIG REQUIRED)  # fails

add_executable(main main.c)
target_link_libraries(main CURL::libcurl)
```

Ref: https://cmake.org/cmake/help/latest/release/3.18.html#other-changes
Ref: https://cmake.org/cmake/help/v3.18/policy/CMP0107.html
Ref: #12300
Assisted-by: Harry Mallon
Closes #11913
2023-11-10 18:23:22 +00:00
Viktor Szakats
9fb6cc54c5
tidy-up: use OPENSSL_VERSION_NUMBER
Uniformly use `OPENSSL_VERSION_NUMBER` to check for OpenSSL version.
Before this patch some places used `OPENSSL_VERSION_MAJOR`.

Also fix `lib/md4.c`, which included `opensslconf.h`, but that doesn't
define any version number in these implementations: BoringSSL, AWS-LC,
LibreSSL, wolfSSL. (Only in mainline OpenSSL/quictls). Switch that to
`opensslv.h`. This wasn't causing a deeper problem because the code is
looking for v3, which is only provided by OpenSSL/quictls as of now.

According to https://github.com/openssl/openssl/issues/17517, the macro
`OPENSSL_VERSION_NUMBER` is safe to use and not deprecated.

Reviewed-by: Marcel Raad
Closes #12298
2023-11-08 17:55:22 +00:00
Daniel Stenberg
6d558cbfd0
resolve.d: drop a multi use-sentence
Since the `multi:` keyword adds that message.

Reported-by: 積丹尼 Dan Jacobson
Fixes https://github.com/curl/curl/discussions/12294
Closes #12295
2023-11-08 12:40:24 +01:00
Daniel Stenberg
82ba603da4
content_encoding: make Curl_all_content_encodings allocless
- Fixes a memory leak pointed out by Coverity
- Also found by OSS-Fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=63947
- Avoids unncessary allocations

Follow-up ad051e1cbe

Closes #12289
2023-11-07 16:35:30 +01:00
Michael Kaufmann
36662c3860 vtls: use ALPN "http/1.1" for HTTP/1.x, including HTTP/1.0
Some servers don't support the ALPN protocol "http/1.0" (e.g. IIS 10),
avoid it and use "http/1.1" instead.

This reverts commit df856cb5c9 (#10183).

Fixes #12259
Closes #12285
2023-11-07 11:43:50 +01:00
Daniel Stenberg
3d93d18ded
Makefile.am: drop vc10, vc11 and vc12 projects from dist
They are end of life products. Support for generating them remain in the
repo for a while but this change drops them from distribution.

Closes #12288
2023-11-07 11:34:24 +01:00
David Suter
28287092cc
projects: add VC14.20 project files
Windows projects included VC14, VC14.10, VC14.30 but not VC14.20.
OpenSSL and Wolf SSL scripts mention VC14.20 so I don't see a reason why
this is missing. Updated the templates to produce a VC14.20 project.
Project opens in Visual Studio 2019 as expected.

Closes #12282
2023-11-07 09:29:19 +01:00
Daniel Stenberg
01d9b8bc7c
curl: move IPFS code into src/tool_ipfs.[ch]
- convert ensure_trailing into ensure_trailing_slash
- strdup the URL string to own it proper
- use shorter variable names
- combine some expressions
- simplify error handling in ipfs_gateway()
- add MAX_GATEWAY_URL_LEN + proper bailout if maximum is reached
- ipfs-gateway.d polish and simplification
- shorten ipfs error message + make them "synthetic"

Closes #12281
2023-11-07 07:42:28 +01:00
Viktor Szakats
fd7ef00f43
build: delete support bits for obsolete Windows compilers
- Pelles C: Unclear status, failed to obtain a fresh copy a few months
  ago. Possible website is HTTP-only. ~10 years ago I left this compiler
  dealing with crashes and other issues with no response on the forum
  for years. It has seen some activity in curl back in 2021.
- LCC: Last stable release in September 2002.
- Salford C: Misses winsock2 support, possibly abandoned? Last mentioned
  in 2006.
- Borland C++: We dropped Borland C++ support in 2018.
- MS Visual C++ 6.0: Released in 1998. curl already requires VS 2010
  (or possibly 2008) as a minimum.

Closes #12222
2023-11-06 22:00:10 +00:00
Viktor Szakats
60359ad504
build: delete HAVE_STDINT_H and HAVE_INTTYPES_H
We use `stdint.h` unconditionally in all places except one. These uses
are imposed by external dependencies / features. nghttp2, quic, wolfSSL
and `HAVE_MACH_ABSOLUTE_TIME` do require this C99 header. It means that
any of these features make curl require a C99 compiler. (In case of
MSVC, this means Visual Studio 2010 or newer.)

This patch changes the single use of `stdint.h` guarded by
`HAVE_STDINT_H` to use `stdint.h` unconditionally. Also stop using
`inttypes.h` as an alternative there. `HAVE_INTTYPES_H` wasn't used
anywhere else, allowing to delete this feature check as well.

Closes #12275
2023-11-06 17:20:39 +00:00
Daniel Stenberg
ba281e5c72
tool_operate: do not mix memory models
Make sure 'inputpath' only points to memory allocated by libcurl so that
curl_free works correctly.

Pointed out by Coverity

Follow-up to 859e88f653

Closes #12280
2023-11-06 14:29:53 +01:00
Stefan Eissing
ad051e1cbe
lib: client writer, part 2, accounting + logging
This PR has these changes:

Renaming of unencode_* to cwriter, e.g. client writers
- documentation of sendf.h functions
- move max decode stack checks back to content_encoding.c
- define writer phase which was used as order before
- introduce phases for monitoring inbetween decode phases
- offering default implementations for init/write/close

Add type paramter to client writer's do_write()
- always pass all writes through the writer stack
- writers who only care about BODY data will pass other writes unchanged

add RAW and PROTOCOL client writers
- RAW used for Curl_debug() logging of CURLINFO_DATA_IN
- PROTOCOL used for updates to data->req.bytecount, max_filesize checks and
  Curl_pgrsSetDownloadCounter()
- remove all updates of data->req.bytecount and calls to
  Curl_pgrsSetDownloadCounter() and Curl_debug() from other code
- adjust test457 expected output to no longer see the excess write

Closes #12184
2023-11-06 13:14:06 +01:00
Daniel Stenberg
2b16b86bb6
VULN-DISCLOSURE-POLICY: escape sequences are not a security flaw
Closes #12278
2023-11-06 12:51:00 +01:00
Viktor Szakats
7925ba431b
rand: fix build error with autotools + LibreSSL
autotools unexpectedly detects `arc4random` because it is also looking
into dependency libs. One dependency, LibreSSL, happens to publish an
`arc4random` function (via its shared lib before v3.7, also via static
lib as of v3.8.2). When trying to use this function in `lib/rand.c`,
its protoype is missing. To fix that, curl included a prototype, but
that used a C99 type without including `stdint.h`, causing:

```
../../lib/rand.c:37:1: error: unknown type name 'uint32_t'
   37 | uint32_t arc4random(void);
      | ^
1 error generated.
```

This patch improves this by dropping the local prototype and instead
limiting `arc4random` use for non-OpenSSL builds. OpenSSL builds provide
their own random source anyway.

The better fix would be to teach autotools to not link dependency libs
while detecting `arc4random`.

LibreSSL publishing a non-namespaced `arc4random` tracked here:
https://github.com/libressl/portable/issues/928

Regression from 755ddbe901 #10672

Reviewed-by: Daniel Stenberg
Fixes #12257
Closes #12274
2023-11-06 10:11:56 +00:00
Daniel Stenberg
1e4f5a4a74
RELEASE-NOTES: synced 2023-11-05 23:28:45 +01:00
Daniel Stenberg
ac57e69b58
strdup: do Curl_strndup without strncpy
To avoid (false positive) gcc-13 compiler warnings.

Follow-up to 4855debd8a

Assisted-by: Jay Satiro
Reported-by: Viktor Szakats
Fixes #12258
2023-11-05 23:21:18 +01:00
Enno Boland
46878b9e3f
HTTP: fix empty-body warning
This change fixes a compiler warning with gcc-12.2.0 when
`-DCURL_DISABLE_BEARER_AUTH=ON` is used.

    /home/tox/src/curl/lib/http.c: In function 'Curl_http_input_auth':
    /home/tox/src/curl/lib/http.c:1147:12: warning: suggest braces around empty body in an 'else' statement [-Wempty-body]
     1147 |            ;
          |            ^

Closes #12262
2023-11-05 17:38:27 +01:00
Daniel Stenberg
86d4a4124e
openssl: identify the "quictls" backend correctly
Since vanilla OpenSSL does not support the QUIC API I think it helps
users to identify the correct OpenSSL fork in version output. The best
(crude) way to do that right now seems to be to check if ngtcp2 support
is enabled.

Closes #12270
2023-11-05 17:34:49 +01:00
Mark Gaiser
859e88f653
curl: improved IPFS and IPNS URL support
Previously just ipfs://<cid> and ipns://<cid> was supported, which is
too strict for some usecases.

This patch allows paths and query arguments to be used too.
Making this work according to normal http semantics:

 ipfs://<cid>/foo/bar?key=val
 ipns://<cid>/foo/bar?key=val

The gateway url support is changed.
It now only supports gateways in the form of:

 http://<gateway>/foo/bar
 http://<gateway>

Query arguments here are explicitly not allowed and trigger an intended
malformed url error.

There also was a crash when IPFS_PATH was set with a non trailing
forward slash. This has been fixed.

Lastly, a load of test cases have been added to verify the above.

Reported-by: Steven Allen
Fixes #12148
Closes #12152
2023-11-05 10:59:20 +01:00
Harry Mallon
d112c24234
docs: KNOWN_BUGS cleanup
* Remove other mention of hyper memory-leaks from `KNOWN_BUGS`.
  Should have been removed in 629723ecf2

* Remove mention of aws-sigv4 sort query string from `KNOWN_BUGS`.
  Fixed in #11806

* Remove mention of aws-sigv4 query empty value problems

* Remove mention of aws-sigv4 missing amz-content-sha256
  Fixed in #9995
2023-11-05 10:39:32 +01:00
Harry Mallon
bbba69dada
http_aws_sigv4: canonicalise valueless query params
Fixes #8107
Closes #12244
2023-11-05 10:35:45 +01:00
Michael Kaufmann
2c8f4c87e1 docs: preserve the modification date when copying the prebuilt man page
The previously built man page "curl.1" must be copied with the original
modification date, otherwise the man page is never updated.

This fixes a bug that has been introduced with commit 2568441cab.

Reviewed-by: Dan Fandrich
Reviewed-by: Daniel Stenberg

Closes #12199
2023-11-04 19:39:48 +01:00
Daniel Stenberg
0f3e9d5723
docs: remove bold from some man page SYNOPSIS sections
In the name of consistency

Closes #12267
2023-11-04 12:29:41 +01:00
Daniel Stenberg
b3c4bbfcaa
openssl: two multi pointer checks should probably rather be asserts
... so add the asserts now and consider removing the dynamic checks in a
future.

Ref: #12261
Closes #12264
2023-11-04 12:23:46 +01:00
boilingoden
559918d80c
docs: add supported version for the json write-out
xref: https://curl.se/changes.html#7_70_0

Closes #12266
2023-11-04 12:21:56 +01:00
Viktor Szakats
026122efd3
appveyor: make VS2008-built curl tool runnable
By linking the CRT statically. This avoids the error about missing
runtime DLL `MSVCR90.dll` when running the freshly built `curl.exe`.

Closes #12263
2023-11-03 22:53:45 +00:00
Stefan Eissing
3e6254f819
url: proxy ssl connection reuse fix
- tunnel https proxy used for http: transfers does
  no check if proxy-ssl configuration matches
- test cases added, test_10_12 fails on 8.4.0

Closes #12255
2023-11-03 16:43:45 +01:00
Jay Satiro
7e828fe503 curl_sspi: support more revocation error names in error messages
- Add these revocation errors to sspi error list:
  CRYPT_E_NO_REVOCATION_DLL, CRYPT_E_NO_REVOCATION_CHECK,
  CRYPT_E_REVOCATION_OFFLINE and CRYPT_E_NOT_IN_REVOCATION_DATABASE.

Prior to this change those error codes were not matched to their macro
name and instead shown as "unknown error".

Before:

schannel: next InitializeSecurityContext failed:
Unknown error (0x80092013) - The revocation function was
unable to check revocation because the revocation server was offline.

After:

schannel: next InitializeSecurityContext failed:
CRYPT_E_REVOCATION_OFFLINE (0x80092013) - The revocation function was
unable to check revocation because the revocation server was offline.

Bug: https://github.com/curl/curl/issues/12239
Reported-by: Niracler Li

Closes https://github.com/curl/curl/pull/12241
2023-11-03 03:50:59 -04:00
Jay Satiro
4855debd8a strdup: don't allow Curl_strndup to read past a null terminator
- Use malloc + strncpy instead of Curl_memdup to dupe the string before
  null terminating it.

Prior to this change if Curl_strndup was passed a length longer than
the allocated string then it could copy out of bounds.

This change is for posterity. Curl_strndup was added in the parent
commit and currently none of the calls to it pass a length that would
cause it to read past the allocated length of the input.

Follow-up to d3b3ba35.

Closes https://github.com/curl/curl/pull/12254
2023-11-02 23:44:46 -04:00
Daniel Stenberg
d3b3ba35a5
lib: add and use Curl_strndup()
The Curl_strndup() function is similar to memdup(), but copies 'n' bytes
then adds a terminating null byte ('\0').

Closes #12251
2023-11-02 20:35:20 +01:00
Daniel Stenberg
fdaed85b02
CURPOST_POSTFIELDS.3: add CURLOPT_COPYPOSTFIELDS in SEE ALSO 2023-11-02 20:34:14 +01:00
Stefan Eissing
7e1c0851bf
pytest: use lower count in repeat tests
- lower large iteration counts in some tests somewhat for
  the same coverage with less duration

Closes #12248
2023-11-02 16:35:00 +01:00
Daniel Stenberg
30e04beafe
RELEASE-NOTES: synced 2023-11-02 16:30:15 +01:00
Daniel Stenberg
63e1a9a1e7
docs: clarify that curl passes on input unfiltered
... for several options.

Reported-by: Ophir Lojkine

Closes #12249
2023-11-02 16:27:39 +01:00
Daniel Stenberg
5c846a12a3
urlapi: when URL encoding the fragment, pass in the right length
A benign bug because it would only add an extra null terminator.

Made lib1560 get a test that runs this code.

Closes #12250
2023-11-02 16:23:17 +01:00
Stefan Eissing
bbdbd4b025
vtls: late clone of connection ssl config
- perform connection cache matching against `data->set.ssl.primary`
  and proxy counterpart
- fully clone connection ssl config only when connection is used

Closes #12237
2023-11-02 14:30:42 +01:00
Stefan Eissing
5d0b3eda43
msh3: error when built with CURL_DISABLE_SOCKETPAIR set
Reported-by: Gisle Vanem
Closes #12252
Fixes #12213
2023-11-02 14:29:21 +01:00
Daniel Stenberg
8c058a820a
hsts: skip single-dot hostname
Reported-by: Maksymilian Arciemowicz

Closes #12247
2023-11-02 13:17:45 +01:00
Daniel Stenberg
ddb95c155e
vtls: fix build without proxy
Follow-up to bf0e278a3c

closes #12243
2023-11-01 14:55:04 +01:00