]> git.ipfire.org Git - thirdparty/curl.git/log
thirdparty/curl.git
3 years agotest3026: add support for Windows using native Win32 threads 9212/head
Marc Hoersken [Tue, 14 Jun 2022 19:55:15 +0000 (21:55 +0200)] 
test3026: add support for Windows using native Win32 threads

Reviewed-by: Viktor Szakats
Reviewed-by: Jay Satiro
Reviewed-by: Daniel Stenberg
Follow up to 7ade9c50b35d95d47a43880c3097bebab7a7e690
Closes #9012

3 years agodigest: fix memory leak, fix not quoted 'opaque'
Evgeny Grin (Karlson2k) [Mon, 25 Jul 2022 11:36:16 +0000 (14:36 +0300)] 
digest: fix memory leak, fix not quoted 'opaque'

Fix leak regression introduced by 3a6fe0c.

Closes https://github.com/curl/curl/pull/9199

3 years agotests: several enumerated type cleanups
Daniel Stenberg [Wed, 20 Jul 2022 23:04:39 +0000 (01:04 +0200)] 
tests: several enumerated type cleanups

To please icc

Closes #9179

3 years agotool_paramhlp: fix "enumerated type mixed with another type"
Daniel Stenberg [Wed, 20 Jul 2022 22:26:29 +0000 (00:26 +0200)] 
tool_paramhlp: fix "enumerated type mixed with another type"

Warning by icc

Closes #9179

3 years agotool_writeout: fix enumerated type mixed with another type
Daniel Stenberg [Wed, 20 Jul 2022 22:05:25 +0000 (00:05 +0200)] 
tool_writeout: fix enumerated type mixed with another type

Closes #9179

3 years agotool_cfgable: make 'synthetic_error' a plain bool
Daniel Stenberg [Wed, 20 Jul 2022 21:53:34 +0000 (23:53 +0200)] 
tool_cfgable: make 'synthetic_error' a plain bool

The specific reason was not used.

Closes #9179

3 years agotool_paramhlp: make check_protocol return ParameterError
Daniel Stenberg [Wed, 20 Jul 2022 21:41:41 +0000 (23:41 +0200)] 
tool_paramhlp: make check_protocol return ParameterError

"enumerated type mixed with another type"

Closes #9179

3 years agotool_formparse: fix variable may be used before its value is set
Daniel Stenberg [Wed, 20 Jul 2022 21:33:59 +0000 (23:33 +0200)] 
tool_formparse: fix variable may be used before its value is set

Warning by icc

Closes #9179

3 years agosendf: skip storing HTTP headers if HTTP disabled
Daniel Stenberg [Wed, 20 Jul 2022 21:29:09 +0000 (23:29 +0200)] 
sendf: skip storing HTTP headers if HTTP disabled

Closes #9179

3 years agourl: enumerated type mixed with another type
Daniel Stenberg [Wed, 20 Jul 2022 21:24:17 +0000 (23:24 +0200)] 
url: enumerated type mixed with another type

Follow-up to 1c58e7ae99ce2030213f28b

Closes #9179

3 years agourldata: change second proxytype field to unsigned char to match
Daniel Stenberg [Wed, 20 Jul 2022 21:13:35 +0000 (23:13 +0200)] 
urldata: change second proxytype field to unsigned char to match

To avoid "enumerated type mixed with another type"

Closes #9179

3 years agohttp: typecast the httpreq assignment to avoid icc compiler warning
Daniel Stenberg [Wed, 20 Jul 2022 20:40:30 +0000 (22:40 +0200)] 
http: typecast the httpreq assignment to avoid icc compiler warning

 error #188: enumerated type mixed with another type

Closes #9179

3 years agourldata: make state.httpreq an unsigned char
Daniel Stenberg [Wed, 20 Jul 2022 11:57:34 +0000 (13:57 +0200)] 
urldata: make state.httpreq an unsigned char

To match set.method used for the same purpose.

