Commit Graph

29019 Commits

Author SHA1 Message Date
Daniel Stenberg
6f037100eb
sendf: fix paused header writes since after the header API
Regression since d1e4a67

Reported-by: Sergey Ogryzkov
Fixes #9180
Closes #9182
2022-07-20 00:49:06 +02:00
Daniel Stenberg
7935972b37
mprintf: fix *dyn_vprintf() when out-of-memory
Follow-up to 0e48ac1f99. Torture-testing 1455 would lead to a memory
leak otherwise.

Closes #9185
2022-07-19 23:56:03 +02:00
Daniel Stenberg
24694cb3ea
curl-confopts: remove leftover AC_REQUIREs
configure.ac:3488: warning: CURL_CHECK_FUNC_IOCTL is m4_require'd but not m4_defun'd
configure.ac:3488: warning: CURL_CHECK_FUNC_SETSOCKOPT is m4_require'd but not m4_defun'd

follow-up from 4d73854462

Closes #9183
2022-07-19 21:05:25 +02:00
Daniel Stenberg
c61e6de7d5
file: fix icc enumerated type mixed with another type warning
Ref: #9179
Closes #9181
2022-07-19 18:10:08 +02:00
Viktor Szakats
4d73854462
tidy-up: delete unused build configuration macros
Most of them feature guards:

- `CURL_INCLUDES_SYS_UIO` [1]
- `HAVE_ALLOCA_H` [2]
- `HAVE_CRYPTO_CLEANUP_ALL_EX_DATA` (unused since de71e68000)
- `HAVE_DLFCN_H`
- `HAVE_DLOPEN`
- `HAVE_DOPRNT`
- `HAVE_FCNTL`
- `HAVE_GETHOSTBYNAME` [3]
- `HAVE_GETOPT_H`
- `HAVE_GETPASS`
- `HAVE_GETPROTOBYNAME`
- `HAVE_GETSERVBYNAME`
- `HAVE_IDN_FREE*`
- `HAVE_INET_ADDR`
- `HAVE_IOCTL`
- `HAVE_KRB4`
- `HAVE_KRB_GET_OUR_IP_FOR_REALM`
- `HAVE_KRB_H`
- `HAVE_LDAPSSL_H`
- `HAVE_LDAP_INIT_FD`
- `HAVE_LIBDL`
- `HAVE_LIBNSL`
- `HAVE_LIBRESOLV*`
- `HAVE_LIBUCB`
- `HAVE_LL`
- `HAVE_LOCALTIME_R`
- `HAVE_MALLOC_H`
- `HAVE_MEMCPY`
- `HAVE_MEMORY_H`
- `HAVE_NETINET_IF_ETHER_H`
- `HAVE_NI_WITHSCOPEID`
- `HAVE_OPENSSL_CRYPTO_H`
- `HAVE_OPENSSL_ERR_H`
- `HAVE_OPENSSL_PEM_H`
- `HAVE_OPENSSL_PKCS12_H`
- `HAVE_OPENSSL_RAND_H`
- `HAVE_OPENSSL_RSA_H`
- `HAVE_OPENSSL_SSL_H`
- `HAVE_OPENSSL_X509_H`
- `HAVE_PEM_H`
- `HAVE_POLL`
- `HAVE_RAND_SCREEN`
- `HAVE_RAND_STATUS`
- `HAVE_RECVFROM`
- `HAVE_SETSOCKOPT`
- `HAVE_SETVBUF`
- `HAVE_SIZEOF_LONG_DOUBLE`
- `HAVE_SOCKIO_H`
- `HAVE_SOCK_OPTS`
- `HAVE_STDIO_H`
- `HAVE_STRCASESTR`
- `HAVE_STRFTIME`
- `HAVE_STRLCAT`
- `HAVE_STRNCMPI`
- `HAVE_STRNICMP`
- `HAVE_STRSTR`
- `HAVE_STRUCT_IN6_ADDR`
- `HAVE_TLD_H`
- `HAVE_TLD_STRERROR`
- `HAVE_UNAME`
- `HAVE_USLEEP`
- `HAVE_WINBER_H`
- `HAVE_WRITEV`
- `HAVE_X509_H`
- `LT_OBJDIR`
- `NEED_BASENAME_PROTO`
- `NOT_NEED_LIBNSL`
- `OPENSSL_NO_KRB5`
- `RECVFROM_TYPE*`
- `SIZEOF_LONG_DOUBLE`
- `STRERROR_R_TYPE_ARG3`
- `USE_YASSLEMUL`
- `_USRDLL` (from CMake) [4]

