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

12987 Коммитов

Автор SHA1 Сообщение Дата
Daniel Stenberg c2df780a97
Revert "multi: remove PENDING + MSGSENT handles from the main linked list"
This reverts commit f6d6f3ce01.

The commits caused issues in the 8.0.0 release. Needs a retake.

Reported-by: Kamil Dudka
Closes #10795
2023-03-20 14:49:04 +01:00
Daniel Stenberg 138860576f
cf-socket: use port 80 when resolving name for local bind
It turns out c-ares returns an error when asked to resolve a host name with
ares_getaddrinfo using port number 0.

Reported as a c-ares bug here: https://github.com/c-ares/c-ares/issues/517

The work-around is to simply use port 80 instead, as the number typically does
not make a difference and a non-zero number works for c-ares.

Fixes #10759
Reported-by: Matt Jolly
Closes #10789
2023-03-17 22:55:31 +01:00
Daniel Stenberg f5e0f52dd3
Revert "rtsp: use dynbuf instead of custom reallocs"
This reverts commit 1b9ea3239d because of OSS-fuzz reports.
I'll do another take after the pending release.

Closes #10785
2023-03-17 15:41:07 +01:00
Daniel Stenberg f7a3fae4cb
libssh: use dynbuf instead of realloc
When building lines to show for SFTP directory listings.

Closes #10778
2023-03-16 23:32:22 +01:00
Daniel Stenberg 1b9ea3239d
rtsp: use dynbuf instead of custom reallocs
For the RTP buffering.

Closes #10776
2023-03-16 16:09:55 +01:00
Daniel Stenberg d2d0e60012
libssh2: remove unused variable from libssh2's struct
Closes #10777
2023-03-16 13:44:48 +01:00
Daniel Stenberg f6d6f3ce01
multi: remove PENDING + MSGSENT handles from the main linked list
As they are not driving transfers or any socket activity, the main loop
does not need to iterate over these handles. A performance improvement.

They are instead only held in their own separate lists.

Assisted-by: Stefan Eissing
Ref: #10743
Closes #10762
2023-03-15 10:37:49 +01:00
Daniel Stenberg a208be3710
multi: turn link/unlinking easy handles into dedicated functions 2023-03-15 10:37:48 +01:00
Daniel Stenberg 18a45a51ba
http_aws_sigv4: fix scan-build "value stored to 'ret' is never read"
Follow-up to 495d09810a

Closes #10766
2023-03-15 07:32:01 +01:00
Daniel Stenberg e5e8815532
lib: skip Curl_llist_destroy calls
Linked lists themselves do not carry any allocations, so for the lists
that do not have have a set destructor we can just skip the
Curl_llist_destroy() call and save CPU time.

Closes #10764
2023-03-15 00:10:21 +01:00
Casey Bodley 495d09810a
aws_sigv4: fall back to UNSIGNED-PAYLOAD for sign_as_s3
all s3 requests default to UNSIGNED-PAYLOAD and add the required
x-amz-content-sha256 header. this allows CURLAUTH_AWS_SIGV4 to correctly
sign s3 requests to amazon with no additional configuration

Signed-off-by: Casey Bodley <cbodley@redhat.com>

Closes #9995
2023-03-14 17:04:47 +01:00
Viktor Szakats ebef55a61d
wolfssl: add quic/ngtcp2 detection in cmake, and fix builds
- add QUIC/ngtcp2 detection in CMake with wolfSSL.

  Because wolfSSL uses zlib if available, move compression detection
  before TLS detection. (OpenSSL might also need this in the future.)

- wolfSSL 5.5.0 started using C99 types in its `quic.h` header, but it
  doesn't #include the necessary C99 header itself, breaking builds
  (unless another dependency pulled it by chance.) Add local workaround
  for it. For this to work with all build tools, we had to fix our
  header detection first. Ref: #10745

  Ref: 6ad5f6ecc1

Closes #10739
2023-03-14 11:57:55 +00:00
Stefan Eissing 31889210b9
secure-transport: fix recv return code handling
Return code handling of recv calls were not always correct when an error
occured or the connection was closed.

Closes #10717
2023-03-14 09:59:27 +01:00
Stefan Eissing 06f65f771b http2: Use KEEP_SEND_HOLD for flow control in HTTP/2
- use the defined, but so far not used, KEEP_SEND_HOLD bit for flow
  control based suspend of sending in transfers.

Prior to this change KEEP_SEND_PAUSE bit was used instead, but that can
interfere with pausing streams from the user side via curl_easy_pause.

