]> git.ipfire.org Git - thirdparty/curl.git/log
thirdparty/curl.git
4 years agoCI/azure: replace python-impacket with python3-impacket 6678/head
Marc Hoersken [Mon, 1 Mar 2021 20:37:25 +0000 (21:37 +0100)] 
CI/azure: replace python-impacket with python3-impacket

As of this month Azure DevOps uses Ubuntu 20.04 LTS which
no longer supports Python 2 and instead ships Python 3.

Closes #6678

4 years agoruntests.pl: kill processes locking test log files
Marc Hoersken [Sun, 28 Feb 2021 21:06:17 +0000 (22:06 +0100)] 
runtests.pl: kill processes locking test log files

Introduce a new runtests.pl command option: -rm

For now only required and implemented for Windows.
Ignore stunnel logs due to long running processes.

Requires Sysinternals handle[64].exe to be on PATH.

Reviewed-by: Jay Satiro
Ref: #6058
Closes #6179

4 years agopathhelp.pm: fix use of pwd -L in Msys environment
Marc Hoersken [Wed, 11 Nov 2020 20:20:20 +0000 (21:20 +0100)] 
pathhelp.pm: fix use of pwd -L in Msys environment

While Msys2 has a pwd binary which supports -L,
Msys1 only has a shell built-in with that feature.

Reviewed-by: Jay Satiro
Part of #6179

4 years agoldap: use correct memory free function
Daniel Gustafsson [Mon, 1 Mar 2021 08:31:33 +0000 (09:31 +0100)] 
ldap: use correct memory free function

unescaped is coming from Curl_urldecode and not a unicode conversion
function, so reclaiming its memory should be performed with a normal
call to free rather than curlx_unicodefree.  In reality, this is the
same thing as curlx_unicodefree is implemented as a call to free but
that's not guaranteed to always hold.  Using the curlx macro present
issues with memory debugging as well.

Closes #6671
Reviewed-by: Jay Satiro <raysatiro@yahoo.com>
Reviewed-by: Daniel Stenberg <daniel@haxx.se>
4 years agourl: fix typo in comment
Daniel Gustafsson [Sun, 28 Feb 2021 20:13:26 +0000 (21:13 +0100)] 
url: fix typo in comment

Correct a small typo which snuck in with a304051620.

4 years agotool_help: Increase space between option and description
Jay Satiro [Sat, 27 Feb 2021 23:08:53 +0000 (18:08 -0500)] 
tool_help: Increase space between option and description

- Increase the minimum number of spaces between the option and the
  description from 1 to 2.

Before:
~~~
 -u, --user <user:password> Server user and password
 -A, --user-agent <name> Send User-Agent <name> to server
 -v, --verbose       Make the operation more talkative
 -V, --version       Show version number and quit
 -w, --write-out <format> Use output FORMAT after completion
     --xattr         Store metadata in extended file attributes
~~~

After:
~~~
 -u, --user <user:password>  Server user and password
 -A, --user-agent <name>  Send User-Agent <name> to server
 -v, --verbose       Make the operation more talkative
 -V, --version       Show version number and quit
 -w, --write-out <format>  Use output FORMAT after completion
     --xattr         Store metadata in extended file attributes
~~~

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

4 years agocurl: set CURLOPT_NEW_FILE_PERMS if requested
Daniel Stenberg [Fri, 26 Feb 2021 10:18:09 +0000 (11:18 +0100)] 
curl: set CURLOPT_NEW_FILE_PERMS if requested

The --create-file-mode code logic accepted the value but never actually
passed it on to libcurl!

Follow-up to a7696c73436f (shipped in 7.75.0)
Reported-by: Johannes Lesr
Fixes #6657
Closes #6666

4 years agotool_operate: check argc before accessing argv[1]
Daniel Stenberg [Fri, 26 Feb 2021 14:00:51 +0000 (15:00 +0100)] 
tool_operate: check argc before accessing argv[1]

Follow-up to 09363500b
Reported-by: Emil Engler
Reviewed-by: Daniel Gustafsson
Closes #6668

4 years agoopenssl: remove get_ssl_version_txt in favor of SSL_get_version
Jean-Philippe Menil [Fri, 26 Feb 2021 08:10:18 +0000 (09:10 +0100)] 
openssl: remove get_ssl_version_txt in favor of SSL_get_version

openssl: use SSL_get_version to get connection protocol

Replace our bespoke get_ssl_version_txt in favor of SSL_get_version.
We can get rid of few lines of code, since SSL_get_version achieve
the exact same thing

Closes #6665
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Signed-off-by: Jean-Philippe Menil <jpmenil@gmail.com>
4 years agognutls: Fix nettle discovery
Daniel Gustafsson [Thu, 25 Feb 2021 17:20:33 +0000 (18:20 +0100)] 
gnutls: Fix nettle discovery

Commit e06fa7462ac258c removed support for libgcrypt leaving only
support for nettle which has been the default crypto library in
GnuTLS for a long time. There were however a few conditionals on
USE_GNUTLS_NETTLE which cause compilation errors in the metalink
code (as it used the gcrypt fallback instead as a result). See the
below autobuild for an example of the error:

  https://curl.se/dev/log.cgi?id=20210225123226-30704#prob1

This removes all uses of USE_GNUTLS_NETTLE and also removes the
gcrypt support from the metalink code while at it.