[1] Related parts in `m4/curl-functions.m4` and `configure.ac` might
    also be deleted.

[2] Related comment can possibly be deleted in
    `packages/vms/generate_config_vms_h_curl.com`.

[3] There are more instances of this in autotools, but I did not dare to
    touch those. Looked like it's used to detect socket support.

[4] This is necessary for MFC (Microsoft Foundation Class) DLLs to
    force linking MFC components statically to the DLL. `libcurl.dll`
    does not use MFC, so we can delete this define.
    Ref: https://docs.microsoft.com/cpp/build/regular-dlls-statically-linked-to-mfc

Script that can help finding unused settings like above:
```shell

autoheader configure.ac  # generate lib/curl_config.h.in

{
  grep -o -E    'set\([A-Z][A-Z0-9_]{3,}'          CMake/Platforms/WindowsCache.cmake | sed -E 's|set\(||g'
  grep -o -E -h '#define +[A-Z][A-Z0-9_]{3,}'      lib/config-*.h                     | sed -E 's|#define +||g'
  grep -o -E    '#cmakedefine +[A-Z][A-Z0-9_]{3,}' lib/curl_config.h.cmake            | sed -E 's|#cmakedefine +||g'
  grep -o -E    '#undef +[A-Z][A-Z0-9_]{3,}'       lib/curl_config.h.in               | sed -E 's|#undef +||g'
} | sort -u | grep -v -F 'HEADER_CURL_' | while read -r def; do
  c="$(git grep -w -F "${def}" | grep -v -E -c '(/libcurl\.tmpl|^lib/config-|^lib/curl_config\.h\.cmake|^CMakeLists\.txt|^CMake/Platforms/WindowsCache\.cmake|^packages/vms/config_h\.com|^m4/curl-functions\.m4|^acinclude\.m4|^configure\.ac)')"
  if [ "${c}" = '0' ]; then
    echo "${def}"
  fi
done
```

Reviewed-by: Daniel Stenberg
Closes #9044
2022-07-19 15:12:19 +00:00
Daniel Stenberg
6e83e27f6c
RELEASE-NOTES: synced 2022-07-19 15:03:02 +02:00
Daniel Stenberg
4c0ac2aa59
cookie: treat a blank domain in Set-Cookie: as non-existing
This matches what RFC 6265 section 5.2.3 says.

Extended test 31 to verify.

Fixes #9164
Reported-by: Gwen Shapira
Closes #9177
2022-07-19 11:52:54 +02:00
Patrick Monnerat
c2e72c7812
base64: base64url encoding has no padding
See RFC4648 section 5 and RFC7540 section 3.2.1.

Suppress generation of '=' padding of base64url encoding. This is
accomplished by considering the string beginning at offset 64 in the
character table as the padding: this is "=" for base64, "" for base64url.

Also use strchr() to replace character search loops where possible.

Suppress erroneous comments about empty encoding results.

Adjust unit test 1302 to unpadded base64url encoding and add tests for
empty results.

Closes #9139
2022-07-19 11:06:20 +02:00
Daniel Stenberg
dfe5a3023b
easyoptions: fix icc warning
easyoptions.c(360): error #188: enumerated type mixed with another type

Ref: #9156
Reported-by: Matthew Thompson
Closes #9176
2022-07-19 11:01:15 +02:00
lwthiker
b9b6148c45
h2h3: fix overriding the 'TE: Trailers' header
A 'TE: Trailers' header is explicitly replaced by 'te: trailers'
(lowercase) in Curl_pseudo_headers() when building the list of HTTP/2 or
HTTP/3 headers. However, this is then replaced again by the original
value due to a bug, resulting in the uppercased version being sent. Some
HTTP/2 servers reject the whole HTTP/2 stream when this is the case.

Closes #9170
2022-07-19 00:19:13 +02:00
Daniel Stenberg
0484127805
lib3026: reduce the number of threads to 100
Down from 1000, to make it run and work in more systems.

Fixes #9172
Reported-by: Érico Nogueira Rolim
Closes #9173
2022-07-18 11:58:38 +02:00
Daniel Stenberg
fe93bb4d1f
doh: move doh related struct definitions to doh.h
and make 'dnstype' in 'struct dnsprobe' use the DNStype to fix the icc compiler warning:

  doh.c(924): error #188: enumerated type mixed with another type