Fixes https://github.com/curl/curl/issues/10751
Closes https://github.com/curl/curl/pull/10753
2023-03-14 03:26:57 -04:00
Daniel Stenberg bc90308328
multi: make multi_perform ignore/unignore signals less often
For improved performance

Reported-by: Jerome St-Louis
Ref: #10743
Closes #10750
2023-03-13 23:01:02 +01:00
Viktor Szakats 9f96537cc3
cmake: delete unused HAVE__STRTOI64
Also delete obsolete surrounding comments.

Reviewed-by: Daniel Stenberg
Closes #10756
2023-03-13 15:49:54 +00:00
Viktor Szakats db073c9d88
build: fix stdint/inttypes detection with non-autotools
Fix `stdint.h` and `inttypes.h` detection with non-autotools builds on
Windows. (autotools already auto-detected them accurately.)

`lib/config-win32.h` builds (e.g. `Makefile.mk`):
- set `HAVE_STDINT_H` where supported.
- set `HAVE_INTTYPES_H` for MinGW.

CMake:
- auto-detect them on Windows. (They were both force-disabled.)
- delete unused `CURL_PULL_STDINT_H`.
- delete unused `CURL_PULL_INTTYPES_H`.
- stop detecting `HAVE_STDINT_H` twice.
  Present since the initial CMake commit: 4c5307b456

curl doesn't use these C99 headers, we need them now to workaround
broken wolfSSL builds. Ref: #10739

Once that clears up, we can delete these detections and macros (unless
we want to keep them for future us.)

Reviewed-by: Daniel Stenberg
Closes #10745
2023-03-13 10:47:21 +00:00
Daniel Stenberg 8f4608468b
ftp: add more conditions for connection reuse
Reported-by: Harry Sintonen
Closes #10730
2023-03-13 09:07:23 +01:00
Viktor Szakats a285b22f8f
Makefile.mk: fix -g option in debug mode [ci skip]
Add it to `CFLAGS` (was: `LDFLAGS`).

Closes #10747
2023-03-13 00:16:30 +00:00
Dan Fandrich ee521a1c88 http: don't send 100-continue for short PUT requests
This is already how curl is documented to behave in Everything curl, but
in actuality only short POSTs skip this. This should knock 30 seconds
off a full run of the test suite since the 100-continue timeout will no
longer be hit.

Closes #10740
2023-03-11 18:57:19 -08:00
Stefan Eissing 544a7f804d
http2: fix error handling during parallel operations
RST and connection close were not handled correctly during parallel
transfers, leading to aborted response bodies being reported complete.

Closes #10715
2023-03-10 23:52:53 +01:00
Daniel Stenberg cb49e67303
url: only reuse connections with same GSS delegation
Reported-by: Harry Sintonen
Closes #10731
2023-03-10 23:30:34 +01:00
Viktor Szakats b725fe1944
lib: silence clang/gcc -Wvla warnings in brotli headers
brotli v1.0.0 throughout current latest v1.0.9 and latest master [1]
trigger this warning.

It happened with CMake and GNU Make. autotools builds avoid it with
the `convert -I options to -isystem` macro.

llvm/clang:
```
In file included from ./curl/lib/content_encoding.c:36:
./brotli/x64-ucrt/usr/include/brotli/decode.h:204:34: warning: variable length array used [-Wvla]
    const uint8_t encoded_buffer[BROTLI_ARRAY_PARAM(encoded_size)],
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./brotli/x64-ucrt/usr/include/brotli/port.h:253:34: note: expanded from macro 'BROTLI_ARRAY_PARAM'
                                 ^~~~~~
In file included from ./curl/lib/content_encoding.c:36:
./brotli/x64-ucrt/usr/include/brotli/decode.h:206:48: warning: variable length array used [-Wvla]
    uint8_t decoded_buffer[BROTLI_ARRAY_PARAM(*decoded_size)]);
                           ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
./brotli/x64-ucrt/usr/include/brotli/port.h:253:35: note: expanded from macro 'BROTLI_ARRAY_PARAM'
                                 ~^~~~~
```

gcc:
```
In file included from ./curl/lib/content_encoding.c:36:
./brotli/x64-ucrt/usr/include/brotli/decode.h:204:5: warning: ISO C90 forbids variable length array 'encoded_buffer' [-Wvla]
  204 |     const uint8_t encoded_buffer[BROTLI_ARRAY_PARAM(encoded_size)],
      |     ^~~~~
./brotli/x64-ucrt/usr/include/brotli/decode.h:206:5: warning: ISO C90 forbids variable length array 'decoded_buffer' [-Wvla]
  206 |     uint8_t decoded_buffer[BROTLI_ARRAY_PARAM(*decoded_size)]);
      |     ^~~~~~~
```