Closes #6656
Reviewed-by: Daniel Stenberg <daniel@haxx.se>
4 years agocookies: Support multiple -b parameters
Daniel Gustafsson [Thu, 25 Feb 2021 17:12:28 +0000 (18:12 +0100)] 
cookies: Support multiple -b parameters

Previously only a single -b cookie parameter was supported with the last
one winning.  This adds support for supplying multiple -b params to have
them serialized semicolon separated.  Both cookiefiles and cookies can be
entered multiple times.

Closes #6649
Reviewed-by: Daniel Stenberg <daniel@haxx.se>
4 years agobuild: remove all traces of USE_BLOCKING_SOCKETS
Daniel Stenberg [Thu, 25 Feb 2021 11:45:21 +0000 (12:45 +0100)] 
build: remove all traces of USE_BLOCKING_SOCKETS

libcurl doesn't behave properly with the define set

Closes #6655

4 years agoRELEASE-NOTES: synced
Daniel Stenberg [Thu, 25 Feb 2021 10:39:44 +0000 (11:39 +0100)] 
RELEASE-NOTES: synced

4 years agodocs: Fix typos
Daniel Gustafsson [Thu, 25 Feb 2021 08:28:00 +0000 (09:28 +0100)] 
docs: Fix typos

Random typos spotted when skimming docs.

4 years agocookies: Use named parameters in header prototypes
Daniel Gustafsson [Tue, 23 Feb 2021 21:00:02 +0000 (22:00 +0100)] 
cookies: Use named parameters in header prototypes

Align header with project style of using named parameters in the
function prototypes to aid readability and self-documentation.

Closes #6653
Reviewed-by: Daniel Stenberg <daniel@haxx.se>
4 years agourldata: make 'actions[]' use unsigned char instead of int
Daniel Stenberg [Wed, 24 Feb 2021 07:15:17 +0000 (08:15 +0100)] 
urldata: make 'actions[]' use unsigned char instead of int

... as it only needs a few bits per index anyway.

Reviewed-by: Daniel Gustafsson
Closes #6648

4 years agoconfigure: fail if --with-quiche is used and quiche isn't found
Daniel Stenberg [Wed, 24 Feb 2021 10:26:52 +0000 (11:26 +0100)] 
configure: fail if --with-quiche is used and quiche isn't found

Closes #6652

4 years agocmake: use CMAKE_INSTALL_INCLUDEDIR indirection
Gregor Jasny [Tue, 12 Jan 2021 13:11:07 +0000 (14:11 +0100)] 
cmake: use CMAKE_INSTALL_INCLUDEDIR indirection

Reviewed-by: Sergei Nikulov
Closes #6440

4 years agomingw: enable using strcasecmp()
Viktor Szakats [Tue, 23 Feb 2021 12:06:55 +0000 (12:06 +0000)] 
mingw: enable using strcasecmp()

This makes the 'Features:' list sorted case-insensitively,
bringing output in-line with *nix builds.

Reviewed-by: Jay Satiro
Closes #6644

4 years agobuild: delete unused feature guards
Viktor Szakats [Tue, 23 Feb 2021 12:04:29 +0000 (12:04 +0000)] 
build: delete unused feature guards

- `HAVE_STRNCASECMP`
- `HAVE_TCGETATTR`
- `HAVE_TCSETATTR`

Reviewed-by: Jay Satiro
Reviewed-by: Daniel Stenberg
Closes #6645

4 years agodocs: add CURLOPT_CURLU to 'See also' in curl_url_ functions
Jay Satiro [Sun, 21 Feb 2021 22:46:14 +0000 (17:46 -0500)] 
docs: add CURLOPT_CURLU to 'See also' in curl_url_ functions

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

4 years agoconfigure: make hyper opt-in, and fail if missing
Jacob Hoffman-Andrews [Fri, 12 Feb 2021 01:14:28 +0000 (17:14 -0800)] 
configure: make hyper opt-in, and fail if missing

Previously, configure would look for hyper by default, and use it if
found; otherwise it would not use hyper, and not error.

Now, configure will not look for hyper unless --with-hyper is passed. If
configure looks for hyper and fails, it will error.

Also, add -ld -lpthread -lm to Hyper's libs. I think they are required.

Closes #6598

4 years agomulti: do once-per-transfer inits in before_perform in DID state
Daniel Stenberg [Mon, 22 Feb 2021 12:03:02 +0000 (13:03 +0100)] 
multi: do once-per-transfer inits in before_perform in DID state

... since the state machine might go to RATELIMITING and then back to
PERFORMING doing once-per-transfer inits in that function is wrong and
it caused problems with receiving chunked HTTP and it set the
PRETRANSFER time much too often...

Regression from b68dc34af341805aeb7b3715 (shipped in 7.75.0)

Reported-by: Amaury Denoyelle
Fixes #6640
Closes #6641

4 years agoRELEASE-NOTES: synced
Daniel Stenberg [Sun, 21 Feb 2021 22:39:39 +0000 (23:39 +0100)] 
RELEASE-NOTES: synced

4 years agoCODE_STYLE.md: fix broken link to INTERNALS
Daniel Stenberg [Sun, 21 Feb 2021 22:32:59 +0000 (23:32 +0100)] 
CODE_STYLE.md: fix broken link to INTERNALS

... the link would only work if browsed on GitHub, while this link now
takes the user to the website instead and thus should work on either.

Reported-by: David Demelier
4 years agocurl_url_set.3: mention CURLU_PATH_AS_IS
Daniel Stenberg [Sun, 21 Feb 2021 12:58:47 +0000 (13:58 +0100)] 
curl_url_set.3: mention CURLU_PATH_AS_IS