Reported-by: Matthew Thompson
Ref #9156
Closes #9174
2022-07-18 11:55:26 +02:00
Viktor Szakats
f9ff59ebe2
Makefile.m32: stop trying to build libcares.a [ci skip]
Before this patch, `lib/Makefile.m32` had a rule to build `libcares.a` in
`-cares`-enabled builds, via c-ares's own `Makefile.m32`. Committed in
2007 [1]. The commit message doesn't specifically address this particular
change. This logic comes from the times when c-ares was part of the curl
source tree, hence the special treatment.

This feature creates problems when building c-ares first, using CMake
and pointing `LIBCARES_PATH` to its install prefix, where `Makefile.m32`
is missing in such case. A sub-build for c-ares is undesired also when
c-ares had already been build via its own `Makefile.m32`.

To avoid the sub-build, this patch deletes its Makefile rule. After this
patch `libcares.a` needs to be manually built before using it in
`Makefile.m32`. Aligning it with the rest of dependencies.

[1] 46c92c0b80

Reviewed-by: Daniel Stenberg
Closes #9169
2022-07-17 21:46:01 +00:00
Daniel Stenberg
0ef4f087cd
curl: writeout: fix repeated header outputs
The function stored a terminating zero into the buffer for convenience,
but when on repeated calls that would cause problems. Starting now, the
passed in buffer is not modified.

Reported-by: highmtworks on github
Fixes #9150
Closes #9152
2022-07-17 23:29:02 +02:00
Daniel Stenberg
a88dbe410f
curl_multi_timeout.3: clarify usage
Fixes #9155
Closes #9157
Reported-by: jvvprasad78 on github
2022-07-17 23:27:55 +02:00
Daniel Stenberg
0e48ac1f99
mprintf: make dprintf_formatf never return negative
This function no longer returns a negative value if the formatting
string is bad since the return value would sometimes be propagated as a
return code from the mprintf* functions and they are documented to
return the length of the output. Which cannot be negative.

Fixes #9149
Closes #9151
Reported-by: yiyuaner on github
2022-07-17 23:27:02 +02:00
Viktor Szakats
8d06af10fb
trace: 0x7F character is non-printable
`0x7F` is `DEL`, a non-printable symbol, so print it as
`UNPRINTABLE_CHAR`.

Reported-by: MasterInQuestion on github
Fixes #9162
Closes #9166
2022-07-17 10:10:35 +00:00
Viktor Szakats
a19f0601fe
doh: use https protocol by default
The only allowed protocol is https, so it makes sense to use that
by default if not passed explicitly by the user.

Reported-by: MasterInQuestion on github
Reviewed-by: Jay Satiro
Fixes #9163
Closes #9165
2022-07-16 14:10:39 +00:00
Viktor Szakats
4c46c829f5
openssl: fix BoringSSL symbol conflicts with LDAP and Schannel
Same issue as here [1], but this time when building curl with BoringSSL
for Windows with LDAP(S) or Schannel support enabled.

Apply the same fix [2] for these source files as well.

This can also be fixed by moving `#include "urldata.h"` _before_
including `winldap.h` and `schnlsp.h` respectively. This seems like
a cleaner fix, though I'm not sure why it works and if it has any
downside.

[1] https://github.com/curl/curl/issues/5669
[2] fbe07c6829

Co-authored-by: Jay Satiro
Closes #9110
2022-07-14 07:14:22 +00:00
Daniel Stenberg
451bcc1a91
asyn-thread: make getaddrinfo_complete return CURLcode
... as the only caller that cares about what it returns assumes that
anyway. This caused icc to warn:

asyn-thread.c(505): error #188: enumerated type mixed with another type
        result = getaddrinfo_complete(data);

Repoorted-by: Matthew Thompson
Bug: https://github.com/curl/curl/issues/9081#issuecomment-1182143076
Closes #9146
2022-07-13 23:26:13 +02:00
Daniel Stenberg
e0c68f0255
easy_lock: fix build with icc
The Intel compiler tries to look like GCC *and* clang *and* it lies in
its __has_builtin() function (returns true when it should return false),
so override it.

Reported-by: Matthew Thompson
Fixes #9081
Closes #9144
2022-07-12 23:08:35 +02:00
Daniel Stenberg
60be90d14e
configure: fix --disable-headers-api
Reported-by: Michał Antoniak
Fixes #9134
Closes #9143
2022-07-12 22:58:57 +02:00
Daniel Stenberg
945a81e143
test3026: require 'threadsafe'
Reported-by: Sukanya Hanumanthu
Fixes #9141
Closes #9142
2022-07-12 22:56:48 +02:00
Even Rouault
0525614269
CMake: link curl to its dependencies with PRIVATE
The current PUBLIC visibility causes issues for downstream users.
Cf https://github.com/OSGeo/PROJ/pull/3172#issuecomment-1157942986