[1] ed1995b6bd

Reviewed-by: Daniel Stenberg
Reviewed-by: Marcel Raad
Closes #10738
2023-03-10 22:24:24 +00:00
Daniel Stenberg 4e2b52b5f7
curl_path: create the new path with dynbuf
Closes #10729
2023-03-10 23:20:19 +01:00
Daniel Stenberg f384d40718
url: remove dummy protocol handler
Just two added checks were needed saves a whole handler struct.

Closes #10727
2023-03-10 23:19:20 +01:00
Daniel Stenberg af369db4d3
url: fix the SSH connection reuse check
Reported-by: Harry Sintonen
Closes #10735
2023-03-10 17:54:32 +01:00
Daniel Stenberg 538b1e79a6
telnet: only accept option arguments in ascii
To avoid embedded telnet negotiation commands etc.

Reported-by: Harry Sintonen
Closes #10728
2023-03-10 17:43:18 +01:00
Jay Satiro b559ef6f36 url: fix cookielist memleak when curl_easy_reset
- Free set.cookelist in Curl_freeset instead of Curl_close.

Prior to this change the cookielist linked list wasn't freed by
curl_easy_reset which calls Curl_freeset to free all set.

Bug: https://github.com/curl/curl/issues/10694#issuecomment-1458619157
Reported-by: Sergey Ryabinin

Closes https://github.com/curl/curl/pull/10709
2023-03-10 03:49:16 -05:00
Stefan Eissing 940b67803a
wolfSSL: ressurect the BIO `io_result`
In pytest'ing the situation occored that wolfSSL reported an
IO error when the underlying BIO operation was returning an
CURLE_AGAIN condition.

Readding the `io_result` filter context member to detect such
situations.

Also, making sure that the returned CURLcode is initialized
on all recv operations outcome.

Closes #10716
2023-03-10 08:06:17 +01:00
Stefan Eissing adaec5d1d0
gssapi: align global `gss_OID_desc` vars to silence ld warnings on macOS ventura
Refs #9975 which first reported this.

Closes #10718
2023-03-10 08:04:42 +01:00
Daniel Stenberg 8b5f100db3
libssh2: only set the memory callbacks when debugging
This makes us debug libssh2 less and libcurl more when for example
running torture tests that otherwise will spend a lot of time in libssh2
functions.

We leave libssh2 to test libssh2.

Closes #10721
2023-03-10 08:01:47 +01:00
Daniel Stenberg 05616379ee
headers: make curl_easy_header and nextheader return different buffers
By letting curl_easy_header() and curl_easy_nextheader() store the
header data in their own struct storage when they return a pointer to
it, it makes it possible for applications to use them both in a loop.
Like the curl tool does.

Reported-by: Boris Okunskiy
Fixes #10704
Closes #10707
2023-03-09 00:13:41 +01:00
rcombs b1d735956f
urlapi: take const args in _dup and _get functions
Closes #10708
2023-03-08 15:38:26 +01:00
rcombs 95cb7d3166
urlapi: avoid mutating internals in getter routine
This was not intended.

Closes #10708
2023-03-08 15:38:18 +01:00
Daniel Stenberg 0a0c9b6dfa
urlapi: '%' is illegal in host names
Update test 1560 to verify

Ref: #10708
Closes #10711
2023-03-08 15:33:43 +01:00
Daniel Stenberg 0546ed54c2
ftp: make the 'ftpauth' a more normal 'char *'-array
Closes #10703
2023-03-08 15:32:16 +01:00
Viktor Szakats 75087c3baa
misc: fix typos
Closes #10706
2023-03-08 08:00:35 +00:00
Stefan Eissing a26418cf14
ftp: active mode with SSL, add the damn filter
- since 7.87.0 we lost adding the SSL filter for an active
  FTP connection that uses SSL. This leads to hangers and timeouts
  as reported in #10666.

Reported-by: SandakovMM on github
Fixes #10666
Closes #10669
2023-03-07 15:22:22 +01:00
Stefan Eissing 7c5637b8b4
url: fix logic in connection reuse to deny reuse on "unclean" connections
- add parameter to `conn_is_alive()` cfilter method that returns
  if there is input data waiting on the connection
- refrain from re-using connnection from the cache that have
  input pending
- adapt http/2 and http/3 alive checks to digest pending input
  to check the connection state
- remove check_cxn method from openssl as that was just doing
  what the socket filter now does.
- add tests for connection reuse with special server configs

