]> git.ipfire.org Git - thirdparty/curl.git/log
thirdparty/curl.git
3 years agourldata: use a curl_prot_t type for storing protocol bits
Daniel Stenberg [Mon, 12 Sep 2022 07:57:01 +0000 (09:57 +0200)] 
urldata: use a curl_prot_t type for storing protocol bits

This internal-use-only storage type can be bumped to a curl_off_t once
we need to use bit 32 as the previous 'unsigned int' can no longer hold
them all then.

The websocket protocols take bit 30 and 31 so they are the last ones
that fit within 32 bits - but cannot properly be exported through APIs
since those use *signed* 32 bit types (long) in places.

Closes #9481

3 years agoformdata: fix warning: 'CURLformoption' is promoted to 'int'
zhanghu [Thu, 22 Apr 2021 09:10:00 +0000 (17:10 +0800)] 
formdata: fix warning: 'CURLformoption' is promoted to 'int'

curl/lib/formdata.c: In function 'FormAdd':
curl/lib/formdata.c:249:31: warning: 'CURLformoption' is promoted to 'int' when passed through '...'
  249 |       option = va_arg(params, CURLformoption);
      |                               ^
curl/lib/formdata.c:249:31: note: (so you should pass 'int' not 'CURLformoption' to 'va_arg')
curl/lib/formdata.c:249:31: note: if this code is reached, the program will abort

Closes #9484

3 years agoCURLOPT_CONNECT_ONLY.3: for ws(s) as well
Daniel Stenberg [Mon, 12 Sep 2022 14:34:31 +0000 (16:34 +0200)] 
CURLOPT_CONNECT_ONLY.3: for ws(s) as well

and correct the version number for when that support comes. Even if it
is still experimental for WebSocket.

Closes #9487

3 years agotool_operate: avoid a few #ifdefs for disabled-libcurl builds
Daniel Stenberg [Mon, 12 Sep 2022 14:30:54 +0000 (16:30 +0200)] 
tool_operate: avoid a few #ifdefs for disabled-libcurl builds

By providing empty macros in the header file instead, the code gets
easier to read and yet is disabled on demand.

Closes #9486

3 years agoscripts: use `grep -E` instead of `egrep`
a1346054 [Mon, 12 Sep 2022 20:21:03 +0000 (20:21 +0000)] 
scripts: use `grep -E` instead of `egrep`

egrep is deprecated

Closes #9491

3 years agowolfSSL: fix session management bug.
Hayden Roche [Tue, 13 Sep 2022 01:14:14 +0000 (18:14 -0700)] 
wolfSSL: fix session management bug.

Prior to this commit, non-persistent pointers were being used to store
sessions.  When a WOLFSSL object was then freed, that freed the session
it owned, and thus invalidated the pointer held in curl's cache. This
commit makes it so we get a persistent (deep copied) session pointer
that we then add to the cache.  Accordingly, wolfssl_session_free, which
was previously a no-op, now needs to actually call SSL_SESSION_free.

This bug was discovered by a wolfSSL customer.

Closes #9492

3 years agodocs: use "WebSocket" in singular
Daniel Stenberg [Tue, 13 Sep 2022 07:17:53 +0000 (09:17 +0200)] 
docs: use "WebSocket" in singular

This is how the RFC calls the protocol. Also rename the file in docs/ to
WEBSOCKET.md in uppercase to match how we have done it for many other
protocol docs in similar fashion.

Add the WebSocket docs to the tarball.

Closes #9496

3 years agows: fix build without `USE_WEBSOCKETS`
Marcel Raad [Mon, 12 Sep 2022 08:22:42 +0000 (10:22 +0200)] 
ws: fix build without `USE_WEBSOCKETS`

The curl.h include is required unconditionally.

3 years agows: add missing curl.h include
Marcel Raad [Mon, 12 Sep 2022 08:11:56 +0000 (10:11 +0200)] 
ws: add missing curl.h include

A conflict between commits 664249d0952 and e5839f4ee70 broke the build.

3 years agows: fix an infof() call to use %uz for size_t output
Daniel Stenberg [Mon, 12 Sep 2022 07:29:16 +0000 (09:29 +0200)] 
ws: fix an infof() call to use %uz for size_t output

Detected by Coverity, CID 1514665.

Closes #9480

3 years agocurl_setup: include only system.h instead of curl.h
Marcel Raad [Wed, 7 Sep 2022 10:30:15 +0000 (12:30 +0200)] 
curl_setup: include only system.h instead of curl.h

As done before commit 9506d01ee50.

Ref: https://github.com/curl/curl/pull/9375#discussion_r957010158
Closes https://github.com/curl/curl/pull/9453

3 years agolib: add missing limits.h includes
Marcel Raad [Wed, 7 Sep 2022 14:11:42 +0000 (16:11 +0200)] 
lib: add missing limits.h includes

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

3 years agolib and tests: add missing curl.h includes
Marcel Raad [Wed, 7 Sep 2022 10:19:29 +0000 (12:19 +0200)] 
lib and tests: add missing curl.h includes

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

3 years agocurl_setup: include curl.h after platform setup headers
Marcel Raad [Wed, 7 Sep 2022 08:54:16 +0000 (10:54 +0200)] 
curl_setup: include curl.h after platform setup headers