... it has been supported since the URL API was added.

Bug: https://curl.se/mail/lib-2021-02/0046.html

Closes #6638

4 years agotime: enable 64-bit time_t in supported mingw environments
Viktor Szakats [Sun, 21 Feb 2021 02:00:36 +0000 (02:00 +0000)] 
time: enable 64-bit time_t in supported mingw environments

(Unless 32-bit `time_t` is selected manually via the `_USE_32BIT_TIME_T`
mingw macro.)

Previously, 64-bit `time_t` was enabled on VS2005 and newer only, and
32-bit `time_t` was used on all other Windows builds.

Assisted-by: Jay Satiro
Closes #6636

4 years agotest1188: Check for --fail HTTP status
Jay Satiro [Fri, 19 Feb 2021 23:30:18 +0000 (18:30 -0500)] 
test1188: Check for --fail HTTP status

- Change the test to check for curl error on HTTP 404 Not Found.

test1188 tests "--write-out with %{onerror} and %{urlnum} to stderr".
Prior to this change it did that by specifying a non-existent host which
would cause an error. ISPs may hijack DNS and resolve non-existent hosts
so the test would not work if that was the case.

Ref: https://en.wikipedia.org/wiki/DNS_hijacking#Manipulation_by_ISPs
Ref: https://github.com/curl/curl/issues/6621
Ref: https://github.com/curl/curl/pull/6623

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

4 years agomemdebug: close debug logfile explicitly on exit
Jay Satiro [Wed, 17 Feb 2021 22:46:16 +0000 (17:46 -0500)] 
memdebug: close debug logfile explicitly on exit

- Use atexit to register a dbg cleanup function that closes the logfile.

LeakSantizier (LSAN) calls _exit() instead of exit() when a leak is
detected on exit so the logfile must be closed explicitly or data could
be lost. Though _exit() does not call atexit handlers such as this,
LSAN's call to _exit() comes after the atexit handlers are called.

Prior to this change the logfile was not explicitly closed so it was
possible that if LSAN detected a leak and called _exit (which does
not flush or close files like exit) then the logfile could be missing
data. That could then cause curl's memanalyze to report false leaks
(eg a malloc was recorded to the logfile but the corresponding free was
discarded from the buffer instead of written to the logfile, then
memanalyze reports that as a leak).

Ref: https://github.com/google/sanitizers/issues/1374

Bug: https://github.com/curl/curl/pull/6591#issuecomment-780396541

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

4 years agocurl_multibyte: always return a heap-allocated copy of string
Jay Satiro [Sat, 13 Feb 2021 05:51:28 +0000 (00:51 -0500)] 
curl_multibyte: always return a heap-allocated copy of string

- Change the Windows char <-> UTF-8 conversion functions to return an
  allocated copy of the passed in string instead of the original.

Prior to this change the curlx_convert_ functions would, as what I
assume was an optimization, not make a copy of the passed in string if
no conversion was required. No conversion is required in non-UNICODE
Windows builds since our tchar strings are type char and remain in
whatever the passed in encoding is, which is assumed to be UTF-8 but may
be other encoding.

In contrast the UNICODE Windows builds require conversion
(wchar <-> char) and do return a copy. That inconsistency could lead to
programming errors where the developer expects a copy, and does not
realize that won't happen in all cases.

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

4 years agohttp: add new files missed from referrer commit
Viktor Szakats [Fri, 19 Feb 2021 16:17:44 +0000 (16:17 +0000)] 
http: add new files missed from referrer commit

Ref: 44872aefc2d54f297caf2b0cc887df321bc9d791
Ref: #6591

4 years agohttp: add support to read and store the referrer header
Viktor Szakats [Fri, 19 Feb 2021 13:57:19 +0000 (13:57 +0000)] 
http: add support to read and store the referrer header

- add CURLINFO_REFERER libcurl option
- add --write-out '%{referer}' command-line option
- extend --xattr command-line option to fill user.xdg.referrer.url extended
  attribute with the referrer (if there was any)

Closes #6591

4 years agourldata: remove the _ORIG suffix from string names
Daniel Stenberg [Thu, 18 Feb 2021 09:13:56 +0000 (10:13 +0100)] 
urldata: remove the _ORIG suffix from string names

It doesn't provide any useful info but only makes the names longer.

Closes #6624

4 years agourl: fix memory leak if OOM in the HSTS handling
Daniel Stenberg [Thu, 18 Feb 2021 22:24:30 +0000 (23:24 +0100)] 
url: fix memory leak if OOM in the HSTS handling

Reported-by: Viktor Szakats
Bug: https://github.com/curl/curl/pull/6627#issuecomment-781626205

Closes #6628

4 years agognutls: assume nettle crypto support
Daniel Stenberg [Thu, 18 Feb 2021 10:42:46 +0000 (11:42 +0100)] 
gnutls: assume nettle crypto support

nettle has been the default crypto library with GnuTLS since 2010. By
dropping support for the previous libcrypto, we simplify code.

Closes #6625

4 years agoasyn-ares: use consistent resolve error message
Daniel Stenberg [Thu, 18 Feb 2021 12:14:55 +0000 (13:14 +0100)] 
asyn-ares: use consistent resolve error message

... with the help of Curl_resolver_error() which now is moved from
asyn-thead.c and is provided globally for this purpose.