Closes #9179

3 years agosplay: avoid using -1 in unsigned variable
Daniel Stenberg [Wed, 20 Jul 2022 11:44:37 +0000 (13:44 +0200)] 
splay: avoid using -1 in unsigned variable

To fix icc compiler warning integer conversion resulted in a change of sign

Closes #9179

3 years agosendf: store the header type in an usigned char to avoid icc warnings
Daniel Stenberg [Wed, 20 Jul 2022 10:48:49 +0000 (12:48 +0200)] 
sendf: store the header type in an usigned char to avoid icc warnings

Closes #9179

3 years agomulti: fix the return code from Curl_pgrsDone()
Daniel Stenberg [Wed, 20 Jul 2022 10:13:02 +0000 (12:13 +0200)] 
multi: fix the return code from Curl_pgrsDone()

It does not return a CURLcode. Detected by the icc compiler warning
"enumerated type mixed with another type"

Closes #9179

3 years agosendf: make Curl_debug a void function
Daniel Stenberg [Wed, 20 Jul 2022 09:15:25 +0000 (11:15 +0200)] 
sendf: make Curl_debug a void function

As virtually no called checked the return code, and those that did
wrongly treated it as a CURLcode. Detected by the icc compiler warning:
enumerated type mixed with another type

Closes #9179

3 years agohttp_chunks: remove an assign + typecast
Daniel Stenberg [Wed, 20 Jul 2022 09:05:50 +0000 (11:05 +0200)] 
http_chunks: remove an assign + typecast

As it caused icc to complain: "pointer cast involving 64-bit pointed-to
type"

Closes #9179

3 years agovtls: make Curl_ssl_backend() return the enum type curl_sslbackend
Daniel Stenberg [Wed, 20 Jul 2022 08:58:16 +0000 (10:58 +0200)] 
vtls: make Curl_ssl_backend() return the enum type curl_sslbackend

To fix the icc warning enumerated type mixed with another type

Closes #9179

3 years agocurl-compilers.m4: make icc use -diag* options and disable two warnings
Daniel Stenberg [Wed, 20 Jul 2022 11:22:09 +0000 (13:22 +0200)] 
curl-compilers.m4: make icc use -diag* options and disable two warnings

-wd and -we are deprecated and are now -diag-disable and -diag-error

Disable warning 1024 and 2259

Closes #9179

3 years agoGHA: add two Intel compiler CI jobs
Matthew Thompson [Fri, 22 Jul 2022 22:29:37 +0000 (00:29 +0200)] 
GHA: add two Intel compiler CI jobs

Closes #9179

3 years agocurl-functions.m4: check whether atomics can link rather than just compile
Daniel Katz [Thu, 21 Jul 2022 00:20:42 +0000 (20:20 -0400)] 
curl-functions.m4: check whether atomics can link rather than just compile

Some build toolchains support C11 atomics (i.e., _Atomic types), but
will not link the associated atomics runtime unless a flag is passed. In
such an environment, linking an application with libcurl.a can fail due
to undefined symbols for atomic load/store functions.

I encountered this behavior when upgrading curl to 7.84.0 and attempting
to build with Solaris Studio 12.6. Solaris provides the flag
-xatomic=[gcc | studio], allowing users to link to one of two atomics
runtime implementations. However, if the user does not provide this
flag, then neither runtime is linked. This led to builds failing in CI.

Closes #9190

3 years agocurl-wolfssl.m4: add options header when building test code
Rosen Penev [Wed, 20 Jul 2022 02:22:20 +0000 (19:22 -0700)] 
curl-wolfssl.m4: add options header when building test code

Needed for certain configurations of wolfSSL. Otherwise, missing header
error may occur.

Tested with OpenWrt.

Closes #9187

3 years agoftp: use a correct expire ID for timer expiry
Daniel Stenberg [Tue, 19 Jul 2022 19:03:48 +0000 (21:03 +0200)] 
ftp: use a correct expire ID for timer expiry