The platform setup headers might set definitions required for the
includes in curl.h.

Ref: https://github.com/curl/curl/pull/9375#discussion_r956998269
Closes https://github.com/curl/curl/pull/9453

3 years agodocs: correct missing uppercase in Markdown files
Benjamin Loison [Sun, 11 Sep 2022 21:39:14 +0000 (23:39 +0200)] 
docs: correct missing uppercase in Markdown files

To detect these typos I used:

```
clear && grep -rn '\. [a-z]' . | uniq | grep -v '\. lib' | grep -v '[0-9]\. [a-z]' | grep -v '\.\. [a-z]' | grep -v '\. curl' | grep -v 'e.g. [a-z]' | grep -v 'eg. [a-z]' | grep -v '\etc. [a-z]' | grep -v 'i.e\. [a-z]' | grep --color=always '\. [a-z]' | grep '\.md'
```

Closes #9474

3 years agotool_setopt: use better English in --libcurl source comments
Daniel Stenberg [Sun, 11 Sep 2022 21:59:38 +0000 (23:59 +0200)] 
tool_setopt: use better English in --libcurl source comments

Like this:

  XYZ was set to an object pointer
  ABC was set to a function pointer

Closes #9475

3 years agosetopt: make protocol2num use a curl_off_t for the protocol bit
Daniel Stenberg [Sun, 11 Sep 2022 22:02:07 +0000 (00:02 +0200)] 
setopt: make protocol2num use a curl_off_t for the protocol bit

... since WSS does not fit within 32 bit.

Bug: https://github.com/curl/curl/pull/9467#issuecomment-1243014887
Closes #9476

3 years agoRELEASE-NOTES: synced
Daniel Stenberg [Sun, 11 Sep 2022 21:46:44 +0000 (23:46 +0200)] 
RELEASE-NOTES: synced

3 years agoconfigure: polish the grep -E message a bit further
Daniel Stenberg [Sun, 11 Sep 2022 13:08:08 +0000 (15:08 +0200)] 
configure: polish the grep -E message a bit further

Suggested-by: Emanuele Torre
Closes #9473

3 years agoGHA: add a gcc-11 -O3 build using OpenSSL
Daniel Stenberg [Thu, 8 Sep 2022 09:32:34 +0000 (11:32 +0200)] 
GHA: add a gcc-11 -O3 build using OpenSSL

Since -O3 might trigger other warnings

Closes #9454

3 years agocontent_encoding: use writer struct subclasses for different encodings
Patrick Monnerat [Fri, 9 Sep 2022 11:25:02 +0000 (13:25 +0200)] 
content_encoding: use writer struct subclasses for different encodings

The variable-sized encoding-specific storage of a struct contenc_writer
currently relies on void * alignment that may be insufficient with
regards to the specific storage fields, although having not caused any
problems yet.

In addition, gcc 11.3 issues a warning on access to fields of partially
allocated structures that can occur when the specific storage size is 0:

  content_encoding.c: In function ‘Curl_build_unencoding_stack’:
  content_encoding.c:980:21: warning: array subscript ‘struct contenc_writer[0]’ is partly outside array bounds of ‘unsigned char[16]’ [-Warray-bounds]
    980 |     writer->handler = handler;
        |     ~~~~~~~~~~~~~~~~^~~~~~~~~
  In file included from content_encoding.c:49:
  memdebug.h:115:29: note: referencing an object of size 16 allocated by ‘curl_dbg_calloc’
    115 | #define calloc(nbelem,size) curl_dbg_calloc(nbelem, size, __LINE__, __FILE__)
        |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  content_encoding.c:977:60: note: in expansion of macro ‘calloc’
    977 |   struct contenc_writer *writer = (struct contenc_writer *)calloc(1, sz);

To solve both these problems, the current commit replaces the
contenc_writer/params structure pairs by "subclasses" of struct
contenc_writer. These are structures that contain a contenc_writer at
offset 0. Proper field alignment is therefore handled by the compiler and
full structure allocation is performed, silencing the warnings.

Closes #9455

3 years agoconfigure: correct the wording when checking grep -E
Daniel Stenberg [Sat, 10 Sep 2022 22:10:26 +0000 (00:10 +0200)] 
configure: correct the wording when checking grep -E

The check first checks that grep -E works, and only as a fallback tries
to find and use egrep. egrep is deprecated.

This change only corrects the output wording, not the checks themselves.

Closes #9471

3 years agowebsockets: sync prototypes in docs with implementation [ci skip]
Viktor Szakats [Sat, 10 Sep 2022 21:36:49 +0000 (21:36 +0000)] 
websockets: sync prototypes in docs with implementation [ci skip]

Docs for the new send/recv functions synced with the committed versions
of these.

Closes #9470

3 years agosetopt: make protocols2num() work with websockets
Daniel Stenberg [Sat, 10 Sep 2022 15:13:44 +0000 (17:13 +0200)] 
setopt: make protocols2num() work with websockets

So that CURLOPT_PROTOCOLS_STR and CURLOPT_REDIR_PROTOCOLS_STR can
specify those as well.