Reviewed-by: Jakub Zakrzewski
Closes #9125
2022-07-12 17:18:39 +02:00
Even Rouault
7ac3607584
CMake: remove APPEND in export(TARGETS)
When running cmake several times, new content was appended to already
existing generated files, which is not appropriate

Reviewed-by: Jakub Zakrzewski
Closes #9124
2022-07-12 17:17:07 +02:00
Tatsuhiro Tsujikawa
e9a2eced69
ngtcp2: implement cb_h3_stop_sending and cb_h3_reset_stream callbacks
Closes #9135
2022-07-12 17:15:52 +02:00
Daniel Stenberg
72516ba1fe
RELEASE-NOTES: synced 2022-07-11 23:38:02 +02:00
Viktor Szakats
ca73991774
build: improve OS string in CMake and config-win32.h
This patch makes CMake fill the "OS string" with the value of
`CMAKE_C_COMPILER_TARGET`, if passed. This typically contains a triplet,
the same we can pass to `./configure` via `--host=`.

For non-CMake, non-autotools, Windows builds, this patch adds the ability
to override the default `OS` value in `lib/config-win32.h`.

With these its possible to get the same OS string across the three build
systems.

This patch supersedes the earlier, partial, CMake-only solution:
435f395f3f, thus retiring the
`CURL_OS_SUFFIX` CMake option.

Reviewed-by: Jay Satiro
Closes #9117
2022-07-11 19:41:31 +00:00
Viktor Szakats
1d5b7b7009
Makefile.m32: add CURL_RC and CURL_STRIP variables [ci skip]
They allow to override the hardcoded values for the `windres` and `strip`
tools, complementing the existing set of `CURL_{CC,AR,RANLIB}` variables.

`CURL_RC` comes handy when using LLVM tools with `CROSSPREFIX=llvm-` and
`CURL_CC=clang` set on current latest debian:unstable or earlier, where
`llvm-windres` is missing, and a `CURL_RC=<triplet>-windres` fixes it.
Hopefully this will be fixed in the llvm package. FWIW `llvm-windres`
does exist in Homebrew llvm, MSYS2 llvm and llvm-mingw.

Reviewed-by: Daniel Stenberg
Closes #9132
2022-07-10 22:28:14 +00:00
Tatsuhiro Tsujikawa
4989cd099e
ngtcp2: fix stall or busy loop on STOP_SENDING with upload data
Fixes #9122
Closes #9123
2022-07-10 23:18:00 +02:00
xkernel
d123f0e590
tool_operate: better cleanup of easy handle in exit path
Closes #9114
2022-07-10 18:23:03 +02:00
xkernel
afdbb176f6
getinfo: return better error on NULL as first argument
Closes #9114
2022-07-10 18:22:23 +02:00
Daniel Stenberg
bf7e887b24
tool_getparam: repair cleanarg
Regression since 9e5669f.

Make sure the "cleaning" of command line arguments is done on the
original argv[] pointers. As a bonus, it also exits better on out of
memory error.

Reported-by: Litter White
Fixes #9128
Closes #9130
2022-07-10 15:49:14 +02:00
Jay Satiro
eab25898b3 docs: explain curl_easy_escape/unescape curl handle is ignored
26101421 (precedes 7.82.0) removed character conversion support used by
very old legacy operating systems and since then the curl handle passed
to curl_easy_escape/unescape is always ignored.

Bug: https://github.com/curl/curl/discussions/9115
Reported-by: Ted Lyngmo

Closes https://github.com/curl/curl/pull/9121
2022-07-10 02:59:58 -04:00
Viktor Szakats
9153ba708b
openssl: add CURL_BORINGSSL_VERSION to identify BoringSSL
BoringSSL doesn't keep a version number, and doesn't self-identify itself
via any other revision number via its own headers. We can identify
BoringSSL revisions by their commit hash. This hash is typically known by
the builder. This patch adds a way to pass this hash to libcurl, so that
it can display in the curl version string:

For example:

`CFLAGS=-DCURL_BORINGSSL_VERSION="c239ffd0"`

