Commit Graph

26892 Commits

Author SHA1 Message Date
Daniel Stenberg 78f642ffab
config: remove CURL_SIZEOF_CURL_OFF_T use only SIZEOF_CURL_OFF_T
Make the code consistently use a single name for the size of the
"curl_off_t" type.

Closes #6702
2021-03-11 10:11:56 +01:00
Jun-ya Kato 6043dfa4f9 ngtcp2: Fix build error due to change in ngtcp2_addr_init
ngtcp2/ngtcp2@b8d90a9 changed the function prototype.

Closes https://github.com/curl/curl/pull/6716
2021-03-10 16:52:09 -05:00
ejanchivdorj a2bbc3ac8c
multi: update pending list when removing handle
when removing a handle, most of the lists are updated but pending list
is not updated. Updating now.

Closes #6713
2021-03-10 14:05:02 +01:00
kokke 4088b25b33
lib1536: check ptr against NULL before dereferencing it
Closes #6710
2021-03-10 14:03:57 +01:00
kokke b2d906754c
lib1537: check ptr against NULL before dereferencing it
Fixes #6707
Closes #6708
2021-03-10 14:01:55 +01:00
Daniel Stenberg 9421eee915
travis: make torture tests skip TLS-SRP tests
... as it seems to often hang.

Also: skip the "normal" tests as they're already run by many other
builds.

Closes #6705
2021-03-10 10:29:28 +01:00
Daniel Stenberg b7e01382d6
openssl: adapt to v3's new const for a few API calls
Closes #6703
2021-03-09 08:15:36 +01:00
Daniel Stenberg ec549aa625
quiche: fix crash when failing to connect
Reported-by: ウさん
Fixes #6664
Closes #6701
2021-03-08 17:14:13 +01:00
Daniel Stenberg b899cb08c6
RELEASE-NOTES: synced
Fixed the release counter and added a missing contributor
2021-03-08 10:11:33 +01:00
Daniel Stenberg f8cc18ccfa
RELEASE-NOTES: synced 2021-03-06 22:51:31 +01:00
Daniel Stenberg 6221bc1a2f
dynbuf: bump the max HTTP request to 1MB
Raised from 128KB to allow longer request headers.

Reported-by: Carl Zogheib
Fixes #6681
Closes #6685
2021-03-06 22:48:35 +01:00
Jay Satiro 7a33c4dff9 schannel: Evaluate CURLOPT_SSL_OPTIONS via SSL_SET_OPTION macro
- Change use of those options from CURLOPT_SSL_OPTIONS that are not
  already evaluated via SSL_SET_OPTION in schannel and secure transport
  to use that instead of data->set.ssl.optname.

Example:

Evaluate SSL_SET_OPTION(no_revoke) instead of data->set.ssl.no_revoke.

This change is because options set via CURLOPT_SSL_OPTIONS
(data->set.ssl.optname) are separate from those set for HTTPS proxy via
CURLOPT_PROXY_SSL_OPTIONS (data->set.proxy_ssl.optname). The
SSL_SET_OPTION macro determines whether the connection is for HTTPS
proxy and based on that which option to evaluate.

Since neither Schannel nor Secure Transport backends currently support
HTTPS proxy in libcurl, this change is for posterity and has no other
effect.

Closes https://github.com/curl/curl/pull/6690
2021-03-06 02:01:35 -05:00
kokke 86338ca698 c-hyper: Remove superfluous pointer check
`n` pointer is never NULL once set. Found by static analysis.

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

Closes https://github.com/curl/curl/pull/6697
2021-03-05 17:09:10 -05:00
Jay Satiro bde786b5d1 version.d: Add missing features to the features list
- Add missing entries for gsasl, Kerberos, NTLM_WB, TrackMemory,
  Unicode and zstd.

- Remove krb4 since it's no longer a feature.

Reported-by: Ádler Jonas Gross

Fixes https://github.com/curl/curl/issues/6677
Closes https://github.com/curl/curl/pull/6687
2021-03-04 18:07:06 -05:00
Vladimir Varlamov e1655b2477 docs: add missing Arg tag to --stderr
Prior to this change the required argument was not shown.

curl.1 before: --stderr
curl.1 after: --stderr <file>

curl --help before:
     --stderr        Where to redirect stderr

curl --help after:
     --stderr <file>  Where to redirect stderr

Closes https://github.com/curl/curl/pull/6692
2021-03-04 18:01:55 -05:00
Jay Satiro dd81489db9 projects: Update VS projects for OpenSSL 1.1.x
- Update VS project templates to use the OpenSSL lib names and include
  directories for OpenSSL 1.1.x.

This change means the VS project files will now build only with OpenSSL
1.1.x when an OpenSSL configuration is chosen. Prior to this change the
project files built only with OpenSSL 1.0.x (end-of-life) when an
OpenSSL configuration was chosen.

The template changes in this commit were made by script:

libeay32.lib => libcrypto.lib
ssleay32.lib => libssl.lib
..\..\..\..\..\openssl\inc32 => ..\..\..\..\..\openssl\include

And since the output directory now contains the includes it's prepended:
..\..\..\..\..\openssl\build\Win{32,64}\VC{6..15}\{DLL,LIB}
{Debug,Release}\include

- Change build-openssl.bat to copy the build's include directory to the
  output directory (as seen above).

Each build has its own opensslconf.h which is different so we can't just
include the source include directory any longer.

Note the include directory in the output directory is a full copy from
the build so technically we don't need to include the OpenSSL source
include directory in the template. However, I left it last in case the
user made a custom OpenSSL build using the old method which would put
opensslconf in the OpenSSL source include directory.

- Change build-openssl.bat to use a temporary install directory that is
  different from the temporary build directory.

