Граф коммитов

12379 Коммитов

Автор SHA1 Сообщение Дата
Viktor Szakats dd94076947
ngtcp2: fix typo in preprocessor condition
Ref: 927ede7edc

Bug: https://github.com/curl/curl/pull/8981#discussion_r894312185
Reported-by: Emil Engler
Closes #8987
2022-06-10 23:07:15 +00:00
Tatsuhiro Tsujikawa 927ede7edc
ngtcp2: build without sendmsg
Closes #8981
2022-06-10 09:10:54 +02:00
Tatsuhiro Tsujikawa d2c6d8be18
ngtcp2: use handshake helper funcs to simplify TLS handshake integration
Closes #8968
2022-06-10 09:07:33 +02:00
Daniel Stenberg 90a7017acb
url: URL encode the path when extracted, if spaces were set 2022-06-08 16:32:46 +02:00
Daniel Stenberg c3fc406ebb
urlapi: support CURLU_URLENCODE for curl_url_get() 2022-06-08 16:32:46 +02:00
Daniel Stenberg 5912da253b
select: return error from "lethal" poll/select errors
Adds two new error codes: CURLE_UNRECOVERABLE_POLL and
CURLM_UNRECOVERABLE_POLL one each for the easy and the multi interfaces.

Reported-by: Harry Sintonen
Fixes #8921
Closes #8961
2022-06-08 11:07:01 +02:00
Daniel Stenberg 07058f6ad8
transfer: maintain --path-as-is after redirects
Reported-by: Marcus T
Fixes #8974
Closes #8975
2022-06-08 10:30:36 +02:00
Thomas Guillem 2ed1012564
curl_version_info: add CURL_VERSION_THREADSAFE_INIT
This flag can be used to make sure that curl_global_init() is
thread-safe.

This can be useful for libraries that can't control what other
dependencies are doing with Curl.

Closes #8680
2022-06-07 13:34:03 +02:00
Thomas Guillem 23af112f55
lib: make curl_global_init() threadsafe when possible
Use a posix pthread or a Windows SRWLOCK to lock curl_global_init*() and
curl_global_cleanup().

Closes #8680
2022-06-07 13:34:03 +02:00
Daniel Stenberg 6754f99398
ftp: when failing to do a secure GSSAPI login, fail hard
... instead of switching to cleartext. For the sake of security.

Reported-by: Harry Sintonen
Bug: https://hackerone.com/reports/1590102
Closes #8963
2022-06-06 11:55:39 +02:00
Daniel Stenberg 21ea13cfe1
http2: reject overly many push-promise headers
Getting more than a thousand of them is rather a sign of some kind of
attack.

Reported-by: Harry Sintonen
Bug: https://hackerone.com/reports/1589847
Closes #8962
2022-06-06 11:53:49 +02:00
Fabian Keil 9dbce9b3d0
misc: spelling improvements
Closes #8956
2022-06-05 12:15:23 +02:00
Tatsuhiro Tsujikawa 298c1dfc7b
ngtcp2: fix assertion failure on EMSGSIZE
Closes #8958
2022-06-05 12:12:26 +02:00
Daniel Stenberg 2bd75e5686
easy/transfer: fix cookie-disabled build
Follow-up from 45de940ceb
Reported-by: Marcel Raad
Fixes #8953
Closes #8954
2022-06-02 22:54:12 +02:00
Wolf Vollprecht 4d4eb8e587
netrc: check %USERPROFILE% as well on Windows
Closes #8855
2022-06-02 09:32:51 +02:00
michael musset 1544513958
libssh2: add CURLOPT_SSH_HOSTKEYFUNCTION
The callback set by CURLOPT_SSH_HOSTKEYFUNCTION is called to check
wether or not the connection should continue.

The host key is passed in argument with a custom handle for the
application.

It overrides CURLOPT_SSH_KNOWNHOSTS

Closes #7959
2022-06-02 08:34:31 +02:00
Evgeny Grin f59508e6cd
digest: tolerate missing "realm"
Server headers may not define "realm", avoid NULL pointer dereference
in such cases.

Closes #8912
2022-06-02 08:18:54 +02:00
Evgeny Grin 807f440301
digest: added detection of more syntax error in server headers
Invalid headers should not be processed otherwise they may create
a security risk.

Closes #8912
2022-06-02 08:18:48 +02:00
Evgeny Grin 3a6fe0c767
digest: unquote realm and nonce before processing
RFC 7616 (and 2617) requires values to be "unquoted" before used for
digest calculations. The only place where unquoting can be done
correctly is header parsing function (realm="DOMAIN\\host" and
realm=DOMAN\\host are different realms).

This commit adds unquoting (de-escaping) of all values during header
parsing and quoting of the values during header forming. This approach
should be most straightforward and easy to read/maintain as all values
are processed in the same way as required by RFC.

Closes #8912
2022-06-02 08:18:34 +02:00
Daniel Stenberg f810047f9d
headers: handle unfold of space-cleansed headers
Detected by OSS-fuzz

