Commit Graph

31624 Commits

Author SHA1 Message Date
Viktor Szakats
02f91d5b64
libssh2: use libssh2_session_callback_set2() with v1.11.1
To avoid a local hack to pass function pointers and to avoid
deprecation warnings when building with libssh2 v1.11.1 or newer:
```
lib/vssh/libssh2.c:3324:5: warning: 'libssh2_session_callback_set' is deprecated: since libssh2 1.11.1. Use libssh2_session_callback_set2() [-Wdeprecated-declarations]
lib/vssh/libssh2.c:3326:5: warning: 'libssh2_session_callback_set' is deprecated: since libssh2 1.11.1. Use libssh2_session_callback_set2() [-Wdeprecated-declarations]
```
Ref: https://github.com/curl/curl-for-win/actions/runs/7609484879/job/20720821100#step:3:4982

Ref: https://github.com/libssh2/libssh2/pull/1285
Ref: c0f69548be
Reviewed-by: Daniel Stenberg
Closes #12754
2024-01-22 16:10:45 +00:00
Daniel Stenberg
cdd905a985
transfer: make the select_bits_paused condition check both directions
If there is activity in a direction that is not paused, return false.

Reported-by: Sergey Bronnikov
Bug: https://curl.se/mail/lib-2024-01/0049.html
Closes #12740
2024-01-22 16:22:19 +01:00
Stefan Eissing
0535f6ec71
http3: initial support for OpenSSL 3.2 QUIC stack
- HTTP/3 for curl using OpenSSL's own QUIC stack together
  with nghttp3
- configure with `--with-openssl-quic` to enable curl to
  build this. This requires the nghttp3 library
- implementation with the following restrictions:
  * macOS has to use an unconnected UDP socket due to an
    issue in OpenSSL's datagram implementation
    See https://github.com/openssl/openssl/issues/23251
    This makes connections to non-reponsive servers hang.
  * GET requests will send the indicator that they have
    no body in a separate QUIC packet. This may result
    in processing delays or Transfer-Encodings on proxied
    requests
  * uploads that encounter blocks will use 100% cpu as
    detection of these flow control issue is not working
    (we have not figured out to pry that from OpenSSL).

Closes #12734
2024-01-22 16:15:45 +01:00
Viktor Szakats
f81a335e85
cmake: fix ENABLE_MANUAL option
Fix the `ENABLE_MANUAL` option. Set it to default to `OFF`.

Before this patch `ENABLE_MANUAL=ON` was a no-op, even though it was the
option designed to enable building and using the built-in curl manual.
(`USE_MANUAL=ON` option worked for this instead, by accident).

Ref: https://github.com/curl/curl/pull/12730#issuecomment-1902572409
Closes #12749
2024-01-22 09:34:38 +00:00
Mohammadreza Hendiani
ca01aca878
TODO: update broken link to ratelimit-headers draft
Closes #12741
2024-01-19 18:18:05 +01:00
Daniel Stenberg
ed420d9329
cmake: when USE_MANUAL=YES, build the curl.1 man page
Fixes KNOWN_BUG 15.4

Closes #12742
2024-01-19 18:14:56 +01:00
Daniel Stenberg
42be71e3ed
cmdline-opts/write-out.d: remove spurious double quotes 2024-01-19 16:37:14 +01:00
Stefan Eissing
524253dc90
rtsp: Convert assertion into debug log
Bug: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=65934

- write excess bytes to the client where the standard excess bytes
  checks will report any wrongness and fail the transfer

Fixes #12738
Closes #12739
2024-01-19 12:15:36 +01:00
Daniel Stenberg
c8cffcb8d4
headers: remove assert from Curl_headers_push
The fuzzer managed to reach the function without a terminating CR or LF
so let's handle it normally. While there, remove the goto.

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

Closes #12721
2024-01-19 09:16:44 +01:00
Daniel Stenberg
48aaab55a5
curl_easy_getinfo.3: remove the wrong time value count
It said "six" time values but they are eight by now. Remove the mention
of the amount.

Closes #12727
2024-01-18 08:57:41 +01:00
Viktor Szakats
434db995a7
mbedtls: fix -Wnull-dereference and -Wredundant-decls
- Silence warning in mbedTLS v3.5.1 public headers:
  ```
  ./mbedtls/_x64-linux-musl/usr/include/psa/crypto_extra.h:489:14: warning: redundant redeclaration of 'psa_set_key_domain_parameters' [-Wredundant-decls]
  ./mbedtls/_x64-linux-musl/usr/include/psa/crypto_struct.h:354:14: note: previous declaration of 'psa_set_key_domain_parameters' was here
  ```
  Ref: ecec68a2c1
  Ref: https://github.com/libssh2/libssh2/pull/1226