Reported-by: Patrick Monnerat
Bug: https://curl.se/mail/lib-2022-09/0016.html
Closes #9467

3 years agocurl/websockets.h: remove leftover bad typedef
Daniel Stenberg [Sat, 10 Sep 2022 15:10:10 +0000 (17:10 +0200)] 
curl/websockets.h: remove leftover bad typedef

Just a leftover trace of a development thing that did not stay like
that.

Reported-by: Marc Hörsken
Fixes #9465
Cloes #9466

3 years agofix Cygwin/MSYS compilation
Orgad Shaneh [Fri, 5 Aug 2022 10:45:25 +0000 (13:45 +0300)] 
fix Cygwin/MSYS compilation

_getpid is Windows API. On Cygwin variants it should remain getpid.

Fixes #8220
Closes #9255

3 years agoGHA: prepare workflow merge by aligning structure again
Marc Hoersken [Thu, 1 Sep 2022 20:44:43 +0000 (22:44 +0200)] 
GHA: prepare workflow merge by aligning structure again

Closes #9413

3 years agodocs: the websockets symbols are added in 7.86.0
Daniel Stenberg [Fri, 9 Sep 2022 13:36:06 +0000 (15:36 +0200)] 
docs: the websockets symbols are added in 7.86.0

Nothing else

Closes #9459

3 years agotests/libtest/Makefile.inc: fixup merge conflict mistake
Daniel Stenberg [Fri, 9 Sep 2022 13:13:07 +0000 (15:13 +0200)] 
tests/libtest/Makefile.inc: fixup merge conflict mistake

3 years agoEXPERIMENTAL.md: add WebSockets
Daniel Stenberg [Fri, 9 Sep 2022 13:11:15 +0000 (15:11 +0200)] 
EXPERIMENTAL.md: add WebSockets

3 years agoappveyor: enable websockets
Daniel Stenberg [Fri, 9 Sep 2022 13:11:15 +0000 (15:11 +0200)] 
appveyor: enable websockets

3 years agocirrus: enable websockets in the windows builds
Daniel Stenberg [Fri, 9 Sep 2022 13:11:14 +0000 (15:11 +0200)] 
cirrus: enable websockets in the windows builds

3 years agoGHA: add websockets to macos, openssl3 and hyper builds
Daniel Stenberg [Fri, 9 Sep 2022 13:11:14 +0000 (15:11 +0200)] 
GHA: add websockets to macos, openssl3 and hyper builds

3 years agotests: add websockets tests
Daniel Stenberg [Fri, 9 Sep 2022 13:11:14 +0000 (15:11 +0200)] 
tests: add websockets tests

 - add websockets support to sws
 - 2300: first very basic websockets test
 - 2301: first libcurl test for ws (not working yet)
 - 2302: use the ws callback
 - 2303: test refused upgrade

3 years agocurl_ws_meta: initial implementation
Daniel Stenberg [Fri, 9 Sep 2022 13:11:14 +0000 (15:11 +0200)] 
curl_ws_meta: initial implementation

3 years agocurl_ws_meta.3: added docs
Daniel Stenberg [Fri, 9 Sep 2022 13:11:14 +0000 (15:11 +0200)] 
curl_ws_meta.3: added docs

3 years agows: initial websockets support
Daniel Stenberg [Fri, 9 Sep 2022 13:11:14 +0000 (15:11 +0200)] 
ws: initial websockets support

Closes #8995

3 years agoversion: add ws + wss
Daniel Stenberg [Fri, 9 Sep 2022 13:11:14 +0000 (15:11 +0200)] 
version: add ws + wss

3 years agolibtest/lib1560: test basic websocket URL parsing
Daniel Stenberg [Fri, 9 Sep 2022 13:11:14 +0000 (15:11 +0200)] 
libtest/lib1560: test basic websocket URL parsing

3 years agoconfigure: add --enable-websockets
Daniel Stenberg [Fri, 9 Sep 2022 13:11:13 +0000 (15:11 +0200)] 
configure: add --enable-websockets

3 years agodocs/WebSockets.md: docs
Daniel Stenberg [Fri, 9 Sep 2022 13:11:13 +0000 (15:11 +0200)] 
docs/WebSockets.md: docs

3 years agotest415: verify Content-Length parser with control code + negative value
Daniel Stenberg [Fri, 9 Sep 2022 11:01:46 +0000 (13:01 +0200)] 
test415: verify Content-Length parser with control code + negative value

3 years agostrtoofft: after space, there cannot be a control code
Daniel Stenberg [Fri, 9 Sep 2022 10:46:01 +0000 (12:46 +0200)] 
strtoofft: after space, there cannot be a control code

With the change from ISSPACE() to ISBLANK() this function no longer
deals with (ignores) control codes the same way, which could lead to
this function returning unexpected values like in the case of
"Content-Length: \r-12354".

Follow-up to 6f9fb7ec2d7cb389a0da5

Detected by OSS-fuzz
Bug: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=51140
Assisted-by: Max Dymond
Closes #9458

3 years agoheaders: reset the requests counter at transfer start
Daniel Stenberg [Wed, 7 Sep 2022 07:51:51 +0000 (09:51 +0200)] 
headers: reset the requests counter at transfer start