Bug: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=47767

Updated test 1274

Closes #8947
2022-06-01 15:24:49 +02:00
Daniel Stenberg 45de940ceb
lib: make more protocol specific struct fields #ifdefed
... so that they don't take up space if the protocols are disabled in
the build.

Closes #8944
2022-06-01 14:31:49 +02:00
Daniel Stenberg 8b1ae28509
urldata: store tcp_keepidle and tcp_keepintvl as ints
They can't be set larger than INT_MAX in the setsocket API calls.

Also document the max values in their respective man pages.

Closes #8940
2022-06-01 08:12:09 +02:00
Daniel Stenberg 4651945822
urldata: reduce size of a few struct fields
When the values are never larger than 32 bit, ints are better than longs.

Closes #8940
2022-06-01 08:12:09 +02:00
Daniel Stenberg b1c1df0b6b
urldata: remove three unused booleans from struct UserDefined
- is_fwrite_set
- free_referer
- strip_path_slash

Closes #8940
2022-06-01 08:12:09 +02:00
Tatsuhiro Tsujikawa 3288e9c6d3
ngtcp2: enable Linux GSO
Enable Linux GSO in ngtcp2 QUIC.  In order to recover from the
EAGAIN/EWOULDBLOCK by sendmsg with multiple packets in one GSO write,
packet buffer is now held by struct quicsocket.  GSO write might fail in
runtime depending on NIC.  Disable GSO if sendmsg returns EIO.

Closes #8909
2022-05-31 16:04:12 +02:00
Daniel Stenberg b7baa78451
headers_push: error out if a folded header has no previous header
As that would indicate an illegal header. The fuzzer reached the assert
in unfold_value() proving that this case can happen.

Follow-up to c9b60f0053

Closes #8939
2022-05-31 14:03:44 +02:00
Daniel Stenberg eeaae10c0f
netrc: support quoted strings
The .netrc parser now accepts strings within double-quotes in order to
deal with for example passwords containing white space - which
previously was not possible.

A password that starts with a double-quote also ends with one, and
double-quotes themselves are escaped with backslashes, like \". It also
supports \n, \r and \t for newline, carriage return and tabs
respectively.

If the password does not start with a double quote, it will end at first
white space and no escaping is performed.

WARNING: this change is not entirely backwards compatible. If anyone
previously used a double-quote as the first letter of their password,
the parser will now get it differently compared to before. This is
highly unfortunate but hard to avoid.

Reported-by: ImpatientHippo on GitHub
Fixes #8908
Closes #8937
2022-05-31 09:04:56 +02:00
Daniel Stenberg 4d94fac9f0
headers api: remove EXPERIMENTAL tag
Closes #8900
2022-05-30 14:13:48 +02:00
Daniel Gustafsson 739275a1d9 cookies: fix documentation comment
Commit 4073cd83b2 added the noexpire parameter to Curl_cookie_add but
missed updating the documentation comment at the head of the file.
2022-05-30 13:46:25 +02:00
Viktor Szakats a77d14d22a
cmake: do not add libcurl.rc to the static libcurl library
Fixes: https://github.com/curl/curl/pull/8918#issuecomment-1138263855

Reviewed-By: Karlson2k@users.noreply.github.com
Closes #8923
2022-05-26 15:54:47 +00:00
Daniel Stenberg b67dcc8ed7
c-hyper: mark status line as status for Curl_client_write()
To make sure the headers API can filter it out as not a regular header.

Reported-by: Gisle Vanem
Fixes #8894
Closes #8914
2022-05-25 13:07:12 +02:00
Daniel Stenberg 5bf1ff002d
headers: fix the unfold realloc to use proper new size
Previously it didn't take the old name length into acount

Follow-up to: c9b60f0053
Closes #8913
2022-05-25 11:56:25 +02:00
Daniel Stenberg c9b60f0053
http: restore header folding behavior
Folded header lines will now get passed through like before. The headers
API is adapted and will provide the content unfolded.

Added test 1274 and extended test 1940 to verify.

Reported-by: Petr Pisar
Fixes #8844
Closes #8899
2022-05-24 23:33:47 +02:00
Viktor Szakats 16a58e9f93
Makefile.m32: delete obsolete options, improve -On [ci skip]
- `-D_AMD64_` has not been necessary for mingw-w64 builds for a long time now.
- `-fno-strict-aliasing` is mentioned for Intel C compiler in autotools, and
  I used this with VxWorks in another project, but otherwise this isn't
  necessary anymore as a default. If a target still needs it, it can be
  added with `CURL_CFLAG_EXTRAS=-fno-strict-aliasing`
- bump up default optimization level to `-O3` (from `-O2`), and also rearrange
  option order so the default can now be overridden via
  `CURL_CFLAG_EXTRAS`.
- delete `-g` (generate debug info) from `CFLAGS` and `-s` from `LDFLAGS`
  (strip debug info). They were working against each other. Now, if someone
  needs debug info, it can be enabled via `CURL_CFLAG_EXTRAS=-g`