- Fix compiler warnings seen with gcc 9.2.0 + cmake unity:
  ```
  ./curl/lib/vtls/mbedtls.c: In function 'mbedtls_bio_cf_read':
  ./curl/lib/vtls/mbedtls.c:189:11: warning: null pointer dereference [-Wnull-dereference]
    189 |   nread = Curl_conn_cf_recv(cf->next, data, (char *)buf, blen, &result);
        |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ./curl/lib/vtls/mbedtls.c: In function 'mbedtls_bio_cf_write':
  ./curl/lib/vtls/mbedtls.c:168:14: warning: null pointer dereference [-Wnull-dereference]
    168 |   nwritten = Curl_conn_cf_send(cf->next, data, (char *)buf, blen, &result);
        |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ```

- delete stray `#else`.

Closes #12720
2024-01-18 07:09:31 +00:00
Daniel Stenberg
6b930f1bfb
docs: cleanup nroff format use
- remove use of .BI for code snippet
- stop using .br, just do a blank line
- remove use of .PP
- remove use for .sp
- remove backslash in .IP
- use .IP instead of .TP

Closes #12731
2024-01-17 23:20:17 +01:00
Stefan Eissing
2462c9d594
test2307: fix expected failure code after ws refactoring
Fixes #12722
Closes #12728
2024-01-17 14:20:05 +01:00
Jay Satiro
7aa24f32db cf-socket: show errno in tcpkeepalive error messages
- If the socket keepalive options (TCP_KEEPIDLE, etc) cannot be set
  then show the errno in the verbose error messages.

Ref: https://github.com/curl/curl/discussions/12715#discussioncomment-8151652

Closes https://github.com/curl/curl/pull/12726
2024-01-17 03:05:45 -05:00
Jay Satiro
f4606a796e tool_getparam: stop supporting @filename style for --cookie
The `@filename` style was never documented for --cookie <data|filename>
but prior to this change curl would accept it anyway and always treat a
@ prefixed string as a filename.

That's a problem if the string also contains a = sign because then it is
documented to be interpreted as a cookie string and not a filename.

Example:

`--cookie @foo=bar`

Before: Interpreted as load cookies from filename foo=bar.

After: Interpreted as cookie `@foo=bar` (name `@foo` and value `bar`).

Other curl options with a data/filename option-value use the `@filename`
to distinguish filenames which is probably how this happened. The
--cookie option has never been documented that way.

Ref: https://curl.se/docs/manpage.html#-b

Closes https://github.com/curl/curl/pull/12645
2024-01-17 00:32:28 -05:00
Stefan Eissing
3378d2bd09
websockets: refactor decode chain
- use client writer stack for decoding frames
- move websocket protocol handler to ws.c

Closes #12713
2024-01-16 16:43:24 +01:00
Stefan Eissing
49ca84144e
websockets: check for negative payload lengths
- in en- and decoding, check the websocket frame payload lengths for
  negative values (from curl_off_t) and error the operation in that case
- add test 2307 to verify

Closes #12707
2024-01-16 14:56:15 +01:00
Daniel Stenberg
9034a16d97
docs: mention env vars not used by schannel
Ref: #12704

Co-authored-by: Jay Satiro <raysatiro@yahoo.com>

Closes #12711
2024-01-16 11:02:13 +01:00
Daniel Stenberg
ae9f01f336
tool_operate: make --remove-on-error only remove "real" files
Reported-by: Harry Sintonen
Assisted-by: Dan Fandrich

Closes #12710
2024-01-16 10:57:12 +01:00
Jay Wu
c5801a28c5
url: don't set default CA paths for Secure Transport backend
As the default for this backend is the native CA store.

Closes #12704
2024-01-16 10:48:36 +01:00
Lin Sun
4224d6e0f3
asyn-ares: with modern c-ares, use its default timeout
Closes #12703
2024-01-16 10:45:58 +01:00
Daniel Stenberg
ba01cac39b
tool_operate: stop setting the file comment on Amiga
- the URL is capped at 80 cols, which ruins it if longer
- it does not strip off URL credentials
- it is done unconditonally, not on --xattr
- we don't have Amiga in the CI which makes fixing it blindly fragile

Someone who builds and tests on Amiga can add it back correctly in a
future if there is a desire.

Reported-by: Harry Sintonen
Closes #12709
2024-01-15 18:21:16 +01:00
Stefan Eissing
036eb150d1
rtsp: deal with borked server responses
- enforce a response body length of 0, if the
  response has no Content-lenght. This is according
  to the RTSP spec.