If not, reusing an easy handle to do a subsequent transfer would
continue the counter from the previous invoke, which then would make use
of the header API difficult/impossible as the request counter
mismatched.

Add libtest 1947 to verify.

Reported-by: Andrew Lambert
Fixes #9424
Closes #9447

3 years agoheader: define public API functions as extern c
Jay Satiro [Wed, 7 Sep 2022 07:07:28 +0000 (03:07 -0400)] 
header: define public API functions as extern c

Prior to this change linker errors would occur if curl_easy_header or
curl_easy_nextheader was called from a C++ unit.

Bug: https://github.com/curl/curl/issues/9424#issuecomment-1238818007
Reported-by: Andrew Lambert
Closes https://github.com/curl/curl/pull/9446

3 years agohttp2: make nghttp2 less picky about field whitespace
Daniel Stenberg [Wed, 7 Sep 2022 13:41:03 +0000 (15:41 +0200)] 
http2: make nghttp2 less picky about field whitespace

In nghttp2 1.49.0 it returns error on leading and trailing whitespace in
header fields according to language in the recently shipped RFC 9113.

nghttp2 1.50.0 introduces an option to switch off this strict check and
this change enables this option by default which should make curl behave
more similar to how it did with nghttp2 1.48.0 and earlier.

We might want to consider making this an option in the future.

Closes #9448

3 years agoRELEASE-NOTES: synced
Daniel Stenberg [Wed, 7 Sep 2022 12:18:28 +0000 (14:18 +0200)] 
RELEASE-NOTES: synced

And bump to 7.86.0 for the pending next release

3 years agoftp: ignore a 550 response to MDTM
Michael Heimpold [Wed, 24 Aug 2022 16:58:02 +0000 (18:58 +0200)] 
ftp: ignore a 550 response to MDTM

The 550 is overused as a return code for multiple error case, e.g.
file not found and/or insufficient permissions to access the file.

So we cannot fail hard in this case.

Adjust test 511 since we now fail later.
Add new test 3027 which check that when MDTM failed, but the file could
actually be retrieved, that in this case no filetime is provided.

Reported-by: Michael Heimpold
Fixes #9357
Closes #9387

3 years agourlapi: leaner with fewer allocs
Daniel Stenberg [Thu, 1 Sep 2022 08:16:24 +0000 (10:16 +0200)] 
urlapi: leaner with fewer allocs

Slightly faster with more robust code. Uses fewer and smaller mallocs.

- remove two fields from the URL handle struct
- reduce copies and allocs
- use dynbuf buffers more instead of custom malloc + copies
- uses dynbuf to build the host name in reduces serial alloc+free within
  the same function.
- move dedotdotify into urlapi.c and make it static, not strdup the input
  and optimize it by checking for . and / before using strncmp
- remove a few strlen() calls
- add Curl_dyn_setlen() that can "trim" an existing dynbuf

Closes #9408

3 years agosetup-win32: no longer define UNICODE/_UNICODE implicitly
Jay Satiro [Mon, 29 Aug 2022 07:59:23 +0000 (03:59 -0400)] 
setup-win32: no longer define UNICODE/_UNICODE implicitly

- If UNICODE or _UNICODE is defined but the other isn't then error
  instead of implicitly defining it.

As Marcel pointed out it is too late at this point to make such a define
because Windows headers may already be included, so likely it never
worked. We never noticed because build systems that can make Windows
Unicode builds always define both. If one is defined but not the other
then something went wrong during the build configuration.

Bug: https://github.com/curl/curl/pull/9375#discussion_r956545272
Reported-by: Marcel Raad
Closes https://github.com/curl/curl/pull/9384

3 years agotests: fix tag syntax errors in test files
Dan Fandrich [Tue, 6 Sep 2022 18:27:06 +0000 (11:27 -0700)] 
tests: fix tag syntax errors in test files

3 years agolib: add required Win32 setup definitions in setup-win32.h
Marc Hoersken [Fri, 26 Aug 2022 19:16:47 +0000 (21:16 +0200)] 
lib: add required Win32 setup definitions in setup-win32.h

Assisted-by: Jay Satiro
Reviewed-by: Marcel Raad
Follow up to #9312
Closes #9375

3 years agopingpong: extend the response reading error with errno
Daniel Stenberg [Tue, 6 Sep 2022 13:51:13 +0000 (15:51 +0200)] 
pingpong: extend the response reading error with errno

To help diagnosing the cause of the problem.

See #9380
Closes #9443

3 years agocurl-compilers.m4: use -O2 as default optimize for clang
Daniel Stenberg [Tue, 6 Sep 2022 14:39:42 +0000 (16:39 +0200)] 
curl-compilers.m4: use -O2 as default optimize for clang

Not -Os

Closes #9444

3 years agotool_operate: fix msnprintfing the error message
Daniel Stenberg [Tue, 6 Sep 2022 09:05:47 +0000 (11:05 +0200)] 
tool_operate: fix msnprintfing the error message

Follow-up to 7be53774c41c59b47075fba

Coverity CID 1513717 pointed out that we cannot use sizeof() on the
error buffer anymore.

Closes #9440