Closes #8904
2022-05-24 17:04:38 +00:00
Daniel Gustafsson e70928b091 doh: remove UNITTEST macro definition
The UNITTEST macro is defined by curl_setup.h so there is no use in
carry a local copy of the logic.

Closes: #8902
Reviewed-by: Daniel Stenberg <daniel@haxx.se>
2022-05-24 12:46:22 +02:00
Daniel Stenberg dcaae6bb5b
cookie: fix false positive "potentially uninitialized local variable"
Reviewed-by: Daniel Gustafsson
Closes #8903
2022-05-24 12:16:08 +02:00
Daniel Stenberg 5a4dbb8ae3
hyper: use 'alt-used'
Makes test 412+413 work

Closes #8898
2022-05-23 16:47:17 +02:00
Daniel Stenberg 7bc785387d
CURLINFO_CAPATH/CAINFO: get the default CA paths from libcurl
Closes #8888
2022-05-23 08:44:29 +02:00
Daniel Stenberg 3c8b969de6
links: update dead links
The wiki pages are gone, remove and link to more long-living docs.

Closes #8897
2022-05-23 08:40:13 +02:00
Daniel Stenberg 216636a4ce
ntlm: (void) typecast msnprintf() where we ignore return code
Follow-up to 5a41abef6, to please Coverity
2022-05-23 08:13:48 +02:00
Daniel Gustafsson 5a41abef6d ntlm: copy NTLM_HOSTNAME to host buffer
Commit 709ae2454f added a fake hostname to avoid leaking the local
hostname, but omitted copying it to the host buffer.  Fix by copying
and adjust the test fallout.

Closes: #8895
Fixes: #8893
Reported-by: Patrick Monnerat <patrick@monnerat.net>
Reviewed-by: Daniel Stenberg <daniel@haxx.se>
2022-05-22 23:26:24 +02:00
Tatsuhiro Tsujikawa 8ea851b29d
ngtcp2: Allow curl to send larger UDP datagrams
Allow curl to send larger UDP datagram if Path MTU Discovery finds the
availability of larger path MTU.  To make it work and not to send
fragmented packet, we need to set DF bit.  That makes send(2) fail with
EMSGSIZE if UDP datagram is too large.  In that case, just let it be
lost.  This patch enables DF bit for Linux only.

Closes #8883
2022-05-20 17:50:38 +02:00
Daniel Stenberg 709ae2454f
ntlm: provide a fixed fake host name
The NTLM protocol includes providing the local host name, but apparently
other implementations already provide a fixed fake name instead to avoid
leaking the real local name.

The exact name used is 'WORKSTATION', because Firefox uses that.

The change is written to allow someone to "back-pedal" fairly easy in
case of need.

Reported-by: Carlo Alberto
Fixes #8859
Closes #8889
2022-05-20 16:24:13 +02:00
Daniel Stenberg a7a18d7589
wolfssl: correct the failf() message when a handle can't be made
Closes #8885
2022-05-19 19:05:17 +02:00
Viktor Szakats a820c55a72
Makefile.m32: delete two obsolete OpenSSL options [ci skip]
- -DOPENSSL_NO_KRB5: No longer used by OpenSSL 1.1.x, 3.x, or
  LibreSSL 3.5.x, yet it collides with the latter, which defines
  it unconditionally, resulting in this warning:
    ../../libressl/include/openssl/opensslfeatures.h:14:9: warning: 'OPENSSL_NO_KRB5' macro redefined [-Wmacro-redefined]
  It was originally added to curl in 2004.

- -DHAVE_OPENSSL_PKCS12_H: No longer used by OpenSSL 1.1.x, 3.x, or
  LibreSSL back to at least 2.5.5. Originally added in the same
  commit as the above, in 2004.

Closes #8884
2022-05-19 16:47:54 +00:00
Balakrishnan Balasubramanian dfa84a0450
socks: support unix sockets for socks proxy
Usage:
  curl -x "socks5h://localhost/run/tor/socks" "https://example.com"

Updated runtests.pl to run a socksd server listening on unix socket

Added tests test1467 test1468

Added documentation for proxy command line option and socks proxy
options

Closes #8668
2022-05-19 15:35:03 +02:00
Vincent Torri ee52bead4d
cmake: add libpsl support
Fixes #8865
Closes #8867
2022-05-19 15:29:55 +02:00
Tatsuhiro Tsujikawa 9accb9a5be
ngtcp2: extend QUIC transport parameters buffer
Extend QUIC transport parameters buffer because 64 bytes are too
short for the ever increasing parameters.

Closes #8872
2022-05-19 14:56:50 +02:00
Tatsuhiro Tsujikawa 136ab928c8
ngtcp2: handle error from ngtcp2_conn_submit_crypto_data
Closes #8871
2022-05-19 14:55:37 +02:00
Tatsuhiro Tsujikawa fe1d00e71b
ngtcp2: send appropriate connection close error code
Closes #8870
2022-05-19 14:54:46 +02:00