For OpenSSL 1.1.x the temporary paths must be separate not a descendant
of the other, otherwise pdb files will be lost between builds.

Ref: https://curl.se/mail/lib-2018-10/0049.html
Ref: https://gist.github.com/jay/125191c35bbeb894444eff827651f755
Ref; https://github.com/openssl/openssl/issues/10005

Fixes https://github.com/curl/curl/issues/984
Closes https://github.com/curl/curl/pull/6675
2021-03-03 18:32:24 -05:00
Jay Satiro 1ba0d4bdb3 doh: Inherit CURLOPT_STDERR from user's easy handle
Prior to this change if the user set their easy handle's error stream
to something other than stderr it was not inherited by the doh handles,
which meant that they would still write to the default standard error
stream (stderr) for verbose output.

Bug: https://github.com/curl/curl/issues/6605
Reported-by: arvids-kokins-bidstack@users.noreply.github.com

Closes https://github.com/curl/curl/pull/6661
2021-03-02 16:59:28 -05:00
Marc Hoersken cc9bf974cd
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
2021-03-01 21:37:25 +01:00
Marc Hoersken 311c31ec8e
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
2021-03-01 20:19:01 +01:00
Marc Hoersken b2b3c91ed7
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
2021-03-01 20:18:04 +01:00
Daniel Gustafsson 24f850f4a4 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>
2021-03-01 09:31:33 +01:00
Daniel Gustafsson 313faa1bcb url: fix typo in comment
Correct a small typo which snuck in with a304051620.
2021-02-28 21:13:26 +01:00
Jay Satiro 5743d66b91 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
2021-02-28 13:41:15 -05:00
Daniel Stenberg 40f3c18e6a
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 a7696c7343 (shipped in 7.75.0)
Reported-by: Johannes Lesr
Fixes #6657
Closes #6666
2021-02-27 00:30:36 +01:00
Daniel Stenberg 15bc86df33
tool_operate: check argc before accessing argv[1]
Follow-up to 09363500b
Reported-by: Emil Engler
Reviewed-by: Daniel Gustafsson
Closes #6668
2021-02-27 00:25:47 +01:00
Jean-Philippe Menil 8779bfe77b 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>
2021-02-26 04:15:04 +01:00
Daniel Gustafsson 09a5bff1c9 gnutls: Fix nettle discovery
Commit e06fa7462a 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>
2021-02-25 18:20:33 +01:00
Daniel Gustafsson 82c583dcf0 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>
2021-02-25 18:12:28 +01:00
Daniel Stenberg 1b2098c3c9
build: remove all traces of USE_BLOCKING_SOCKETS
libcurl doesn't behave properly with the define set

Closes #6655
2021-02-25 16:41:35 +01:00
Daniel Stenberg 71bfa5aca8
RELEASE-NOTES: synced 2021-02-25 11:40:01 +01:00
Daniel Gustafsson 4d28382bd3 docs: Fix typos
Random typos spotted when skimming docs.
2021-02-25 09:28:00 +01:00
Daniel Gustafsson 4e76905b04 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>
2021-02-23 22:00:02 +01:00
Daniel Stenberg 0c7d111f4e
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
2021-02-24 14:16:11 +01:00
Daniel Stenberg c7c1e5851f
configure: fail if --with-quiche is used and quiche isn't found
Closes #6652
2021-02-24 14:05:29 +01:00
Gregor Jasny 811acd1a08
cmake: use CMAKE_INSTALL_INCLUDEDIR indirection
Reviewed-by: Sergei Nikulov
Closes #6440
2021-02-24 08:17:53 +01:00
Viktor Szakats fb98a436a7
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
2021-02-23 12:06:55 +00:00
Viktor Szakats 95014b0a4d
build: delete unused feature guards
- `HAVE_STRNCASECMP`
- `HAVE_TCGETATTR`
- `HAVE_TCSETATTR`

Reviewed-by: Jay Satiro
Reviewed-by: Daniel Stenberg
Closes #6645
2021-02-23 12:04:29 +00:00
Jay Satiro c79b9de45c docs: add CURLOPT_CURLU to 'See also' in curl_url_ functions
Closes https://github.com/curl/curl/pull/6639
2021-02-23 02:31:20 -05:00
Jacob Hoffman-Andrews aab3c6c4c8
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
2021-02-23 07:39:05 +01:00
Daniel Stenberg bf601472a0
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 b68dc34af3 (shipped in 7.75.0)

Reported-by: Amaury Denoyelle
Fixes #6640
Closes #6641
2021-02-22 15:54:46 +01:00
Daniel Stenberg 628078ddb7
RELEASE-NOTES: synced 2021-02-21 23:39:39 +01:00
Daniel Stenberg 294ca24241
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
2021-02-21 23:34:13 +01:00
Daniel Stenberg 659b05df6a
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
2021-02-21 23:25:22 +01:00
Viktor Szakats 6b0f217c65
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
2021-02-21 02:00:36 +00:00
Jay Satiro 3d954e4e26 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
2021-02-20 14:41:13 -05:00
Jay Satiro eb36c03e83 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
2021-02-20 14:40:24 -05:00
Jay Satiro 09363500b9 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
2021-02-20 14:39:39 -05:00
Viktor Szakats f65d7889b5
http: add new files missed from referrer commit
Ref: 44872aefc2
Ref: #6591
2021-02-19 16:18:15 +00:00
Viktor Szakats 44872aefc2
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
2021-02-19 13:57:19 +00:00
Daniel Stenberg 70472a44de
urldata: remove the _ORIG suffix from string names
It doesn't provide any useful info but only makes the names longer.

Closes #6624
2021-02-19 08:07:19 +01:00