Closes #10690
2023-03-07 12:50:31 +01:00
Daniel Stenberg 6466071e8e
x509asn1: use plain %x, not %lx, when the arg is an int
Pointed out by Coverity.

Closes #10689
2023-03-06 23:59:12 +01:00
Stefan Eissing 48cd032623
http2: fix handling of RST and GOAWAY to recognize partial transfers
- a reset transfer (HTTP/2 RST) did not always lead to the proper
  error message on receiving its response, leading to wrong reports
  of a successful transfer
- test_05_02 was able to trigger this condition with increased transfer
  count. The simulated response errors did not carry a 'Content-Length'
  so only proper RST handling could detect the abort
- When doing such transfers in parallel, a connection could enter the
  state where
  a) it had been closed (GOAWAY received)
  b) the RST had not been "seen" for the transfer yet
  or c) the GOAWAY announced an error and the last successful
  stream id was not checked against ongoing transfers

Closes #10693
2023-03-06 23:58:24 +01:00
Stefan Eissing 257416023d
connect: fix time_connect and time_appconnect timer statistics
- time_connect was not updated when the overall connection failed,
  e.g. when SSL verification was unsuccessful, refs #10670
- rework gather those values to interrogate involved filters,
  also from all eyeballing attempts, to report the maximum of
  those values.
- added 3 test cases in test_06 to check reported values on
  successful, partially failed and totally failed connections.

Reported-by: Master Inspire
Fixes #10670
Closes #10671
2023-03-06 20:16:43 +01:00
Daniel Stenberg 45d4bf5af3
cookie: don't load cookies again when flushing
Reported-by: Sergio Mijatovic
Fixes #10677
Closes #10685
2023-03-06 15:51:56 +01:00
Harry Sintonen 755ddbe901
rand: use arc4random as fallback when available
Normally curl uses cryptographically strong random provided by the
selected SSL backend. If compiled without SSL support, a naive built-in
function was used instead.

Generally this was okay, but it will result in some downsides for non-
SSL builds, such as predictable temporary file names.

This change ensures that arc4random will be used instead, if available.

Closes #10672
2023-03-06 11:21:38 +01:00
Viktor Szakats 8cfc936f5c
cmake: fix enabling LDAPS on Windows
Before this patch, enabling LDAPS required a manual C flag:
c1cfc31cfc/curl-cmake.sh (L105)

Fix this and enable LDAPS automatically when using `wldap32` (and
when not explicitly disabled). This matches autotools and `Makefile.mk`
behavior. Also remove issue from KNOWN_BUGS.

Add workaround for MSVS 2010 warning triggered by LDAPS now enabled
in more CI tests:
`ldap.c(360): warning C4306: 'type cast' : conversion from 'int' to 'void *' of greater size`
Ref: https://ci.appveyor.com/project/curlorg/curl/builds/46408284/job/v8mwl9yfbmoeqwlr#L312

Reported-by: JackBoosY on github
Reviewed-by: Jay Satiro
Reviewed-by: Marcel Raad
Fixes #6284
Closes #10674
2023-03-05 19:55:14 +00:00
Viktor Szakats 8d0fa3a70d
Makefile.mk: delete redundant `HAVE_LDAP_SSL` macro [ci skip]
Since abebb2b893, we set this macro for
all Windows `wldap32` builds using `Makefile.mk`.

For OpenLDAP builds this macro is not enough to enable LDAPS, and
OpenLDAP is not an option in `Makefile.mk`. For Novell LDAP it might
have helped, but it's also not an option anymore in `Makefile.mk`.

The future for LDAPS is that we should enable it by default without
extra build knobs.

Reviewed-by: Marcel Raad
Closes #10681
2023-03-05 19:52:21 +00:00
Daniel Stenberg e135bc9d31
schannel: loop over the algos to pick the selected one
Avoid using the funny macro and the extra buffer copy.

Closes #10647
2023-03-03 23:26:41 +01:00
Daniel Stenberg 56d5c07bbb
wildcard: remove files and move functions into ftplistparser.c 2023-03-03 23:25:30 +01:00
Daniel Stenberg 9c188e771c
ftp: allocate the wildcard struct on demand
The feature is rarely used so this frees up data for the vast majority
of easy handles that don't use it.

Rename "protdata" to "ftpwc" since it is always an FTP wildcard struct
pointer. Made the state struct field an unsigned char to save space.

Closes #10639
2023-03-03 23:25:23 +01:00
Brad Spencer ad4997e5b2
urlapi: parse IPv6 literals without ENABLE_IPV6
This makes the URL parser API stable and working the same way
independently of libcurl supporting IPv6 transfers or not.

Closes #10660
2023-03-03 10:05:08 +01:00