3 years agocurl_ctype: add space around <= operator in ISSPACE macro
Emanuele Torre [Tue, 6 Sep 2022 10:32:49 +0000 (12:32 +0200)] 
curl_ctype: add space around <= operator in ISSPACE macro

Follow-up to f65f750

Closes #9441

3 years agoCURLOPT_PROXY_SSLCERT_BLOB.3: this is for HTTPS proxies
Daniel Stenberg [Tue, 6 Sep 2022 06:27:50 +0000 (08:27 +0200)] 
CURLOPT_PROXY_SSLCERT_BLOB.3: this is for HTTPS proxies

The 'protocols' listed were previously wrong.

Reported-by: ProceduralMan on github
Fixes #9434
Closes #9435

3 years agocurl_ctype: convert to macros-only
Daniel Stenberg [Mon, 5 Sep 2022 10:15:21 +0000 (12:15 +0200)] 
curl_ctype: convert to macros-only

This no longer provide functions, only macros. Runs faster and produces
smaller output.

The biggest precaution this change brings:

DO NOT use post/pre-increments when passing arguments to the macros.

Closes #9429

3 years agomisc: ISSPACE() => ISBLANK()
Daniel Stenberg [Mon, 5 Sep 2022 21:21:15 +0000 (23:21 +0200)] 
misc: ISSPACE() => ISBLANK()

Instances of ISSPACE() use that should rather use ISBLANK(). I think
somewhat carelessly used because it sounds as if it checks for space or
whitespace, but also includes %0a to %0d.

For parsing purposes, we should only accept what we must and not be
overly liberal. It leads to surprises and surprises lead to bad things.

Closes #9432

3 years agoctype: remove all use of <ctype.h>, use our own versions
Daniel Stenberg [Mon, 5 Sep 2022 22:17:36 +0000 (00:17 +0200)] 
ctype: remove all use of <ctype.h>, use our own versions

Except in the test servers.

Closes #9433

3 years agocmake: skip superfluous hex2dec conversion using math expr
Marc Hoersken [Thu, 1 Sep 2022 17:50:29 +0000 (19:50 +0200)] 
cmake: skip superfluous hex2dec conversion using math expr

CMake seems to be able to compare two hex values just fine.
Also make sure CURL_TARGET_WINDOWS_VERSION is respected.

Assisted-by: Marcel Raad
Reviewed-by: Viktor Szakats
Reported-by: Keitagit-kun on github
Follow up to #9312
Fixes #9406
Closes #9411

3 years agocurl_easy_pause.3: unpausing is as fast as possible
Daniel Stenberg [Mon, 5 Sep 2022 13:52:28 +0000 (15:52 +0200)] 
curl_easy_pause.3: unpausing is as fast as possible

Reported-by: ssdbest on github
Fixes #9410
Closes #9430

3 years agoCURLOPT_DNS_INTERFACE.3: mention it works for almost all protocols
Daniel Stenberg [Mon, 5 Sep 2022 05:43:54 +0000 (07:43 +0200)] 
CURLOPT_DNS_INTERFACE.3: mention it works for almost all protocols

Except file.

Reported-by: ProceduralMan on github
Fixes #9427
Closes #9428

3 years agoNPN: remove support for and use of
Daniel Stenberg [Thu, 1 Sep 2022 07:23:22 +0000 (09:23 +0200)] 
NPN: remove support for and use of

Next Protocol Negotiation is a TLS extension that was created and used
for agreeing to use the SPDY protocol (the precursor to HTTP/2) for
HTTPS. In the early days of HTTP/2, before the spec was finalized and
shipped, the protocol could be enabled using this extension with some
servers.

curl supports the NPN extension with some TLS backends since then, with
a command line option `--npn` and in libcurl with
`CURLOPT_SSL_ENABLE_NPN`.

HTTP/2 proper is made to use the ALPN (Application-Layer Protocol
Negotiation) extension and the NPN extension has no purposes
anymore. The HTTP/2 spec was published in May 2015.

Today, use of NPN in the wild should be extremely rare and most likely
totally extinct. Chrome removed NPN support in Chrome 51, shipped in
June 2016. Removed in Firefox 53, April 2017.

Closes #9307

3 years agoRELEASE-NOTES: synced
Daniel Stenberg [Sun, 4 Sep 2022 21:13:34 +0000 (23:13 +0200)] 
RELEASE-NOTES: synced

and bump the tentative next release version to 7.85.1

3 years agoconfigure: fail if '--without-ssl' + explicit parameter for an ssl lib
Samuel Henrique [Thu, 1 Sep 2022 21:32:49 +0000 (22:32 +0100)] 
configure: fail if '--without-ssl' + explicit parameter for an ssl lib

A side effect of a previous change to configure (576e507c78bdd2ec88)
exposed a non-critical issue that can happen if configure is called with
both '--without-ssl' and some parameter setting the use of a ssl library
(e.g. --with-gnutls). The configure script would end up assuming this is
a MultiSSL build, due to the way the case statement is written.

I have changed the order of the variables in the string concatenation
for the case statement and also tweaked the options so that
--without-ssl never turns the build into a MultiSSL one and also clearly
stating that there are conflicting parameters if the user sets it like
described above.

Closes #9414