- excess bytes in a response body are forwarded to
  the client writers which will report and fail the
  transfer

Follow-up to d7b6ce6
Fixes #12701
Closes #12706
2024-01-15 14:13:58 +01:00
Daniel Stenberg
72bd88adde
version: show only the libpsl version, not its dependencies
The libpsl version output otherwise also includes version number for its
dependencies, like IDN lib, but since libcurl does not use libpsl's IDN
functionality those components are not important.

Ref: https://github.com/curl/curl-for-win/issues/63
Closes #12700
2024-01-14 23:33:22 +01:00
bch
e3b386f86f
curl.h: CURLOPT_DNS_SERVERS is only available with c-ares
Closes #12695
2024-01-14 18:18:43 +01:00
Daniel Stenberg
aaab6cb0c4
cmdline-opts/gen.pl: error on initital blank line
After the "---" separator, there should be no blank line and this script
now errors out if one is detected.

Ref: #12696
Closes #12698
2024-01-14 18:12:14 +01:00
Daniel Stenberg
e186ca6534
cf-h1-proxy: no CURLOPT_USERAGENT in CONNECT with hyper
Follow-up to 693cd16793 which was incomplete

Ref #12680
Closes #12697
2024-01-14 18:11:15 +01:00
Daniel Stenberg
beb2283746
curl_multi_fdset.3: remove mention of null pointer support
... since this funtion has not supported null pointer fd_set arguments since
at least 2006. (That's when I stopped my git blame journey)

Fixes #12691
Reported-by: sfan5 on github
Closes #12692
2024-01-14 14:53:38 +01:00
Mark Huang
3167dab0d5
docs/cmdline: remove unnecessary line breaks
Closes #12696
2024-01-14 14:45:23 +01:00
Daniel Stenberg
adfffc39a3
transfer: remove warning: Value stored to 'blen' is never read
Detected by scan-build

Follow-up from 1cd2f0072f

Closes #12693
2024-01-14 14:33:46 +01:00
Stefan Eissing
d7b6ce64ce
lib: replace readwrite with write_resp
This clarifies the handling of server responses by folding the code for
the complicated protocols into their protocol handlers. This concerns
mainly HTTP and its bastard sibling RTSP.

The terms "read" and "write" are often used without clear context if
they refer to the connect or the client/application side of a
transfer. This PR uses "read/write" for operations on the client side
and "send/receive" for the connection, e.g. server side. If this is
considered useful, we can revisit renaming of further methods in another
PR.

Curl's protocol handler `readwrite()` method been changed:

```diff
-  CURLcode (*readwrite)(struct Curl_easy *data, struct connectdata *conn,
-                        const char *buf, size_t blen,
-                        size_t *pconsumed, bool *readmore);
+  CURLcode (*write_resp)(struct Curl_easy *data, const char *buf, size_t blen,
+                         bool is_eos, bool *done);
```

The name was changed to clarify that this writes reponse data to the
client side. The parameter changes are:

* `conn` removed as it always operates on `data->conn`
* `pconsumed` removed as the method needs to handle all data on success
* `readmore` removed as no longer necessary
* `is_eos` as indicator that this is the last call for the transfer
  response (end-of-stream).
* `done` TRUE on return iff the transfer response is to be treated as
  finished

This change affects many files only because of updated comments in
handlers that provide no implementation. The real change is that the
HTTP protocol handlers now provide an implementation.

The HTTP protocol handlers `write_resp()` implementation will get passed
**all** raw data of a server response for the transfer. The HTTP/1.x
formatted status and headers, as well as the undecoded response
body. `Curl_http_write_resp_hds()` is used internally to parse the
response headers and pass them on. This method is public as the RTSP
protocol handler also uses it.

HTTP/1.1 "chunked" transport encoding is now part of the general
*content encoding* writer stack, just like other encodings. A new flag
`CLIENTWRITE_EOS` was added for the last client write. This allows
writers to verify that they are in a valid end state. The chunked
decoder will check if it indeed has seen the last chunk.

The general response handling in `transfer.c:466` happens in function
`readwrite_data()`. This mainly operates now like:

```
static CURLcode readwrite_data(data, ...)
{
  do {
    Curl_xfer_recv_resp(data, buf)
    ...
    Curl_xfer_write_resp(data, buf)
    ...
  } while(interested);
  ...
}
```

All the response data handling is implemented in
`Curl_xfer_write_resp()`. It calls the protocol handler's `write_resp()`
implementation if available, or does the default behaviour.

All raw response data needs to pass through this function. Which also
means that anyone in possession of such data may call
`Curl_xfer_write_resp()`.

Closes #12480
2024-01-13 17:23:42 +01:00
Daniel Stenberg
d587ab422d
RELEASE-NOTES: synced 2024-01-13 17:02:45 +01:00
Daniel Stenberg
9582f20d8a
TODO: TFTP doesn't convert LF to CRLF for mode=netascii
Closes #12655
Closes #12690
2024-01-13 16:26:17 +01:00
Daniel Stenberg
9729560a6f
gen: do italics/bold for a range of letters, not just single word
Previously it would match only on a sequence of non-space, which made it
miss to highlight for example "public suffix list".

Updated the recent cookie.d edit from 5da57193b7 to use bold instead
of italics.

Closes #12689
2024-01-13 16:25:20 +01:00
Daniel Stenberg
5da57193b7
docs: describe and highlight super cookies
Reported-by: Yadhu Krishna M

Closes #12687
2024-01-12 23:55:20 +01:00
Daniel Stenberg
b3f02e1d92
configure: when enabling QUIC, check that TLS supports QUIC
Most importantly perhaps is when using OpenSSL that the used
build/flavor has the QUIC API: the vanilla OpenSSL does not, only
BoringSSL, libressl, AWS-LC and quictls do.

Ref: 5d044ad948 (r136780413)

Closes #12683
2024-01-12 09:47:42 +01:00
Stefan Eissing
5d044ad948
vquic: extract TLS setup into own source
- separate ngtcp2 specific parts out
- provide callback during init to allow ngtcp2 to apply its defaults

Closes #12678
2024-01-11 10:43:00 +01:00
Sergey Markelov
98543fc2cf
multi: remove total timer reset in file_do() while fetching file://
The total timer is properly reset in MSTATE_INIT.  MSTATE_CONNECT starts
with resetting the timer that is a start point for further multi states.
If file://, MSTATE_DO calls file_do() that should not reset the total
timer.  Otherwise, the total time is always less than the pre-transfer
and the start transfer times.

Closes #12682
2024-01-11 08:51:29 +01:00
Daniel Stenberg
693cd16793
http_proxy: a blank CURLOPT_USERAGENT should not be used in CONNECT
Extended test 80 to verify this.

Reported-by: Stefan Eissing
Fixes #12680
Closes #12681
2024-01-11 08:49:21 +01:00
Daniel Stenberg
dd0f680fc0
sectransp: do verify_cert without memdup for blobs
Since the information is then already stored in memory, this can avoid
an extra set of malloc + free calls.

Closes #12679
2024-01-10 23:22:52 +01:00
Daniel Stenberg
24ae4a07f3
hsts: remove assert for zero length domain
A zero length domain can happen if the HSTS parser is given invalid
input data which is not unheard of and is done by the fuzzer.

Follow-up from cfe7902111

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

Closes #12676
2024-01-10 13:58:14 +01:00
Daniel Stenberg
a9e128d569
headers: make sure the trailing newline is not stored
extended test1940 to verify blank header fields too

Bug: https://curl.se/mail/lib-2024-01/0019.html
Reported-by: Dmitry Karpov
Closes #12675
2024-01-10 13:57:08 +01:00
Daniel Stenberg
77c3c1a8fb
curl_easy_header.3: tiny language fix
Closes #12672
2024-01-10 09:42:49 +01:00
Daniel Stenberg
5d75bcd2ea
examples/range.c: add
Closes #12671
2024-01-10 09:33:08 +01:00
Daniel Stenberg
1404bcdeae
examples/netrc.c: add
Closes #12671
2024-01-10 09:33:06 +01:00
Daniel Stenberg
dd09f88f13
examples/ipv6.c: new example showing IPv6-only internet transfer
Closes #12671
2024-01-10 09:33:03 +01:00
Daniel Stenberg
ebbc6243d7
examples/address-scope.c: renamed from ipv6.c
It shows address scope use really

Closes #12671
2024-01-10 09:32:54 +01:00
Stefan Eissing
48d86999af
multi: pollset adjust, init with FIRSTSOCKET during connect
- `conn->sockfd` is set by `Curl_setup_transfer()`, but that
  is called *after* the connection has been established
- use `conn->sock[FIRSTSOCKET]` instead

Follow-up to a0f94800d5
Closes #12664
2024-01-09 17:41:13 +01:00
Daniel Stenberg
6d9bf0db7e
WEBSOCKET.md: remove dead link 2024-01-09 16:00:29 +01:00
Daniel Stenberg
e2fbe56610
CI: spellcheck/appveyor: invoke configure --without-libpsl
Follow-up to 2998874bb6
2024-01-09 16:00:29 +01:00