```
curl 7.84.0 (x86_64-w64-mingw32) libcurl/7.84.0 BoringSSL/c239ffd0 (Schannel) zlib/1.2.12 [...]
Release-Date: 2022-06-27
Protocols: dict file ftp ftps gopher gophers http https imap imaps ldap ldaps mqtt pop3 [...]
Features: alt-svc AsynchDNS brotli gsasl HSTS HTTP2 HTTP3 HTTPS-proxy IDN IPv6 Kerberos [...]
```

The setting is optional, and if not passed, BoringSSL will appear without
a version number, like before this patch.

Closes #9113
2022-07-08 10:12:15 +00:00
Jay Satiro
30c862513d escape: remove outdated comment
Bug: https://github.com/curl/curl/discussions/9115
Reported-by: Ted Lyngmo
2022-07-08 01:39:55 -04:00
Tatsuhiro Tsujikawa
7f5a29e689 ngtcp2: Fix missing initialization of nghttp3_nv.flags
Closes https://github.com/curl/curl/pull/9118
2022-07-08 00:12:08 -04:00
Brad Forschinger
91824e2c4b
netrc.d: remove spurious quote
Closes #9111
2022-07-06 11:29:16 +02:00
Viktor Szakats
190caa9ce2
Makefile.m32: add NGTCP2_LIBS option [ci skip]
Makefile.m32's ngtcp2 has its two libs hardwired for OpenSSL.
Add `NGTCP2_LIBS` envvar to override them with a custom list,
making it possible to use BoringSSL, or any other backend.

Closes #9109
2022-07-06 09:22:42 +00:00
Evgeny Grin (Karlson2k)
647ed7c78b digest: fix missing increment of 'nc' value for auth-int
- Increment nc regardless of qop type.

Prior to this change nc was only incremented for qop type auth even
though libcurl sends nc with any qop.

Closes https://github.com/curl/curl/pull/9090
2022-07-06 04:14:37 -04:00
Daniel Stenberg
2b2a47eb38
RELEASE-NOTES: synced
Bumped to 7.85.0
2022-07-05 10:39:52 +02:00
Daniel Stenberg
1b3d59acf9
urldata: reduce size of four ftp related members
ftp_filemethod, ftpsslauth and ftp_ccc are now uchars

accepttimeout is now unsigned int - almost 50 days ought to be enough
for this value.

Closes #9106
2022-07-05 10:18:48 +02:00
Daniel Stenberg
dcb7d4f904
urldata: reduce three type-members from int to uchar
- timecondition
 - proxytype
 - method

... previously used their enum type in the struct, which made them
unnecesarily large.

Closes #9105
2022-07-05 10:17:31 +02:00
Daniel Stenberg
be43dd600a
CURLOPT_SERVER_RESPONSE_TIMEOUT: the new name
Starting now, CURLOPT_FTP_RESPONSE_TIMEOUT is the alias instead of the
other way around.

Since 7.20.0, CURLOPT_SERVER_RESPONSE_TIMEOUT has existed as an alias
but since the option is for more protocols than FTP the more "correct"
version of the option is the "server" one so now we switch.

Closes #9104
2022-07-05 10:16:05 +02:00
Daniel Stenberg
671cc8e110
urldata: make 'ftp_create_missing_dirs' a uchar
It only ever holds the values 0-2.

Closes #9103
2022-07-05 10:10:49 +02:00
Don
7f8b36b074
cmake: support ngtcp2 boringssl backend
Update the ngtcp2 find module to detect the boringssl backend. Determine
if the underlying OpenSSL implementation is BoringSSL and if so use that
as the ngtcp2 backend.

Reviewed-by: Jakub Zakrzewski
Closes #9065
2022-07-05 10:09:40 +02:00
Daniel Stenberg
3622bf4e79
urldata: change 4 timeouts to unsigned int from long
They're not used for that long times anyway, 32 bit milliseconds is long
enough.

Closes #9101
2022-07-05 00:15:54 +02:00
Daniel Stenberg
fe14ff6150
urldata: make 'use_netrc' a uchar
Closes #9102
2022-07-04 23:04:24 +02:00
Daniel Stenberg
3fa343a35c
urldata: make 'buffer_size' an unsigned int
It is already capped at READBUFFER_MAX which fits easily in 32 bits.

Closes #9098
2022-07-04 23:03:44 +02:00
Daniel Stenberg
cb17b12b01
urldata: remove the unused 'rtspversion' struct member
Closes #9100
2022-07-04 19:44:10 +02:00