Follow-up to 35ca04ce1b77636

Makes test 1188 work for c-ares builds

Closes #6626

4 years agoci: stop building on freebsd-12-1
Viktor Szakats [Thu, 18 Feb 2021 11:18:36 +0000 (11:18 +0000)] 
ci: stop building on freebsd-12-1

An updated freebsd-12-2 image was added a few months ago, and this
older one is consistently failing to go past `pkginstall`:
```
Newer FreeBSD version for package py37-mlt:
To ignore this error set IGNORE_OSVERSION=yes
- package: 1202000
- running kernel: 1201000
Ignore the mismatch and continue? [Y/n]: pkg: repository FreeBSD contains packages for wrong OS version: FreeBSD:12:amd64
```

FreeBSD thread suggests that 12.1 is EOL, and best to avoid.

Ref: https://forums.freebsd.org/threads/78856/

Reviewed-by: Daniel Stenberg
Closes #6622

4 years agotest1188: change error from connect to resolve error
Daniel Stenberg [Thu, 18 Feb 2021 07:30:35 +0000 (08:30 +0100)] 
test1188: change error from connect to resolve error

Using the %NOLISTENPORT to trigger a connection failure is somewhat
"risky" (since it isn't guaranteed to not be listened to) and caused
occasional CI problems. This fix changes the infused error to be a more
reliable one but still verifies the --write-out functionality properly -
which is the purpose of this test.

Reported-by: Jay Satiro
Fixes #6621
Closes #6623

4 years agourl.c: use consistent error message for failed resolve
Daniel Stenberg [Thu, 18 Feb 2021 08:57:30 +0000 (09:57 +0100)] 
url.c: use consistent error message for failed resolve

4 years agoBUGS: language polish
Daniel Stenberg [Thu, 18 Feb 2021 07:47:27 +0000 (08:47 +0100)] 
BUGS: language polish

4 years agowolfssl: don't store a NULL sessionid
Daniel Stenberg [Wed, 17 Feb 2021 13:19:57 +0000 (14:19 +0100)] 
wolfssl: don't store a NULL sessionid

This caused a memory leak as the session id cache entry was still
erroneously stored with a NULL sessionid and that would later be treated
as not needed to get freed.

Reported-by: Gisle Vanem
Fixes #6616
Closes #6617

4 years agoparse_proxy: fix a memory leak in the OOM path
Daniel Stenberg [Wed, 17 Feb 2021 10:53:32 +0000 (11:53 +0100)] 
parse_proxy: fix a memory leak in the OOM path

Reported-by: Jay Satiro
Reviewed-by: Jay Satiro
Reviewed-by: Emil Engler
Closes #6614
Bug: https://github.com/curl/curl/pull/6591#issuecomment-780396541

4 years agourl: fix possible use-after-free in default protocol
Jay Satiro [Tue, 16 Feb 2021 22:13:22 +0000 (17:13 -0500)] 
url: fix possible use-after-free in default protocol

Prior to this change if the user specified a default protocol and a
separately allocated non-absolute URL was used then it was freed
prematurely, before it was then used to make the replacement URL.

Bug: https://github.com/curl/curl/issues/6604#issuecomment-780138219
Reported-by: arvids-kokins-bidstack@users.noreply.github.com
Closes https://github.com/curl/curl/pull/6613

4 years agomulti: rename the multi transfer states
Daniel Stenberg [Tue, 16 Feb 2021 07:19:24 +0000 (08:19 +0100)] 
multi: rename the multi transfer states

While working on documenting the states it dawned on me that step one is
to use more descriptive names on the states. This also changes prefix on
the states to make them shorter in the source.

State names NOT ending with *ing are transitional ones.

Closes #6612

4 years agohttp: do not add a referrer header with empty value
Viktor Szakats [Tue, 16 Feb 2021 10:19:37 +0000 (10:19 +0000)] 
http: do not add a referrer header with empty value

Previously an empty 'Referer:' header was added to the HTTP request when
passing `--referer ';auto'` or `--referer ''` on the command-line. This
patch makes `--referer` work like `--header 'Referer:'` and will only add
the header if it has a non-zero length value.

Reviewed-by: Jay Satiro
Closes #6610

4 years agolib: remove 'conn->data' completely
Daniel Stenberg [Mon, 15 Feb 2021 09:15:46 +0000 (10:15 +0100)] 
lib: remove 'conn->data' completely

The Curl_easy pointer struct entry in connectdata is now gone. Just
before commit 215db086e0 landed on January 8, 2021 there were 919
references to conn->data.

Closes #6608

4 years agoopenldap: pass 'data' to the callbacks instead of 'conn'
Daniel Stenberg [Mon, 15 Feb 2021 08:41:22 +0000 (09:41 +0100)] 
openldap: pass 'data' to the callbacks instead of 'conn'

4 years agodoh: Fix sharing user's resolve list with DOH handles
Jay Satiro [Mon, 15 Feb 2021 05:25:59 +0000 (00:25 -0500)] 
doh: Fix sharing user's resolve list with DOH handles

- Share the shared object from the user's easy handle with the DOH
  handles.

Prior to this change if the user had set a shared object with shared
cached DNS (CURL_LOCK_DATA_DNS) for their easy handle then that wasn't
used by any associated DOH handles, since they used the multi's default
hostcache.

This change means all the handles now use the same hostcache, which is
either the shared hostcache from the user created shared object if it
exists or if not then the multi's default hostcache.

Reported-by: Manuj Bhatia
Fixes https://github.com/curl/curl/issues/6589
Closes https://github.com/curl/curl/pull/6607

4 years agohttp2: remove conn->data use
Daniel Stenberg [Mon, 15 Feb 2021 07:35:32 +0000 (08:35 +0100)] 
http2: remove conn->data use

... but instead use a private alternative that points to the "driving
transfer" from the connection. We set the "user data" associated with
the connection to be the connectdata struct, but when we drive transfers
the code still needs to know the pointer to the transfer. We can change
the user data to become the Curl_easy handle, but with older nghttp2
version we cannot dynamically update that pointer properly when
different transfers are used over the same connection.

Closes #6520

4 years agoopenssl: remove conn->data use
Daniel Stenberg [Mon, 25 Jan 2021 13:18:31 +0000 (14:18 +0100)] 
openssl: remove conn->data use

We still make the trace callback function get the connectdata struct
passed to it, since the callback is anchored on the connection.

Repeatedly updating the callback pointer to set 'data' with
SSL_CTX_set_msg_callback_arg() doesn't seem to work, probably because
there might already be messages in the queue with the old pointer.

This code therefore makes sure to set the "logger" handle before using
OpenSSL calls so that the right easy handle gets used for tracing.

Closes #6522

4 years agoRELEASE-NOTES: synced
Daniel Stenberg [Mon, 15 Feb 2021 07:31:34 +0000 (08:31 +0100)] 
RELEASE-NOTES: synced

4 years agodoh: add options to disable ssl verification
Jay Satiro [Thu, 11 Feb 2021 22:09:59 +0000 (17:09 -0500)] 
doh: add options to disable ssl verification

- New libcurl options CURLOPT_DOH_SSL_VERIFYHOST,
  CURLOPT_DOH_SSL_VERIFYPEER and CURLOPT_DOH_SSL_VERIFYSTATUS do the
  same as their respective counterparts.

- New curl tool options --doh-insecure and --doh-cert-status do the same
  as their respective counterparts.

Prior to this change DOH SSL certificate verification settings for
verifyhost and verifypeer were supposed to be inherited respectively
from CURLOPT_SSL_VERIFYHOST and CURLOPT_SSL_VERIFYPEER, but due to a bug
were not. As a result DOH verification remained at the default, ie
enabled, and it was not possible to disable. This commit changes
behavior so that the DOH verification settings are independent and not
inherited.

Ref: https://github.com/curl/curl/pull/4579#issuecomment-554723676

Fixes https://github.com/curl/curl/issues/4578
Closes https://github.com/curl/curl/pull/6597

4 years agohostip: fix crash in sync resolver builds that use DOH
Jay Satiro [Sat, 13 Feb 2021 07:45:33 +0000 (02:45 -0500)] 
hostip: fix crash in sync resolver builds that use DOH

- Guard some Curl_async accesses with USE_CURL_ASYNC instead of
  !CURLRES_SYNCH.

This is another follow-up to 8335c64 which moved the async struct from
the connectdata struct into the Curl_easy struct. A previous follow-up
6cd167a fixed building for sync resolver by guarding some async struct
accesses with !CURLRES_SYNCH. The problem is since DOH (DNS-over-HTTPS)
is available as an asynchronous secondary resolver the async struct may
be used even when libcurl is built for the sync resolver. That means
that CURLRES_SYNCH and USE_CURL_ASYNC may be defined at the same time.

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

4 years agoKNOWN_BUGS: cannot enable LDAPS on Windows with cmake
Daniel Stenberg [Sat, 13 Feb 2021 21:49:16 +0000 (22:49 +0100)] 
KNOWN_BUGS: cannot enable LDAPS on Windows with cmake

Reported-by: Jack Boos Yu
Closes #6284

4 years agoKNOWN_BUGS: Excessive HTTP/2 packets with TCP_NODELAY
Daniel Stenberg [Sat, 13 Feb 2021 21:42:58 +0000 (22:42 +0100)] 
KNOWN_BUGS: Excessive HTTP/2 packets with TCP_NODELAY

Reported-by: Alex Xu
Closes #6363

4 years agohttp: use credentials from transfer, not connection
Daniel Stenberg [Fri, 12 Feb 2021 09:27:42 +0000 (10:27 +0100)] 
http: use credentials from transfer, not connection

HTTP auth "accidentally" worked before this cleanup since the code would
always overwrite the connection credentials with the credentials from
the most recent transfer and since HTTP auth is typically done first
thing, this has not been an issue. It was still wrong and subject to
possible race conditions or future breakage if the sequence of functions
would change.

The data.set.str[] strings MUST remain unmodified exactly as set by the
user, and the credentials to use internally are instead set/updated in
state.aptr.*

Added test 675 to verify different credentials used in two requests done
over a reused HTTP connection, which previously behaved wrongly.

Fixes #6542
Closes #6545

4 years agotest433: clear some home dir env variables
Daniel Stenberg [Fri, 12 Feb 2021 07:45:10 +0000 (08:45 +0100)] 
test433: clear some home dir env variables

Follow-up to bd6b54ba1f55b5

... so that XDG_CONFIG_HOME is the only home dir variable set and thus
used correctly in the test!

Fixes #6599
Closes #6600

4 years agoRELEASE-NOTES: synced
Daniel Stenberg [Fri, 12 Feb 2021 08:55:04 +0000 (09:55 +0100)] 
RELEASE-NOTES: synced

bumped the version to 7.76.0

4 years agotravis: install libgsasl-dev to add that to the builds
Daniel Stenberg [Tue, 9 Feb 2021 22:39:31 +0000 (23:39 +0100)] 
travis: install libgsasl-dev to add that to the builds

Closes #6588

4 years agourldata: don't touch data->set.httpversion at run-time
Daniel Stenberg [Thu, 11 Feb 2021 15:30:32 +0000 (16:30 +0100)] 
urldata: don't touch data->set.httpversion at run-time

Rename it to 'httpwant' and make a cloned field in the state struct as
well for run-time updates.

Also: refuse non-supported HTTP versions. Verified with test 129.

Closes #6585

4 years agotests: disable .curlrc in more environments
Viktor Szakats [Thu, 11 Feb 2021 22:06:02 +0000 (22:06 +0000)] 
tests: disable .curlrc in more environments

by also setting CURL_HOME and XDG_CONFIG_HOME envvars to the local
directory.

Reviewed-by: Daniel Stenberg
Fixes #6595
Closes #6596

4 years agodocs/Makefile.inc: format to be update-friendly
Viktor Szakats [Thu, 11 Feb 2021 16:12:12 +0000 (16:12 +0000)] 
docs/Makefile.inc: format to be update-friendly

- one source file per line
- convert tabs to spaces
- do not align line-continuation backslashes
- sort source files alphabetically

Reviewed-by: Daniel Stenberg
Closes #6593

4 years agocurl: provide libgsasl version and feature info in -V output
Daniel Stenberg [Thu, 11 Feb 2021 07:54:23 +0000 (08:54 +0100)] 
curl: provide libgsasl version and feature info in -V output

Closes #6592

4 years agogsasl: provide CURL_VERSION_GSASL if built-in
Daniel Stenberg [Thu, 11 Feb 2021 07:53:33 +0000 (08:53 +0100)] 
gsasl: provide CURL_VERSION_GSASL if built-in

To let applications know the feature is available.

Closes #6592

4 years agocurl: add --fail-with-body
Daniel Stenberg [Thu, 11 Feb 2021 07:30:39 +0000 (08:30 +0100)] 
curl: add --fail-with-body

Prevent both --fail and --fail-with-body on the same command line.

Verify with test 349, 360 and 361.

Closes #6449

4 years agoTODO: remove HSTS
Daniel Stenberg [Wed, 10 Feb 2021 21:54:33 +0000 (22:54 +0100)] 
TODO: remove HSTS

Provided now since commit 7385610d0c74

4 years agotests: Fix tests failing due to change in curl --help
Jay Satiro [Wed, 10 Feb 2021 20:57:26 +0000 (15:57 -0500)] 
tests: Fix tests failing due to change in curl --help

Follow-up to parent 3183217 which added add missing <mode> argument to
--create-file-mode <mode>.

Ref: https://github.com/curl/curl/issues/6590

4 years agotool_help: add missing argument for --create-file-mode
Jay Satiro [Wed, 10 Feb 2021 19:10:49 +0000 (14:10 -0500)] 
tool_help: add missing argument for --create-file-mode

Prior to this change the required argument was not shown in curl --help.

before:
     --create-file-mode File mode for created files

after:
     --create-file-mode <mode> File mode (octal) for created files

Reported-by: ZimCodes@users.noreply.github.com
Fixes https://github.com/curl/curl/issues/6590

4 years agocreate-file-mode.d: add missing Arg tag
Jay Satiro [Wed, 10 Feb 2021 18:57:40 +0000 (13:57 -0500)] 
create-file-mode.d: add missing Arg tag

Prior to this change the required argument was not shown.

curl.1 before: --create-file-mode
curl.1 after: --create-file-mode <mode>

Reported-by: ZimCodes@users.noreply.github.com
Fixes https://github.com/curl/curl/issues/6590

4 years agogsasl: fix errors/warnings building against libgsasl
Viktor Szakats [Wed, 10 Feb 2021 18:50:36 +0000 (18:50 +0000)] 
gsasl: fix errors/warnings building against libgsasl

- also fix an indentation
- make Curl_auth_gsasl_token() use CURLcode (by Daniel Stenberg)

Ref: https://github.com/curl/curl/pull/6372#issuecomment-776118711
Ref: https://github.com/curl/curl/pull/6588

Reviewed-by: Jay Satiro
Assisted-by: Daniel Stenberg
Reviewed-by: Simon Josefsson
Closes #6587

4 years agoMakefile.m32: add support for libgsasl dependency
Viktor Szakats [Wed, 10 Feb 2021 18:46:57 +0000 (18:46 +0000)] 
Makefile.m32: add support for libgsasl dependency

Reviewed-by: Marcel Raad
Closes #6586

4 years agongtcp2: clarify calculation precedence
Marcel Raad [Sun, 7 Feb 2021 10:53:56 +0000 (11:53 +0100)] 
ngtcp2: clarify calculation precedence

As suggested by Codacy/cppcheck.

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

4 years agoserver: remove redundant condition
Marcel Raad [Sun, 7 Feb 2021 10:45:16 +0000 (11:45 +0100)] 
server: remove redundant condition

`end` is always non-null here.

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

4 years agolib: remove redundant code
Marcel Raad [Sun, 7 Feb 2021 08:29:59 +0000 (09:29 +0100)] 
lib: remove redundant code

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

4 years agomqttd: remove unused variable
Marcel Raad [Sat, 6 Feb 2021 10:46:22 +0000 (11:46 +0100)] 
mqttd: remove unused variable

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

4 years agotool_paramhlp: reduce variable scope
Marcel Raad [Sat, 6 Feb 2021 10:40:18 +0000 (11:40 +0100)] 
tool_paramhlp: reduce variable scope

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

4 years agotests: reduce variable scopes
Marcel Raad [Sat, 6 Feb 2021 10:30:09 +0000 (11:30 +0100)] 
tests: reduce variable scopes

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

4 years agolib: reduce variable scopes
Marcel Raad [Sat, 6 Feb 2021 10:21:53 +0000 (11:21 +0100)] 
lib: reduce variable scopes

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

4 years agoftp: fix Codacy/cppcheck warning about null pointer arithmetic
Marcel Raad [Sat, 6 Feb 2021 09:26:38 +0000 (10:26 +0100)] 
ftp: fix Codacy/cppcheck warning about null pointer arithmetic

Increment `bytes` only if it is non-null.

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

4 years agongtcp2: adapt to the new recv_datagram callback
Daniel Stenberg [Tue, 9 Feb 2021 22:25:20 +0000 (23:25 +0100)] 
ngtcp2: adapt to the new recv_datagram callback

4 years agoquiche: fix build error: use 'int' for port number
Daniel Stenberg [Tue, 9 Feb 2021 22:21:13 +0000 (23:21 +0100)] 
quiche: fix build error: use 'int' for port number

Follow-up to cb2dc1ba8

4 years agoftp: add 'list_only' to the transfer state struct
Daniel Stenberg [Mon, 8 Feb 2021 15:40:34 +0000 (16:40 +0100)] 
ftp: add 'list_only' to the transfer state struct

and rename it from 'ftp_list_only' since it is also used for SSH and
POP3. The state is updated internally for 'type=D' FTP URLs.

Added test case 1570 to verify.

Closes #6578

4 years agoftp: add 'prefer_ascii' to the transfer state struct
Daniel Stenberg [Mon, 8 Feb 2021 14:56:10 +0000 (15:56 +0100)] 
ftp: add 'prefer_ascii' to the transfer state struct

... and make sure the code never updates 'set.prefer_ascii' as it breaks
handle reuse which should use the setting as the user specified it.

Added test 1569 to verify: it first makes an FTP transfer with ';type=A'
and then another without type on the same handle and the second should
then use binary. Previously, curl failed this.

Closes #6578

4 years agoRELEASE-NOTES: synced
Daniel Stenberg [Tue, 9 Feb 2021 10:35:47 +0000 (11:35 +0100)] 
RELEASE-NOTES: synced

4 years agovtls: initial implementation of rustls backend
Jacob Hoffman-Andrews [Sun, 13 Dec 2020 07:55:09 +0000 (23:55 -0800)] 
vtls: initial implementation of rustls backend

This adds a new TLS backend, rustls. It uses the C-to-rustls bindings
from https://github.com/abetterinternet/crustls.

Rustls is at https://github.com/ctz/rustls/.

There is still a fair bit to be done, like sending CloseNotify on
connection shutdown, respecting CAPATH, and properly indicating features
like "supports TLS 1.3 ciphersuites." But it works well enough to make
requests and receive responses.

Blog post for context:
https://www.abetterinternet.org/post/memory-safe-curl/

Closes #6350

4 years agosasl: support SCRAM-SHA-1 and SCRAM-SHA-256 via libgsasl
Simon Josefsson [Thu, 24 Dec 2020 18:48:45 +0000 (19:48 +0100)] 
sasl: support SCRAM-SHA-1 and SCRAM-SHA-256 via libgsasl

Closes #6372

4 years agolib: use int type for more port variables
Jay Satiro [Mon, 1 Feb 2021 07:10:07 +0000 (02:10 -0500)] 
lib: use int type for more port variables

This is a follow-up to 764c6bd. Prior to that change port variables
were usually type long.

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

4 years agotool_writeout: refactor write-out and write-out json
Jay Satiro [Thu, 28 Jan 2021 23:56:50 +0000 (18:56 -0500)] 
tool_writeout: refactor write-out and write-out json

- Deduplicate the logic used by write-out and write-out json.

Rather than have separate writeLong, writeString, etc, logic for
each of write-out and write-out json instead have respective shared
functions that can output either format and a 'use_json' parameter to
indicate whether it is json that is output.

This will make it easier to maintain. Rather than have to go through
two sets of logic now we only have to go through one.

- Support write-out %{errormsg} and %{exitcode} in json.

- Clarify in the doc that %{exitcode} is the exit code of the transfer.

Prior to this change it just said "The numerical exitcode" which
implies it's the exit code of the tool, and it's not necessarily that.

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

4 years agolib: drop USE_SOCKETPAIR in favor of CURL_DISABLE_SOCKETPAIR
Jay Satiro [Mon, 25 Jan 2021 06:27:13 +0000 (01:27 -0500)] 
lib: drop USE_SOCKETPAIR in favor of CURL_DISABLE_SOCKETPAIR

.. since the former is undocumented and they both do the same thing.

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

4 years agocurl_multibyte: fall back to local code page stat/access on Windows
Jay Satiro [Sun, 24 Jan 2021 23:22:05 +0000 (18:22 -0500)] 
curl_multibyte: fall back to local code page stat/access on Windows

If libcurl is built with Unicode support for Windows then it is assumed
the filename string is Unicode in UTF-8 encoding and it is converted to
UTF-16 to be passed to the wide character version of the respective
function (eg wstat). However the filename string may actually be in the
local encoding so, even if it successfully converted to UTF-16, if it
could not be stat/accessed then try again using the local code page
version of the function (eg wstat fails try stat).

We already do this with fopen (ie wfopen fails try fopen), so I think it
makes sense to extend it to stat and access functions.

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

4 years agofile: Support unicode urls on windows
Stephan Szabo [Wed, 20 Jan 2021 18:08:49 +0000 (10:08 -0800)] 
file: Support unicode urls on windows

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

4 years agocmake: fix import library name for non-MS compiler on Windows
Vincent Torri [Thu, 19 Nov 2020 18:34:43 +0000 (19:34 +0100)] 
cmake: fix import library name for non-MS compiler on Windows

- Use _imp.lib suffix only for Microsoft's compiler (MSVC).

Prior to this change library suffix _imp.lib was used for the import
library on Windows regardless of compiler.

With this change the other compilers should now use their default
suffix which should be .dll.a.

This change is motivated by the usage of pkg-config on MSYS2.
Indeed, when 'pkg-config --libs libcurl' is used, -lcurl is
passed to ld. The documentation of ld on Windows :

https://sourceware.org/binutils/docs/ld/WIN32.html

lists, in the 'direct linking to a dll' section, the pattern
of the searched import library, and libcurl_imp.lib is not there.

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

4 years agourldata: move 'followlocation' to UrlState
Daniel Stenberg [Mon, 8 Feb 2021 22:00:21 +0000 (23:00 +0100)] 
urldata: move 'followlocation' to UrlState

As this is a state variable it does not belong in UserDefined which is
used to store values set by the user.

Closes #6582

4 years agohttp_proxy: fix typo in http_proxy.c
Ikko Ashimine [Tue, 9 Feb 2021 05:22:09 +0000 (14:22 +0900)] 
http_proxy: fix typo in http_proxy.c

settting -> setting

Closes #6583

4 years agotests/server: Bump MAX_TAG_LEN to 200
Fabian Keil [Wed, 20 Jan 2021 11:32:14 +0000 (12:32 +0100)] 
tests/server: Bump MAX_TAG_LEN to 200

This is useful for tests containing HTML inside of <data> sections.
For <img> tags it's not uncommon to be longer than the previous
limit of 79 bytes.

An example of a previously problem-causing tag is:
<img src="http://config.privoxy.org/send-banner?type=auto" border="0" title="Killed-http://www.privoxy.org/images/privoxy.png-by-size" width="88" height="31">
which is needed for a Privoxy test for the banners-by-size filter.

Previously it caused server failures like:
12:29:05.786961 ====> Client connect
12:29:05.787116 accept_connection 3 returned 4
12:29:05.787194 accept_connection 3 returned 0
12:29:05.787285 Read 119 bytes
12:29:05.787345 Process 119 bytes request
12:29:05.787407 Got request: GET /banners-by-size/9 HTTP/1.1
12:29:05.787464 Requested test number 9 part 0
12:29:05.787686 getpart() failed with error: -2
12:29:05.787744 - request found to be complete (9)
12:29:05.787912 getpart() failed with error: -2
12:29:05.788048 Wrote request (119 bytes) input to log/server.input
12:29:05.788157 Send response test9 section <data>
12:29:05.788443 getpart() failed with error: -2
12:29:05.788498 instructed to close connection after server-reply
12:29:05.788550 ====> Client disconnect 0
12:29:05.871448 exit_signal_handler: 15
12:29:05.871714 signalled to die
12:29:05.872040 ========> IPv4 sws (port 21108 pid: 51758) exits with signal (15)

4 years agotests/badsymbols.pl: when opening '$incdir' fails include it in the error message
Fabian Keil [Fri, 28 Feb 2020 09:46:22 +0000 (10:46 +0100)] 
tests/badsymbols.pl: when opening '$incdir' fails include it in the error message

4 years agoruntests.1: document -o, -P, -L, and -E
Fabian Keil [Mon, 18 Jan 2021 08:21:54 +0000 (09:21 +0100)] 
runtests.1: document -o, -P, -L, and -E

4 years agoruntests.pl: add %TESTNUMBER variable to make copying tests more convenient
Fabian Keil [Mon, 16 Jun 2014 14:03:00 +0000 (16:03 +0200)] 
runtests.pl: add %TESTNUMBER variable to make copying tests more convenient

4 years agoruntests.pl: add an -o option to change internal variables
Fabian Keil [Thu, 9 Oct 2014 13:48:19 +0000 (15:48 +0200)] 
runtests.pl: add an -o option to change internal variables

runtests.pl has lots of internal variables one might want to
change in certain situations, but adding a dedicated option
for every single one of them isn't practical.

Usage:
./runtests.pl -o TESTDIR=$privoxy_curl_test_dir -o HOSTIP=10.0.0.1 ...

4 years agoruntests.pl: cleanups
Fabian Keil [Thu, 15 Nov 2012 14:57:29 +0000 (15:57 +0100)] 
runtests.pl: cleanups

- show the summarized test result in the last line of the report
- do not use $_ after mapping it to a named variable
  Doing that makes the code harder to follow.
- log the restraints sorted by the number of their occurrences
- fix language when logging restraints that only occured once
- let runhttpserver() use $TESTDIR instead of $srcdir
  ... so it works if a non-default $TESTDIR is being used.