This was an accurate error pointed out by the icc warning: enumerated
type mixed with another type

Ref: #9179
Closes #9184

3 years agosendf: fix paused header writes since after the header API
Daniel Stenberg [Tue, 19 Jul 2022 15:54:23 +0000 (17:54 +0200)] 
sendf: fix paused header writes since after the header API

Regression since d1e4a67

Reported-by: Sergey Ogryzkov
Fixes #9180
Closes #9182

3 years agomprintf: fix *dyn_vprintf() when out-of-memory
Daniel Stenberg [Tue, 19 Jul 2022 20:32:12 +0000 (22:32 +0200)] 
mprintf: fix *dyn_vprintf() when out-of-memory

Follow-up to 0e48ac1f99a. Torture-testing 1455 would lead to a memory
leak otherwise.

Closes #9185

3 years agocurl-confopts: remove leftover AC_REQUIREs
Daniel Stenberg [Tue, 19 Jul 2022 16:12:31 +0000 (18:12 +0200)] 
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 4d73854462f30

Closes #9183

3 years agofile: fix icc enumerated type mixed with another type warning
Daniel Stenberg [Tue, 19 Jul 2022 14:45:30 +0000 (16:45 +0200)] 
file: fix icc enumerated type mixed with another type warning

Ref: #9179
Closes #9181