3 years agotests/certs/scripts: insert standard curl source headers
Daniel Stenberg [Fri, 2 Sep 2022 12:24:25 +0000 (14:24 +0200)] 
tests/certs/scripts: insert standard curl source headers

... including the SPDX-License-Identifier.

These omissions were not detected by the RUEUSE CI job nor the copyright.pl
scanners because we have a general wildcard in .reuse/dep5 for
"tests/certs/*".

Reported-by: Samuel Henrique
Fixes #9417
Closes #9420

3 years agodocs: remove mentions of deprecated '--without-openssl' config parameter
Samuel Henrique [Thu, 1 Sep 2022 21:39:34 +0000 (22:39 +0100)] 
docs: remove mentions of deprecated '--without-openssl' config parameter

Closes #9415

3 years agomanpages: Fix spelling of "allows to" -> "allows one to"
Samuel Henrique [Fri, 2 Sep 2022 11:36:43 +0000 (12:36 +0100)] 
manpages: Fix spelling of "allows to" -> "allows one to"

 References:
 https://salsa.debian.org/lintian/lintian/-/blob/master/tags/t/typo-in-manual-page.tag
 https://english.stackexchange.com/questions/60271/grammatical-complements-for-allow/60285#60285

Closes #9419

3 years agoCURLOPT_WILDCARDMATCH.3: Fix backslash escaping under single quotes
Samuel Henrique [Fri, 2 Sep 2022 11:02:02 +0000 (12:02 +0100)] 
CURLOPT_WILDCARDMATCH.3: Fix backslash escaping under single quotes

 Lintian (on Debian) has been complaining about this for a while but
 I didn't bother initially as the groff parser that we use is not
 affected by this.

 But I have now noticed that the online manpage is affected by it:
 https://curl.se/libcurl/c/CURLOPT_WILDCARDMATCH.html

 (I'm using double quotes for quoting-only down below)

 The section that should be parsed as "'\'" ends up being parsed as
 "'´".

 This is due to roffit not parsing "'\\'" correctly, which is fine
 as the "correct" way of writing "'\'" is "'\e'" instead.

 Note that this fix is not enough to fix the online manpage at
 curl's website, as roffit seems to parse it wrongly either way.

 My intent is to at least fix the manpage so that roffit can
 be changed to parse "'\e'" correctly (although I suggest making
 roffit parse both ways correctly, since that's what groff does).

 More details at:
 https://bugs.debian.org/966803
 https://salsa.debian.org/lintian/lintian/-/blob/930b18e4b28b7540253f458ef42a884cca7965c3/tags/a/acute-accent-in-manual-page.tag

Closes #9418

3 years agotool_operate: reduce errorbuffer allocs
Daniel Stenberg [Tue, 30 Aug 2022 14:44:12 +0000 (16:44 +0200)] 
tool_operate: reduce errorbuffer allocs

- parallel transfers: only alloc and keep errorbuffers in memory for
  actual "live" transfers and not for the ones in the pending queue

- serial transfers: reuse the same fixed buffer for all transfers, not
  allocated at all.

Closes #9394

3 years agomisc: spelling fixes
Viktor Szakats [Wed, 31 Aug 2022 14:31:01 +0000 (14:31 +0000)] 
misc: spelling fixes

Found using codespell 2.2.1.

Also delete the redundant protocol designator from an archive.org URL.

Reviewed-by: Daniel Stenberg
Closes #9403

3 years agotool_progress: remove 'Qd' from the parallel progress bar
Daniel Stenberg [Wed, 31 Aug 2022 13:57:46 +0000 (15:57 +0200)] 
tool_progress: remove 'Qd' from the parallel progress bar

The "queued" value is no longer showing anything useful to the user. It
is an internal number of transfers waiting at that moment.

Closes #9389

3 years agotool_operate: prevent over-queuing in parallel mode
Daniel Stenberg [Wed, 31 Aug 2022 13:57:46 +0000 (15:57 +0200)] 
tool_operate: prevent over-queuing in parallel mode

When doing a huge amount of parallel transfers, we must not add them to
the per_transfer list frivolously since they all use memory after all.
This was previous done without really considering millions or billions
of transfers. Massive parallelism would use a lot of memory for no good
purpose.

The queue is now limited to twice the paralleism number.

This makes the 'Qd' value in the parallel progress meter mostly useless
for users, but works for now for us as a debug display.

Reported-by: justchen1369 on github
Fixes #8933
Closes #9389

3 years agocmake: fix original MinGW builds
Viktor Szakats [Wed, 31 Aug 2022 11:57:24 +0000 (11:57 +0000)] 
cmake: fix original MinGW builds

1. Re-enable `HAVE_GETADDRINFO` detection on Windows

   Commit d08ee3c83d6bd416aef62ff844c98e47c4682429 (in 2013) added logic
   that automatically assumed `getaddrinfo()` to be present for builds
   with IPv6 enabled. As it turns out, certain toolchains (e.g. original
   MinGW) by default target older Windows versions, and thus do not
   support `getaddrinfo()` out of the box. The issue was masked for
   a while by CMake builds forcing a newer Windows version, but that
   logic got deleted in commit 8ba22ffb2030ed91312fc8634e29516cdf0a9761.
   Since then, some CI builds started failing due to IPv6 enabled,
   `HAVE_GETADDRINFO` set, but `getaddrinfo()` in fact missing.

   It also turns out that IPv6 works without `getaddrinfo()` since commit
   67a08dca27a6a07b36c7f97252e284ca957ff1a5 (from 2019, via #4662). So,
   to resolve all this, we can now revert the initial commit, thus
   restoring `getaddrinfo()` detection and support IPv6 regardless of its
   outcome.

Reported-by: Daniel Stenberg
2. Omit `bcrypt` with original MinGW

   Original (aka legacy/old) MinGW versions do not support `bcrypt`
   (introduced with Vista). We already have logic to handle that in
   `lib/rand.c` and autotools builds, where we do not call the
   unsupported API and do not link `bcrypt`, respectively, when using
   original MinGW.

   This patch ports that logic to CMake, fixing the link error:
   `c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: cannot find -lbcrypt`

   Ref: https://ci.appveyor.com/project/curlorg/curl/builds/44624888/job/40vle84cn4vle7s0#L508
   Regression since 76172511e7adcf720f4c77bd91f49278300ec97e

Fixes #9214
Fixes #9393
Fixes #9395
Closes #9396

3 years agoRELEASE-NOTES: synced curl-7_85_0
Daniel Stenberg [Wed, 31 Aug 2022 06:09:21 +0000 (08:09 +0200)] 
RELEASE-NOTES: synced

curl 7.85.0 release

3 years agoTHANKS: add contributors from the 7.85.0 release
Daniel Stenberg [Wed, 31 Aug 2022 06:09:21 +0000 (08:09 +0200)] 
THANKS: add contributors from the 7.85.0 release

3 years agogetparam: correctly clean args
Daniel Stenberg [Tue, 30 Aug 2022 21:40:19 +0000 (23:40 +0200)] 
getparam: correctly clean args

Follow-up to bf7e887b2442783ab52

The previous fix for #9128 was incomplete and caused #9397.

Fixes #9397
Closes #9399

3 years agozuul: remove the clang-tidy job
Daniel Stenberg [Tue, 30 Aug 2022 11:24:28 +0000 (13:24 +0200)] 
zuul: remove the clang-tidy job

Turns out we don't see the warnings, but the warnings right now are
plain ridiculous and unhelpful so we can just as well just kill this
job.

Closes #9390

3 years agocmake: set feature PSL if present
Daniel Stenberg [Tue, 30 Aug 2022 11:57:19 +0000 (13:57 +0200)] 
cmake: set feature PSL if present

... make test 1014 pass when libpsl is used.

Closes #9391

3 years agolib530: simplify realloc failure exit path
Daniel Stenberg [Tue, 30 Aug 2022 11:46:03 +0000 (13:46 +0200)] 
lib530: simplify realloc failure exit path

To make code analyzers happier

Closes #9392

3 years agotests: add tests for netrc login/password combinations
Orgad Shaneh [Fri, 5 Aug 2022 13:50:34 +0000 (16:50 +0300)] 
tests: add tests for netrc login/password combinations

Covers the following PRs:

- #9066
- #9247
- #9248

Closes #9256

3 years agourl: really use the user provided in the url when netrc entry exists
Orgad Shaneh [Wed, 3 Aug 2022 16:13:07 +0000 (19:13 +0300)] 
url: really use the user provided in the url when netrc entry exists

If the user is specified as part of the URL, and the same user exists
in .netrc, Authorization header was not sent at all.

The user and password fields were assigned in conn->user and password
but the user was not assigned to data->state.aptr, which is the field
that is used in output_auth_headers and friends.

Fix by assigning the user also to aptr.

Amends commit d1237ac906ae7e3cd7a22c3a2d3a135a97edfbf5.

Fixes #9243

3 years agonetrc: Use the password from lines without login
Orgad Shaneh [Thu, 4 Aug 2022 20:41:26 +0000 (23:41 +0300)] 
netrc: Use the password from lines without login

If netrc entry has password with empty login, use it for any username.

Example:
.netrc:
machine example.com password 123456

curl -vn http://user@example.com/

Fix it by initializing state_our_login to TRUE, and reset it only when
finding an entry with the same host and different login.

Closes #9248

3 years agourl: treat missing usernames in netrc as empty
Jay Satiro [Wed, 29 Jun 2022 07:43:56 +0000 (03:43 -0400)] 
url: treat missing usernames in netrc as empty

- If, after parsing netrc, there is a password with no username then
  set a blank username.

This used to be the case prior to 7d600ad (precedes 7.82). Note
parseurlandfillconn already does the same thing for URLs.

Reported-by: Raivis <standsed@users.noreply.github.com>
Testing-by: Domen Kožar
Fixes https://github.com/curl/curl/issues/8653
Closes #9334
Closes #9066

3 years agotest8: verify that "ctrl-byte cookies" are ignored
Daniel Stenberg [Sun, 28 Aug 2022 22:09:17 +0000 (00:09 +0200)] 
test8: verify that "ctrl-byte cookies" are ignored

3 years agocookie: reject cookies with "control bytes"
Daniel Stenberg [Sun, 28 Aug 2022 22:09:17 +0000 (00:09 +0200)] 
cookie: reject cookies with "control bytes"

Rejects 0x01 - 0x1f (except 0x09) plus 0x7f

Reported-by: Axel Chong
Bug: https://curl.se/docs/CVE-2022-35252.html

CVE-2022-35252

Closes #9381

3 years agolibssh: ignore deprecation warnings
Daniel Stenberg [Mon, 29 Aug 2022 07:17:54 +0000 (09:17 +0200)] 
libssh: ignore deprecation warnings

libssh 0.10.0 marks all SCP functions as "deprecated" which causes
compiler warnings and errors in our CI jobs and elsewhere. Ignore
deprecation warnings if 0.10.0 or later is found in the build.

If they actually remove the functions at a later point, then someone can
deal with that pain and functionality break then.

Fixes #9382
Closes #9383

3 years agoRevert "schannel: when importing PFX, disable key persistence"
Daniel Stenberg [Mon, 29 Aug 2022 06:16:16 +0000 (08:16 +0200)] 
Revert "schannel: when importing PFX, disable key persistence"

This reverts commit 70d010d285315e5f1cad6bdb4953e167b069b692.

Due to further reports in #9300 that indicate this commit might
introduce problems.

3 years agomulti: use larger dns hash table for multi interface
Daniel Stenberg [Sat, 27 Aug 2022 12:48:13 +0000 (14:48 +0200)] 
multi: use larger dns hash table for multi interface

Have curl_multi_init() use a much larger DNS hash table than used for
the easy interface to scale and perform better when used with _many_
host names.

curl_share_init() sets an in-between size.

Inspired-by: Ivan Tsybulin
See #9340
Closes #9376

3 years agoCI/runtests.pl: add param for dedicated curl to talk to APIs
Marc Hoersken [Wed, 24 Aug 2022 19:46:25 +0000 (21:46 +0200)] 
CI/runtests.pl: add param for dedicated curl to talk to APIs

This should make it possible to also report test failures
if our freshly build curl binary is not fully functional.

Reviewed-by: Daniel Stenberg
Closes #9360

3 years agoopenssl: add cert path in error message
Jacob Tolar [Mon, 22 Aug 2022 22:20:16 +0000 (17:20 -0500)] 
openssl: add cert path in error message

Closes #9349

3 years agocert.d: clarify that escape character works for file paths
Jacob Tolar [Mon, 22 Aug 2022 22:18:59 +0000 (17:18 -0500)] 
cert.d: clarify that escape character works for file paths

Closes #9349

3 years agogha: move over ngtcp2-gnutls CI job from zuul
Daniel Stenberg [Wed, 17 Aug 2022 12:07:44 +0000 (14:07 +0200)] 
gha: move over ngtcp2-gnutls CI job from zuul

Closes #9331

3 years agocmake: add detection of threadsafe feature
Marc Hoersken [Sun, 14 Aug 2022 19:05:40 +0000 (19:05 +0000)] 
cmake: add detection of threadsafe feature

Avoids failing test 1014 by replicating configure checks
for HAVE_ATOMIC and _WIN32_WINNT with custom CMake tests.

Reviewed-by: Marcel Raad
Follow up to #8680
Closes #9312

3 years agoRELEASE-NOTES: synced
Daniel Stenberg [Fri, 26 Aug 2022 14:23:20 +0000 (16:23 +0200)] 
RELEASE-NOTES: synced

3 years agoCI/azure: align torture shallowness with GHA
Marc Hoersken [Thu, 25 Aug 2022 21:52:34 +0000 (23:52 +0200)] 
CI/azure: align torture shallowness with GHA

There 25 is used with FTP tests skipped, and 20 for FTP tests.
This should make torture tests stay within the 60min timeout.

Reviewed-by: Daniel Stenberg
Closes #9371

3 years agomulti_wait: fix and improve Curl_poll error handling on Windows
Marc Hoersken [Thu, 25 Aug 2022 22:06:34 +0000 (00:06 +0200)] 
multi_wait: fix and improve Curl_poll error handling on Windows

First check for errors and return CURLM_UNRECOVERABLE_POLL
before moving forward and waiting on socket readiness events.

Reviewed-by: Jay Satiro
Reviewed-by: Marcel Raad
Reported-by: Daniel Stenberg
Ref: #9361

Follow up to #8961
Closes #9372

3 years agomulti_wait: fix skipping to populate revents for extra_fds
Marc Hoersken [Mon, 25 Jul 2022 20:29:27 +0000 (22:29 +0200)] 
multi_wait: fix skipping to populate revents for extra_fds

On Windows revents was not populated for extra_fds if
multi_wait had to wait due to the Curl_poll pre-check
not signalling any readiness. This commit fixes that.

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

3 years agoCI/appveyor: disable TLS in msys2-native autotools builds
Marc Hoersken [Thu, 25 Aug 2022 19:20:43 +0000 (21:20 +0200)] 
CI/appveyor: disable TLS in msys2-native autotools builds

Schannel cannot be used from msys2-native Linux-emulated builds.

Reviewed-by: Marcel Raad
Reviewed-by: Daniel Stenberg
Follow up to #9367
Closes #9370