Commit Graph

29778 Commits

Author SHA1 Message Date
Daniel Stenberg
da8e97b5d0
ws: use %Ou for outputting curl_off_t with info()
Reported-by: Mike Duglas
Fixes #10439
Closes #10441
2023-02-09 08:15:24 +01:00
Jay Satiro
b4b6e4f1fa curl_setup: Disable by default recv-before-send in Windows
Prior to this change a workaround for Windows to recv before every send
was enabled by default. The way it works is a recv is called before
every send and saves the received data, in case send fails because in
Windows apparently that can wipe out the socket's internal received
data buffer.

This feature has led to several bugs because the way libcurl operates
it waits on a socket to read or to write, and may not at all times
check for buffered receive data.

Two recent significant bugs this workaround caused:
- Broken Schannel TLS 1.3 connections (#9431)
- HTTP/2 arbitrary hangs (#10253)

The actual code remains though it is disabled by default. Though future
changes to connection filter buffering could improve the situation IMO
it's just not tenable to manage this workaround.

Ref: https://github.com/curl/curl/issues/657
Ref: https://github.com/curl/curl/pull/668
Ref: https://github.com/curl/curl/pull/720

Ref: https://github.com/curl/curl/issues/9431
Ref: https://github.com/curl/curl/issues/10253

Closes https://github.com/curl/curl/pull/10409
2023-02-09 01:30:10 -05:00
Stefan Eissing
ead2b2d4f6
http2: aggregate small SETTINGS/PRIO/WIN_UPDATE frames
add a small buffer to nghttp2 session sending in order to aggregate
small SETTINGS/PRIO/WIN_UPDATE frames that nghttp2 "writes" to the
callback individually.

Ref: #10389
Closes #10432
2023-02-08 10:41:15 +01:00
Stefan Eissing
e8b00fcd6a
openssl: store the CA after first send (ClientHello)
move Curl_ssl_setup_x509_store() call after the first send (ClientHello)
this gives time to parse CA anchors while waiting on the server reply

Ref: #10389
Closes #10432
2023-02-08 10:41:11 +01:00
Daniel Stenberg
341280e161
RELEASE-NOTES: synced 2023-02-08 09:31:29 +01:00
Anthony Hu
12e9186fc4
wolfssl: remove deprecated post-quantum algorithms
Closes #10440
2023-02-08 08:31:45 +01:00
John Bampton
0065b146eb
misc: fix spelling
Closes #10437
2023-02-08 08:30:05 +01:00
Daniel Stenberg
1695fcf57d
man pages: call the custom user pointer 'clientp' consistently
The variable had a few different names. Now try to use 'clientp'
consistently for all man pages using a custom pointer set by the
application.

Reported-by: Gerrit Renker

Fixes #10434
Closes #10435
2023-02-07 22:33:47 +01:00
Daniel Stenberg
1c91ba3939
vtls: infof using %.*s needs to provide the length as int
Fixes a Coverity warning.

Closes #10436
2023-02-07 16:33:04 +01:00
Stefan Eissing
7dad86a03f
vrls: addressing issues reported by coverity
I believe the code was secure before this, but limiting the accepted
name length to what is used in the structures should help Coverity's
analysis.

Closes #10431
2023-02-07 14:05:21 +01:00
Daniel Stenberg
95fe2bba74
tool_operate: move the 'updated' variable
This was already done by Dan Fandrich in the previous PR but somehow I
lost that fixup.

Follow-up to 349c5391f2
2023-02-07 12:16:13 +01:00
Dan Fandrich
df3722a46c
tool_operate: Fix error codes during DOS filename sanitize
It would return CURLE_URL_MALFORMAT in an OOM condition.

Closes #10414
2023-02-07 08:20:19 +01:00
Dan Fandrich
349c5391f2
tool_operate: Fix error codes on bad URL & OOM
curl would erroneously report CURLE_OUT_OF_MEMORY in some cases instead
of CURLE_URL_MALFORMAT. In other cases, it would erroneously return
CURLE_URL_MALFORMAT instead of CURLE_OUT_OF_MEMORY.  Add a test case to
test the former condition.

Fixes #10130
Closes #10414
2023-02-07 08:20:04 +01:00
Daniel Stenberg
a0adda4b47
setopt: use >, not >=, when checking if uarg is larger than uint-max
Closes #10421
2023-02-06 23:42:27 +01:00
Daniel Stenberg
82123417ff
vtls: fix failf() format argument type for %.*s handling
Reported by Coverity

Closes #10422
2023-02-06 23:41:21 +01:00
Daniel Stenberg
b0b33fe71d
openssl: fix "Improper use of negative value"
By getting the socket first and returning error in case of bad socket.

Detected by Coverity.

Closes #10423
2023-02-06 23:40:20 +01:00
Dan Fandrich
30607e77dc packages: Remove Android.mk from makefile
This was missed in commit #44141512

Ref: #10418
2023-02-06 14:02:06 -08:00
Daniel Stenberg
ff7c390b29
curl_ws_send.3: clarify how to send multi-frame messages 2023-02-06 17:27:51 +01:00
Mike Duglas
ad55b23634
ws: fix multiframe send handling
Fixes #10413
Closes #10420
2023-02-06 17:27:46 +01:00
Daniel Stenberg
51e9cff268
unit2600: make sure numerical curl_easy_setopt sets long
Follow-up to 671158242d

Reported-by: Marcel Raad
Fixes #10410
Closes #10419
2023-02-06 17:26:18 +01:00
andy5995
4f051d0e54
GHA: move Slackware test into matrix
Closes #10412
2023-02-06 09:57:53 +01:00
Pronyushkin Petr
2b46ce0313
urlapi: fix part of conditional expression is always true: qlen
Closes #10408
2023-02-06 08:53:07 +01:00
Pronyushkin Petr
690c43b3ee
url: fix part of conditional expression is always true
Closes #10407
2023-02-06 08:51:31 +01:00
Daniel Stenberg
6740cf9ea0
RELEASE-NOTES: synced 2023-02-06 08:35:03 +01:00
Philip H
b87664445c
GHA/macos.yml: bump to gcc-12
Closes #10415
2023-02-06 08:20:03 +01:00
Daniel Stenberg
44141512ed
packages: remove Android, update README
- Nobody builds curl for Android using this anymore
- Refreshed the README and converted to markdown

Reported-by: John Porter
Fixes #10416
Closes #10418
2023-02-06 08:18:21 +01:00
Kvarec Lezki
74040ddecb fopen: remove unnecessary assignment
[CWE-1164] V1048: The '* tempname' variable was assigned the same value.

Ref: https://pvs-studio.com/en/docs/warnings/v1048/

Closes https://github.com/curl/curl/pull/10398
2023-02-05 03:15:08 -05:00
Gisle Vanem
62097a7ea4 libtest: add a sleep macro for Windows
.. because sleep() is used in some libtests.

Closes https://github.com/curl/curl/pull/10295
2023-02-05 03:15:07 -05:00
Kvarec Lezki
97f7f668d6
http_aws_sigv4: remove typecasts from HMAC_SHA256 macro
V220: Suspicious sequence of types castings: memsize -> 32-bit integer -> memsize.

https://pvs-studio.com/en/docs/warnings/v220/

Closes #10400
2023-02-03 10:07:28 +01:00
Daniel Stenberg
2537808d9e
mailmap: Thomas1664 on github 2023-02-03 10:04:34 +01:00
Thomas1664
c29ccb35ff
CURLOPT_WRITEFUNCTION.3: fix memory leak in example
Closes #10390
2023-02-03 10:02:47 +01:00
Kvarec Lezki
80c98ef6d2
doh: ifdef IPv6 code
For disabled IPv6 a condition (conn->ip_version != CURL_IPRESOLVE_V4) is
always false. https://pvs-studio.com/en/docs/warnings/v560/

Closes #10397
2023-02-03 08:23:27 +01:00
Daniel Stenberg
37554d7c07
urlapi: remove pathlen assignment
"Value stored to 'pathlen' is never read"

Follow-up to 804d5293f8

Reported-by: Kvarec Lezki

Closes #10405
2023-02-03 08:20:21 +01:00
Kvarec Lezki
e1f78ce25b
http: fix "part of conditional expression is always false"
[CWE-570] V560: A part of conditional expression is always false: conn->bits.authneg.
[CWE-570] V560: A part of conditional expression is always false: conn->handler->protocol & (0 | 0).

https://pvs-studio.com/en/docs/warnings/v560/

Closes #10399
2023-02-03 08:17:18 +01:00
Daniel Stenberg
63c53ea627
urlapi: skip the extra dedotdot alloc if no dot in path
Saves an allocation for many/most URLs.

Updates test 1395 accordingly

Closes #10403
2023-02-02 22:34:32 +01:00
Stefan Eissing
671158242d
connections: introduce http/3 happy eyeballs
New cfilter HTTP-CONNECT for h3/h2/http1.1 eyeballing.
- filter is installed when `--http3` in the tool is used (or
  the equivalent CURLOPT_ done in the library)
- starts a QUIC/HTTP/3 connect right away. Should that not
  succeed after 100ms (subject to change), a parallel attempt
  is started for HTTP/2 and HTTP/1.1 via TCP
- both attempts are subject to IPv6/IPv4 eyeballing, same
  as happens for other connections
- tie timeout to the ip-version HAPPY_EYEBALLS_TIMEOUT
- use a `soft` timeout at half the value. When the soft timeout
  expires, the HTTPS-CONNECT filter checks if the QUIC filter
  has received any data from the server. If not, it will start
  the HTTP/2 attempt.

HTTP/3(ngtcp2) improvements.
- setting call_data in all cfilter calls similar to http/2 and vtls filters
  for use in callback where no stream data is available.
- returning CURLE_PARTIAL_FILE for prematurely terminated transfers
- enabling pytest test_05 for h3
- shifting functionality to "connect" UDP sockets from ngtcp2
  implementation into the udp socket cfilter. Because unconnected
  UDP sockets are weird. For example they error when adding to a
  pollset.

HTTP/3(quiche) improvements.
- fixed upload bug in quiche implementation, now passes 251 and pytest
- error codes on stream RESET
- improved debug logs
- handling of DRAIN during connect
- limiting pending event queue

HTTP/2 cfilter improvements.
- use LOG_CF macros for dynamic logging in debug build
- fix CURLcode on RST streams to be CURLE_PARTIAL_FILE
- enable pytest test_05 for h2
- fix upload pytests and improve parallel transfer performance.

GOAWAY handling for ngtcp2/quiche
- during connect, when the remote server refuses to accept new connections
  and closes immediately (so the local conn goes into DRAIN phase), the
  connection is torn down and a another attempt is made after a short grace
  period.
  This is the behaviour observed with nghttpx when we tell it to  shut
  down gracefully. Tested in pytest test_03_02.

TLS improvements
- ALPN selection for SSL/SSL-PROXY filters in one vtls set of functions, replaces
  copy of logic in all tls backends.
- standardized the infof logging of offered ALPNs
- ALPN negotiated: have common function for all backends that sets alpn proprty
  and connection related things based on the negotiated protocol (or lack thereof).

- new tests/tests-httpd/scorecard.py for testing h3/h2 protocol implementation.
  Invoke:
    python3 tests/tests-httpd/scorecard.py --help
  for usage.

Improvements on gathering connect statistics and socket access.
- new CF_CTRL_CONN_REPORT_STATS cfilter control for having cfilters
  report connection statistics. This is triggered when the connection
  has completely connected.
- new void Curl_pgrsTimeWas(..) method to report a timer update with
  a timestamp of when it happend. This allows for updating timers
  "later", e.g. a connect statistic after full connectivity has been
  reached.
- in case of HTTP eyeballing, the previous changes will update
  statistics only from the filter chain that "won" the eyeballing.
- new cfilter query CF_QUERY_SOCKET for retrieving the socket used
  by a filter chain.
  Added methods Curl_conn_cf_get_socket() and Curl_conn_get_socket()
  for convenient use of this query.
- Change VTLS backend to query their sub-filters for the socket when
  checks during the handshake are made.

HTTP/3 documentation on how https eyeballing works.

TLS improvements
- ALPN selection for SSL/SSL-PROXY filters in one vtls set of functions, replaces
  copy of logic in all tls backends.
- standardized the infof logging of offered ALPNs
- ALPN negotiated: have common function for all backends that sets alpn proprty
  and connection related things based on the negotiated protocol (or lack thereof).

Scorecard with Caddy.
- configure can be run with `--with-test-caddy=path` to specify which caddy to use for testing
- tests/tests-httpd/scorecard.py now measures download speeds with caddy

pytest improvements
- adding Makfile to clean gen dir
- adding nghttpx rundir creation on start
- checking httpd version 2.4.55 for test_05 cases where it is needed. Skipping with message if too old.
- catch exception when checking for caddy existance on system.

Closes #10349
2023-02-02 09:57:34 +01:00
Daniel Stenberg
b7aaf074e5
CODEOWNERS: remove the peeps mentioned as CI owners
These owners do not have the bandwidth/energy to do the reviews which
makes PRs stall and this ownership claim flawed. We can bring people
back when the situation is different.

Follow-up to c04c78ac87

Closes #10386
2023-02-02 08:42:29 +01:00
Martin D'Aloia
3cc9df1817
write-out.d: add 'since version' to %{header_json} documentation
The documentation of `%{header_json}` missed to mention since which
version this variable for `--write-out` is present.

Based on commit https://github.com/curl/curl/commit/4133a69f2daa476bb
we can determine from the tags were this commit is present that the
first version to include it was `7.83.0`.
This could be also checked with:
`git tag --contains 4133a69f2daa476bb6d902687f1dd6660ea9c3c5`

Closes #10395
2023-02-02 08:31:41 +01:00
Daniel Stenberg
7305ca63e2
urlapi: avoid Curl_dyn_addf() for hex outputs
Inspired by the recent fixes to escape.c, we should avoid calling
Curl_dyn_addf() in loops, perhaps in particular when adding something so
simple as %HH codes - for performance reasons. This change makes the
same thing for the URL parser's two URL-encoding loops.

Closes #10384
2023-02-01 23:05:51 +01:00
Daniel Stenberg
804d5293f8
urlapi: skip path checks if path is just "/"
As a miniscule optimization, treat a path of the length 1 as the same as
non-existing, as it can only be a single leading slash, and that's what
we do for no paths as well.

Closes #10385
2023-02-01 23:04:45 +01:00
Philip H
92d4053afd
GHA/macos: use Xcode_14.0.1 for cmake builds
Fixes #10356
Closes #10381
2023-02-01 11:36:40 +01:00
Viktor Szakats
48eb71ade4
tls: fixes for wolfssl + openssl combo builds
1. Add `USE_WOLFSSL` to the TLS backend priority list in
   `lib/curl_ntlm_core.c`.

2. Fix `lib/curl_ntlm_core.h` to respect TLS backend priority, bringing
   it in sync with the above list and `lib/curl_ntlm_core.c` itself.

   Reported-by: Mark Roszko
   Ref: https://github.com/curl/curl/issues/10321

3. Allow enabling both wolfSSL and OpenSSL at the same time in
   `lib/Makefile.mk` bringing this in line with cmake/autotools builds.
   Update logic to select the crypto-specific lib for `ngtcp2`, which
   supports a single TLS backend at the same time.

Closes #10322
2023-02-01 09:47:16 +00:00
Daniel Stenberg
53be6f3840
RELEASE-NOTES: synced 2023-02-01 08:08:07 +01:00
Daniel Stenberg
886861b38f
docs/INSTALL: document how to use multiple TLS backends
And document how OpenSSL forks and wolfSSL cannot be used at the same
time.

Reported-by: Mark Roszko
Fixes #10321
Closes #10382
2023-02-01 08:00:55 +01:00
Kvarec Lezki
9caa7bc930
cookies: fp is always not NULL
Closes #10383
2023-02-01 07:57:06 +01:00
Daniel Stenberg
fc8ad0b23c
escape: use table lookup when adding %-codes to output
On my dev host, this code runs 7.8 times faster.

Closes #10377
2023-01-31 22:42:21 +01:00
Daniel Stenberg
b1e8cd52d9
unit2600: avoid error: ‘TEST_CASES’ defined but not used
Follow-up to d55de24dce

Closes #10379
2023-01-31 18:20:13 +01:00
Daniel Stenberg
f1f8acb3b9
escape: hex decode with a lookup-table
Makes the decoding 2.8 times faster in my tests.

Closes #10376
2023-01-31 15:03:19 +01:00
Daniel Stenberg
1ca483a40c
cf-socket: fix build error wo TCP_FASTOPEN_CONNECT
Follow-up to 5651a36d1a

Closes #10378

Reviewed-by: Stefan Eissing
2023-01-31 14:35:39 +01:00
Stefan Eissing
91eb197a9e
CI: add pytest github workflow to CI test/tests-httpd on a HTTP/3 setup
Closes #10317
2023-01-31 12:04:23 +01:00