3 years agotidy-up: delete unused build configuration macros
Viktor Szakats [Tue, 19 Jul 2022 15:06:26 +0000 (15:06 +0000)] 
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 de71e68000c8624ea13f90b136f8734dd0fb1bdc)
- `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

3 years agoRELEASE-NOTES: synced
Daniel Stenberg [Tue, 19 Jul 2022 13:03:02 +0000 (15:03 +0200)] 
RELEASE-NOTES: synced

3 years agocookie: treat a blank domain in Set-Cookie: as non-existing
Daniel Stenberg [Mon, 18 Jul 2022 22:05:43 +0000 (00:05 +0200)] 
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

3 years agobase64: base64url encoding has no padding
Patrick Monnerat [Tue, 12 Jul 2022 17:03:45 +0000 (19:03 +0200)] 
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

3 years agoeasyoptions: fix icc warning
Daniel Stenberg [Mon, 18 Jul 2022 21:38:36 +0000 (23:38 +0200)] 
easyoptions: fix icc warning

    easyoptions.c(360): error #188: enumerated type mixed with another type

Ref: #9156
Reported-by: Matthew Thompson
Closes #9176

3 years agoh2h3: fix overriding the 'TE: Trailers' header
lwthiker [Sun, 17 Jul 2022 16:11:33 +0000 (19:11 +0300)] 
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

3 years agolib3026: reduce the number of threads to 100
Daniel Stenberg [Sun, 17 Jul 2022 21:48:22 +0000 (23:48 +0200)] 
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

3 years agodoh: move doh related struct definitions to doh.h
Daniel Stenberg [Sun, 17 Jul 2022 21:58:43 +0000 (23:58 +0200)] 
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

3 years agoMakefile.m32: stop trying to build libcares.a [ci skip]
Viktor Szakats [Sun, 17 Jul 2022 21:45:34 +0000 (21:45 +0000)] 
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] 46c92c0b806da041d7a5c6fb64dbcdc474d99b31

Reviewed-by: Daniel Stenberg
Closes #9169

3 years agocurl: writeout: fix repeated header outputs
Daniel Stenberg [Wed, 13 Jul 2022 21:53:05 +0000 (23:53 +0200)] 
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

3 years agocurl_multi_timeout.3: clarify usage
Daniel Stenberg [Thu, 14 Jul 2022 21:37:13 +0000 (23:37 +0200)] 
curl_multi_timeout.3: clarify usage

Fixes #9155
Closes #9157
Reported-by: jvvprasad78 on github
3 years agomprintf: make dprintf_formatf never return negative
Daniel Stenberg [Wed, 13 Jul 2022 21:46:16 +0000 (23:46 +0200)] 
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
3 years agotrace: 0x7F character is non-printable
Viktor Szakats [Sun, 17 Jul 2022 10:10:35 +0000 (10:10 +0000)] 
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

3 years agodoh: use https protocol by default
Viktor Szakats [Sat, 16 Jul 2022 14:10:39 +0000 (14:10 +0000)] 
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

3 years agoopenssl: fix BoringSSL symbol conflicts with LDAP and Schannel
Viktor Szakats [Thu, 14 Jul 2022 07:14:22 +0000 (07:14 +0000)] 
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] https://github.com/curl/curl/commit/fbe07c6829ba8c5793c84c2856526e19e9029ab9

Co-authored-by: Jay Satiro
Closes #9110

3 years agoasyn-thread: make getaddrinfo_complete return CURLcode
Daniel Stenberg [Tue, 12 Jul 2022 21:06:01 +0000 (23:06 +0200)] 
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

3 years agoeasy_lock: fix build with icc
Daniel Stenberg [Tue, 12 Jul 2022 13:57:02 +0000 (15:57 +0200)] 
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

3 years agoconfigure: fix --disable-headers-api
Daniel Stenberg [Tue, 12 Jul 2022 13:53:11 +0000 (15:53 +0200)] 
configure: fix --disable-headers-api

Reported-by: Michał Antoniak
Fixes #9134
Closes #9143

3 years agotest3026: require 'threadsafe'
Daniel Stenberg [Tue, 12 Jul 2022 13:37:21 +0000 (15:37 +0200)] 
test3026: require 'threadsafe'

Reported-by: Sukanya Hanumanthu
Fixes #9141
Closes #9142

3 years agoCMake: link curl to its dependencies with PRIVATE
Even Rouault [Fri, 8 Jul 2022 11:30:57 +0000 (13:30 +0200)] 
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

3 years agoCMake: remove APPEND in export(TARGETS)
Even Rouault [Fri, 8 Jul 2022 11:25:14 +0000 (13:25 +0200)] 
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

3 years agongtcp2: implement cb_h3_stop_sending and cb_h3_reset_stream callbacks
Tatsuhiro Tsujikawa [Sat, 9 Jul 2022 07:25:14 +0000 (16:25 +0900)] 
ngtcp2: implement cb_h3_stop_sending and cb_h3_reset_stream callbacks

Closes #9135

3 years agoRELEASE-NOTES: synced
Daniel Stenberg [Mon, 11 Jul 2022 21:38:02 +0000 (23:38 +0200)] 
RELEASE-NOTES: synced

3 years agobuild: improve OS string in CMake and `config-win32.h`
Viktor Szakats [Mon, 11 Jul 2022 19:41:31 +0000 (19:41 +0000)] 
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:
435f395f3f8c11eebfcc243ca55ebcc11a19b8b8, thus retiring the
`CURL_OS_SUFFIX` CMake option.

Reviewed-by: Jay Satiro
Closes #9117

3 years agoMakefile.m32: add `CURL_RC` and `CURL_STRIP` variables [ci skip]
Viktor Szakats [Sun, 10 Jul 2022 22:28:14 +0000 (22:28 +0000)] 
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

3 years agongtcp2: fix stall or busy loop on STOP_SENDING with upload data
Tatsuhiro Tsujikawa [Fri, 8 Jul 2022 09:48:09 +0000 (18:48 +0900)] 
ngtcp2: fix stall or busy loop on STOP_SENDING with upload data

Fixes #9122
Closes #9123

3 years agotool_operate: better cleanup of easy handle in exit path
xkernel [Sun, 10 Jul 2022 16:23:03 +0000 (18:23 +0200)] 
tool_operate: better cleanup of easy handle in exit path

Closes #9114

3 years agogetinfo: return better error on NULL as first argument
xkernel [Sun, 10 Jul 2022 16:22:23 +0000 (18:22 +0200)] 
getinfo: return better error on NULL as first argument

Closes #9114

3 years agotool_getparam: repair cleanarg
Daniel Stenberg [Sun, 10 Jul 2022 13:22:13 +0000 (15:22 +0200)] 
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

3 years agodocs: explain curl_easy_escape/unescape curl handle is ignored
Jay Satiro [Fri, 8 Jul 2022 06:04:35 +0000 (02:04 -0400)] 
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

3 years agoopenssl: add `CURL_BORINGSSL_VERSION` to identify BoringSSL
Viktor Szakats [Fri, 8 Jul 2022 10:10:04 +0000 (10:10 +0000)] 
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

3 years agoescape: remove outdated comment
Jay Satiro [Fri, 8 Jul 2022 05:39:55 +0000 (01:39 -0400)] 
escape: remove outdated comment

Bug: https://github.com/curl/curl/discussions/9115
Reported-by: Ted Lyngmo
3 years agongtcp2: Fix missing initialization of nghttp3_nv.flags
Tatsuhiro Tsujikawa [Thu, 7 Jul 2022 15:01:48 +0000 (00:01 +0900)] 
ngtcp2: Fix missing initialization of nghttp3_nv.flags

Closes https://github.com/curl/curl/pull/9118

3 years agonetrc.d: remove spurious quote
Brad Forschinger [Wed, 6 Jul 2022 07:45:07 +0000 (17:45 +1000)] 
netrc.d: remove spurious quote

Closes #9111

3 years agoMakefile.m32: add `NGTCP2_LIBS` option [ci skip]
Viktor Szakats [Wed, 6 Jul 2022 09:22:42 +0000 (09:22 +0000)] 
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

3 years agodigest: fix missing increment of 'nc' value for auth-int
Evgeny Grin (Karlson2k) [Sun, 3 Jul 2022 14:58:50 +0000 (17:58 +0300)] 
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

3 years agoRELEASE-NOTES: synced
Daniel Stenberg [Tue, 5 Jul 2022 08:39:52 +0000 (10:39 +0200)] 
RELEASE-NOTES: synced

Bumped to 7.85.0

3 years agourldata: reduce size of four ftp related members
Daniel Stenberg [Mon, 4 Jul 2022 22:11:35 +0000 (00:11 +0200)] 
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

3 years agourldata: reduce three type-members from int to uchar
Daniel Stenberg [Mon, 4 Jul 2022 22:04:38 +0000 (00:04 +0200)] 
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

3 years agoCURLOPT_SERVER_RESPONSE_TIMEOUT: the new name
Daniel Stenberg [Mon, 4 Jul 2022 21:22:36 +0000 (23:22 +0200)] 
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

3 years agourldata: make 'ftp_create_missing_dirs' a uchar
Daniel Stenberg [Mon, 4 Jul 2022 21:09:15 +0000 (23:09 +0200)] 
urldata: make 'ftp_create_missing_dirs' a uchar

It only ever holds the values 0-2.

Closes #9103

3 years agocmake: support ngtcp2 boringssl backend
Don [Tue, 28 Jun 2022 22:33:25 +0000 (15:33 -0700)] 
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

3 years agourldata: change 4 timeouts to unsigned int from long
Daniel Stenberg [Mon, 4 Jul 2022 12:58:08 +0000 (14:58 +0200)] 
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

3 years agourldata: make 'use_netrc' a uchar
Daniel Stenberg [Mon, 4 Jul 2022 13:03:35 +0000 (15:03 +0200)] 
urldata: make 'use_netrc' a uchar

Closes #9102

3 years agourldata: make 'buffer_size' an unsigned int
Daniel Stenberg [Mon, 4 Jul 2022 17:41:52 +0000 (19:41 +0200)] 
urldata: make 'buffer_size' an unsigned int

It is already capped at READBUFFER_MAX which fits easily in 32 bits.

Closes #9098

3 years agourldata: remove the unused 'rtspversion' struct member
Daniel Stenberg [Mon, 4 Jul 2022 12:49:28 +0000 (14:49 +0200)] 
urldata: remove the unused 'rtspversion' struct member

Closes #9100

3 years agourldata: make 'use_port' an usigned short
Daniel Stenberg [Mon, 4 Jul 2022 17:42:40 +0000 (19:42 +0200)] 
urldata: make 'use_port' an usigned short

... instead of a long. It is already enforced to not attempt to set any
value outside of 16 bits unsigned.

Closes #9099

3 years agourldata: store dns cache timeout in an int
Daniel Stenberg [Mon, 4 Jul 2022 17:28:49 +0000 (19:28 +0200)] 
urldata: store dns cache timeout in an int

68 years ought to be enough for most.

Closes #9097

3 years agocurl: proto2num: make sure obuf is inited
Daniel Stenberg [Mon, 4 Jul 2022 10:50:15 +0000 (12:50 +0200)] 
curl: proto2num: make sure obuf is inited

Detected by Coverity. CID 1507052.

Closes #9096

3 years agocookie: use %zu to infof() for size_t values
Daniel Stenberg [Mon, 4 Jul 2022 10:48:10 +0000 (12:48 +0200)] 
cookie: use %zu to infof() for size_t values

Detected by Coverity. CID 1507051
Closes #9095

3 years agomakefile.m32: add support for custom ARCH [ci skip]
Viktor Szakats [Mon, 4 Jul 2022 10:26:30 +0000 (10:26 +0000)] 
makefile.m32: add support for custom ARCH [ci skip]

When building curl for target platform other than x64 and x86, it is now
possible to pass `ARCH=custom`, that will omit all hardcoded logic for
setting up CFLAGS/LDFLAGS/RCFLAGS for these platforms, and let these be
customized via `CURL_CFLAG_EXTRAS`, `CURL_LDFLAG_EXTRAS`, and a newly
added one for the resource compiler: `CURL_RCFLAG_EXTRAS`.

This makes it possible to use `makefile.m32` to build for ARM64 for
example.

Reviewed-by: Daniel Stenberg
Closes #9092

3 years agocmake: do not force Windows target versions
Viktor Szakats [Mon, 4 Jul 2022 09:40:55 +0000 (09:40 +0000)] 
cmake: do not force Windows target versions

The goal of this patch is to avoid CMake forcing specific Windows
versions and rely on toolchain defaults or manual selection instead.
This gives back control to the user. This also brings CMake closer to
how autotools and `Makefile.m32` behaves in this regard.

- CMake had a setting `ENABLE_INET_PTON` defaulting to `ON`, which did
  nothing else than fixing the Windows build target to Vista. This also
  happened when the toolchain did not have Vista support (e.g. original
  MinGW), breaking such builds.

  In other environments it did not make a user-facing difference,
  because libcurl has its own pton() implementation, so it works well
  with or without Vista's inet_pton().

  This patch drops this setting. inet_pton() is now used whenever
  building for Vista or newer, either when requested manually or by
  default with modern toolchains (e.g. mingw-w64). Older envs will fall
  back to curl's pton().

  Ref: https://github.com/curl/curl/pull/9027#issuecomment-1164157604
  Ref: https://github.com/curl/curl/pull/8997#issuecomment-1164344155

- When the user did no select a Windows target version manually, stop
  explicitly targeting Windows XP, and instead use the toolchain default.

  This may pose an issue with old toolchains defaulting to pre-XP
  targets. In such case you must manually target Windows XP via:
    `-DCURL_TARGET_WINDOWS_VERSION=0x0501`
  or
    `-DCMAKE_C_FLAGS=-D_WIN32_WINNT=0x0501`

Reviewed-by: Jay Satiro
Reviewed-by: Marcel Raad
Closes #9046

3 years agowindows: improve random source
Viktor Szakats [Mon, 4 Jul 2022 09:38:24 +0000 (09:38 +0000)] 
windows: improve random source

- Use the Windows API to seed the fallback random generator.

  This ensures to always have a random seed, even when libcurl is built
  with a vtls backend lacking a random generator API, such as rustls
  (experimental), GSKit and certain mbedTLS builds, or, when libcurl is
  built without a TLS backend. We reuse the Windows-specific random
  function from the Schannel backend.

- Implement support for `BCryptGenRandom()` [1] on Windows, as a
  replacement for the deprecated `CryptGenRandom()` [2] function.

  It is used as the secure random generator for Schannel, and also to
  provide entropy for libcurl's fallback random generator. The new
  function is supported on Vista and newer via its `bcrypt.dll`. It is
  used automatically when building for supported versions. It also works
  in UWP apps (the old function did not).

- Clear entropy buffer before calling the Windows random generator.

  This avoids using arbitrary application memory as entropy (with
  `CryptGenRandom()`) and makes sure to return in a predictable state
  when an API call fails.

[1] https://docs.microsoft.com/windows/win32/api/bcrypt/nf-bcrypt-bcryptgenrandom
[2] https://docs.microsoft.com/windows/win32/api/wincrypt/nf-wincrypt-cryptgenrandom

Closes #9027

3 years agosetopt: add CURLOPT_PROTOCOLS_STR and CURLOPT_REDIR_PROTOCOLS_STR
Daniel Stenberg [Mon, 13 Jun 2022 07:30:45 +0000 (09:30 +0200)] 
setopt: add CURLOPT_PROTOCOLS_STR and CURLOPT_REDIR_PROTOCOLS_STR

... as replacements for deprecated CURLOPT_PROTOCOLS and
CURLOPT_REDIR_PROTOCOLS as these new ones do not risk running into the
32 bit limit the old ones are facing.

CURLINFO_PROTCOOL is now deprecated.

The curl tool is updated to use the new options.

Added test 1597 to verify the libcurl protocol parser.

Closes #8992

3 years agodigest: simplify a switch() to a simple if
Daniel Stenberg [Mon, 4 Jul 2022 06:27:21 +0000 (08:27 +0200)] 
digest: simplify a switch() to a simple if

3 years agodigest: provide a special bit for "sess" algos
Daniel Stenberg [Mon, 4 Jul 2022 06:27:15 +0000 (08:27 +0200)] 
digest: provide a special bit for "sess" algos

Also shortened the names and moved them to the .c file since they are
private for this source file only. Also made them #defines instead of
enum.

Closes #9079

3 years agoselect: do not return fatal error on EINTR from poll()
Thomas Weißschuh [Sun, 3 Jul 2022 16:20:44 +0000 (18:20 +0200)] 
select: do not return fatal error on EINTR from poll()

The same was done for select() in 5912da25 but poll() was missed.

Bug: https://bugs.archlinux.org/task/75201
Reported-by: Alexandre Bury (gyscos at archlinux)
Ref: https://github.com/curl/curl/issues/8921
Ref: https://github.com/curl/curl/pull/8961
Ref: https://github.com/curl/curl/commit/5912da25#r77584294

Closes https://github.com/curl/curl/pull/9091

3 years agocmake: fix build for mingw cross compile
Kai Pastor [Sat, 2 Jul 2022 07:36:09 +0000 (09:36 +0200)] 
cmake: fix build for mingw cross compile

- Change normaliz lib name to all lowercase.

This is from a standing patch in vcpkg:
Mingw has libnormaliz.a. For case-sensitive file systems (e.g. cross
builds from Linux), the spelling must match exactly.

Closes https://github.com/curl/curl/pull/9084

3 years agoeasy_lock: fix build for mingw
Jay Satiro [Fri, 1 Jul 2022 07:02:20 +0000 (03:02 -0400)] 
easy_lock: fix build for mingw

- Define SRWLOCK symbols missing in some mingw environments.

Closes https://github.com/curl/curl/pull/8997

3 years agotool_progress: avoid division by zero in parallel progress meter
Daniel Stenberg [Fri, 1 Jul 2022 22:02:04 +0000 (00:02 +0200)] 
tool_progress: avoid division by zero in parallel progress meter

Reported-by: Brian Carpenter
Fixes #9082
Closes #9083

3 years agohttp_aws_sigv4.c: remove two unusued includes
Daniel Stenberg [Fri, 1 Jul 2022 14:43:02 +0000 (16:43 +0200)] 
http_aws_sigv4.c: remove two unusued includes

Closes #9080

3 years ago.mailmap: additional edit
Daniel Stenberg [Fri, 1 Jul 2022 07:56:07 +0000 (09:56 +0200)] 
.mailmap: additional edit

Follow-up to 861e2a8aca6c7 so that Evgeny appears with the same in git
logs even when using old email.

3 years agoRELEASE-NOTES: synced
Daniel Stenberg [Fri, 1 Jul 2022 07:53:08 +0000 (09:53 +0200)] 
RELEASE-NOTES: synced

bumped to 7.84.1

3 years ago.mailmap: updated
Evgeny Grin (Karlson2k) [Thu, 30 Jun 2022 14:31:52 +0000 (17:31 +0300)] 
.mailmap: updated

3 years agoTHANKS: merged two entries for Evgeny Grin
Evgeny Grin (Karlson2k) [Thu, 30 Jun 2022 11:27:23 +0000 (14:27 +0300)] 
THANKS: merged two entries for Evgeny Grin

Also updated THANKS-filter file

Closes #9076

3 years agolib/curl_path.c: add ISC to license expression
Jilayne Lovejoy [Thu, 30 Jun 2022 17:01:49 +0000 (11:01 -0600)] 
lib/curl_path.c: add ISC to license expression

THe text of the ISC license is in this file, so the SPDX license
expression should be updated

Closes #9073

3 years agohyper: use wakers for curl pause/resume
Sean McArthur [Thu, 30 Jun 2022 00:45:32 +0000 (17:45 -0700)] 
hyper: use wakers for curl pause/resume

Closes #9070

3 years agoMakefile.m32: do not set the libcurl.rc debug flag [ci skip]
Viktor Szakats [Thu, 30 Jun 2022 08:14:29 +0000 (08:14 +0000)] 
Makefile.m32: do not set the libcurl.rc debug flag [ci skip]

Delete `-DDEBUGBUILD=0` windres option. This was likely meant to
disable VS_FF_DEBUG in FILEFLAGS, but any assigned value enabled
it instead. Delete this unnecessary option and thus sync up with
how CMake compiles libcurl.rc by default.

Reviewed-by: Jay Satiro
Closes #9069

3 years agocurl.h: CURLE_CONV_FAILED is obsoleted
Daniel Stenberg [Wed, 29 Jun 2022 08:42:04 +0000 (10:42 +0200)] 
curl.h: CURLE_CONV_FAILED is obsoleted

The last use was removed in 7.82.0. Updated some docs too to reflect the
current error code situation.

Closes #9067

3 years agocurl: output warning when a cookie is dropped due to size
Daniel Stenberg [Tue, 28 Jun 2022 15:15:24 +0000 (17:15 +0200)] 
curl: output warning when a cookie is dropped due to size

Dropped from the request, that is.

Closes #9064

3 years agocurl_mime_data.3: polish the wording
Daniel Stenberg [Tue, 28 Jun 2022 11:01:40 +0000 (13:01 +0200)] 
curl_mime_data.3: polish the wording

Closes #9063

3 years agoconfigure: check for the stdatomic.h header in configure
Daniel Stenberg [Tue, 28 Jun 2022 06:37:22 +0000 (08:37 +0200)] 
configure: check for the stdatomic.h header in configure

... and only set HAVE_ATOMIC if that header exists since we use
typedefes set in it.

Reported-by: Ryan Schmidt
Fixes #9059
Closes #9060