diff options
author | dartraiden <wowemuh@gmail.com> | 2023-03-22 14:58:20 +0300 |
---|---|---|
committer | dartraiden <wowemuh@gmail.com> | 2023-03-22 15:00:13 +0300 |
commit | 95538ee3e112abd86c963c246d994a533d2b366d (patch) | |
tree | 03bca2a3cac1da684e43d95aab0fffd9236cbcf9 | |
parent | 7c3c13800855033b8d5c5ffe08b3586456fa0b7b (diff) |
libcurl: update to 8.0.1
81 files changed, 3551 insertions, 3478 deletions
diff --git a/libs/libcurl/docs/CHANGES b/libs/libcurl/docs/CHANGES index 4a84f08c70..a9e2dcf620 100644 --- a/libs/libcurl/docs/CHANGES +++ b/libs/libcurl/docs/CHANGES @@ -6,6 +6,1598 @@ Changelog
+Version 8.0.1 (20 Mar 2023)
+
+Daniel Stenberg (20 Mar 2023)
+
+- RELEASE-NOTES: synced
+
+ curl 8.0.1
+
+- Revert "multi: remove PENDING + MSGSENT handles from the main linked list"
+
+ This reverts commit f6d6f3ce01e377932f1ce7c24ee34d45a36950b8.
+
+ The commits caused issues in the 8.0.0 release. Needs a retake.
+
+ Reported-by: Kamil Dudka
+ Closes #10795
+
+- include/curl/curlver.h: bump to 8.0.1
+
+Version 8.0.0 (20 Mar 2023)
+
+Daniel Stenberg (20 Mar 2023)
+
+- RELEASE-NOTES: synced
+
+ The curl 8.0.0 release
+
+- THANKS: from the 8.0.0 release
+
+- scripts/delta: fix "ambiguous argument" when used in branches
+
+- SECURITY-PROCESS.md: Busy-loops are not security problems
+
+ Closes #10790
+
+Stefan Eissing (17 Mar 2023)
+
+- tests/http: do not save files for downloads in scorecard testing
+
+ Closes #10788
+
+Daniel Stenberg (17 Mar 2023)
+
+- 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 doe
+ s
+ not make a difference and a non-zero number works for c-ares.
+
+ Fixes #10759
+ Reported-by: Matt Jolly
+ Closes #10789
+
+- curl.h: require gcc 12.1 for the deprecation magic
+
+ Reported-by: kchow-FTNT on github
+ Fixes #10726
+ Closes #10784
+
+- Revert "rtsp: use dynbuf instead of custom reallocs"
+
+ This reverts commit 1b9ea3239d22147e00d8 because of OSS-fuzz reports.
+ I'll do another take after the pending release.
+
+ Closes #10785
+
+- test422: verify --next used without a prior URL
+
+ Closes #10782
+
+- tool_getparam: error if --next is used without a prior URL
+
+ Reported-by: 積丹尼 Dan Jacobson
+ Ref: https://github.com/curl/curl/pull/10769#discussion_r1137895629
+
+ Closes #10782
+
+- libssh: use dynbuf instead of realloc
+
+ When building lines to show for SFTP directory listings.
+
+ Closes #10778
+
+- lib2305: deal with CURLE_AGAIN
+
+ The test does a slightly ugly busy-loop for this case but should be
+ managable due to it likely being a very short moment.
+
+ Mention CURLE_AGAIN in curl_ws_recv.3
+
+ Fixes #10760
+ Reported-by: Jay Satiro
+ Closes #10781
+
+- rtsp: use dynbuf instead of custom reallocs
+
+ For the RTP buffering.
+
+ Closes #10776
+
+- libssh2: remove unused variable from libssh2's struct
+
+ Closes #10777
+
+- RELEASE-NOTES: synced
+
+- 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
+
+- multi: turn link/unlinking easy handles into dedicated functions
+
+- http_aws_sigv4: fix scan-build "value stored to 'ret' is never read"
+
+ Follow-up to 495d09810aa9a
+
+ Closes #10766
+
+- 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
+
+- lib643: LIB644 is never defined, this is dead code
+
+ Closes #10765
+
+- libtest/Makefile.inc: remove superfluous variables
+
+ Rely on the defaults when possible.
+
+ Closes #10765
+
+- tests/http: remove year ranges from copyrights
+
+ Closes #10763
+
+Casey Bodley (14 Mar 2023)
+
+- 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
+
+Viktor Szakats (14 Mar 2023)
+
+- 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: https://github.com/curl/curl-for-win/commit/6ad5f6ecc15620c15625fc4434
+ 76b3a1ecef4f3f
+
+ Closes #10739
+
+Stefan Eissing (14 Mar 2023)
+
+- 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
+
+- 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
+
+Dan Fandrich (13 Mar 2023)
+
+- tests: fix control code that hid some text in runtests.1
+
+- tests: sync option lists in runtests.pl & its man page
+
+Daniel Stenberg (13 Mar 2023)
+
+- multi: make multi_perform ignore/unignore signals less often
+
+ For improved performance
+
+ Reported-by: Jerome St-Louis
+ Ref: #10743
+ Closes #10750
+
+Viktor Szakats (13 Mar 2023)
+
+- cmake: delete unused HAVE__STRTOI64
+
+ Also delete obsolete surrounding comments.
+
+ Reviewed-by: Daniel Stenberg
+ Closes #10756
+
+- CI: fix copyright header
+
+ Follow-up to 395b9175b7422d699fa93643973295c106cdf147
+
+Daniel Stenberg (13 Mar 2023)
+
+- RELEASE-PROCEDURE.md: update coming release dates
+
+Stefan Eissing (13 Mar 2023)
+
+- tests/http: add pytest to GHA and improve tests
+
+ - added to: ngtcp2-quictls, ngtcp2-gnutls and the linux varians
+ quiche, bearssl, libressl, mbedtls, openssl3, rustls
+ - added disabled in ngtcp2-wolfssl due to weird SSL_connect() errors
+ not reproducable locally
+
+ Improvements on pytest:
+
+ - handling of systems with nghttpx in $PATH
+ - configure will seach $PATH got nghttpx used in pytest
+ - pytest fixes for managing nghttpx without h3 support
+ - ngtcp2-wolfssl: use a fully enabled wolfssl build
+
+ - lower parallel count for http/1.1 tests, since we do not
+ want to test excessive connections.
+ - check built curl for HTTPS-proxy support in proxy tests
+ - bearssl does not like one of our critical cert extensions, making
+ it non-critical now
+ - bearssl is too slow for test_12, skipping
+ - making sure we do h3 tests only when curl and server support is there
+
+ Closes #10699
+
+Marcel Raad (13 Mar 2023)
+
+- tool_operate: silence unused parameter warning
+
+ `global` is only used in the `my_setopt` macro version without
+ `CURL_DISABLE_LIBCURL_OPTION` since commit 4774decf10a.
+
+ Closes https://github.com/curl/curl/pull/10752
+
+Viktor Szakats (13 Mar 2023)
+
+- 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: 4c5307b45655ba75ab066564afdc0c111a8
+ b9291
+
+ 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
+
+Daniel Stenberg (13 Mar 2023)
+
+- RELEASE-NOTES: synced
+
+- ftp: add more conditions for connection reuse
+
+ Reported-by: Harry Sintonen
+ Closes #10730
+
+Dan Fandrich (12 Mar 2023)
+
+- tests: make first.c the same for both lib tests and unit tests
+
+ The only difference used to be global variable used in unittest tests.
+ After cb7ed5a removed individual flag overrides for the unittests, first.c
+ was no longer recompiled for unit tests to include the flag, so whether it
+ worked or gave a link error depended on whether it was compiled in
+ libtest or unittest first. This way also speeds up the build by
+ eliminating 40 identical compile invocations.
+
+ Fixes #10749
+
+- tests: use AM_CPPFILES to modify flags in unit tests
+
+ Using CPPFLAGS sometimes caused odd compile issues when building tests
+ with parallel make and AM_CPPFILES is the right flag, anyway.
+
+ Follow-up to cb7ed5a
+
+ Ref #10749
+
+Viktor Szakats (13 Mar 2023)
+
+- Makefile.mk: fix -g option in debug mode [ci skip]
+
+ Add it to `CFLAGS` (was: `LDFLAGS`).
+
+ Closes #10747
+
+Jay Satiro (12 Mar 2023)
+
+- tool: improve --stderr handling
+
+ - freopen stderr with the user-specified file (--stderr file) instead of
+ using a separate 'errors' stream.
+
+ - In tool_setup.h override stdio.h's stderr macro as global variable
+ tool_stderr.
+
+ Both freopen and overriding the stderr macro are necessary because if
+ the user-specified filename is "-" then stdout is assigned to
+ tool_stderr and no freopen takes place. See the PR for more information.
+
+ Ref: https://github.com/curl/curl/issues/10491
+
+ Closes https://github.com/curl/curl/pull/10673
+
+Dan Fandrich (11 Mar 2023)
+
+- CI: don't run CI jobs if only another CI was changed
+
+ Also skip builds on non-Windows platforms when only Windows build files
+ have changed.
+
+ This should reduce the number of useless builds and the associated
+ waiting time and chance of spurious failures, freeing resources for
+ new PRs.
+
+ Closes #10742
+
+- 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
+
+- tests: add DELAY keyword to more tests using waits
+
+- tests: hack to build most unit tests under cmake
+
+ These are only built when a libcurl static library is available, since
+ we're not building a special libcurlu library yet and these tests rely
+ on private symbols that aren't available in the shared library. A few
+ unit tests do require libcurlu, so those are not built.
+
+ Closes #10722
+
+- tests: fix MSVC unreachable code warnings in unit tests
+
+ Switch unit1654 to use the proper test macros as well.
+
+- tests: make CPPFLAGS common to all unit tests
+
+ There's no need to specify them individually.
+
+- tests: keep cmake unit tests names in sync
+
+ Put only the test names into Makefile.inc so they can be used by both
+ cmake and automake. This will prevent the list of tests from becoming
+ out of date when they are also built under cmake.
+
+Viktor Szakats (11 Mar 2023)
+
+- src: silence wmain() warning for all build methods
+
+ llvm/clang and gcc doesn't recognize the wmain() function in Unicode
+ Windows builds:
+
+ llvm/clang:
+ ```
+ ../../src/tool_main.c:239:5: warning: no previous prototype for function 'wma
+ in' [-Wmissing-prototypes]
+ int wmain(int argc, wchar_t *argv[])
+ ^
+ 1 warning generated.
+ ```
+
+ gcc:
+ ```
+ ../../src/tool_main.c:239:5: warning: no previous prototype for 'wmain' [-Wmi
+ ssing-prototypes]
+ 239 | int wmain(int argc, wchar_t *argv[])
+ | ^~~~~
+ ```
+
+ Before this patch, we already silenced it with CMake. This patch moves
+ the silencing to the source, so that it applies to all build tools.
+
+ Bug: https://github.com/curl/curl/issues/7229#issuecomment-1464806651
+
+ Reviewed-by: Marcel Raad
+ Closes #10744
+
+Dan Fandrich (10 Mar 2023)
+
+- CI: fix retrying on brew failures
+
+ The previous attempt didn't consider that the shell would exit
+ immediately after the false statement in the retry case.
+
+ Follow-up to dc141a37
+
+Stefan Eissing (10 Mar 2023)
+
+- 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
+
+Daniel Stenberg (10 Mar 2023)
+
+- url: only reuse connections with same GSS delegation
+
+ Reported-by: Harry Sintonen
+ Closes #10731
+
+Viktor Szakats (10 Mar 2023)
+
+- 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 lengt
+ h 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 lengt
+ h 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] https://github.com/google/brotli/commit/ed1995b6bda19244070ab5d331111f16f
+ 67c8054
+
+ Reviewed-by: Daniel Stenberg
+ Reviewed-by: Marcel Raad
+ Closes #10738
+
+Daniel Stenberg (10 Mar 2023)
+
+- curl_path: create the new path with dynbuf
+
+ Closes #10729
+
+- url: remove dummy protocol handler
+
+ Just two added checks were needed saves a whole handler struct.
+
+ Closes #10727
+
+Dan Fandrich (10 Mar 2023)
+
+- CI: retry a failed brew update too, not just brew install
+
+ Also, make sure an eventual failure ends up returning a failure code so
+ the job stops.
+
+Daniel Stenberg (10 Mar 2023)
+
+- url: fix the SSH connection reuse check
+
+ Reported-by: Harry Sintonen
+ Closes #10735
+
+- CURLOPT_PROXY.3: curl+NSS does not handle HTTPS over unix domain socket
+
+ It results in error "NSS error -5985 (PR_ADDRESS_NOT_SUPPORTED_ERROR)"
+
+ Disabled test 1470 for NSS builds and documented the restriction.
+
+ Reported-by: Dan Fandrich
+ Fixes #10723
+ Closes #10734
+
+- CURLSHOPT_SHARE.3: HSTS sharing is not thread-safe
+
+ Reported-by: Hiroki Kurosawa
+ Closes #10732
+
+- telnet: only accept option arguments in ascii
+
+ To avoid embedded telnet negotiation commands etc.
+
+ Reported-by: Harry Sintonen
+ Closes #10728
+
+- test1903: test use of COOKIEFILE - reset - COOKIEFILE
+
+ This also tests for the memory leak bug fixed by parent commit b559ef6f.
+
+ Ref: #10694
+
+ Closes https://github.com/curl/curl/pull/10712
+
+Jay Satiro (10 Mar 2023)
+
+- 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
+
+Dan Fandrich (10 Mar 2023)
+
+- tests: fix some keywords and unused sections
+
+- tests: fix test1301 to call the right binary
+
+ It was refactored in commit 480ac6e5 but this step was missed.
+
+- tests: add timeout, SLOWDOWN and DELAY keywords to tests
+
+ These are tests that are testing timing and end up being quite slow.
+
+Daniel Stenberg (10 Mar 2023)
+
+- RELEASE-NOTES: synced
+
+Stefan Eissing (10 Mar 2023)
+
+- 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
+
+- gssapi: align global `gss_OID_desc` vars to silence ld warnings on macOS vent
+ ura
+
+ Refs #9975 which first reported this.
+
+ Closes #10718
+
+Daniel Stenberg (10 Mar 2023)
+
+- 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
+
+- docs/SECURITY-PROCESS.md: updates
+
+ - allow Low+Medium issues to be managed through plain PRs
+ - update the bug-bounty part to reflect current reality
+
+ Closes #10719
+
+Dan Fandrich (9 Mar 2023)
+
+- tests: fix tag markup issues in some tests
+
+Marcel Raad (9 Mar 2023)
+
+- tests: add `cookies` features
+
+ These tests don't work with `--disable-cookies`.
+
+ Closes https://github.com/curl/curl/pull/10713
+
+- test420: add cookies keyword
+
+ It fails with `--disable-cookies`.
+
+ Closes https://github.com/curl/curl/pull/10713
+
+Dan Fandrich (8 Mar 2023)
+
+- CI: Add more labeler match patterns
+
+ Also, add the CI, tests or libcurl API tags in conjunction with any
+ others that might also apply.
+
+Andy Alt (9 Mar 2023)
+
+- GHA: minor improvements to spellcheck
+
+ Closes #10640
+
+Daniel Stenberg (9 Mar 2023)
+
+- test1671: fix after fix
+
+- test421: -w %{header_json} test with multiple same header names
+
+ To reproduce the issue in #10704
+
+- tool_writeout_json. fix the output for duplicate header names
+
+ Header entries with index != 0 are handled at the index 0 level so they
+ should then be skipped when iterated over.
+
+ Reported-by: Boris Okunskiy
+ Fixes #10704
+ Closes #10707
+
+- 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
+
+rcombs (8 Mar 2023)
+
+- urlapi: take const args in _dup and _get functions
+
+ Closes #10708
+
+- urlapi: avoid mutating internals in getter routine
+
+ This was not intended.
+
+ Closes #10708
+
+Daniel Stenberg (8 Mar 2023)
+
+- urlapi: '%' is illegal in host names
+
+ Update test 1560 to verify
+
+ Ref: #10708
+ Closes #10711
+
+- ftp: make the 'ftpauth' a more normal 'char *'-array
+
+ Closes #10703
+
+Evgeny Grin (Karlson2k) (8 Mar 2023)
+
+- doc: fix compiler warning in libcurl.m4
+
+ Current test for curl_free() may produce warnings with strict compiler
+ flags or even with default compiler flags with upcoming versions.
+ These warning could turned into errors by -Werror or similar flags.
+ Such warnings/errors are avoided by this patch.
+
+ Closes #10710
+
+Viktor Szakats (8 Mar 2023)
+
+- misc: fix typos
+
+ Closes #10706
+
+Stefan Eissing (7 Mar 2023)
+
+- 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
+
+Daniel Stenberg (7 Mar 2023)
+
+- docs: extend the URL API descriptions
+
+ Closes #10701
+
+Stefan Eissing (7 Mar 2023)
+
+- 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
+
+Daniel Stenberg (6 Mar 2023)
+
+- x509asn1: use plain %x, not %lx, when the arg is an int
+
+ Pointed out by Coverity.
+
+ Closes #10689
+
+Stefan Eissing (6 Mar 2023)
+
+- 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
+
+- tests: use dynamic ports numbers in pytest suite
+
+ - necessary ports are bound at start of test suite and then
+ given to server fixtures for use.
+ - this make parallel use of pytest (in separate directories),
+ practically safe for use as OS tend to not reuse such port numbers
+ for a while
+
+ Closes #10692
+
+- 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
+
+Daniel Stenberg (6 Mar 2023)
+
+- test1905: update output cookie order
+
+ After the #10685 update
+
+- test420: verify expiring cookies
+
+ Cookies that are loaded fine from a jar but then are expired in headers.
+
+- cookie: don't load cookies again when flushing
+
+ Reported-by: Sergio Mijatovic
+ Fixes #10677
+ Closes #10685
+
+- RELEASE-NOTES: synced
+
+Andy Alt (6 Mar 2023)
+
+- docs: note '--data-urlencode' option
+
+ Closes #10687
+
+Daniel Stenberg (6 Mar 2023)
+
+- DEPRECATE: the original legacy mingw version 1
+
+ Remove completely in September 2023
+
+ Closes #10667
+
+Harry Sintonen (6 Mar 2023)
+
+- 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
+
+Grisha Levit (6 Mar 2023)
+
+- tool: dump headers even if file is write-only
+
+ The fixes in #10079 brought a (seemingly unrelated) change of open mode
+ from `wb`/`ab` to `wb+`/`ab+` for the headerfile. This makes it no
+ longer possible to write the header file to e.g. a pipe, like:
+
+ curl -D >(grep ...) file:///dev/null
+
+ Which presently results in `Warning: Failed to open /dev/fd/63`
+
+ See #10079
+ Closes #10675
+
+Jay Satiro (6 Mar 2023)
+
+- tests: fix gnutls-serv check
+
+ - If gnutls-serv doesn't exist then don't try to execute it.
+
+ Follow-up to 2fdc1d81.
+
+ Closes https://github.com/curl/curl/pull/10688
+
+Daniel Stenberg (6 Mar 2023)
+
+- lib1560: fix enumerated type mixed with another type
+
+ Follow-up to c84c0f9aa3bb006
+
+ Closes #10684
+
+Viktor Szakats (5 Mar 2023)
+
+- cmake: fix enabling LDAPS on Windows
+
+ Before this patch, enabling LDAPS required a manual C flag:
+ https://github.com/curl/curl-for-win/blob/c1cfc31cfc04f24f7a4f946564d6f0e1b4d
+ 7dd36/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/v8mwl9y
+ fbmoeqwlr#L312
+
+ Reported-by: JackBoosY on github
+ Reviewed-by: Jay Satiro
+ Reviewed-by: Marcel Raad
+ Fixes #6284
+ Closes #10674
+
+- Makefile.mk: delete redundant `HAVE_LDAP_SSL` macro [ci skip]
+
+ Since abebb2b8939c6b3e0f951eb2d9ec3729b569aa2c, 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
+
+- cmake: skip CA-path/bundle auto-detection in cross-builds
+
+ Also remove issue from KNOWN_BUGS.
+
+ Reported-by: Cristian Morales Vega
+ Reviewed-by: Marcel Raad
+ Fixes #6178
+ Closes #10676
+
+Daniel Stenberg (3 Mar 2023)
+
+- schannel: loop over the algos to pick the selected one
+
+ Avoid using the funny macro and the extra buffer copy.
+
+ Closes #10647
+
+- wildcard: remove files and move functions into ftplistparser.c
+
+- 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
+
+- lib1560: test parsing URLs with ridiculously large fields
+
+ In the order of 120K.
+
+ Closes #10665
+
+Brad Spencer (3 Mar 2023)
+
+- 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
+
+Jan Engelhardt (3 Mar 2023)
+
+- build: drop the use of XC_AMEND_DISTCLEAN
+
+ Because automake used to delete depdirs at once (.deps) and there was an issu
+ e
+ with portability, curl's XC_AMEND_DISTCLEAN greps the Makefiles in an attempt
+ to build a list of all depfiles and delete them individually instead.
+
+ Since commit 08849db866b44510f6b8fd49e313c91a43a3dfd3, automake switched from
+ deleting directories to individual files. curl's custom logic now finds a lot
+ more results with the grep (the filtering of these results isn't great), whic
+ h
+ causes a massive bloating of the Makefile in the order of O(n^2).
+
+ Also remove now-unused XC_AMEND_DISTCLEAN macro group
+
+ References: https://github.com/curl/curl/issues/9843
+ References: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=59288
+
+ Reported-by: Ilmari Lauhakangas
+ Fixes #9843
+ Closes #10661
+
+Balakrishnan Balasubramanian (3 Mar 2023)
+
+- test1470: test socks proxy using unix sockets and connect to https
+
+ Similar to test1468 except using https instead of http
+
+ Closes #10662
+
+Daniel Stenberg (3 Mar 2023)
+
+- test1960: verify CURL_SOCKOPT_ALREADY_CONNECTED
+
+ When returned from the CURLOPT_SOCKOPTFUNCTION, like when we have a
+ custom socket connected in the app, passed in to libcurl.
+
+ Verifies the fix in #10648
+
+ Closes #10651
+
+Stefan Eissing (2 Mar 2023)
+
+- tests: rename tests/tests-httpd to tests/http
+
+ - httpd is only one server we test with
+ - the suite coveres the HTTP protocol in general where
+ the default test cases need a more beefy environment
+
+ Closes #10654
+
+- socket: detect "dead" connections better, e.g. not fit for reuse
+
+ - refs #10646 where reuse was attempted on closed connections in the
+ cache, leading to an exhaustion of retries on a transfer
+ - the mistake was that poll events like POLLHUP, POLLERR, etc
+ were regarded as "not dead".
+ - change cf-socket filter check to regard such events as inidication
+ of corpsiness.
+ - vtls filter checks: fixed interpretation of backend check result
+ when inconclusive to interrogate status further down the filter
+ chain.
+
+ Reported-by: SendSonS on github
+ Fixes #10646
+ Closes #10652
+
+- lib: give source files cf-http.* better fitting names
+
+ Closes #10656
+
+- http2: fix code indent
+
+ Closes https://github.com/curl/curl/pull/10655
+
+Shankar Jadhavar (1 Mar 2023)
+
+- cf-socket: if socket is already connected, return CURLE_OK
+
+ In 7.87.0, if callback method for CURLOPT_SOCKOPTFUNCTION returns
+ CURL_SOCKOPT_ALREADY_CONNECTED then curl library used to return
+ CURLE_OK. n 7.88.0, now even if callback returns
+ CURL_SOCKOPT_ALREADY_CONNECTED, curl library still tries to connect to
+ socket by invoking method do_connect().
+
+ This is regression caused by commit
+ https://github.com/curl/curl/commit/71b7e0161032927cdfb
+
+ Fix: Check if we are already connected and return CURLE_OK.
+
+ Fixes #10626
+ Closes #10648
+
+Jay Satiro (1 Mar 2023)
+
+- DYNBUF.md: note Curl_dyn_add* calls Curl_dyn_free on failure
+
+ This is the existing behavior and it has been widely assumed in the
+ codebase.
+
+ Closes https://github.com/curl/curl/pull/10645
+
+Stefan Eissing (1 Mar 2023)
+
+- http2: fix upload busy loop
+
+ - Set KEEP_SEND_PAUSE when exhausting remote HTTP/2 window size of a
+ stream.
+
+ - Clear KEEP_SEND_PAUSE when receiving HTTP/2 window updates on a paused
+ stream.
+
+ - Also fix http2 send compiler warnings reported in #10449.
+
+ Prior to this change, starting in 71b7e016 which precedes 7.88.0,
+ libcurl may eat CPU during HTTP/2 upload.
+
+ Reported-by: Jay Satiro
+
+ Fixes https://github.com/curl/curl/issues/10449
+ Fixes https://github.com/curl/curl/issues/10618
+ Closes https://github.com/curl/curl/pull/10627
+
+Daniel Stenberg (1 Mar 2023)
+
+- sectransp: make read_cert() use a dynbuf when loading
+
+ Closes #10632
+
+Jay Satiro (1 Mar 2023)
+
+- transfer: limit Windows SO_SNDBUF updates to once a second
+
+ - Change readwrite_upload() to call win_update_buffer_size() no more
+ than once a second to update SO_SNDBUF (send buffer limit).
+
+ Prior to this change during an upload readwrite_upload() could call
+ win_update_buffer_size() anywhere from hundreds of times per second to
+ an extreme test case of 100k per second (which is likely due to a bug,
+ see #10618). In the latter case WPA profiler showed
+ win_update_buffer_size was the highest capture count in
+ readwrite_upload. In any case the calls were excessive and unnecessary.
+
+ Ref: https://github.com/curl/curl/pull/2762
+
+ Closes https://github.com/curl/curl/pull/10611
+
+Daniel Stenberg (28 Feb 2023)
+
+- RELEASE-NOTES: synced
+
+Stefan Eissing (28 Feb 2023)
+
+- http2: fix for http2-prior-knowledge when reusing connections
+
+ - refs #10634 where errors in the HTTP/2 framing layer are observed.
+ - the bug was that on connection reuse, the code attempted to switch
+ in yet another layer of HTTP/2 handling instead of detecting that
+ this was already in place.
+ - added pytest testcase reproducing the issue.
+
+ Reported-by: rwmjones on github
+ Fixes #10634
+ Closes #10643
+
+- cf-socket: fix handling of remote addr for accepted tcp sockets
+
+ - do not try to determine the remote address of a listen socket. There
+ is none.
+ - Update remote address of an accepted socket by getpeername() if
+ available.
+
+ Reported-by: Harry Sintonen
+ Fixes #10622
+ Closes #10642
+
+- http: fix unix domain socket use in https connects
+
+ - when h2/h3 eyeballing was involved, unix domain socket
+ configurations were not honoured
+ - configuring --unix-socket will disable HTTP/3 as candidate for eyeballing
+ - combinatino of --unix-socket and --http3-only will fail during initialisati
+ on
+ - adding pytest test_11 to reproduce
+
+ Reported-by: Jelle van der Waa
+ Fixes #10633
+ Closes #10641
+
+Daniel Stenberg (28 Feb 2023)
+
+- setopt: move the CURLOPT_CHUNK_DATA pointer to the set struct
+
+ To make duphandle work etc
+
+ Closes #10635
+
+Viktor Szakats (28 Feb 2023)
+
+- quic/schannel: fix compiler warnings
+
+ Fixes #10603
+ Closes #10616
+
+Daniel Stenberg (28 Feb 2023)
+
+- page-footer: add explanation for three missing exit codes
+
+ Added in 7.73.0, 7.77.0 and 7.84.0
+
+ Closes #10630
+
+積丹尼 Dan Jacobson (28 Feb 2023)
+
+- rate.c: single URLs make no sense in --rate example
+
+ Here somehow you need to put more than one URL in these examples, else
+ they will make no sense, as --rate only affects the second and beyond
+ URLs. The first URL will always finish the same time no matter what
+ --rate is given.
+
+ Closes #10638
+
+Daniel Stenberg (28 Feb 2023)
+
+- libcurl-errors.3: add the CURLHcode errors from curl_easy_header.3
+
+ Closes #10629
+
+- mqtt: on send error, return error
+
+ Reported-by: Maciej Domanski
+
+ Closes #10623
+
+- ws: keep the socket non-blocking
+
+ Reported-by: marski on github
+ Fixes #10615
+ Closes #10625
+
+- hostip: avoid sscanf and extra buffer copies
+
+ Also made create_hostcache_id() return the id length.
+
+ Closes #10601
+
+- PARALLEL-TRANSFERS.md: not "early days" for this anymore
+
+ Refresh the language as the support is now over three years old
+
+ Closes #10624
+
+- easy: remove infof() debug leftover from curl_easy_recv
+
+ It said "reached [path]/easy.c:1231"
+
+ Closes #10628
+
+- idn: return error if the conversion ends up with a blank host
+
+ Some IDN sequences are converted into "" (nothing), which can make this
+ function end up with a zero length host name and we cannot consider that
+ a valid host to continue with.
+
+ Reported-by: Maciej Domanski
+ Closes #10617
+
+- examples/http3.c: use CURL_HTTP_VERSION_3
+
+ and update the comment
+
+ Closes #10619
+
+- x509asn1.c: use correct format specifier for infof() call
+
+ Detected by Coverity
+
+ Closes #10614
+
+- Revert "GHA: add Microsoft C++ Code Analysis"
+
+ This reverts commit e0db842b2a082dffad4a9fbe31321e9a75c74041.
+
+ This tool seems very restricted in how often it might be used by a
+ project and thus very quickly start to report fails simply because it
+ refuses to run when "there are more runs than allowed".
+
+ Closes #10613
+
+Patrick Monnerat (25 Feb 2023)
+
+- tests: test secure mail protocols with explicit SSL requests
+
+ New tests 987, 988 and 989, disabled for rustls (hanging).
+
+ Closes #10077
+
+- tests: support for imaps/pop3s/smtps protocols
+
+ Closes #10077
+
+- runtests: use a hash table for server port numbers
+
+ Closes #10077
+
+Andy Alt (25 Feb 2023)
+
+- INTERNALS.md: grammar
+
+ Closes #10607
+
+Daniel Stenberg (25 Feb 2023)
+
+- RELEASE-NOTES: synced
+
+Philip Heiduck (25 Feb 2023)
+
+- .cirrus.yml: Bump to FreeBSD 13.2
+
+ Closes #10270
+
+- ngtcp2-gnutls.yml: bump to gnutls 3.8.0
+
+ Closes #10507
+
+- CI: update ngtcp2 and nghttp2 for pytest
+
+ Follow-up: https://github.com/curl/curl/commit/5c9ee8cef4b351a085b440f8178500
+ 124647f8e6
+
+ Closes #10508
+
+Andy Alt (25 Feb 2023)
+
+- GHA: use same flags for Slackbuild as Slack package
+
+ Closes #10526
+
+Daniel Stenberg (24 Feb 2023)
+
+- rtsp: avoid sscanf for parsing
+
+ Closes #10605
+
+- http_proxy: parse the status line without sscanf
+
+ Closes #10602
+
+- telnet: error correctly for WS set to "x[num]"
+
+ Follow-up to e4f93be9d587
+ Reported-by: Harry Sintonen
+ Closes #10606
+
+- krb5: avoid sscanf for parsing
+
+ Closes #10599
+
+- misc: remove support for curl_off_t < 8 bytes
+
+ Closes #10597
+
+- telnet: parse NEW_ENVIRON without sscanf
+
+ Closes #10596
+
+- telnet: parse the WS= argument without sscanf
+
+ Closes #10596
+
+- telnet: parse telnet options without sscanf
+
+ Closes #10596
+
+- ftp: replace sscanf for MDTM 213 response parsing
+
+ Closes #10590
+
+- ftp: replace sscanf for PASV parsing
+
+ Closes #10590
+
+- ftp: make the EPSV response parser not use sscanf
+
+ Closes #10590
+
+Stefan Eissing (24 Feb 2023)
+
+- ngtcp2: fix unwanted close of file descriptor 0
+
+ ... causing macOS to hand out 0 as next socket handle and failing on
+ further operations.
+
+ Reported-by: Sergey Fionov
+ Fixes #10593
+ Closes #10595
+
+Daniel Stenberg (23 Feb 2023)
+
+- select: stop treating POLLRDBAND as an error
+
+ POLLRDBAND does not seem to be an general error and on Windows the value
+ for POLLIN is 768 and the value for POLLRDBAND is 512.
+
+ Fixes #10501
+ Reported-by: opensslonzos-github on github
+ Closes #10592
+
+- test978: mark file as text mode
+
+ Follow-up to 4ea5702980cb
+
+ To fix test failures on Windows
+
+ Closes #10594
+
+- http: rewrite the status line parser without sscanf
+
+ Closes #10585
+
+- test978: verify that --stderr works for -w's stderr as well
+
+Jay Satiro (23 Feb 2023)
+
+- curl: make -w's %{stderr} use the file set with --stderr
+
+ Reported-by: u20221022 on github
+ Fixes #10491
+ Closes #10569
+
+- winbuild: fix makefile clean
+
+ - Fix and move 'clean' code that removes the output and obj directories
+ trees from MakefileBuild.vc to Makefile.vc.
+
+ Prior to this change the 'clean' code did not work right because the
+ variables containing the directory names were not fully initialized and
+ the rmdir syntax was sometimes incorrect (typos). DIRDIST for example
+ was set to ..\builds\ and not ..\builds\$(CONFIG_NAME_LIB)\ so it would
+ remove the former and not the latter. If WITH_PREFIX was set then that
+ directory was removed instead.
+
+ Also, DIRDIST (the output directory) even if initialized should not be
+ removed by MakefileBuild.vc because by that time it could be set to a
+ user directory that may contain other files if WITH_PREFIX is set (eg we
+ don't want rmdir /s /q C:\usr\local). Therefore we remove from
+ Makefile.vc before any of that happens. I added a comment in both
+ makefiles explaining this.
+
+ Closes https://github.com/curl/curl/pull/10576
+
+- sectransp: fix compiler warning c89 mixed code/declaration
+
+ Since cbf57176 the Cirrus CI 'macOS arm64 SecureTransport http2' has
+ been failing due to c89 warnings mixed code/declaration. That commit is
+ not the cause so I assume something has changed in the CI outside of our
+ configuration. Anyway, we don't mix code/declaration so this is the fix
+ for that.
+
+ Closes https://github.com/curl/curl/pull/10574
+
+Philipp Engel (22 Feb 2023)
+
+- BINDINGS: add Fortran binding
+
+ Closes #10589
+
+Stefan Eissing (22 Feb 2023)
+
+- test2600: detect when ALARM_TIMEOUT is in use and adjust
+
+ - use higher timeout values > 1s
+ - skip duration checks
+
+ Assisted-by: Marcel Raad
+ Closes #10513
+
+Daniel Stenberg (22 Feb 2023)
+
+- RELEASE-NOTES: synced
+
+- test686: verify return code for no URL after --next
+
+- tool_operate: propagate error codes for missing URL after --next
+
+ Fixes #10558
+ Reported-by: u20221022 on github
+ Closes #10580
+
+- test1278: verify that an extra --no-remote-name cause no warning
+
+- tool_getparam: don't add a new node for just --no-remote-name
+
+ Unless --remote-name-all is used.
+
+ Fixes #10564
+ Reported-by: u20221022 on github
+ Closes #10582
+
+- gen.pl: add '%GLOBALS' as a variable for mainpage
+
+ And use it in page-header to list all global command line options.
+
+- docs/cmdline-opts: mark all global options
+
+ gen.pl now outputs a generic explanations for them for each option
+
+ Fixes #10566
+ Reported-by: u20221022 on github
+ Closes #10584
+
+- GHA: add Microsoft C++ Code Analysis
+
+ Closes #10583
+
+- tool_progress: shut off progress meter for --silent in parallel
+
+ Reported-by: finkjsc on github
+ Fixes #10573
+ Closes #10579
+
+- lib1560: add a test using %25 in the userinfo in a URL
+
+ Closes #10578
+
+Stefan Eissing (21 Feb 2023)
+
+- CURLOPT_PIPEWAIT: allow waited reuse also for subsequent connections
+
+ As tested in test_02_07, when firing off 200 urls with --parallel, 199
+ wait for the first connection to be established. if that is multiuse,
+ urls are added up to its capacity.
+
+ The first url over capacity opens another connection. But subsequent
+ urls found the same situation and open a connection too. They should
+ have waited for the second connection to actually connect and make its
+ capacity known.
+
+ This change fixes that by
+
+ - setting `connkeep()` early in the HTTP setup handler. as otherwise
+ a new connection is marked as closeit by default and not considered
+ for multiuse at all
+ - checking the "connected" status for a candidate always and continuing
+ to PIPEWAIT if no alternative is found.
+
+ pytest:
+ - removed "skip" from test_02_07
+ - added test_02_07b to check that http/1.1 continues to work as before
+
+ Closes #10456
+
+Daniel Stenberg (21 Feb 2023)
+
+- test419: verify --dump-header to file that cannot be created
+
+ Closes #10571
+
+- tool_operate: avoid fclose(NULL) on bad header dump file
+
+ Fixes #10570
+ Reported-by: Jérémy Rabasco
+ Closes #10571
+
+- RELEASE-NOTES: synced
+
+ Starting the journey towards 8.0.0
+
+- cookie: parse without sscanf()
+
+ Saves us from using 2*4096 bytes buffers on stack, the extra copies and
+ more.
+
+ Closes #10550
+
+- lib517: verify time stamps without leading zeroes plus some more
+
+- parsedate: replace sscanf( for time stamp parsing
+
+ Closes #10547
+
+- parsedate: parse strings without using sscanf()
+
+ - sscanf is slow and complex, avoid it
+ - give up already if the string is 12 bytes or longer as no valid string
+ can be that long
+ - this can now be done without copy
+
+ Closes #10547
+
+Matt Jolly (20 Feb 2023)
+
+- tests: HTTP server fixups
+
+ - httpserver.pl -> http-server.pl for consistency
+ - add http3-server.pl to EXTRA_DIST; alphabetise for maintainability
+ - nghttpx proxy invocation scripts should not use getcwd
+
+ Closes #10568
+
Version 7.88.1 (20 Feb 2023)
Daniel Stenberg (20 Feb 2023)
@@ -8293,1903 +9885,3 @@ Daniel Stenberg (8 Sep 2022) - RELEASE-NOTES: synced
And bump to 7.86.0 for the pending next release
-
-Michael Heimpold (7 Sep 2022)
-
-- ftp: ignore a 550 response to MDTM
-
- The 550 is overused as a return code for multiple error case, e.g.
- file not found and/or insufficient permissions to access the file.
-
- So we cannot fail hard in this case.
-
- Adjust test 511 since we now fail later.
- Add new test 3027 which check that when MDTM failed, but the file could
- actually be retrieved, that in this case no filetime is provided.
-
- Reported-by: Michael Heimpold
- Fixes #9357
- Closes #9387
-
-Daniel Stenberg (7 Sep 2022)
-
-- urlapi: leaner with fewer allocs
-
- Slightly faster with more robust code. Uses fewer and smaller mallocs.
-
- - remove two fields from the URL handle struct
- - reduce copies and allocs
- - use dynbuf buffers more instead of custom malloc + copies
- - uses dynbuf to build the host name in reduces serial alloc+free within
- the same function.
- - move dedotdotify into urlapi.c and make it static, not strdup the input
- and optimize it by checking for . and / before using strncmp
- - remove a few strlen() calls
- - add Curl_dyn_setlen() that can "trim" an existing dynbuf
-
- Closes #9408
-
-Jay Satiro (7 Sep 2022)
-
-- setup-win32: no longer define UNICODE/_UNICODE implicitly
-
- - If UNICODE or _UNICODE is defined but the other isn't then error
- instead of implicitly defining it.
-
- As Marcel pointed out it is too late at this point to make such a define
- because Windows headers may already be included, so likely it never
- worked. We never noticed because build systems that can make Windows
- Unicode builds always define both. If one is defined but not the other
- then something went wrong during the build configuration.
-
- Bug: https://github.com/curl/curl/pull/9375#discussion_r956545272
- Reported-by: Marcel Raad
-
- Closes https://github.com/curl/curl/pull/9384
-
-Dan Fandrich (6 Sep 2022)
-
-- tests: fix tag syntax errors in test files
-
-Marc Hoersken (6 Sep 2022)
-
-- lib: add required Win32 setup definitions in setup-win32.h
-
- Assisted-by: Jay Satiro
- Reviewed-by: Marcel Raad
-
- Follow up to #9312
- Closes #9375
-
-Daniel Stenberg (6 Sep 2022)
-
-- pingpong: extend the response reading error with errno
-
- To help diagnosing the cause of the problem.
-
- See #9380
- Closes #9443
-
-- curl-compilers.m4: use -O2 as default optimize for clang
-
- Not -Os
-
- Closes #9444
-
-- tool_operate: fix msnprintfing the error message
-
- Follow-up to 7be53774c41c59b47075fba
-
- Coverity CID 1513717 pointed out that we cannot use sizeof() on the
- error buffer anymore.
-
- Closes #9440
-
-Emanuele Torre (6 Sep 2022)
-
-- curl_ctype: add space around <= operator in ISSPACE macro
-
- Follow-up to f65f750
-
- Closes #9441
-
-Daniel Stenberg (6 Sep 2022)
-
-- CURLOPT_PROXY_SSLCERT_BLOB.3: this is for HTTPS proxies
-
- The 'protocols' listed were previously wrong.
-
- Reported-by: ProceduralMan on github
- Fixes #9434
- Closes #9435
-
-- curl_ctype: convert to macros-only
-
- This no longer provide functions, only macros. Runs faster and produces
- smaller output.
-
- The biggest precaution this change brings:
-
- DO NOT use post/pre-increments when passing arguments to the macros.
-
- Closes #9429
-
-- misc: ISSPACE() => ISBLANK()
-
- Instances of ISSPACE() use that should rather use ISBLANK(). I think
- somewhat carelessly used because it sounds as if it checks for space or
- whitespace, but also includes %0a to %0d.
-
- For parsing purposes, we should only accept what we must and not be
- overly liberal. It leads to surprises and surprises lead to bad things.
-
- Closes #9432
-
-- ctype: remove all use of <ctype.h>, use our own versions
-
- Except in the test servers.
-
- Closes #9433
-
-Marc Hoersken (5 Sep 2022)
-
-- cmake: skip superfluous hex2dec conversion using math expr
-
- CMake seems to be able to compare two hex values just fine.
- Also make sure CURL_TARGET_WINDOWS_VERSION is respected.
-
- Assisted-by: Marcel Raad
- Reviewed-by: Viktor Szakats
- Reported-by: Keitagit-kun on github
-
- Follow up to #9312
- Fixes #9406
- Closes #9411
-
-Daniel Stenberg (5 Sep 2022)
-
-- curl_easy_pause.3: unpausing is as fast as possible
-
- Reported-by: ssdbest on github
- Fixes #9410
- Closes #9430
-
-- CURLOPT_DNS_INTERFACE.3: mention it works for almost all protocols
-
- Except file.
-
- Reported-by: ProceduralMan on github
- Fixes #9427
- Closes #9428
-
-- NPN: remove support for and use of
-
- Next Protocol Negotiation is a TLS extension that was created and used
- for agreeing to use the SPDY protocol (the precursor to HTTP/2) for
- HTTPS. In the early days of HTTP/2, before the spec was finalized and
- shipped, the protocol could be enabled using this extension with some
- servers.
-
- curl supports the NPN extension with some TLS backends since then, with
- a command line option `--npn` and in libcurl with
- `CURLOPT_SSL_ENABLE_NPN`.
-
- HTTP/2 proper is made to use the ALPN (Application-Layer Protocol
- Negotiation) extension and the NPN extension has no purposes
- anymore. The HTTP/2 spec was published in May 2015.
-
- Today, use of NPN in the wild should be extremely rare and most likely
- totally extinct. Chrome removed NPN support in Chrome 51, shipped in
- June 2016. Removed in Firefox 53, April 2017.
-
- Closes #9307
-
-- RELEASE-NOTES: synced
-
- and bump the tentative next release version to 7.85.1
-
-Samuel Henrique (4 Sep 2022)
-
-- configure: fail if '--without-ssl' + explicit parameter for an ssl lib
-
- A side effect of a previous change to configure (576e507c78bdd2ec88)
- exposed a non-critical issue that can happen if configure is called with
- both '--without-ssl' and some parameter setting the use of a ssl library
- (e.g. --with-gnutls). The configure script would end up assuming this is
- a MultiSSL build, due to the way the case statement is written.
-
- I have changed the order of the variables in the string concatenation
- for the case statement and also tweaked the options so that
- --without-ssl never turns the build into a MultiSSL one and also clearly
- stating that there are conflicting parameters if the user sets it like
- described above.
-
- Closes #9414
-
-Daniel Stenberg (4 Sep 2022)
-
-- tests/certs/scripts: insert standard curl source headers
-
- ... including the SPDX-License-Identifier.
-
- These omissions were not detected by the RUEUSE CI job nor the copyright.pl
- scanners because we have a general wildcard in .reuse/dep5 for
- "tests/certs/*".
-
- Reported-by: Samuel Henrique
- Fixes #9417
- Closes #9420
-
-Samuel Henrique (2 Sep 2022)
-
-- docs: remove mentions of deprecated '--without-openssl' config parameter
-
- Closes #9415
-
-- manpages: Fix spelling of "allows to" -> "allows one to"
-
- References:
- https://salsa.debian.org/lintian/lintian/-/blob/master/tags/t/typo-in-manual
- -page.tag
- https://english.stackexchange.com/questions/60271/grammatical-complements-fo
- r-allow/60285#60285
-
- Closes #9419
-
-- CURLOPT_WILDCARDMATCH.3: Fix backslash escaping under single quotes
-
- Lintian (on Debian) has been complaining about this for a while but
- I didn't bother initially as the groff parser that we use is not
- affected by this.
-
- But I have now noticed that the online manpage is affected by it:
- https://curl.se/libcurl/c/CURLOPT_WILDCARDMATCH.html
-
- (I'm using double quotes for quoting-only down below)
-
- The section that should be parsed as "'\'" ends up being parsed as
- "'´".
-
- This is due to roffit not parsing "'\\'" correctly, which is fine
- as the "correct" way of writing "'\'" is "'\e'" instead.
-
- Note that this fix is not enough to fix the online manpage at
- curl's website, as roffit seems to parse it wrongly either way.
-
- My intent is to at least fix the manpage so that roffit can
- be changed to parse "'\e'" correctly (although I suggest making
- roffit parse both ways correctly, since that's what groff does).
-
- More details at:
- https://bugs.debian.org/966803
- https://salsa.debian.org/lintian/lintian/-/blob/930b18e4b28b7540253f458ef42a
- 884cca7965c3/tags/a/acute-accent-in-manual-page.tag
-
- Closes #9418
-
-Daniel Stenberg (1 Sep 2022)
-
-- tool_operate: reduce errorbuffer allocs
-
- - parallel transfers: only alloc and keep errorbuffers in memory for
- actual "live" transfers and not for the ones in the pending queue
-
- - serial transfers: reuse the same fixed buffer for all transfers, not
- allocated at all.
-
- Closes #9394
-
-Viktor Szakats (31 Aug 2022)
-
-- misc: spelling fixes
-
- Found using codespell 2.2.1.
-
- Also delete the redundant protocol designator from an archive.org URL.
-
- Reviewed-by: Daniel Stenberg
- Closes #9403
-
-Daniel Stenberg (31 Aug 2022)
-
-- tool_progress: remove 'Qd' from the parallel progress bar
-
- The "queued" value is no longer showing anything useful to the user. It
- is an internal number of transfers waiting at that moment.
-
- Closes #9389
-
-- tool_operate: prevent over-queuing in parallel mode
-
- When doing a huge amount of parallel transfers, we must not add them to
- the per_transfer list frivolously since they all use memory after all.
- This was previous done without really considering millions or billions
- of transfers. Massive parallelism would use a lot of memory for no good
- purpose.
-
- The queue is now limited to twice the paralleism number.
-
- This makes the 'Qd' value in the parallel progress meter mostly useless
- for users, but works for now for us as a debug display.
-
- Reported-by: justchen1369 on github
- Fixes #8933
- Closes #9389
-
-Viktor Szakats (31 Aug 2022)
-
-- cmake: fix original MinGW builds
-
- 1. Re-enable `HAVE_GETADDRINFO` detection on Windows
-
- Commit d08ee3c83d6bd416aef62ff844c98e47c4682429 (in 2013) added logic
- that automatically assumed `getaddrinfo()` to be present for builds
- with IPv6 enabled. As it turns out, certain toolchains (e.g. original
- MinGW) by default target older Windows versions, and thus do not
- support `getaddrinfo()` out of the box. The issue was masked for
- a while by CMake builds forcing a newer Windows version, but that
- logic got deleted in commit 8ba22ffb2030ed91312fc8634e29516cdf0a9761.
- Since then, some CI builds started failing due to IPv6 enabled,
- `HAVE_GETADDRINFO` set, but `getaddrinfo()` in fact missing.
-
- It also turns out that IPv6 works without `getaddrinfo()` since commit
- 67a08dca27a6a07b36c7f97252e284ca957ff1a5 (from 2019, via #4662). So,
- to resolve all this, we can now revert the initial commit, thus
- restoring `getaddrinfo()` detection and support IPv6 regardless of its
- outcome.
-
- Reported-by: Daniel Stenberg
-
- 2. Omit `bcrypt` with original MinGW
-
- Original (aka legacy/old) MinGW versions do not support `bcrypt`
- (introduced with Vista). We already have logic to handle that in
- `lib/rand.c` and autotools builds, where we do not call the
- unsupported API and do not link `bcrypt`, respectively, when using
- original MinGW.
-
- This patch ports that logic to CMake, fixing the link error:
- `c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: can
- not find -lbcrypt`
-
- Ref: https://ci.appveyor.com/project/curlorg/curl/builds/44624888/job/40vl
- e84cn4vle7s0#L508
- Regression since 76172511e7adcf720f4c77bd91f49278300ec97e
-
- Fixes #9214
- Fixes #9393
- Fixes #9395
- Closes #9396
-
-Version 7.85.0 (31 Aug 2022)
-
-Daniel Stenberg (31 Aug 2022)
-
-- RELEASE-NOTES: synced
-
- curl 7.85.0 release
-
-- THANKS: add contributors from the 7.85.0 release
-
-- getparam: correctly clean args
-
- Follow-up to bf7e887b2442783ab52
-
- The previous fix for #9128 was incomplete and caused #9397.
-
- Fixes #9397
- Closes #9399
-
-- zuul: remove the clang-tidy job
-
- Turns out we don't see the warnings, but the warnings right now are
- plain ridiculous and unhelpful so we can just as well just kill this
- job.
-
- Closes #9390
-
-- cmake: set feature PSL if present
-
- ... make test 1014 pass when libpsl is used.
-
- Closes #9391
-
-- lib530: simplify realloc failure exit path
-
- To make code analyzers happier
-
- Closes #9392
-
-Orgad Shaneh (29 Aug 2022)
-
-- tests: add tests for netrc login/password combinations
-
- Covers the following PRs:
-
- - #9066
- - #9247
- - #9248
-
- Closes #9256
-
-- url: really use the user provided in the url when netrc entry exists
-
- If the user is specified as part of the URL, and the same user exists
- in .netrc, Authorization header was not sent at all.
-
- The user and password fields were assigned in conn->user and password
- but the user was not assigned to data->state.aptr, which is the field
- that is used in output_auth_headers and friends.
-
- Fix by assigning the user also to aptr.
-
- Amends commit d1237ac906ae7e3cd7a22c3a2d3a135a97edfbf5.
-
- Fixes #9243
-
-- netrc: Use the password from lines without login
-
- If netrc entry has password with empty login, use it for any username.
-
- Example:
- .netrc:
- machine example.com password 123456
-
- curl -vn http://user@example.com/
-
- Fix it by initializing state_our_login to TRUE, and reset it only when
- finding an entry with the same host and different login.
-
- Closes #9248
-
-Jay Satiro (29 Aug 2022)
-
-- url: treat missing usernames in netrc as empty
-
- - If, after parsing netrc, there is a password with no username then
- set a blank username.
-
- This used to be the case prior to 7d600ad (precedes 7.82). Note
- parseurlandfillconn already does the same thing for URLs.
-
- Reported-by: Raivis <standsed@users.noreply.github.com>
- Testing-by: Domen Kožar
-
- Fixes https://github.com/curl/curl/issues/8653
- Closes #9334
- Closes #9066
-
-Daniel Stenberg (29 Aug 2022)
-
-- test8: verify that "ctrl-byte cookies" are ignored
-
-- cookie: reject cookies with "control bytes"
-
- Rejects 0x01 - 0x1f (except 0x09) plus 0x7f
-
- Reported-by: Axel Chong
-
- Bug: https://curl.se/docs/CVE-2022-35252.html
-
- CVE-2022-35252
-
- Closes #9381
-
-- libssh: ignore deprecation warnings
-
- libssh 0.10.0 marks all SCP functions as "deprecated" which causes
- compiler warnings and errors in our CI jobs and elsewhere. Ignore
- deprecation warnings if 0.10.0 or later is found in the build.
-
- If they actually remove the functions at a later point, then someone can
- deal with that pain and functionality break then.
-
- Fixes #9382
- Closes #9383
-
-- Revert "schannel: when importing PFX, disable key persistence"
-
- This reverts commit 70d010d285315e5f1cad6bdb4953e167b069b692.
-
- Due to further reports in #9300 that indicate this commit might
- introduce problems.
-
-- multi: use larger dns hash table for multi interface
-
- Have curl_multi_init() use a much larger DNS hash table than used for
- the easy interface to scale and perform better when used with _many_
- host names.
-
- curl_share_init() sets an in-between size.
-
- Inspired-by: Ivan Tsybulin
- See #9340
- Closes #9376
-
-Marc Hoersken (28 Aug 2022)
-
-- CI/runtests.pl: add param for dedicated curl to talk to APIs
-
- This should make it possible to also report test failures
- if our freshly build curl binary is not fully functional.
-
- Reviewed-by: Daniel Stenberg
- Closes #9360
-
-Jacob Tolar (27 Aug 2022)
-
-- openssl: add cert path in error message
-
- Closes #9349
-
-- cert.d: clarify that escape character works for file paths
-
- Closes #9349
-
-Daniel Stenberg (27 Aug 2022)
-
-- gha: move over ngtcp2-gnutls CI job from zuul
-
- Closes #9331
-
-Marc Hoersken (26 Aug 2022)
-
-- cmake: add detection of threadsafe feature
-
- Avoids failing test 1014 by replicating configure checks
- for HAVE_ATOMIC and _WIN32_WINNT with custom CMake tests.
-
- Reviewed-by: Marcel Raad
-
- Follow up to #8680
- Closes #9312
-
-Daniel Stenberg (26 Aug 2022)
-
-- RELEASE-NOTES: synced
-
-Marc Hoersken (26 Aug 2022)
-
-- CI/azure: align torture shallowness with GHA
-
- There 25 is used with FTP tests skipped, and 20 for FTP tests.
- This should make torture tests stay within the 60min timeout.
-
- Reviewed-by: Daniel Stenberg
- Closes #9371
-
-- multi_wait: fix and improve Curl_poll error handling on Windows
-
- First check for errors and return CURLM_UNRECOVERABLE_POLL
- before moving forward and waiting on socket readiness events.
-
- Reviewed-by: Jay Satiro
- Reviewed-by: Marcel Raad
-
- Reported-by: Daniel Stenberg
- Ref: #9361
-
- Follow up to #8961
- Closes #9372
-
-- multi_wait: fix skipping to populate revents for extra_fds
-
- On Windows revents was not populated for extra_fds if
- multi_wait had to wait due to the Curl_poll pre-check
- not signalling any readiness. This commit fixes that.
-
- Reviewed-by: Marcel Raad
- Reviewed-by: Jay Satiro
-
- Closes #9361
-
-- CI/appveyor: disable TLS in msys2-native autotools builds
-
- Schannel cannot be used from msys2-native Linux-emulated builds.
-
- Reviewed-by: Marcel Raad
- Reviewed-by: Daniel Stenberg
-
- Follow up to #9367
- Closes #9370
-
-Jay Satiro (25 Aug 2022)
-
-- tests: fix http2 tests to use CRLF headers
-
- Prior to this change some tests that rely on nghttpx proxy did not use
- CRLF headers everywhere. A recent change in nghttp2, which updated its
- version of llhttp (HTTP parser), requires curl's HTTP/1.1 test server to
- use CRLF headers.
-
- Ref: https://github.com/nghttp2/nghttp2/commit/9d389e8
-
- Fixes https://github.com/curl/curl/issues/9364
- Closes https://github.com/curl/curl/pull/9365
-
-rcombs (25 Aug 2022)
-
-- multi: use a pipe instead of a socketpair on apple platforms
-
- Sockets may be shut down by the kernel when the app is moved to the
- background, but pipes are not.
-
- Removed from KNOWN_BUGS
-
- Fixes #6132
- Closes #9368
-
-Somnath Kundu (25 Aug 2022)
-
-- libssh2: provide symlink name in SFTP dir listing
-
- When reading the symbolic link name for a file, we need to add the file
- name to base path name.
-
- Closes #9369
-
-Daniel Stenberg (25 Aug 2022)
-
-- configure: if asked to use TLS, fail if no TLS lib was detected
-
- Previously the configure script would just warn about this fact and
- continue with TLS disabled build which is not always helpful. TLS should
- be explicitly disabled if that is what the user wants.
-
- Closes #9367
-
-Dustin Howett (25 Aug 2022)
-
-- schannel: when importing PFX, disable key persistence
-
- By default, the PFXImportCertStore API persists the key in the user's
- key store (as though the certificate was being imported for permanent,
- ongoing use.)
-
- The documentation specifies that keys that are not to be persisted
- should be imported with the flag `PKCS12_NO_PERSIST_KEY`.
- NOTE: this flag is only supported on versions of Windows newer than XP
- and Server 2003.
-
- Fixes #9300
- Closes #9363
-
-Daniel Stenberg (23 Aug 2022)
-
-- unit1303: four tests should have TRUE for 'connecting'
-
- To match the comments.
-
- Reported-by: Wu Zheng
-
- See #9355
- Closes #9356
-
-- CURLOPT_BUFFERSIZE.3: add upload buffersize to see also
-
- Closes #9354
-
-Fabian Fischer (23 Aug 2022)
-
-- HTTP3.md: add missing autoreconf command for building with wolfssl
-
- Closes #9353
-
-Daniel Stenberg (23 Aug 2022)
-
-- RELEASE-NOTES: synced
-
-- multi: have curl_multi_remove_handle close CONNECT_ONLY transfer
-
- Ẃhen it has been used in the multi interface, it is otherwise left in
- the connection cache, can't be reused and nothing will close them since
- the easy handle loses the association with the multi handle and thus the
- connection cache - until the multi handle is closed or it gets pruned
- because the cache is full.
-
- Reported-by: Dominik Thalhammer
- Fixes #9335
- Closes #9342
-
-- docs/cmdline-opts: remove \& escapes from all .d files
-
- gen.pl escapes them itself now
-
-- docs/cmdline-opts/gen.pl: encode leading single and double quotes
-
- As "(aq" and "(dq" to prevent them from implying a meaning in the nroff
- output. This removes the need for using \& escapes in the .d files'
- description parts.
-
- Closes #9352
-
-Marc Hoersken (23 Aug 2022)
-
-- tests/server/sockfilt.c: avoid race condition without a mutex
-
- Avoid loosing any triggered handles by first aborting and joining
- the waiting threads before evaluating the individual signal state.
-
- This removes the race condition and therefore need for a mutex.
-
- Closes #9023
-
-Emil Engler (22 Aug 2022)
-
-- url: output the maximum when rejecting a url
-
- This commit changes the failf message to output the maximum length, when
- curl refuses to process a URL because it is too long.
-
- See: #9317
- Closes: #9327
-
-Chris Paulson-Ellis (22 Aug 2022)
-
-- configure: fix broken m4 syntax in TLS options
-
- Commit b589696f added lines to some shell within AC_ARG_WITH macros, but
- inadvertently failed to move the final closing ).
-
- Quote the script section using braces.
-
- So, if these problems have been around for a while, how did I find them?
- Only because I did a configure including these options:
-
- $ ./configure --with-openssl --without-rustls
- SSL: enabled (OpenSSL)
-
- Closes #9344
-
-Daniel Stenberg (18 Aug 2022)
-
-- tests/data/CMakeLists: remove making the 'show' makefile target
-
- It is not used by runtests since 3c0f462
-
- Closes #9333
-
-- tests/data/Makefile: remove 'filecheck' target
-
- No practical use anymore since 3c0f4622cdfd6
-
- Closes #9332
-
-- libssh2: make atime/mtime date overflow return error
-
- Closes #9328
-
-- libssh: make atime/mtime date overflow return error
-
- Closes #9328
-
-- examples/curlx.c: remove
-
- This example is a bit convoluted to use as an example, combined with the
- special license for it makes it unsuitable.
-
- Closes #9330
-
-Tobias Nygren (17 Aug 2022)
-
-- curl.h: include <sys/select.h> on SunOS
-
- It is needed for fd_set to be visible to downstream consumers that use
- <curl/multi.h>. Header is known to exist at least as far back as Solaris
- 2.6.
-
- Closes #9329
-
-Daniel Stenberg (17 Aug 2022)
-
-- DEPRECATE.md: push the NSS deprecation date forward one year to 2023
-
- URL: https://curl.se/mail/lib-2022-08/0016.html
-
-- libssh2: setting atime or mtime >32bit on 4-bytes-long systems
-
- Since the libssh2 API uses 'long' to store the timestamp, it cannot
- transfer >32bit times on Windows and 32bit architecture builds.
-
- Avoid nasty surprises by instead not setting such time.
-
- Spotted by Coverity
-
- Closes #9325
-
-- libssh: setting atime or mtime > 32bit is now just skipped
-
- The libssh API used caps the time to an unsigned 32bit variable. Avoid
- nasty surprises by instead not setting such time.
-
- Spotted by Coverity.
-
- Closes #9324
-
-Jay Satiro (16 Aug 2022)
-
-- KNOWN_BUGS: Windows Unicode builds use homedir in current locale
-
- Bug: https://github.com/curl/curl/pull/7252
- Reported-by: dEajL3kA@users.noreply.github.com
-
- Ref: https://github.com/curl/curl/pull/7281
-
- Closes https://github.com/curl/curl/pull/9305
-
-Daniel Stenberg (16 Aug 2022)
-
-- test399: switch it to use a config file instead
-
- ... as using a 65535 bytes host name in a URL does not fit on the
- command line on some systems - like Windows.
-
- Reported-by: Marcel Raad
- Fixes #9321
- Closes #9322
-
-- RELEASE-NOTES: synced
-
-- asyn-ares: make a single alloc out of hostname + async data
-
- This saves one alloc per name resolve and simplifies the exit path.
-
- Closes #9310
-
-- Curl_close: call Curl_resolver_cancel to avoid memory-leak
-
- There might be a pending (c-ares) resolve that isn't free'd up yet.
-
- Closes #9310
-
-- asyn-thread: fix socket leak on OOM
-
- Closes #9310
-
-- GHA: mv CI torture test from Zuul
-
- Closes #9310
-
-- ngtcp2-wolfssl.yml: add GHA to build ngtcp2 + wolfSSL
-
- Closes #9318
-
-- test399: verify check of too long host name
-
-- url: reject URLs with hostnames longer than 65535 bytes
-
- It *probably* causes other problems too since DNS can't resolve such
- long names, but the SNI field in TLS is limited to 16 bits length.
-
- Closes #9317
-
-- curl_multi_perform.3: minor language fix
-
- Closes #9316
-
-- ngtcp2: fix picky compiler warnings with wolfSSL for QUIC
-
- Follow-up to 8a13be227eede2
-
- Closes #9315
-
-- ngtcp2: remove leftover variable
-
- Mistake leftover from my edit before push.
-
- Follow-up from 8a13be227eede2601c2b3b
- Reported-by: Viktor Szakats
- Bug: https://github.com/curl/curl/pull/9290#issuecomment-1214569167
-
-Viktor Szakats (15 Aug 2022)
-
-- Makefile.m32: allow -nghttp3/-ngtcp2 without -ssl [ci skip]
-
- Before this patch `-nghttp3`/`-ngtcp2` had an effect only when `-ssl`
- was also enabled. `-ssl` meaning OpenSSL (and its forks). After
- 8a13be227eede2601c2b3b1c63e08b3dc9b35dd5 nghttp3/ngtcp2 can also be
- used together with wolfSSL. This patch adds the ability to enable
- `-nghttp3`/`-ngtcp2` independently from `-ssl` (OpenSSL), allowing to
- use it with wolfSSL or other, future TLS backends.
-
- Before this patch, it was fine to enable `-nghttp3`/`-ngtcp2`
- unconditionally. After this patch, this is no longer the case, and now
- it's the user's responsibility to enable `-nghttp3`/`-ngtcp2` only
- together with a compatible TLS backend.
-
- When using a TLS backend other than OpenSSL, the TLS-specific ngtcp2
- library must be configured manually, e.g.:
- `export CURL_LDFLAG_EXTRAS=-lngtcp2_crypto_wolfssl`
-
- (or via `NGTCP2_LIBS`)
-
- Closes #9314
-
-Stefan Eissing (15 Aug 2022)
-
-- quic: add support via wolfSSL
-
- - based on ngtcp2 PR https://github.com/ngtcp2/ngtcp2/pull/505
- - configure adapted to build against ngtcp2 wolfssl crypto lib
- - quic code added for creation of WOLFSSL* instances
-
- Closes #9290
-
-David Carlier (14 Aug 2022)
-
-- memdebug: add annotation attributes
-
- memory debug tracking annotates whether the returned pointer does not
- `alias`, hints where the size required is, for Windows to be better
- debugged via Visual Studio.
-
- Closes https://github.com/curl/curl/pull/9306
-
-Daniel Stenberg (14 Aug 2022)
-
-- GHA: move libressl CI from zuul to GitHub
-
- Closes #9309
-
-- KNOWN_BUGS: FTPS directory listing hangs on Windows with Schannel
-
- Closes #9161
-
-- KNOWN_BUGS: CURLOPT_CERTINFO results in CURLE_OUT_OF_MEMORY with Schannel
-
- Closes #8741
-
-- KNOWN_BUGS: libssh blocking and infinite loop problem
-
- Closes #8632
-
-- RELEASE-NOTES: synced
-
-- msh3: fix the QUIC disconnect function
-
- And free request related memory better in 'done'. Fixes a memory-leak.
-
- Reported-by: Gisle Vanem
- Fixes #8915
- Closes #9304
-
-- connect: close the happy eyeballs loser connection when using QUIC
-
- Reviewed-by: Nick Banks
-
- Closes #9303
-
-Emil Engler (12 Aug 2022)
-
-- refactor: split resolve_server() into functions
-
- This commit splits the branch-heavy resolve_server() function into
- various sub-functions, in order to reduce the amount of nested
- if/else-statements.
-
- Beside this, it also removes many else-sequences, by returning in the
- previous if-statement.
-
- Closes #9283
-
-Daniel Stenberg (12 Aug 2022)
-
-- schannel: re-indent to use curl style better
-
- Only white space changes
-
- Closes #9301
-
-Emanuele Torre (12 Aug 2022)
-
-- docs/cmdline-opts: fix example and categories for --form-escape
-
- The example was missing a "--form" argument
- I also replaced "--form" with "-F" to shorten the line a bit since it
- was already very long.
-
- And I also moved --form-escape from the "post" category to the "upload"
- category (this is what I originally wanted to fix, before also noticing
- the mistake in the example).
-
- Closes #9298
-
-Nick Banks (11 Aug 2022)
-
-- HTTP3.md: update to msh3 v0.4.0
-
- Closes #9297
-
-Daniel Stenberg (11 Aug 2022)
-
-- hostip: resolve *.localhost to 127.0.0.1/::1
-
- Following the footsteps of other clients like Firefox/Chrome. RFC 6761
- says clients SHOULD do this.
-
- Add test 389 to verify.
-
- Reported-by: TheKnarf on github
- Fixes #9192
- Closes #9296
-
-Jay Satiro (11 Aug 2022)
-
-- KNOWN_BUGS: long paths are not fully supported on Windows
-
- Bug: https://github.com/curl/curl/issues/8361
- Reported-by: Gisle Vanem
-
- Closes https://github.com/curl/curl/pull/9288
-
-Daniel Stenberg (11 Aug 2022)
-
-- config: remove the check for and use of SIZEOF_SHORT
-
- shorts are 2 bytes on all platforms curl runs and have ever run on.
-
- Closes #9291
-
-- configure: introduce CURL_SIZEOF
-
- This is a rewrite of the previously used GPLv3+exception licensed
- file. With this change, there is no more reference to GPL so we can
- remove that from LICENSES/.
-
- Ref: #9220
- Closes #9291
-
-Sean McArthur (10 Aug 2022)
-
-- hyper: customize test1274 to how hyper unfolds headers
-
- Closes #9217
-
-Orgad Shaneh (10 Aug 2022)
-
-- curl-config: quote directories with potential space
-
- On Windows (at least with CMake), the default prefix is
- C:/Program Files (x86)/CURL.
-
- Closes #9253
-
-Oliver Roberts (10 Aug 2022)
-
-- amigaos: fix threaded resolver on AmigaOS 4.x
-
- Replace ip4 resolution function on AmigaOS 4.x, as it requires runtime
- feature detection and extra code to make it thread safe.
-
- Closes #9265
-
-Emil Engler (10 Aug 2022)
-
-- imap: use ISALNUM() for alphanumeric checks
-
- This commit replaces a self-made character check for alphanumeric
- characters within imap_is_bchar() with the ISALNUM() macro, as it is
- reduces the size of the code and makes the performance better, due to
- ASCII arithmetic.
-
- Closes #9289
-
-Daniel Stenberg (10 Aug 2022)
-
-- RELEASE-NOTES: synced
-
-Cering on github (10 Aug 2022)
-
-- connect: add quic connection information
-
- Fixes #9286
- Closes #9287
-
-Philip Heiduck (8 Aug 2022)
-
-- cirrus/freebsd-ci: bootstrap the pip installer
-
- Signed-off-by: Philip H <47042125+pheiduck@users.noreply.github.com>
-
- Closes #9213
-
-Daniel Stenberg (8 Aug 2022)
-
-- urldata: move smaller fields down in connectdata struct
-
- By (almost) sorting the struct fields in connectdata in a decending size
- order, having the single char ones last, we reduce the number of holes
- in the struct and thus the amount of storage needed.
-
- Closes #9280
-
-- ldap: adapt to conn->port now being an 'int'
-
- Remove typecasts. Fix printf() formats.
-
- Follow-up from 764c6bd3bf.
- Pointed out by Coverity CID 1507858.
-
- Closes #9281
-
-- KNOWN_BUGS: Negotiate authentication against Hadoop HDFS
-
- Closes #8264
-
-Oliver Roberts (8 Aug 2022)
-
-- file: add handling of native AmigaOS paths
-
- On AmigaOS 4.x, handle native absolute paths, whilst blocking relative
- paths. Also allow unix style paths if feature enabled at link time.
-
- Inspiration-from: Michael Trebilcock
-
- Closes #9259
-
-Daniel Stenberg (8 Aug 2022)
-
-- KNOWN_BUGS: cmake build is not thread-safe
-
- The cmake build does not check for and verify presence of a working
- Atomic type, which then makes curl_global_init() to not build
- thread-safe on non-Windows platforms.
-
- Closes https://github.com/curl/curl/issues/8973
- Closes https://github.com/curl/curl/pull/8982
-
-Oliver Roberts (8 Aug 2022)
-
-- configure: fixup bsdsocket detection code for AmigaOS 4.x
-
- The code that detects bsdsocket.library for AmigaOS did not work
- for AmigaOS 4.x. This has been fixed and also cleaned up a little
- to reduce duplication. Wasn't technically necessary before, but is
- required when building with AmiSSL instead of OpenSSL.
-
- Closes #9268
-
-- tool: reintroduce set file comment code for AmigaOS
-
- Amiga specific code which put the URL in the file comment was perhaps
- accidentally removed in b88940850002a3f1c25bc6488b95ad30eb80d696 having
- originally been added in 5c215bdbdfde8b2350cdcbac82aae0c914da5314.
- Reworked to fit the code changes and added it back in.
-
- Reported-by: Michael Trebilcock
- Originally-added-by: Chris Young
-
- Closes #9258
-
-Daniel Stenberg (8 Aug 2022)
-
-- urldata: make 'negnpn' use less storage
-
- The connectdata struct field 'negnpn' never holds a value larger than
- 30, so an unsigned char saves 3 bytes struct space.
-
- Closes #9279
-
-- urldata: make three *_proto struct fields smaller
-
- Use 'unsigned char' for storage instead of the enum, for three GSSAPI
- related fields in the connectdata struct.
-
- Closes #9278
-
-- connect: set socktype/protocol correctly
-
- So that an address used from the DNS cache that was previously used for
- QUIC can be reused for TCP and vice versa.
-
- To make this possible, set conn->transport to "unix" for unix domain
- connections ... and store the transport struct field in an unsigned char
- to use less space.
-
- Reported-by: ウさん
- Fixes #9274
- Closes #9276
-
-Oliver Roberts (8 Aug 2022)
-
-- amissl: allow AmiSSL to be used with AmigaOS 4.x builds
-
- Enable AmiSSL to be used instead of static OpenSSL link libraries.
- for AmigaOS 4.x, as it already is in the AmigaOS 3.x build.
-
- Closes #9269
-
-opensignature on github (8 Aug 2022)
-
-- openssl: add details to "unable to set client certificate" error
-
- from: "curl: (58) unable to set client certificate"
-
- to: curl: (58) unable to set client certificate [error:0A00018F:SSL
- routines::ee key too small]
-
- Closes #9228
-
-Oliver Roberts (8 Aug 2022)
-
-- amissl: make AmiSSL v5 a minimum requirement
-
- AmiSSL v5 is the latest version, featuring a port of OpenSSL 3.0.
- Support for previous OpenSSL 1.1.x versions has been dropped, so
- makes sense to enforce v5 as the minimum requirement. This also
- allows all the AmiSSL stub workarounds to be removed as they are
- now provided in a link library in the AmiSSL SDK.
-
- Closes #9267
-
-- configure: -pthread not available on AmigaOS 4.x
-
- The most recent GCC builds for AmigaOS 4.x do not allow -pthread and
- exit with an error. Instead, need to explictly specify -lpthread.
-
- Closes #9266
-
-Daniel Stenberg (8 Aug 2022)
-
-- digest: pass over leading spaces in qop values
-
- When parsing the "qop=" parameter of the digest authentication, and the
- value is provided within quotes, the list of values can have leading
- white space which the parser previously did not handle correctly.
-
- Add test case 388 to verify.
-
- Reported-by: vlubart on github
- Fixes #9264
- Closes #9270
-
-Evgeny Grin (Karlson2k) (7 Aug 2022)
-
-- digest: reject broken header with session protocol but without qop
-
- Closes #9077
-
-Daniel Stenberg (7 Aug 2022)
-
-- CURLINFO_SPEED_UPLOAD/DOWNLOAD.3: fix examples
-
- Reported-by: jvvprasad78 on github
- Assisted-by: Jay Satiro
- Fixes #9239
- Closes #9241
-
-Fabian Keil (7 Aug 2022)
-
-- test44[2-4]: add '--resolve' to the keywords
-
- ... so the tests can be automatically skipped when
- using an external proxy like Privoxy.
-
- Closes #9250
-
-Daniel Stenberg (7 Aug 2022)
-
-- RELEASE-NOTES: synced
-
-- CURLOPT_CONNECT_ONLY.3: clarify multi API use
-
- Reported-by: Maxim Ivanov
- Fixes #9244
- Closes #9262
-
-Andrew Lambert (6 Aug 2022)
-
-- curl_easy_header: Add CURLH_PSEUDO to sanity check
-
- Fixes #9235
- Closes #9236
-
-Emil Engler (6 Aug 2022)
-
-- docs: add dns category to --resolve
-
- This commit adds the dns category to the --resolve command line option,
- because it can be interpreted as both: a low-level connection option and
- an option related to the resolving of a hostname.
-
- It is also not common for dns options to belong to the connection
- category and vice versa. --ipv4 and --ipv6 are both good examples.
-
- Closes #9229
-
-Wyatt O'Day (2 Aug 2022)
-
-- schannel: Add TLS 1.3 support
-
- - Support TLS 1.3 as the default max TLS version for Windows Server 2022
- and Windows 11.
-
- - Support specifying TLS 1.3 ciphers via existing option
- CURLOPT_TLS13_CIPHERS (tool: --tls13-ciphers).
-
- Closes https://github.com/curl/curl/pull/8419
-
-Emil Engler (2 Aug 2022)
-
-- cmdline-opts/gen.pl: improve performance
-
- On some systems, the gen.pl script takes nearly two minutes for the
- generation of the main-page, which is a completely unacceptable time.
-
- The slow performance has two causes:
- 1. Use of a regex locale operator
- 2. Useless invokations of loops
-
- The commit addresses the first issue by replacing the "\W" wiht
- [^a-zA-Z0-9_], which is, according to regex101.com, functionally
- equivalent to the previous operation, except that it is obviously
- limited to ASCII only, which is fine, as the curl project is
- English-only anyway.
-
- The second issue is being addressed by only running the loop if the line
- contains a "--" in it. The loop may be completeley removed in the
- future.
-
- Co-authored-by: Emanuele Torre <torreemanuele6@gmail.com>
-
- See #8299
- Fixes #9230
- Closes #9232
-
-Daniel Stenberg (2 Aug 2022)
-
-- docs/cmdline: mark fail and fail-with-body as mutually exclusive
-
- Reported-by: Andreas Sommer
- Fixes #9221
- Closes #9222
-
-Nao Yonashiro (2 Aug 2022)
-
-- quiche: fix build failure
-
- Reviewed-by: Alessandro Ghedini
- Closes #9223
-
-Viktor Szakats (2 Aug 2022)
-
-- configure.ac: drop references to deleted functions
-
- follow-up from 4d73854462f30948acab12984b611e9e33ee41e6
-
- Reported-by: Oliver Roberts
- Fixes #9238
- Closes #9240
-
-Sean McArthur (28 Jul 2022)
-
-- hyper: enable obs-folded multiline headers
-
- Closes #9216
-
-Daniel Stenberg (28 Jul 2022)
-
-- connect: revert the use of IP*_RECVERR
-
- The options were added in #6341 and d13179d, but cause problems: Lots of
- POLLIN event occurs but recvfrom read nothing.
-
- Reported-by: Tatsuhiro Tsujikawa
- Fixes #9209
- Closes #9215
-
-Marco Kamner (27 Jul 2022)
-
-- docs: remove him/her/he/she from documentation
-
- Closes #9208
-
-Daniel Stenberg (27 Jul 2022)
-
-- RELEASE-NOTES: synced
-
-- tool_getparam: make --doh-url "" switch it off
-
- A possible future addition could be to parse the URL first too to verify
- that it is valid before trying to use it.
-
- Assisted-by: Jay Satiro
- Closes #9207
-
-- mailmap: add rzrymiak on github
-
-Jay Satiro (26 Jul 2022)
-
-- ngtcp2: Fix build error due to change in nghttp3 prototypes
-
- ngtcp2/nghttp3@4a066b2 changed nghttp3_conn_block_stream and
- nghttp3_conn_shutdown_stream_write return from int to void.
-
- Reported-by: jurisuk@users.noreply.github.com
-
- Fixes https://github.com/curl/curl/issues/9204
- Closes https://github.com/curl/curl/pull/9200
-
-rzrymiak on github (26 Jul 2022)
-
-- BUGS.md: improve language
-
- Closes #9205
-
-Philip Heiduck (26 Jul 2022)
-
-- cirrus.yml: replace py38-pip with py39-pip
-
- Reported-by: Jay Satiro
- Fixes #9201
- Closes #9202
-
-Daniel Stenberg (25 Jul 2022)
-
-- tool_getparam: fix cleanarg() for unicode builds
-
- Use the correct type, and make cleanarg an empty macro if the cleaning
- ability is absent.
-
- Fixes #9195
- Closes #9196
-
- Reviewed-by: Jay Satiro
- Reviewed-by: Marcel Raad
-
-Marc Hoersken (25 Jul 2022)
-
-- test3026: add support for Windows using native Win32 threads
-
- Reviewed-by: Viktor Szakats
- Reviewed-by: Jay Satiro
- Reviewed-by: Daniel Stenberg
-
- Follow up to 7ade9c50b35d95d47a43880c3097bebab7a7e690
- Closes #9012
-
-Evgeny Grin (Karlson2k) (25 Jul 2022)
-
-- digest: fix memory leak, fix not quoted 'opaque'
-
- Fix leak regression introduced by 3a6fe0c.
-
- Closes https://github.com/curl/curl/pull/9199
-
-Daniel Stenberg (23 Jul 2022)
-
-- tests: several enumerated type cleanups
-
- To please icc
-
- Closes #9179
-
-- tool_paramhlp: fix "enumerated type mixed with another type"
-
- Warning by icc
-
- Closes #9179
-
-- tool_writeout: fix enumerated type mixed with another type
-
- Closes #9179
-
-- tool_cfgable: make 'synthetic_error' a plain bool
-
- The specific reason was not used.
-
- Closes #9179
-
-- tool_paramhlp: make check_protocol return ParameterError
-
- "enumerated type mixed with another type"
-
- Closes #9179
-
-- tool_formparse: fix variable may be used before its value is set
-
- Warning by icc
-
- Closes #9179
-
-- sendf: skip storing HTTP headers if HTTP disabled
-
- Closes #9179
-
-- url: enumerated type mixed with another type
-
- Follow-up to 1c58e7ae99ce2030213f28b
-
- Closes #9179
-
-- urldata: change second proxytype field to unsigned char to match
-
- To avoid "enumerated type mixed with another type"
-
- Closes #9179
-
-- http: typecast the httpreq assignment to avoid icc compiler warning
-
- error #188: enumerated type mixed with another type
-
- Closes #9179
-
-- urldata: make state.httpreq an unsigned char
-
- To match set.method used for the same purpose.
-
- Closes #9179
-
-- splay: avoid using -1 in unsigned variable
-
- To fix icc compiler warning integer conversion resulted in a change of sign
-
- Closes #9179
-
-- sendf: store the header type in an usigned char to avoid icc warnings
-
- Closes #9179
-
-- multi: fix the return code from Curl_pgrsDone()
-
- It does not return a CURLcode. Detected by the icc compiler warning
- "enumerated type mixed with another type"
-
- Closes #9179
-
-- sendf: make Curl_debug a void function
-
- As virtually no called checked the return code, and those that did
- wrongly treated it as a CURLcode. Detected by the icc compiler warning:
- enumerated type mixed with another type
-
- Closes #9179
-
-- http_chunks: remove an assign + typecast
-
- As it caused icc to complain: "pointer cast involving 64-bit pointed-to
- type"
-
- Closes #9179
-
-- vtls: make Curl_ssl_backend() return the enum type curl_sslbackend
-
- To fix the icc warning enumerated type mixed with another type
-
- Closes #9179
-
-- curl-compilers.m4: make icc use -diag* options and disable two warnings
-
- -wd and -we are deprecated and are now -diag-disable and -diag-error
-
- Disable warning 1024 and 2259
-
- Closes #9179
-
-Matthew Thompson (23 Jul 2022)
-
-- GHA: add two Intel compiler CI jobs
-
- Closes #9179
-
-Daniel Katz (21 Jul 2022)
-
-- curl-functions.m4: check whether atomics can link rather than just compile
-
- Some build toolchains support C11 atomics (i.e., _Atomic types), but
- will not link the associated atomics runtime unless a flag is passed. In
- such an environment, linking an application with libcurl.a can fail due
- to undefined symbols for atomic load/store functions.
-
- I encountered this behavior when upgrading curl to 7.84.0 and attempting
- to build with Solaris Studio 12.6. Solaris provides the flag
- -xatomic=[gcc | studio], allowing users to link to one of two atomics
- runtime implementations. However, if the user does not provide this
- flag, then neither runtime is linked. This led to builds failing in CI.
-
- Closes #9190
-
-Rosen Penev (20 Jul 2022)
-
-- curl-wolfssl.m4: add options header when building test code
-
- Needed for certain configurations of wolfSSL. Otherwise, missing header
- error may occur.
-
- Tested with OpenWrt.
-
- Closes #9187
-
-Daniel Stenberg (20 Jul 2022)
-
-- ftp: use a correct expire ID for timer expiry
-
- This was an accurate error pointed out by the icc warning: enumerated
- type mixed with another type
-
- Ref: #9179
- Closes #9184
-
-- sendf: fix paused header writes since after the header API
-
- Regression since d1e4a67
-
- Reported-by: Sergey Ogryzkov
- Fixes #9180
- Closes #9182
-
-- mprintf: fix *dyn_vprintf() when out-of-memory
-
- Follow-up to 0e48ac1f99a. Torture-testing 1455 would lead to a memory
- leak otherwise.
-
- Closes #9185
-
-- curl-confopts: remove leftover AC_REQUIREs
-
- configure.ac:3488: warning: CURL_CHECK_FUNC_IOCTL is m4_require'd but not m4_
- defun'd
- configure.ac:3488: warning: CURL_CHECK_FUNC_SETSOCKOPT is m4_require'd but no
- t m4_defun'd
-
- follow-up from 4d73854462f30
-
- Closes #9183
-
-- file: fix icc enumerated type mixed with another type warning
-
- Ref: #9179
- Closes #9181
-
-Viktor Szakats (19 Jul 2022)
-
-- tidy-up: delete unused build configuration macros
-
- Most of them feature guards:
-
- - `CURL_INCLUDES_SYS_UIO` [1]
- - `HAVE_ALLOCA_H` [2]
- - `HAVE_CRYPTO_CLEANUP_ALL_EX_DATA` (unused since de71e68000c8624ea13f90b136f
- 8734dd0fb1bdc)
- - `HAVE_DLFCN_H`
- - `HAVE_DLOPEN`
- - `HAVE_DOPRNT`
- - `HAVE_FCNTL`
- - `HAVE_GETHOSTBYNAME` [3]
- - `HAVE_GETOPT_H`
- - `HAVE_GETPASS`
- - `HAVE_GETPROTOBYNAME`
- - `HAVE_GETSERVBYNAME`
- - `HAVE_IDN_FREE*`
- - `HAVE_INET_ADDR`
- - `HAVE_IOCTL`
- - `HAVE_KRB4`
- - `HAVE_KRB_GET_OUR_IP_FOR_REALM`
- - `HAVE_KRB_H`
- - `HAVE_LDAPSSL_H`
- - `HAVE_LDAP_INIT_FD`
- - `HAVE_LIBDL`
- - `HAVE_LIBNSL`
- - `HAVE_LIBRESOLV*`
- - `HAVE_LIBUCB`
- - `HAVE_LL`
- - `HAVE_LOCALTIME_R`
- - `HAVE_MALLOC_H`
- - `HAVE_MEMCPY`
- - `HAVE_MEMORY_H`
- - `HAVE_NETINET_IF_ETHER_H`
- - `HAVE_NI_WITHSCOPEID`
- - `HAVE_OPENSSL_CRYPTO_H`
- - `HAVE_OPENSSL_ERR_H`
- - `HAVE_OPENSSL_PEM_H`
- - `HAVE_OPENSSL_PKCS12_H`
- - `HAVE_OPENSSL_RAND_H`
- - `HAVE_OPENSSL_RSA_H`
- - `HAVE_OPENSSL_SSL_H`
- - `HAVE_OPENSSL_X509_H`
- - `HAVE_PEM_H`
- - `HAVE_POLL`
- - `HAVE_RAND_SCREEN`
- - `HAVE_RAND_STATUS`
- - `HAVE_RECVFROM`
- - `HAVE_SETSOCKOPT`
- - `HAVE_SETVBUF`
- - `HAVE_SIZEOF_LONG_DOUBLE`
- - `HAVE_SOCKIO_H`
- - `HAVE_SOCK_OPTS`
- - `HAVE_STDIO_H`
- - `HAVE_STRCASESTR`
- - `HAVE_STRFTIME`
- - `HAVE_STRLCAT`
- - `HAVE_STRNCMPI`
- - `HAVE_STRNICMP`
- - `HAVE_STRSTR`
- - `HAVE_STRUCT_IN6_ADDR`
- - `HAVE_TLD_H`
- - `HAVE_TLD_STRERROR`
- - `HAVE_UNAME`
- - `HAVE_USLEEP`
- - `HAVE_WINBER_H`
- - `HAVE_WRITEV`
- - `HAVE_X509_H`
- - `LT_OBJDIR`
- - `NEED_BASENAME_PROTO`
- - `NOT_NEED_LIBNSL`
- - `OPENSSL_NO_KRB5`
- - `RECVFROM_TYPE*`
- - `SIZEOF_LONG_DOUBLE`
- - `STRERROR_R_TYPE_ARG3`
- - `USE_YASSLEMUL`
- - `_USRDLL` (from CMake) [4]
-
- [1] Related parts in `m4/curl-functions.m4` and `configure.ac` might
- also be deleted.
-
- [2] Related comment can possibly be deleted in
- `packages/vms/generate_config_vms_h_curl.com`.
-
- [3] There are more instances of this in autotools, but I did not dare to
- touch those. Looked like it's used to detect socket support.
-
- [4] This is necessary for MFC (Microsoft Foundation Class) DLLs to
- force linking MFC components statically to the DLL. `libcurl.dll`
- does not use MFC, so we can delete this define.
- Ref: https://docs.microsoft.com/cpp/build/regular-dlls-statically-linked-
- to-mfc
-
- Script that can help finding unused settings like above:
- ```shell
-
- autoheader configure.ac # generate lib/curl_config.h.in
-
- {
- grep -o -E 'set\([A-Z][A-Z0-9_]{3,}' CMake/Platforms/WindowsCac
- he.cmake | sed -E 's|set\(||g'
- grep -o -E -h '#define +[A-Z][A-Z0-9_]{3,}' lib/config-*.h
- | sed -E 's|#define +||g'
- grep -o -E '#cmakedefine +[A-Z][A-Z0-9_]{3,}' lib/curl_config.h.cmake
- | sed -E 's|#cmakedefine +||g'
- grep -o -E '#undef +[A-Z][A-Z0-9_]{3,}' lib/curl_config.h.in
- | sed -E 's|#undef +||g'
- } | sort -u | grep -v -F 'HEADER_CURL_' | while read -r def; do
- c="$(git grep -w -F "${def}" | grep -v -E -c '(/libcurl\.tmpl|^lib/config-|
- ^lib/curl_config\.h\.cmake|^CMakeLists\.txt|^CMake/Platforms/WindowsCache\.cm
- ake|^packages/vms/config_h\.com|^m4/curl-functions\.m4|^acinclude\.m4|^config
- ure\.ac)')"
- if [ "${c}" = '0' ]; then
- echo "${def}"
- fi
- done
- ```
-
- Reviewed-by: Daniel Stenberg
- Closes #9044
-
-Daniel Stenberg (19 Jul 2022)
-
-- RELEASE-NOTES: synced
-
-- cookie: treat a blank domain in Set-Cookie: as non-existing
-
- This matches what RFC 6265 section 5.2.3 says.
-
- Extended test 31 to verify.
-
- Fixes #9164
- Reported-by: Gwen Shapira
- Closes #9177
-
-Patrick Monnerat (19 Jul 2022)
-
-- base64: base64url encoding has no padding
-
- See RFC4648 section 5 and RFC7540 section 3.2.1.
-
- Suppress generation of '=' padding of base64url encoding. This is
- accomplished by considering the string beginning at offset 64 in the
- character table as the padding: this is "=" for base64, "" for base64url.
-
- Also use strchr() to replace character search loops where possible.
-
- Suppress erroneous comments about empty encoding results.
-
- Adjust unit test 1302 to unpadded base64url encoding and add tests for
- empty results.
-
- Closes #9139
-
-Daniel Stenberg (19 Jul 2022)
-
-- easyoptions: fix icc warning
-
- easyoptions.c(360): error #188: enumerated type mixed with another type
-
- Ref: #9156
- Reported-by: Matthew Thompson
- Closes #9176
-
-lwthiker (19 Jul 2022)
-
-- h2h3: fix overriding the 'TE: Trailers' header
-
- A 'TE: Trailers' header is explicitly replaced by 'te: trailers'
- (lowercase) in Curl_pseudo_headers() when building the list of HTTP/2 or
- HTTP/3 headers. However, this is then replaced again by the original
- value due to a bug, resulting in the uppercased version being sent. Some
- HTTP/2 servers reject the whole HTTP/2 stream when this is the case.
-
- Closes #9170
-
-Daniel Stenberg (18 Jul 2022)
-
-- lib3026: reduce the number of threads to 100
-
- Down from 1000, to make it run and work in more systems.
-
- Fixes #9172
- Reported-by: Érico Nogueira Rolim
- Closes #9173
-
-- doh: move doh related struct definitions to doh.h
-
- and make 'dnstype' in 'struct dnsprobe' use the DNStype to fix the icc compil
- er warning:
-
- doh.c(924): error #188: enumerated type mixed with another type
-
- Reported-by: Matthew Thompson
- Ref #9156
- Closes #9174
-
-Viktor Szakats (17 Jul 2022)
-
-- Makefile.m32: stop trying to build libcares.a [ci skip]
-
- Before this patch, `lib/Makefile.m32` had a rule to build `libcares.a` in
- `-cares`-enabled builds, via c-ares's own `Makefile.m32`. Committed in
- 2007 [1]. The commit message doesn't specifically address this particular
- change. This logic comes from the times when c-ares was part of the curl
- source tree, hence the special treatment.
-
- This feature creates problems when building c-ares first, using CMake
- and pointing `LIBCARES_PATH` to its install prefix, where `Makefile.m32`
- is missing in such case. A sub-build for c-ares is undesired also when
- c-ares had already been build via its own `Makefile.m32`.
-
- To avoid the sub-build, this patch deletes its Makefile rule. After this
- patch `libcares.a` needs to be manually built before using it in
- `Makefile.m32`. Aligning it with the rest of dependencies.
-
- [1] 46c92c0b806da041d7a5c6fb64dbcdc474d99b31
-
- Reviewed-by: Daniel Stenberg
- Closes #9169
-
-Daniel Stenberg (17 Jul 2022)
-
-- curl: writeout: fix repeated header outputs
-
- The function stored a terminating zero into the buffer for convenience,
- but when on repeated calls that would cause problems. Starting now, the
- passed in buffer is not modified.
-
- Reported-by: highmtworks on github
- Fixes #9150
- Closes #9152
-
-- curl_multi_timeout.3: clarify usage
-
- Fixes #9155
- Closes #9157
- Reported-by: jvvprasad78 on github
-
-- mprintf: make dprintf_formatf never return negative
-
- This function no longer returns a negative value if the formatting
- string is bad since the return value would sometimes be propagated as a
- return code from the mprintf* functions and they are documented to
- return the length of the output. Which cannot be negative.
-
- Fixes #9149
- Closes #9151
- Reported-by: yiyuaner on github
diff --git a/libs/libcurl/docs/THANKS b/libs/libcurl/docs/THANKS index 5f2b7f729e..699eebabfc 100644 --- a/libs/libcurl/docs/THANKS +++ b/libs/libcurl/docs/THANKS @@ -333,6 +333,7 @@ Bob Schader bobmitchell1956 on github
Bodo Bergmann
Bogdan Nicula
+Boris Okunskiy
Boris Rasin
Boris Verkhovskiy
Brad Burdick
@@ -526,7 +527,6 @@ Dan Becker Dan Cristian
Dan Donahue
Dan Fandrich
-Dan Jacobson
Dan Johnson
Dan Kenigsberg
Dan Locks
@@ -842,6 +842,7 @@ Feng Tu Fernando Muñoz
Filip Lundgren
Filip Salomonsson
+finkjsc on github
Firefox OS
Flameborn on github
Flavio Medeiros
@@ -957,6 +958,7 @@ Gregory Panakkal Gregory Szorc
Griffin Downs
Grigory Entin
+Grisha Levit
Guenole Bescon
Guido Berhoerster
Guillaume Arluison
@@ -1059,6 +1061,7 @@ Ilguiz Latypov Ilja van Sprundel
Illarion Taev
illusory-dream on github
+Ilmari Lauhakangas
Ilya Kosarev
imilli on github
Immanuel Gregoire
@@ -1086,6 +1089,7 @@ J. Bromley Jack Boos Yu
Jack Zhang
Jackarain on github
+JackBoosY on github
Jacky Lam
Jacob Barthelmeh
Jacob Hoffman-Andrews
@@ -1122,6 +1126,7 @@ Jamie Wilkinson Jan Alexander Steffens
Jan Chren
Jan Ehrhardt
+Jan Engelhardt
Jan Koen Annot
Jan Kunder
Jan Mazur
@@ -1178,6 +1183,7 @@ Jeff Weber Jeffrey Tolar
Jeffrey Walton
jeffrson on github
+Jelle van der Waa
Jenny Heino
Jens Finkhaeuser
Jens Rantil
@@ -1197,6 +1203,7 @@ Jeroen Ooms Jerome Mao
Jerome Muffat-Meridol
Jerome Robert
+Jerome St-Louis
Jerome Vouillon
Jerry Krinock
Jerry Wu
@@ -1365,6 +1372,7 @@ jvreelanda on github jvvprasad78 on github
jzinn on github
János Fekete
+Jérémy Rabasco
Jérémy Rocher
Jörg Mueller-Tolk
Jörn Hartroth
@@ -1393,6 +1401,7 @@ Kaspar Brand Katie Wang
Katsuhiko YOSHIDA
Kazuho Oku
+kchow-FTNT on github
Kees Cook
Kees Dekker
Keitagit-kun on github
@@ -1562,6 +1571,7 @@ lwthiker on github Lyman Epp
Lyndon Hill
M.R.T on github
+Maciej Domanski
Maciej Karpiuk
Maciej Puzio
Maciej W. Rozycki
@@ -1635,6 +1645,7 @@ Markus Olsson Markus Westerlind
Maros Priputen
Marquis de Muesli
+marski on github
Martijn Koster
Martin Ankerl
Martin Bašti
@@ -1669,6 +1680,7 @@ masbug on github Massimiliano Fantuzzi
Massimiliano Ziccardi
Massimo Callegari
+Master Inspire
MasterInQuestion on github
Mateusz Loskot
Mathias Axelsson
@@ -1681,6 +1693,7 @@ Mats Lindestam Matt Arsenault
Matt Ford
Matt Holt
+Matt Jolly
Matt Kraai
Matt McClure
Matt Veenstra
@@ -1940,6 +1953,7 @@ Olivier Brunel Omar Ramadan
omau on github
opensignature on github
+opensslonzos-github on github
Orange Tsai
Oren Souroujon
Oren Tirosh
@@ -2068,6 +2082,7 @@ Philip Heiduck Philip Langdale
Philip Prindeville
Philip Sanetra
+Philipp Engel
Philipp Klaus Krause
Philipp Waehnert
Philippe Hameau
@@ -2283,6 +2298,7 @@ Ruslan Gazizov Rutger Hofman
Ruurd Beerstra
RuurdBeerstra on github
+rwmjones on github
Ryan Beck-Buysse
Ryan Braud
Ryan Chan
@@ -2315,6 +2331,7 @@ Samuel Marks Samuel Surtees
Samuel Thibault
Samuel Tranchet
+SandakovMM on github
Sander Gates
Sandor Feldi
Sandro Jaeckel
@@ -2347,12 +2364,15 @@ Sebastian Mundry Sebastian Pohlschmidt
Sebastian Rasmussen
Sebastian Sterk
+SendSonS on github
Senthil Raja Velu
Sergei Kuzmin
Sergei Nikulov
Sergey Bronnikov
+Sergey Fionov
Sergey Markelov
Sergey Ogryzkov
+Sergey Ryabinin
Sergey Tatarincev
Sergii Kavunenko
Sergii Pylypenko
@@ -2360,6 +2380,7 @@ Sergio Ballestrero Sergio Barresi
Sergio Borghese
Sergio Durigan Junior
+Sergio Mijatovic
Sergio-IME on github
sergio-nsk on github
Serj Kalichev
@@ -2822,4 +2843,4 @@ zzq1015 on github 不确定
加藤郁之
梦终无痕
-
+積丹尼 Dan Jacobson
diff --git a/libs/libcurl/include/curl/curl.h b/libs/libcurl/include/curl/curl.h index 556a88deeb..0ec7223141 100644 --- a/libs/libcurl/include/curl/curl.h +++ b/libs/libcurl/include/curl/curl.h @@ -34,11 +34,12 @@ #endif
/* Compile-time deprecation macros. */
-#if defined(__GNUC__) && (__GNUC__ >= 6) && \
+#if defined(__GNUC__) && \
+ ((__GNUC__ > 12) || ((__GNUC__ == 12) && (__GNUC_MINOR__ >= 1 ))) && \
!defined(__INTEL_COMPILER) && \
!defined(CURL_DISABLE_DEPRECATION) && !defined(BUILDING_LIBCURL)
-#define CURL_DEPRECATED(version, message) \
- __attribute__((deprecated("since " # version ". " message)))
+#define CURL_DEPRECATED(version, message) \
+ __attribute__((deprecated("since " # version ". " message)))
#define CURL_IGNORE_DEPRECATION(statements) \
_Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") \
diff --git a/libs/libcurl/include/curl/curlver.h b/libs/libcurl/include/curl/curlver.h index d2f6d8e293..ac29eb51c7 100644 --- a/libs/libcurl/include/curl/curlver.h +++ b/libs/libcurl/include/curl/curlver.h @@ -32,12 +32,12 @@ /* This is the version number of the libcurl package from which this header
file origins: */
-#define LIBCURL_VERSION "7.88.1"
+#define LIBCURL_VERSION "8.0.1"
/* The numeric version number is also available "in parts" by using these
defines: */
-#define LIBCURL_VERSION_MAJOR 7
-#define LIBCURL_VERSION_MINOR 88
+#define LIBCURL_VERSION_MAJOR 8
+#define LIBCURL_VERSION_MINOR 0
#define LIBCURL_VERSION_PATCH 1
/* This is the numeric version of the libcurl version number, meant for easier
@@ -59,7 +59,7 @@ CURL_VERSION_BITS() macro since curl's own configure script greps for it
and needs it to contain the full number.
*/
-#define LIBCURL_VERSION_NUM 0x075801
+#define LIBCURL_VERSION_NUM 0x080001
/*
* This is the date and time when the full source package was created. The
@@ -70,7 +70,7 @@ *
* "2007-11-23"
*/
-#define LIBCURL_TIMESTAMP "2023-02-20"
+#define LIBCURL_TIMESTAMP "2023-03-20"
#define CURL_VERSION_BITS(x,y,z) ((x)<<16|(y)<<8|(z))
#define CURL_AT_LEAST_VERSION(x,y,z) \
diff --git a/libs/libcurl/include/curl/urlapi.h b/libs/libcurl/include/curl/urlapi.h index a65e7f4692..2440c1affc 100644 --- a/libs/libcurl/include/curl/urlapi.h +++ b/libs/libcurl/include/curl/urlapi.h @@ -117,14 +117,14 @@ CURL_EXTERN void curl_url_cleanup(CURLU *handle); * curl_url_dup() duplicates a CURLU handle and returns a new copy. The new
* handle must also be freed with curl_url_cleanup().
*/
-CURL_EXTERN CURLU *curl_url_dup(CURLU *in);
+CURL_EXTERN CURLU *curl_url_dup(const CURLU *in);
/*
* curl_url_get() extracts a specific part of the URL from a CURLU
* handle. Returns error code. The returned pointer MUST be freed with
* curl_free() afterwards.
*/
-CURL_EXTERN CURLUcode curl_url_get(CURLU *handle, CURLUPart what,
+CURL_EXTERN CURLUcode curl_url_get(const CURLU *handle, CURLUPart what,
char **part, unsigned int flags);
/*
diff --git a/libs/libcurl/libcurl.vcxproj b/libs/libcurl/libcurl.vcxproj index af5e41c6ca..42e3a7cd03 100644 --- a/libs/libcurl/libcurl.vcxproj +++ b/libs/libcurl/libcurl.vcxproj @@ -47,7 +47,7 @@ <ClCompile Include="src\c-hyper.c">
<PrecompiledHeader>NotUsing</PrecompiledHeader>
</ClCompile>
- <ClCompile Include="src\cf-http.c">
+ <ClCompile Include="src\cf-https-connect.c">
<PrecompiledHeader>NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="src\cf-socket.c">
@@ -461,9 +461,6 @@ <ClCompile Include="src\warnless.c">
<PrecompiledHeader>NotUsing</PrecompiledHeader>
</ClCompile>
- <ClCompile Include="src\wildcard.c">
- <PrecompiledHeader>NotUsing</PrecompiledHeader>
- </ClCompile>
<ClCompile Include="src\ws.c">
<PrecompiledHeader>NotUsing</PrecompiledHeader>
</ClCompile>
@@ -473,7 +470,7 @@ <ClInclude Include="src\asyn.h" />
<ClInclude Include="src\bufref.h" />
<ClInclude Include="src\c-hyper.h" />
- <ClInclude Include="src\cf-http.h" />
+ <ClInclude Include="src\cf-https-connect.h" />
<ClInclude Include="src\cf-socket.h" />
<ClInclude Include="src\cfilters.h" />
<ClInclude Include="src\config-amigaos.h" />
@@ -608,7 +605,6 @@ <ClInclude Include="src\vquic\vquic.h" />
<ClInclude Include="src\vquic\vquic_int.h" />
<ClInclude Include="src\warnless.h" />
- <ClInclude Include="src\wildcard.h" />
<ClInclude Include="src\ws.h" />
</ItemGroup>
<ItemGroup>
diff --git a/libs/libcurl/libcurl.vcxproj.filters b/libs/libcurl/libcurl.vcxproj.filters index 46bd409df3..c73c53cb99 100644 --- a/libs/libcurl/libcurl.vcxproj.filters +++ b/libs/libcurl/libcurl.vcxproj.filters @@ -23,7 +23,7 @@ <ClCompile Include="src\c-hyper.c">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="src\cf-http.c">
+ <ClCompile Include="src\cf-https-connect.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\cf-socket.c">
@@ -431,9 +431,6 @@ <ClCompile Include="src\warnless.c">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="src\wildcard.c">
- <Filter>Source Files</Filter>
- </ClCompile>
<ClCompile Include="src\strcase.c">
<Filter>Source Files</Filter>
</ClCompile>
@@ -496,7 +493,7 @@ <ClInclude Include="src\c-hyper.h">
<Filter>Header Files</Filter>
</ClInclude>
- <ClInclude Include="src\cf-http.h">
+ <ClInclude Include="src\cf-https-connect.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\cf-socket.h">
@@ -901,9 +898,6 @@ <ClInclude Include="src\warnless.h">
<Filter>Header Files</Filter>
</ClInclude>
- <ClInclude Include="src\wildcard.h">
- <Filter>Header Files</Filter>
- </ClInclude>
<ClInclude Include="src\ws.h">
<Filter>Header Files</Filter>
</ClInclude>
diff --git a/libs/libcurl/src/CMakeLists.txt b/libs/libcurl/src/CMakeLists.txt index f2968e708d..d37499846a 100644 --- a/libs/libcurl/src/CMakeLists.txt +++ b/libs/libcurl/src/CMakeLists.txt @@ -47,29 +47,6 @@ if(WIN32 AND NOT CURL_STATICLIB) list(APPEND CSOURCES libcurl.rc)
endif()
-# SET(CSOURCES
-# # memdebug.c -not used
-# # nwlib.c - Not used
-# # strtok.c - specify later
-# # strtoofft.c - specify later
-# )
-
-# #OPTION(CURL_MALLOC_DEBUG "Debug mallocs in Curl" OFF)
-# MARK_AS_ADVANCED(CURL_MALLOC_DEBUG)
-# IF(CURL_MALLOC_DEBUG)
-# SET(CSOURCES ${CSOURCES}
-# memdebug.c
-# )
-# ENDIF(CURL_MALLOC_DEBUG)
-
-# # only build compat strtoofft if we need to
-# IF(NOT HAVE_STRTOLL AND NOT HAVE__STRTOI64)
-# SET(CSOURCES ${CSOURCES}
-# strtoofft.c
-# )
-# ENDIF(NOT HAVE_STRTOLL AND NOT HAVE__STRTOI64)
-
-
# The rest of the build
include_directories(${CMAKE_CURRENT_BINARY_DIR}/../include)
diff --git a/libs/libcurl/src/Makefile.in b/libs/libcurl/src/Makefile.in index d86dc19d04..f1144ae9c3 100644 --- a/libs/libcurl/src/Makefile.in +++ b/libs/libcurl/src/Makefile.in @@ -212,7 +212,7 @@ am__installdirs = "$(DESTDIR)$(libdir)" LTLIBRARIES = $(lib_LTLIBRARIES) $(noinst_LTLIBRARIES)
libcurl_la_LIBADD =
am__libcurl_la_SOURCES_DIST = altsvc.c amigaos.c asyn-ares.c \
- asyn-thread.c base64.c bufref.c c-hyper.c cf-http.c \
+ asyn-thread.c base64.c bufref.c c-hyper.c cf-https-connect.c \
cf-socket.c cfilters.c conncache.c connect.c \
content_encoding.c cookie.c curl_addrinfo.c curl_des.c \
curl_endian.c curl_fnmatch.c curl_get_line.c \
@@ -234,43 +234,44 @@ am__libcurl_la_SOURCES_DIST = altsvc.c amigaos.c asyn-ares.c \ speedcheck.c splay.c strcase.c strdup.c strerror.c strtok.c \
strtoofft.c system_win32.c telnet.c tftp.c timediff.c \
timeval.c transfer.c url.c urlapi.c version.c version_win32.c \
- warnless.c wildcard.c ws.c vauth/cleartext.c vauth/cram.c \
- vauth/digest.c vauth/digest_sspi.c vauth/gsasl.c \
- vauth/krb5_gssapi.c vauth/krb5_sspi.c vauth/ntlm.c \
- vauth/ntlm_sspi.c vauth/oauth2.c vauth/spnego_gssapi.c \
- vauth/spnego_sspi.c vauth/vauth.c vtls/bearssl.c vtls/gskit.c \
- vtls/gtls.c vtls/hostcheck.c vtls/keylog.c vtls/mbedtls.c \
+ warnless.c ws.c vauth/cleartext.c vauth/cram.c vauth/digest.c \
+ vauth/digest_sspi.c vauth/gsasl.c vauth/krb5_gssapi.c \
+ vauth/krb5_sspi.c vauth/ntlm.c vauth/ntlm_sspi.c \
+ vauth/oauth2.c vauth/spnego_gssapi.c vauth/spnego_sspi.c \
+ vauth/vauth.c vtls/bearssl.c vtls/gskit.c vtls/gtls.c \
+ vtls/hostcheck.c vtls/keylog.c vtls/mbedtls.c \
vtls/mbedtls_threadlock.c vtls/nss.c vtls/openssl.c \
vtls/rustls.c vtls/schannel.c vtls/schannel_verify.c \
vtls/sectransp.c vtls/vtls.c vtls/wolfssl.c vtls/x509asn1.c \
vquic/curl_msh3.c vquic/curl_ngtcp2.c vquic/curl_quiche.c \
vquic/vquic.c vssh/libssh.c vssh/libssh2.c vssh/wolfssh.c \
altsvc.h amigaos.h arpa_telnet.h asyn.h bufref.h c-hyper.h \
- cf-http.h cf-socket.h cfilters.h conncache.h connect.h \
- content_encoding.h cookie.h curl_addrinfo.h curl_base64.h \
- curl_ctype.h curl_des.h curl_endian.h curl_fnmatch.h \
- curl_get_line.h curl_gethostname.h curl_gssapi.h curl_hmac.h \
- curl_krb5.h curl_ldap.h curl_log.h curl_md4.h curl_md5.h \
- curl_memory.h curl_memrchr.h curl_multibyte.h curl_ntlm_core.h \
- curl_ntlm_wb.h curl_path.h curl_printf.h curl_range.h \
- curl_rtmp.h curl_sasl.h curl_setup.h curl_setup_once.h \
- curl_sha256.h curl_sspi.h curl_threads.h curlx.h dict.h doh.h \
- dynbuf.h easy_lock.h easyif.h easyoptions.h escape.h file.h \
- fileinfo.h fopen.h formdata.h functypes.h ftp.h \
- ftplistparser.h getinfo.h gopher.h h2h3.h hash.h headers.h \
- hostip.h hsts.h http.h http2.h http_chunks.h http_digest.h \
- http_negotiate.h http_ntlm.h http_proxy.h http_aws_sigv4.h \
- idn.h if2ip.h imap.h inet_ntop.h inet_pton.h llist.h \
- memdebug.h mime.h mqtt.h multihandle.h multiif.h netrc.h \
- nonblock.h noproxy.h parsedate.h pingpong.h pop3.h progress.h \
- psl.h rand.h rename.h rtsp.h select.h sendf.h setopt.h \
- setup-vms.h share.h sigpipe.h slist.h smb.h smtp.h sockaddr.h \
- socketpair.h socks.h speedcheck.h splay.h strcase.h strdup.h \
- strerror.h strtok.h strtoofft.h system_win32.h telnet.h tftp.h \
- timediff.h timeval.h transfer.h url.h urlapi-int.h urldata.h \
- version_win32.h warnless.h wildcard.h ws.h vauth/digest.h \
- vauth/ntlm.h vauth/vauth.h vtls/bearssl.h vtls/gskit.h \
- vtls/gtls.h vtls/hostcheck.h vtls/keylog.h vtls/mbedtls.h \
+ cf-https-connect.h cf-socket.h cfilters.h conncache.h \
+ connect.h content_encoding.h cookie.h curl_addrinfo.h \
+ curl_base64.h curl_ctype.h curl_des.h curl_endian.h \
+ curl_fnmatch.h curl_get_line.h curl_gethostname.h \
+ curl_gssapi.h curl_hmac.h curl_krb5.h curl_ldap.h curl_log.h \
+ curl_md4.h curl_md5.h curl_memory.h curl_memrchr.h \
+ curl_multibyte.h curl_ntlm_core.h curl_ntlm_wb.h curl_path.h \
+ curl_printf.h curl_range.h curl_rtmp.h curl_sasl.h \
+ curl_setup.h curl_setup_once.h curl_sha256.h curl_sspi.h \
+ curl_threads.h curlx.h dict.h doh.h dynbuf.h easy_lock.h \
+ easyif.h easyoptions.h escape.h file.h fileinfo.h fopen.h \
+ formdata.h functypes.h ftp.h ftplistparser.h getinfo.h \
+ gopher.h h2h3.h hash.h headers.h hostip.h hsts.h http.h \
+ http2.h http_chunks.h http_digest.h http_negotiate.h \
+ http_ntlm.h http_proxy.h http_aws_sigv4.h idn.h if2ip.h imap.h \
+ inet_ntop.h inet_pton.h llist.h memdebug.h mime.h mqtt.h \
+ multihandle.h multiif.h netrc.h nonblock.h noproxy.h \
+ parsedate.h pingpong.h pop3.h progress.h psl.h rand.h rename.h \
+ rtsp.h select.h sendf.h setopt.h setup-vms.h share.h sigpipe.h \
+ slist.h smb.h smtp.h sockaddr.h socketpair.h socks.h \
+ speedcheck.h splay.h strcase.h strdup.h strerror.h strtok.h \
+ strtoofft.h system_win32.h telnet.h tftp.h timediff.h \
+ timeval.h transfer.h url.h urlapi-int.h urldata.h \
+ version_win32.h warnless.h ws.h vauth/digest.h vauth/ntlm.h \
+ vauth/vauth.h vtls/bearssl.h vtls/gskit.h vtls/gtls.h \
+ vtls/hostcheck.h vtls/keylog.h vtls/mbedtls.h \
vtls/mbedtls_threadlock.h vtls/nssg.h vtls/openssl.h \
vtls/rustls.h vtls/schannel.h vtls/sectransp.h vtls/vtls.h \
vtls/vtls_int.h vtls/wolfssl.h vtls/x509asn1.h \
@@ -279,7 +280,7 @@ am__libcurl_la_SOURCES_DIST = altsvc.c amigaos.c asyn-ares.c \ am__objects_1 = libcurl_la-altsvc.lo libcurl_la-amigaos.lo \
libcurl_la-asyn-ares.lo libcurl_la-asyn-thread.lo \
libcurl_la-base64.lo libcurl_la-bufref.lo \
- libcurl_la-c-hyper.lo libcurl_la-cf-http.lo \
+ libcurl_la-c-hyper.lo libcurl_la-cf-https-connect.lo \
libcurl_la-cf-socket.lo libcurl_la-cfilters.lo \
libcurl_la-conncache.lo libcurl_la-connect.lo \
libcurl_la-content_encoding.lo libcurl_la-cookie.lo \
@@ -329,7 +330,7 @@ am__objects_1 = libcurl_la-altsvc.lo libcurl_la-amigaos.lo \ libcurl_la-timeval.lo libcurl_la-transfer.lo libcurl_la-url.lo \
libcurl_la-urlapi.lo libcurl_la-version.lo \
libcurl_la-version_win32.lo libcurl_la-warnless.lo \
- libcurl_la-wildcard.lo libcurl_la-ws.lo
+ libcurl_la-ws.lo
am__dirstamp = $(am__leading_dot)dirstamp
am__objects_2 = vauth/libcurl_la-cleartext.lo vauth/libcurl_la-cram.lo \
vauth/libcurl_la-digest.lo vauth/libcurl_la-digest_sspi.lo \
@@ -372,7 +373,7 @@ libcurlu_la_LIBADD = am__objects_11 = libcurlu_la-altsvc.lo libcurlu_la-amigaos.lo \
libcurlu_la-asyn-ares.lo libcurlu_la-asyn-thread.lo \
libcurlu_la-base64.lo libcurlu_la-bufref.lo \
- libcurlu_la-c-hyper.lo libcurlu_la-cf-http.lo \
+ libcurlu_la-c-hyper.lo libcurlu_la-cf-https-connect.lo \
libcurlu_la-cf-socket.lo libcurlu_la-cfilters.lo \
libcurlu_la-conncache.lo libcurlu_la-connect.lo \
libcurlu_la-content_encoding.lo libcurlu_la-cookie.lo \
@@ -426,8 +427,7 @@ am__objects_11 = libcurlu_la-altsvc.lo libcurlu_la-amigaos.lo \ libcurlu_la-timeval.lo libcurlu_la-transfer.lo \
libcurlu_la-url.lo libcurlu_la-urlapi.lo \
libcurlu_la-version.lo libcurlu_la-version_win32.lo \
- libcurlu_la-warnless.lo libcurlu_la-wildcard.lo \
- libcurlu_la-ws.lo
+ libcurlu_la-warnless.lo libcurlu_la-ws.lo
am__objects_12 = vauth/libcurlu_la-cleartext.lo \
vauth/libcurlu_la-cram.lo vauth/libcurlu_la-digest.lo \
vauth/libcurlu_la-digest_sspi.lo vauth/libcurlu_la-gsasl.lo \
@@ -480,7 +480,7 @@ am__depfiles_remade = ./$(DEPDIR)/libcurl_la-altsvc.Plo \ ./$(DEPDIR)/libcurl_la-base64.Plo \
./$(DEPDIR)/libcurl_la-bufref.Plo \
./$(DEPDIR)/libcurl_la-c-hyper.Plo \
- ./$(DEPDIR)/libcurl_la-cf-http.Plo \
+ ./$(DEPDIR)/libcurl_la-cf-https-connect.Plo \
./$(DEPDIR)/libcurl_la-cf-socket.Plo \
./$(DEPDIR)/libcurl_la-cfilters.Plo \
./$(DEPDIR)/libcurl_la-conncache.Plo \
@@ -592,7 +592,6 @@ am__depfiles_remade = ./$(DEPDIR)/libcurl_la-altsvc.Plo \ ./$(DEPDIR)/libcurl_la-version.Plo \
./$(DEPDIR)/libcurl_la-version_win32.Plo \
./$(DEPDIR)/libcurl_la-warnless.Plo \
- ./$(DEPDIR)/libcurl_la-wildcard.Plo \
./$(DEPDIR)/libcurl_la-ws.Plo \
./$(DEPDIR)/libcurlu_la-altsvc.Plo \
./$(DEPDIR)/libcurlu_la-amigaos.Plo \
@@ -601,7 +600,7 @@ am__depfiles_remade = ./$(DEPDIR)/libcurl_la-altsvc.Plo \ ./$(DEPDIR)/libcurlu_la-base64.Plo \
./$(DEPDIR)/libcurlu_la-bufref.Plo \
./$(DEPDIR)/libcurlu_la-c-hyper.Plo \
- ./$(DEPDIR)/libcurlu_la-cf-http.Plo \
+ ./$(DEPDIR)/libcurlu_la-cf-https-connect.Plo \
./$(DEPDIR)/libcurlu_la-cf-socket.Plo \
./$(DEPDIR)/libcurlu_la-cfilters.Plo \
./$(DEPDIR)/libcurlu_la-conncache.Plo \
@@ -717,7 +716,6 @@ am__depfiles_remade = ./$(DEPDIR)/libcurl_la-altsvc.Plo \ ./$(DEPDIR)/libcurlu_la-version.Plo \
./$(DEPDIR)/libcurlu_la-version_win32.Plo \
./$(DEPDIR)/libcurlu_la-warnless.Plo \
- ./$(DEPDIR)/libcurlu_la-wildcard.Plo \
./$(DEPDIR)/libcurlu_la-ws.Plo \
vauth/$(DEPDIR)/libcurl_la-cleartext.Plo \
vauth/$(DEPDIR)/libcurl_la-cram.Plo \
@@ -1205,7 +1203,7 @@ LIB_CFILES = \ base64.c \
bufref.c \
c-hyper.c \
- cf-http.c \
+ cf-https-connect.c \
cf-socket.c \
cfilters.c \
conncache.c \
@@ -1321,7 +1319,6 @@ LIB_CFILES = \ version.c \
version_win32.c \
warnless.c \
- wildcard.c \
ws.c
LIB_HFILES = \
@@ -1331,7 +1328,7 @@ LIB_HFILES = \ asyn.h \
bufref.h \
c-hyper.h \
- cf-http.h \
+ cf-https-connect.h \
cf-socket.h \
cfilters.h \
conncache.h \
@@ -1450,7 +1447,6 @@ LIB_HFILES = \ urldata.h \
version_win32.h \
warnless.h \
- wildcard.h \
ws.h
LIB_RCFILES = libcurl.rc
@@ -1778,7 +1774,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcurl_la-base64.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcurl_la-bufref.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcurl_la-c-hyper.Plo@am__quote@ # am--include-marker
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcurl_la-cf-http.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcurl_la-cf-https-connect.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcurl_la-cf-socket.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcurl_la-cfilters.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcurl_la-conncache.Plo@am__quote@ # am--include-marker
@@ -1894,7 +1890,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcurl_la-version.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcurl_la-version_win32.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcurl_la-warnless.Plo@am__quote@ # am--include-marker
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcurl_la-wildcard.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcurl_la-ws.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcurlu_la-altsvc.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcurlu_la-amigaos.Plo@am__quote@ # am--include-marker
@@ -1903,7 +1898,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcurlu_la-base64.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcurlu_la-bufref.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcurlu_la-c-hyper.Plo@am__quote@ # am--include-marker
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcurlu_la-cf-http.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcurlu_la-cf-https-connect.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcurlu_la-cf-socket.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcurlu_la-cfilters.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcurlu_la-conncache.Plo@am__quote@ # am--include-marker
@@ -2019,7 +2014,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcurlu_la-version.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcurlu_la-version_win32.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcurlu_la-warnless.Plo@am__quote@ # am--include-marker
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcurlu_la-wildcard.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcurlu_la-ws.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@vauth/$(DEPDIR)/libcurl_la-cleartext.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@vauth/$(DEPDIR)/libcurl_la-cram.Plo@am__quote@ # am--include-marker
@@ -2173,12 +2167,12 @@ libcurl_la-c-hyper.lo: c-hyper.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcurl_la_CPPFLAGS) $(CPPFLAGS) $(libcurl_la_CFLAGS) $(CFLAGS) -c -o libcurl_la-c-hyper.lo `test -f 'c-hyper.c' || echo '$(srcdir)/'`c-hyper.c
-libcurl_la-cf-http.lo: cf-http.c
-@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcurl_la_CPPFLAGS) $(CPPFLAGS) $(libcurl_la_CFLAGS) $(CFLAGS) -MT libcurl_la-cf-http.lo -MD -MP -MF $(DEPDIR)/libcurl_la-cf-http.Tpo -c -o libcurl_la-cf-http.lo `test -f 'cf-http.c' || echo '$(srcdir)/'`cf-http.c
-@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcurl_la-cf-http.Tpo $(DEPDIR)/libcurl_la-cf-http.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cf-http.c' object='libcurl_la-cf-http.lo' libtool=yes @AMDEPBACKSLASH@
+libcurl_la-cf-https-connect.lo: cf-https-connect.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcurl_la_CPPFLAGS) $(CPPFLAGS) $(libcurl_la_CFLAGS) $(CFLAGS) -MT libcurl_la-cf-https-connect.lo -MD -MP -MF $(DEPDIR)/libcurl_la-cf-https-connect.Tpo -c -o libcurl_la-cf-https-connect.lo `test -f 'cf-https-connect.c' || echo '$(srcdir)/'`cf-https-connect.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcurl_la-cf-https-connect.Tpo $(DEPDIR)/libcurl_la-cf-https-connect.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cf-https-connect.c' object='libcurl_la-cf-https-connect.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcurl_la_CPPFLAGS) $(CPPFLAGS) $(libcurl_la_CFLAGS) $(CFLAGS) -c -o libcurl_la-cf-http.lo `test -f 'cf-http.c' || echo '$(srcdir)/'`cf-http.c
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcurl_la_CPPFLAGS) $(CPPFLAGS) $(libcurl_la_CFLAGS) $(CFLAGS) -c -o libcurl_la-cf-https-connect.lo `test -f 'cf-https-connect.c' || echo '$(srcdir)/'`cf-https-connect.c
libcurl_la-cf-socket.lo: cf-socket.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcurl_la_CPPFLAGS) $(CPPFLAGS) $(libcurl_la_CFLAGS) $(CFLAGS) -MT libcurl_la-cf-socket.lo -MD -MP -MF $(DEPDIR)/libcurl_la-cf-socket.Tpo -c -o libcurl_la-cf-socket.lo `test -f 'cf-socket.c' || echo '$(srcdir)/'`cf-socket.c
@@ -2985,13 +2979,6 @@ libcurl_la-warnless.lo: warnless.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcurl_la_CPPFLAGS) $(CPPFLAGS) $(libcurl_la_CFLAGS) $(CFLAGS) -c -o libcurl_la-warnless.lo `test -f 'warnless.c' || echo '$(srcdir)/'`warnless.c
-libcurl_la-wildcard.lo: wildcard.c
-@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcurl_la_CPPFLAGS) $(CPPFLAGS) $(libcurl_la_CFLAGS) $(CFLAGS) -MT libcurl_la-wildcard.lo -MD -MP -MF $(DEPDIR)/libcurl_la-wildcard.Tpo -c -o libcurl_la-wildcard.lo `test -f 'wildcard.c' || echo '$(srcdir)/'`wildcard.c
-@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcurl_la-wildcard.Tpo $(DEPDIR)/libcurl_la-wildcard.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='wildcard.c' object='libcurl_la-wildcard.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcurl_la_CPPFLAGS) $(CPPFLAGS) $(libcurl_la_CFLAGS) $(CFLAGS) -c -o libcurl_la-wildcard.lo `test -f 'wildcard.c' || echo '$(srcdir)/'`wildcard.c
-
libcurl_la-ws.lo: ws.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcurl_la_CPPFLAGS) $(CPPFLAGS) $(libcurl_la_CFLAGS) $(CFLAGS) -MT libcurl_la-ws.lo -MD -MP -MF $(DEPDIR)/libcurl_la-ws.Tpo -c -o libcurl_la-ws.lo `test -f 'ws.c' || echo '$(srcdir)/'`ws.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcurl_la-ws.Tpo $(DEPDIR)/libcurl_la-ws.Plo
@@ -3300,12 +3287,12 @@ libcurlu_la-c-hyper.lo: c-hyper.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcurlu_la_CPPFLAGS) $(CPPFLAGS) $(libcurlu_la_CFLAGS) $(CFLAGS) -c -o libcurlu_la-c-hyper.lo `test -f 'c-hyper.c' || echo '$(srcdir)/'`c-hyper.c
-libcurlu_la-cf-http.lo: cf-http.c
-@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcurlu_la_CPPFLAGS) $(CPPFLAGS) $(libcurlu_la_CFLAGS) $(CFLAGS) -MT libcurlu_la-cf-http.lo -MD -MP -MF $(DEPDIR)/libcurlu_la-cf-http.Tpo -c -o libcurlu_la-cf-http.lo `test -f 'cf-http.c' || echo '$(srcdir)/'`cf-http.c
-@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcurlu_la-cf-http.Tpo $(DEPDIR)/libcurlu_la-cf-http.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cf-http.c' object='libcurlu_la-cf-http.lo' libtool=yes @AMDEPBACKSLASH@
+libcurlu_la-cf-https-connect.lo: cf-https-connect.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcurlu_la_CPPFLAGS) $(CPPFLAGS) $(libcurlu_la_CFLAGS) $(CFLAGS) -MT libcurlu_la-cf-https-connect.lo -MD -MP -MF $(DEPDIR)/libcurlu_la-cf-https-connect.Tpo -c -o libcurlu_la-cf-https-connect.lo `test -f 'cf-https-connect.c' || echo '$(srcdir)/'`cf-https-connect.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcurlu_la-cf-https-connect.Tpo $(DEPDIR)/libcurlu_la-cf-https-connect.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cf-https-connect.c' object='libcurlu_la-cf-https-connect.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcurlu_la_CPPFLAGS) $(CPPFLAGS) $(libcurlu_la_CFLAGS) $(CFLAGS) -c -o libcurlu_la-cf-http.lo `test -f 'cf-http.c' || echo '$(srcdir)/'`cf-http.c
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcurlu_la_CPPFLAGS) $(CPPFLAGS) $(libcurlu_la_CFLAGS) $(CFLAGS) -c -o libcurlu_la-cf-https-connect.lo `test -f 'cf-https-connect.c' || echo '$(srcdir)/'`cf-https-connect.c
libcurlu_la-cf-socket.lo: cf-socket.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcurlu_la_CPPFLAGS) $(CPPFLAGS) $(libcurlu_la_CFLAGS) $(CFLAGS) -MT libcurlu_la-cf-socket.lo -MD -MP -MF $(DEPDIR)/libcurlu_la-cf-socket.Tpo -c -o libcurlu_la-cf-socket.lo `test -f 'cf-socket.c' || echo '$(srcdir)/'`cf-socket.c
@@ -4112,13 +4099,6 @@ libcurlu_la-warnless.lo: warnless.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcurlu_la_CPPFLAGS) $(CPPFLAGS) $(libcurlu_la_CFLAGS) $(CFLAGS) -c -o libcurlu_la-warnless.lo `test -f 'warnless.c' || echo '$(srcdir)/'`warnless.c
-libcurlu_la-wildcard.lo: wildcard.c
-@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcurlu_la_CPPFLAGS) $(CPPFLAGS) $(libcurlu_la_CFLAGS) $(CFLAGS) -MT libcurlu_la-wildcard.lo -MD -MP -MF $(DEPDIR)/libcurlu_la-wildcard.Tpo -c -o libcurlu_la-wildcard.lo `test -f 'wildcard.c' || echo '$(srcdir)/'`wildcard.c
-@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcurlu_la-wildcard.Tpo $(DEPDIR)/libcurlu_la-wildcard.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='wildcard.c' object='libcurlu_la-wildcard.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcurlu_la_CPPFLAGS) $(CPPFLAGS) $(libcurlu_la_CFLAGS) $(CFLAGS) -c -o libcurlu_la-wildcard.lo `test -f 'wildcard.c' || echo '$(srcdir)/'`wildcard.c
-
libcurlu_la-ws.lo: ws.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcurlu_la_CPPFLAGS) $(CPPFLAGS) $(libcurlu_la_CFLAGS) $(CFLAGS) -MT libcurlu_la-ws.lo -MD -MP -MF $(DEPDIR)/libcurlu_la-ws.Tpo -c -o libcurlu_la-ws.lo `test -f 'ws.c' || echo '$(srcdir)/'`ws.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libcurlu_la-ws.Tpo $(DEPDIR)/libcurlu_la-ws.Plo
@@ -4531,7 +4511,7 @@ distclean: distclean-am -rm -f ./$(DEPDIR)/libcurl_la-base64.Plo
-rm -f ./$(DEPDIR)/libcurl_la-bufref.Plo
-rm -f ./$(DEPDIR)/libcurl_la-c-hyper.Plo
- -rm -f ./$(DEPDIR)/libcurl_la-cf-http.Plo
+ -rm -f ./$(DEPDIR)/libcurl_la-cf-https-connect.Plo
-rm -f ./$(DEPDIR)/libcurl_la-cf-socket.Plo
-rm -f ./$(DEPDIR)/libcurl_la-cfilters.Plo
-rm -f ./$(DEPDIR)/libcurl_la-conncache.Plo
@@ -4647,7 +4627,6 @@ distclean: distclean-am -rm -f ./$(DEPDIR)/libcurl_la-version.Plo
-rm -f ./$(DEPDIR)/libcurl_la-version_win32.Plo
-rm -f ./$(DEPDIR)/libcurl_la-warnless.Plo
- -rm -f ./$(DEPDIR)/libcurl_la-wildcard.Plo
-rm -f ./$(DEPDIR)/libcurl_la-ws.Plo
-rm -f ./$(DEPDIR)/libcurlu_la-altsvc.Plo
-rm -f ./$(DEPDIR)/libcurlu_la-amigaos.Plo
@@ -4656,7 +4635,7 @@ distclean: distclean-am -rm -f ./$(DEPDIR)/libcurlu_la-base64.Plo
-rm -f ./$(DEPDIR)/libcurlu_la-bufref.Plo
-rm -f ./$(DEPDIR)/libcurlu_la-c-hyper.Plo
- -rm -f ./$(DEPDIR)/libcurlu_la-cf-http.Plo
+ -rm -f ./$(DEPDIR)/libcurlu_la-cf-https-connect.Plo
-rm -f ./$(DEPDIR)/libcurlu_la-cf-socket.Plo
-rm -f ./$(DEPDIR)/libcurlu_la-cfilters.Plo
-rm -f ./$(DEPDIR)/libcurlu_la-conncache.Plo
@@ -4772,7 +4751,6 @@ distclean: distclean-am -rm -f ./$(DEPDIR)/libcurlu_la-version.Plo
-rm -f ./$(DEPDIR)/libcurlu_la-version_win32.Plo
-rm -f ./$(DEPDIR)/libcurlu_la-warnless.Plo
- -rm -f ./$(DEPDIR)/libcurlu_la-wildcard.Plo
-rm -f ./$(DEPDIR)/libcurlu_la-ws.Plo
-rm -f vauth/$(DEPDIR)/libcurl_la-cleartext.Plo
-rm -f vauth/$(DEPDIR)/libcurl_la-cram.Plo
@@ -4898,7 +4876,7 @@ maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/libcurl_la-base64.Plo
-rm -f ./$(DEPDIR)/libcurl_la-bufref.Plo
-rm -f ./$(DEPDIR)/libcurl_la-c-hyper.Plo
- -rm -f ./$(DEPDIR)/libcurl_la-cf-http.Plo
+ -rm -f ./$(DEPDIR)/libcurl_la-cf-https-connect.Plo
-rm -f ./$(DEPDIR)/libcurl_la-cf-socket.Plo
-rm -f ./$(DEPDIR)/libcurl_la-cfilters.Plo
-rm -f ./$(DEPDIR)/libcurl_la-conncache.Plo
@@ -5014,7 +4992,6 @@ maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/libcurl_la-version.Plo
-rm -f ./$(DEPDIR)/libcurl_la-version_win32.Plo
-rm -f ./$(DEPDIR)/libcurl_la-warnless.Plo
- -rm -f ./$(DEPDIR)/libcurl_la-wildcard.Plo
-rm -f ./$(DEPDIR)/libcurl_la-ws.Plo
-rm -f ./$(DEPDIR)/libcurlu_la-altsvc.Plo
-rm -f ./$(DEPDIR)/libcurlu_la-amigaos.Plo
@@ -5023,7 +5000,7 @@ maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/libcurlu_la-base64.Plo
-rm -f ./$(DEPDIR)/libcurlu_la-bufref.Plo
-rm -f ./$(DEPDIR)/libcurlu_la-c-hyper.Plo
- -rm -f ./$(DEPDIR)/libcurlu_la-cf-http.Plo
+ -rm -f ./$(DEPDIR)/libcurlu_la-cf-https-connect.Plo
-rm -f ./$(DEPDIR)/libcurlu_la-cf-socket.Plo
-rm -f ./$(DEPDIR)/libcurlu_la-cfilters.Plo
-rm -f ./$(DEPDIR)/libcurlu_la-conncache.Plo
@@ -5139,7 +5116,6 @@ maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/libcurlu_la-version.Plo
-rm -f ./$(DEPDIR)/libcurlu_la-version_win32.Plo
-rm -f ./$(DEPDIR)/libcurlu_la-warnless.Plo
- -rm -f ./$(DEPDIR)/libcurlu_la-wildcard.Plo
-rm -f ./$(DEPDIR)/libcurlu_la-ws.Plo
-rm -f vauth/$(DEPDIR)/libcurl_la-cleartext.Plo
-rm -f vauth/$(DEPDIR)/libcurl_la-cram.Plo
diff --git a/libs/libcurl/src/Makefile.inc b/libs/libcurl/src/Makefile.inc index bd4aef267b..1a24ff461d 100644 --- a/libs/libcurl/src/Makefile.inc +++ b/libs/libcurl/src/Makefile.inc @@ -107,7 +107,7 @@ LIB_CFILES = \ base64.c \
bufref.c \
c-hyper.c \
- cf-http.c \
+ cf-https-connect.c \
cf-socket.c \
cfilters.c \
conncache.c \
@@ -223,7 +223,6 @@ LIB_CFILES = \ version.c \
version_win32.c \
warnless.c \
- wildcard.c \
ws.c
LIB_HFILES = \
@@ -233,7 +232,7 @@ LIB_HFILES = \ asyn.h \
bufref.h \
c-hyper.h \
- cf-http.h \
+ cf-https-connect.h \
cf-socket.h \
cfilters.h \
conncache.h \
@@ -352,7 +351,6 @@ LIB_HFILES = \ urldata.h \
version_win32.h \
warnless.h \
- wildcard.h \
ws.h
LIB_RCFILES = libcurl.rc
diff --git a/libs/libcurl/src/cf-http.c b/libs/libcurl/src/cf-https-connect.c index 95eab7c0be..ba5c00e965 100644 --- a/libs/libcurl/src/cf-http.c +++ b/libs/libcurl/src/cf-https-connect.c @@ -32,7 +32,7 @@ #include "cfilters.h"
#include "connect.h"
#include "multiif.h"
-#include "cf-http.h"
+#include "cf-https-connect.h"
#include "http2.h"
#include "vquic/vquic.h"
@@ -266,7 +266,8 @@ static CURLcode cf_hc_connect(struct Curl_cfilter *cf, Curl_expire(data, ctx->soft_eyeballs_timeout_ms, EXPIRE_ALPN_EYEBALLS);
}
else if(ctx->h21_baller.enabled)
- cf_hc_baller_init(&ctx->h21_baller, cf, data, "h21", TRNSPRT_TCP);
+ cf_hc_baller_init(&ctx->h21_baller, cf, data, "h21",
+ cf->conn->transport);
ctx->state = CF_HC_CONNECT;
/* FALLTHROUGH */
@@ -280,7 +281,8 @@ static CURLcode cf_hc_connect(struct Curl_cfilter *cf, }
if(time_to_start_h21(cf, data, now)) {
- cf_hc_baller_init(&ctx->h21_baller, cf, data, "h21", TRNSPRT_TCP);
+ cf_hc_baller_init(&ctx->h21_baller, cf, data, "h21",
+ cf->conn->transport);
}
if(cf_hc_baller_is_active(&ctx->h21_baller)) {
@@ -374,6 +376,55 @@ static bool cf_hc_data_pending(struct Curl_cfilter *cf, || cf_hc_baller_data_pending(&ctx->h21_baller, data);
}
+static struct curltime get_max_baller_time(struct Curl_cfilter *cf,
+ struct Curl_easy *data,
+ int query)
+{
+ struct cf_hc_ctx *ctx = cf->ctx;
+ struct Curl_cfilter *cfb;
+ struct curltime t, tmax;
+
+ memset(&tmax, 0, sizeof(tmax));
+ memset(&t, 0, sizeof(t));
+ cfb = ctx->h21_baller.enabled? ctx->h21_baller.cf : NULL;
+ if(cfb && !cfb->cft->query(cfb, data, query, NULL, &t)) {
+ if((t.tv_sec || t.tv_usec) && Curl_timediff_us(t, tmax) > 0)
+ tmax = t;
+ }
+ memset(&t, 0, sizeof(t));
+ cfb = ctx->h3_baller.enabled? ctx->h3_baller.cf : NULL;
+ if(cfb && !cfb->cft->query(cfb, data, query, NULL, &t)) {
+ if((t.tv_sec || t.tv_usec) && Curl_timediff_us(t, tmax) > 0)
+ tmax = t;
+ }
+ return tmax;
+}
+
+static CURLcode cf_hc_query(struct Curl_cfilter *cf,
+ struct Curl_easy *data,
+ int query, int *pres1, void *pres2)
+{
+ if(!cf->connected) {
+ switch(query) {
+ case CF_QUERY_TIMER_CONNECT: {
+ struct curltime *when = pres2;
+ *when = get_max_baller_time(cf, data, CF_QUERY_TIMER_CONNECT);
+ return CURLE_OK;
+ }
+ case CF_QUERY_TIMER_APPCONNECT: {
+ struct curltime *when = pres2;
+ *when = get_max_baller_time(cf, data, CF_QUERY_TIMER_APPCONNECT);
+ return CURLE_OK;
+ }
+ default:
+ break;
+ }
+ }
+ return cf->next?
+ cf->next->cft->query(cf->next, data, query, pres1, pres2) :
+ CURLE_UNKNOWN_OPTION;
+}
+
static void cf_hc_close(struct Curl_cfilter *cf, struct Curl_easy *data)
{
DEBUGF(LOG_CF(data, cf, "close"));
@@ -411,7 +462,7 @@ struct Curl_cftype Curl_cft_http_connect = { Curl_cf_def_cntrl,
Curl_cf_def_conn_is_alive,
Curl_cf_def_conn_keep_alive,
- Curl_cf_def_query,
+ cf_hc_query,
};
static CURLcode cf_hc_create(struct Curl_cfilter **pcf,
diff --git a/libs/libcurl/src/cf-http.h b/libs/libcurl/src/cf-https-connect.h index 3ca1468ea9..3ca1468ea9 100644 --- a/libs/libcurl/src/cf-http.h +++ b/libs/libcurl/src/cf-https-connect.h diff --git a/libs/libcurl/src/cf-socket.c b/libs/libcurl/src/cf-socket.c index 7cabeea978..69d44369fe 100644 --- a/libs/libcurl/src/cf-socket.c +++ b/libs/libcurl/src/cf-socket.c @@ -253,19 +253,6 @@ static CURLcode socket_open(struct Curl_easy *data, else {
/* opensocket callback not set, so simply create the socket now */
*sockfd = socket(addr->family, addr->socktype, addr->protocol);
- if(!*sockfd && addr->socktype == SOCK_DGRAM) {
- /* This is icky and seems, at least, to happen on macOS:
- * we get sockfd == 0 and if called again, we get a valid one > 0.
- * If we close the 0, we sometimes get failures in multi poll, as
- * 0 seems also be the fd for the sockpair used for WAKEUP polling.
- * Very strange. Maybe this code should be ifdef'ed for macOS, but
- * on "real" OS, fd 0 is stdin and we never see that. So...
- */
- fake_sclose(*sockfd);
- *sockfd = socket(addr->family, addr->socktype, addr->protocol);
- DEBUGF(infof(data, "QUIRK: UDP socket() gave handle 0, 2nd attempt %d",
- (int)*sockfd));
- }
}
if(*sockfd == CURL_SOCKET_BAD)
@@ -338,20 +325,6 @@ int Curl_socket_close(struct Curl_easy *data, struct connectdata *conn, return socket_close(data, conn, FALSE, sock);
}
-bool Curl_socket_is_dead(curl_socket_t sock)
-{
- int sval;
- bool ret_val = TRUE;
-
- sval = SOCKET_READABLE(sock, 0);
- if(sval == 0)
- /* timeout */
- ret_val = FALSE;
-
- return ret_val;
-}
-
-
#ifdef USE_WINSOCK
/* When you run a program that uses the Windows Sockets API, you may
experience slow performance when you copy data to a TCP server.
@@ -522,7 +495,7 @@ static CURLcode bindlocal(struct Curl_easy *data, struct connectdata *conn, conn->ip_version = CURL_IPRESOLVE_V6;
#endif
- rc = Curl_resolv(data, dev, 0, FALSE, &h);
+ rc = Curl_resolv(data, dev, 80, FALSE, &h);
if(rc == CURLRESOLV_PENDING)
(void)Curl_resolver_wait_resolv(data, &h);
conn->ip_version = ipver;
@@ -1084,6 +1057,11 @@ static CURLcode cf_tcp_connect(struct Curl_cfilter *cf, if(result)
goto out;
+ if(cf->connected) {
+ *done = TRUE;
+ return CURLE_OK;
+ }
+
/* Connect TCP socket */
rc = do_connect(cf, data, cf->conn->bits.tcp_fastopen);
if(-1 == rc) {
@@ -1449,22 +1427,6 @@ static CURLcode cf_socket_cntrl(struct Curl_cfilter *cf, case CF_CTRL_CONN_INFO_UPDATE:
cf_socket_active(cf, data);
break;
- case CF_CTRL_CONN_REPORT_STATS:
- switch(ctx->transport) {
- case TRNSPRT_UDP:
- case TRNSPRT_QUIC:
- /* Since UDP connected sockets work different from TCP, we use the
- * time of the first byte from the peer as the "connect" time. */
- if(ctx->got_first_byte) {
- Curl_pgrsTimeWas(data, TIMER_CONNECT, ctx->first_byte_at);
- break;
- }
- /* FALLTHROUGH */
- default:
- Curl_pgrsTimeWas(data, TIMER_CONNECT, ctx->connected_at);
- break;
- }
- break;
case CF_CTRL_DATA_SETUP:
Curl_persistconninfo(data, cf->conn, ctx->l_ip, ctx->l_port);
break;
@@ -1473,38 +1435,39 @@ static CURLcode cf_socket_cntrl(struct Curl_cfilter *cf, }
static bool cf_socket_conn_is_alive(struct Curl_cfilter *cf,
- struct Curl_easy *data)
+ struct Curl_easy *data,
+ bool *input_pending)
{
struct cf_socket_ctx *ctx = cf->ctx;
- int sval;
+ struct pollfd pfd[1];
+ int r;
+ *input_pending = FALSE;
(void)data;
if(!ctx || ctx->sock == CURL_SOCKET_BAD)
return FALSE;
- sval = SOCKET_READABLE(ctx->sock, 0);
- if(sval == 0) {
- /* timeout */
- return TRUE;
- }
- else if(sval & CURL_CSELECT_ERR) {
- /* socket is in an error state */
+ /* Check with 0 timeout if there are any events pending on the socket */
+ pfd[0].fd = ctx->sock;
+ pfd[0].events = POLLRDNORM|POLLIN|POLLRDBAND|POLLPRI;
+ pfd[0].revents = 0;
+
+ r = Curl_poll(pfd, 1, 0);
+ if(r < 0) {
+ DEBUGF(LOG_CF(data, cf, "is_alive: poll error, assume dead"));
return FALSE;
}
- else if(sval & CURL_CSELECT_IN) {
- /* readable with no error. could still be closed */
-/* Minix 3.1 doesn't support any flags on recv; just assume socket is OK */
-#ifdef MSG_PEEK
- /* use the socket */
- char buf;
- if(recv((RECV_TYPE_ARG1)ctx->sock, (RECV_TYPE_ARG2)&buf,
- (RECV_TYPE_ARG3)1, (RECV_TYPE_ARG4)MSG_PEEK) == 0) {
- return FALSE; /* FIN received */
- }
-#endif
+ else if(r == 0) {
+ DEBUGF(LOG_CF(data, cf, "is_alive: poll timeout, assume alive"));
return TRUE;
}
+ else if(pfd[0].revents & (POLLERR|POLLHUP|POLLPRI|POLLNVAL)) {
+ DEBUGF(LOG_CF(data, cf, "is_alive: err/hup/etc events, assume dead"));
+ return FALSE;
+ }
+ DEBUGF(LOG_CF(data, cf, "is_alive: valid events, looks alive"));
+ *input_pending = TRUE;
return TRUE;
}
@@ -1527,6 +1490,24 @@ static CURLcode cf_socket_query(struct Curl_cfilter *cf, else
*pres1 = -1;
return CURLE_OK;
+ case CF_QUERY_TIMER_CONNECT: {
+ struct curltime *when = pres2;
+ switch(ctx->transport) {
+ case TRNSPRT_UDP:
+ case TRNSPRT_QUIC:
+ /* Since UDP connected sockets work different from TCP, we use the
+ * time of the first byte from the peer as the "connect" time. */
+ if(ctx->got_first_byte) {
+ *when = ctx->first_byte_at;
+ break;
+ }
+ /* FALLTHROUGH */
+ default:
+ *when = ctx->connected_at;
+ break;
+ }
+ return CURLE_OK;
+ }
default:
break;
}
@@ -1826,7 +1807,6 @@ CURLcode Curl_conn_tcp_listen_set(struct Curl_easy *data, Curl_conn_cf_add(data, conn, sockindex, cf);
conn->sock[sockindex] = ctx->sock;
- set_remote_ip(cf, data);
set_local_ip(cf, data);
ctx->active = TRUE;
ctx->connected_at = Curl_now();
@@ -1841,6 +1821,38 @@ out: return result;
}
+static void set_accepted_remote_ip(struct Curl_cfilter *cf,
+ struct Curl_easy *data)
+{
+ struct cf_socket_ctx *ctx = cf->ctx;
+#ifdef HAVE_GETPEERNAME
+ char buffer[STRERROR_LEN];
+ struct Curl_sockaddr_storage ssrem;
+ curl_socklen_t plen;
+
+ ctx->r_ip[0] = 0;
+ ctx->r_port = 0;
+ plen = sizeof(ssrem);
+ memset(&ssrem, 0, plen);
+ if(getpeername(ctx->sock, (struct sockaddr*) &ssrem, &plen)) {
+ int error = SOCKERRNO;
+ failf(data, "getpeername() failed with errno %d: %s",
+ error, Curl_strerror(error, buffer, sizeof(buffer)));
+ return;
+ }
+ if(!Curl_addr2string((struct sockaddr*)&ssrem, plen,
+ ctx->r_ip, &ctx->r_port)) {
+ failf(data, "ssrem inet_ntop() failed with errno %d: %s",
+ errno, Curl_strerror(errno, buffer, sizeof(buffer)));
+ return;
+ }
+#else
+ ctx->r_ip[0] = 0;
+ ctx->r_port = 0;
+ (void)data;
+#endif
+}
+
CURLcode Curl_conn_tcp_accepted_set(struct Curl_easy *data,
struct connectdata *conn,
int sockindex, curl_socket_t *s)
@@ -1857,13 +1869,14 @@ CURLcode Curl_conn_tcp_accepted_set(struct Curl_easy *data, socket_close(data, conn, TRUE, ctx->sock);
ctx->sock = *s;
conn->sock[sockindex] = ctx->sock;
- set_remote_ip(cf, data);
+ set_accepted_remote_ip(cf, data);
set_local_ip(cf, data);
ctx->active = TRUE;
ctx->accepted = TRUE;
ctx->connected_at = Curl_now();
cf->connected = TRUE;
- DEBUGF(LOG_CF(data, cf, "Curl_conn_tcp_accepted_set(%d)", (int)ctx->sock));
+ DEBUGF(LOG_CF(data, cf, "accepted_set(sock=%d, remote=%s port=%d)",
+ (int)ctx->sock, ctx->r_ip, ctx->r_port));
return CURLE_OK;
}
diff --git a/libs/libcurl/src/cf-socket.h b/libs/libcurl/src/cf-socket.h index fa9391f9a9..897a46e580 100644 --- a/libs/libcurl/src/cf-socket.h +++ b/libs/libcurl/src/cf-socket.h @@ -70,13 +70,6 @@ CURLcode Curl_socket_open(struct Curl_easy *data, int Curl_socket_close(struct Curl_easy *data, struct connectdata *conn,
curl_socket_t sock);
-/*
- * This function should return TRUE if the socket is to be assumed to
- * be dead. Most commonly this happens when the server has closed the
- * connection due to inactivity.
- */
-bool Curl_socket_is_dead(curl_socket_t sock);
-
/**
* Determine the curl code for a socket connect() == -1 with errno.
*/
diff --git a/libs/libcurl/src/cfilters.c b/libs/libcurl/src/cfilters.c index 8d65681ce1..ffd0dbc883 100644 --- a/libs/libcurl/src/cfilters.c +++ b/libs/libcurl/src/cfilters.c @@ -124,10 +124,11 @@ ssize_t Curl_cf_def_recv(struct Curl_cfilter *cf, struct Curl_easy *data, }
bool Curl_cf_def_conn_is_alive(struct Curl_cfilter *cf,
- struct Curl_easy *data)
+ struct Curl_easy *data,
+ bool *input_pending)
{
return cf->next?
- cf->next->cft->is_alive(cf->next, data) :
+ cf->next->cft->is_alive(cf->next, data, input_pending) :
FALSE; /* pessimistic in absence of data */
}
@@ -370,9 +371,12 @@ CURLcode Curl_conn_connect(struct Curl_easy *data, result = cf->cft->connect(cf, data, blocking, done);
if(!result && *done) {
Curl_conn_ev_update_info(data, data->conn);
- Curl_conn_ev_report_stats(data, data->conn);
+ Curl_conn_report_connect_stats(data, data->conn);
data->conn->keepalive = Curl_now();
}
+ else if(result) {
+ Curl_conn_report_connect_stats(data, data->conn);
+ }
}
return result;
@@ -608,16 +612,32 @@ void Curl_conn_ev_update_info(struct Curl_easy *data, cf_cntrl_all(conn, data, TRUE, CF_CTRL_CONN_INFO_UPDATE, 0, NULL);
}
-void Curl_conn_ev_report_stats(struct Curl_easy *data,
- struct connectdata *conn)
+void Curl_conn_report_connect_stats(struct Curl_easy *data,
+ struct connectdata *conn)
{
- cf_cntrl_all(conn, data, TRUE, CF_CTRL_CONN_REPORT_STATS, 0, NULL);
+ struct Curl_cfilter *cf = conn->cfilter[FIRSTSOCKET];
+ if(cf) {
+ struct curltime connected;
+ struct curltime appconnected;
+
+ memset(&connected, 0, sizeof(connected));
+ cf->cft->query(cf, data, CF_QUERY_TIMER_CONNECT, NULL, &connected);
+ if(connected.tv_sec || connected.tv_usec)
+ Curl_pgrsTimeWas(data, TIMER_CONNECT, connected);
+
+ memset(&appconnected, 0, sizeof(appconnected));
+ cf->cft->query(cf, data, CF_QUERY_TIMER_APPCONNECT, NULL, &appconnected);
+ if(appconnected.tv_sec || appconnected.tv_usec)
+ Curl_pgrsTimeWas(data, TIMER_APPCONNECT, appconnected);
+ }
}
-bool Curl_conn_is_alive(struct Curl_easy *data, struct connectdata *conn)
+bool Curl_conn_is_alive(struct Curl_easy *data, struct connectdata *conn,
+ bool *input_pending)
{
struct Curl_cfilter *cf = conn->cfilter[FIRSTSOCKET];
- return cf && !cf->conn->bits.close && cf->cft->is_alive(cf, data);
+ return cf && !cf->conn->bits.close &&
+ cf->cft->is_alive(cf, data, input_pending);
}
CURLcode Curl_conn_keep_alive(struct Curl_easy *data,
diff --git a/libs/libcurl/src/cfilters.h b/libs/libcurl/src/cfilters.h index 244b956918..3a50fadcd8 100644 --- a/libs/libcurl/src/cfilters.h +++ b/libs/libcurl/src/cfilters.h @@ -85,7 +85,8 @@ typedef ssize_t Curl_cft_recv(struct Curl_cfilter *cf, CURLcode *err); /* error to return */
typedef bool Curl_cft_conn_is_alive(struct Curl_cfilter *cf,
- struct Curl_easy *data);
+ struct Curl_easy *data,
+ bool *input_pending);
typedef CURLcode Curl_cft_conn_keep_alive(struct Curl_cfilter *cf,
struct Curl_easy *data);
@@ -109,8 +110,6 @@ typedef CURLcode Curl_cft_conn_keep_alive(struct Curl_cfilter *cf, #define CF_CTRL_DATA_DONE_SEND 8 /* 0 NULL ignored */
/* update conn info at connection and data */
#define CF_CTRL_CONN_INFO_UPDATE (256+0) /* 0 NULL ignored */
-/* report conn statistics (timers) for connection and data */
-#define CF_CTRL_CONN_REPORT_STATS (256+1) /* 0 NULL ignored */
/**
* Handle event/control for the filter.
@@ -138,6 +137,8 @@ typedef CURLcode Curl_cft_cntrl(struct Curl_cfilter *cf, #define CF_QUERY_MAX_CONCURRENT 1 /* number - */
#define CF_QUERY_CONNECT_REPLY_MS 2 /* number - */
#define CF_QUERY_SOCKET 3 /* - curl_socket_t */
+#define CF_QUERY_TIMER_CONNECT 4 /* - struct curltime */
+#define CF_QUERY_TIMER_APPCONNECT 5 /* - struct curltime */
/**
* Query the cfilter for properties. Filters ignorant of a query will
@@ -216,7 +217,8 @@ CURLcode Curl_cf_def_cntrl(struct Curl_cfilter *cf, struct Curl_easy *data,
int event, int arg1, void *arg2);
bool Curl_cf_def_conn_is_alive(struct Curl_cfilter *cf,
- struct Curl_easy *data);
+ struct Curl_easy *data,
+ bool *input_pending);
CURLcode Curl_cf_def_conn_keep_alive(struct Curl_cfilter *cf,
struct Curl_easy *data);
CURLcode Curl_cf_def_query(struct Curl_cfilter *cf,
@@ -435,15 +437,16 @@ void Curl_conn_ev_update_info(struct Curl_easy *data, struct connectdata *conn);
/**
- * Inform connection filters to report statistics.
+ * Update connection statistics
*/
-void Curl_conn_ev_report_stats(struct Curl_easy *data,
- struct connectdata *conn);
+void Curl_conn_report_connect_stats(struct Curl_easy *data,
+ struct connectdata *conn);
/**
* Check if FIRSTSOCKET's cfilter chain deems connection alive.
*/
-bool Curl_conn_is_alive(struct Curl_easy *data, struct connectdata *conn);
+bool Curl_conn_is_alive(struct Curl_easy *data, struct connectdata *conn,
+ bool *input_pending);
/**
* Try to upkeep the connection filters at sockindex.
diff --git a/libs/libcurl/src/config-win32.h b/libs/libcurl/src/config-win32.h index f014d4746c..e12ab552fd 100644 --- a/libs/libcurl/src/config-win32.h +++ b/libs/libcurl/src/config-win32.h @@ -39,10 +39,18 @@ #define HAVE_FCNTL_H 1
/* Define to 1 if you have the <inttypes.h> header file. */
-#if defined(_MSC_VER) && (_MSC_VER >= 1800)
+#if defined(__MINGW32__) || \
+ (defined(_MSC_VER) && (_MSC_VER >= 1800))
#define HAVE_INTTYPES_H 1
#endif
+/* Define to 1 if you have the <stdint.h> header file. */
+#if defined(__MINGW32__) || defined(__POCC__) || \
+ (defined(_MSC_VER) && (_MSC_VER >= 1600)) || \
+ (defined(__BORLANDC__) && (__BORLANDC__ >= 0x0582))
+#define HAVE_STDINT_H 1
+#endif
+
/* Define if you have the <io.h> header file. */
#define HAVE_IO_H 1
@@ -197,10 +205,6 @@ /* Define if you have the socket function. */
#define HAVE_SOCKET 1
-/* Define if libSSH2 is in use */
-#define USE_LIBSSH2 1
-#define HAVE_LIBSSH2_H 1
-
/* Define if you have the strcasecmp function. */
#ifdef __MINGW32__
#define HAVE_STRCASECMP 1
@@ -619,9 +623,6 @@ Vista # define CURL_DISABLE_LDAP 1
#endif
-/* if SSL is enabled */
-#define USE_OPENSSL 1
-
/* Define to use the Windows crypto library. */
#if !defined(CURL_WINDOWS_APP)
#define USE_WIN32_CRYPTO
diff --git a/libs/libcurl/src/conncache.c b/libs/libcurl/src/conncache.c index 54075da7e6..5b17a1b7b1 100644 --- a/libs/libcurl/src/conncache.c +++ b/libs/libcurl/src/conncache.c @@ -45,13 +45,6 @@ #define HASHKEY_SIZE 128
-static void conn_llist_dtor(void *user, void *element)
-{
- struct connectdata *conn = element;
- (void)user;
- conn->bundle = NULL;
-}
-
static CURLcode bundle_create(struct connectbundle **bundlep)
{
DEBUGASSERT(*bundlep == NULL);
@@ -62,17 +55,12 @@ static CURLcode bundle_create(struct connectbundle **bundlep) (*bundlep)->num_connections = 0;
(*bundlep)->multiuse = BUNDLE_UNKNOWN;
- Curl_llist_init(&(*bundlep)->conn_list, (Curl_llist_dtor) conn_llist_dtor);
+ Curl_llist_init(&(*bundlep)->conn_list, NULL);
return CURLE_OK;
}
static void bundle_destroy(struct connectbundle *bundle)
{
- if(!bundle)
- return;
-
- Curl_llist_destroy(&bundle->conn_list, NULL);
-
free(bundle);
}
diff --git a/libs/libcurl/src/connect.c b/libs/libcurl/src/connect.c index e17bf235be..5b715acf58 100644 --- a/libs/libcurl/src/connect.c +++ b/libs/libcurl/src/connect.c @@ -59,7 +59,7 @@ #include "strerror.h"
#include "cfilters.h"
#include "connect.h"
-#include "cf-http.h"
+#include "cf-https-connect.h"
#include "cf-socket.h"
#include "select.h"
#include "url.h" /* for Curl_safefree() */
@@ -957,6 +957,28 @@ static bool cf_he_data_pending(struct Curl_cfilter *cf, return FALSE;
}
+static struct curltime get_max_baller_time(struct Curl_cfilter *cf,
+ struct Curl_easy *data,
+ int query)
+{
+ struct cf_he_ctx *ctx = cf->ctx;
+ struct curltime t, tmax;
+ size_t i;
+
+ memset(&tmax, 0, sizeof(tmax));
+ for(i = 0; i < sizeof(ctx->baller)/sizeof(ctx->baller[0]); i++) {
+ struct eyeballer *baller = ctx->baller[i];
+
+ memset(&t, 0, sizeof(t));
+ if(baller && baller->cf &&
+ !baller->cf->cft->query(baller->cf, data, query, NULL, &t)) {
+ if((t.tv_sec || t.tv_usec) && Curl_timediff_us(t, tmax) > 0)
+ tmax = t;
+ }
+ }
+ return tmax;
+}
+
static CURLcode cf_he_query(struct Curl_cfilter *cf,
struct Curl_easy *data,
int query, int *pres1, void *pres2)
@@ -984,7 +1006,16 @@ static CURLcode cf_he_query(struct Curl_cfilter *cf, DEBUGF(LOG_CF(data, cf, "query connect reply: %dms", *pres1));
return CURLE_OK;
}
-
+ case CF_QUERY_TIMER_CONNECT: {
+ struct curltime *when = pres2;
+ *when = get_max_baller_time(cf, data, CF_QUERY_TIMER_CONNECT);
+ return CURLE_OK;
+ }
+ case CF_QUERY_TIMER_APPCONNECT: {
+ struct curltime *when = pres2;
+ *when = get_max_baller_time(cf, data, CF_QUERY_TIMER_APPCONNECT);
+ return CURLE_OK;
+ }
default:
break;
}
diff --git a/libs/libcurl/src/content_encoding.c b/libs/libcurl/src/content_encoding.c index eba1f319c4..6858b4547f 100644 --- a/libs/libcurl/src/content_encoding.c +++ b/libs/libcurl/src/content_encoding.c @@ -33,7 +33,15 @@ #endif
#ifdef HAVE_BROTLI
+#if defined(__GNUC__)
+/* Ignore -Wvla warnings in brotli headers */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+#endif
#include <brotli/decode.h>
+#if defined(__GNUC__)
+#pragma GCC diagnostic pop
+#endif
#endif
#ifdef HAVE_ZSTD
diff --git a/libs/libcurl/src/cookie.c b/libs/libcurl/src/cookie.c index ccb25cdc51..77e202b6c6 100644 --- a/libs/libcurl/src/cookie.c +++ b/libs/libcurl/src/cookie.c @@ -101,13 +101,14 @@ Example set of cookies: #include "parsedate.h"
#include "rename.h"
#include "fopen.h"
+#include "strdup.h"
/* The last 3 #include files should be in this order */
#include "curl_printf.h"
#include "curl_memory.h"
#include "memdebug.h"
-static void strstore(char **str, const char *newstr);
+static void strstore(char **str, const char *newstr, size_t len);
static void freecookie(struct Cookie *co)
{
@@ -122,15 +123,17 @@ static void freecookie(struct Cookie *co) free(co);
}
-static bool tailmatch(const char *cooke_domain, const char *hostname)
+static bool tailmatch(const char *cookie_domain, size_t cookie_domain_len,
+ const char *hostname)
{
- size_t cookie_domain_len = strlen(cooke_domain);
size_t hostname_len = strlen(hostname);
if(hostname_len < cookie_domain_len)
return FALSE;
- if(!strcasecompare(cooke_domain, hostname + hostname_len-cookie_domain_len))
+ if(!strncasecompare(cookie_domain,
+ hostname + hostname_len-cookie_domain_len,
+ cookie_domain_len))
return FALSE;
/*
@@ -176,7 +179,7 @@ static bool pathmatch(const char *cookie_path, const char *request_uri) /* #-fragments are already cut off! */
if(0 == strlen(uri_path) || uri_path[0] != '/') {
- strstore(&uri_path, "/");
+ strstore(&uri_path, "/", 1);
if(!uri_path)
return FALSE;
}
@@ -310,7 +313,7 @@ static char *sanitize_cookie_path(const char *cookie_path) /* RFC6265 5.2.4 The Path Attribute */
if(new_path[0] != '/') {
/* Let cookie-path be the default-path. */
- strstore(&new_path, "/");
+ strstore(&new_path, "/", 1);
return new_path;
}
@@ -333,10 +336,9 @@ void Curl_cookie_loadfiles(struct Curl_easy *data) if(list) {
Curl_share_lock(data, CURL_LOCK_DATA_COOKIE, CURL_LOCK_ACCESS_SINGLE);
while(list) {
- struct CookieInfo *newcookies = Curl_cookie_init(data,
- list->data,
- data->cookies,
- data->set.cookiesession);
+ struct CookieInfo *newcookies =
+ Curl_cookie_init(data, list->data, data->cookies,
+ data->set.cookiesession);
if(!newcookies)
/*
* Failure may be due to OOM or a bad cookie; both are ignored
@@ -360,10 +362,14 @@ void Curl_cookie_loadfiles(struct Curl_easy *data) * parsing in a last-wins scenario. The caller is responsible for checking
* for OOM errors.
*/
-static void strstore(char **str, const char *newstr)
+static void strstore(char **str, const char *newstr, size_t len)
{
+ DEBUGASSERT(newstr);
+ DEBUGASSERT(str);
free(*str);
- *str = strdup(newstr);
+ *str = Curl_memdup(newstr, len + 1);
+ if(*str)
+ (*str)[len] = 0;
}
/*
@@ -425,15 +431,19 @@ static void remove_expired(struct CookieInfo *cookies) }
/* Make sure domain contains a dot or is localhost. */
-static bool bad_domain(const char *domain)
+static bool bad_domain(const char *domain, size_t len)
{
- if(strcasecompare(domain, "localhost"))
+ if((len == 9) && strncasecompare(domain, "localhost", 9))
return FALSE;
else {
/* there must be a dot present, but that dot must not be a trailing dot */
- char *dot = strchr(domain, '.');
- if(dot)
- return dot[1] ? FALSE : TRUE;
+ char *dot = memchr(domain, '.', len);
+ if(dot) {
+ size_t i = dot - domain;
+ if((len - i) > 1)
+ /* the dot is not the last byte */
+ return FALSE;
+ }
}
return TRUE;
}
@@ -513,10 +523,9 @@ Curl_cookie_add(struct Curl_easy *data, if(httpheader) {
/* This line was read off an HTTP-header */
- char name[MAX_NAME];
- char what[MAX_NAME];
+ const char *namep;
+ const char *valuep;
const char *ptr;
- const char *semiptr;
size_t linelength = strlen(lineptr);
if(linelength > MAX_COOKIE_LINE) {
@@ -525,73 +534,65 @@ Curl_cookie_add(struct Curl_easy *data, return NULL;
}
- semiptr = strchr(lineptr, ';'); /* first, find a semicolon */
-
- while(*lineptr && ISBLANK(*lineptr))
- lineptr++;
-
ptr = lineptr;
do {
- /* we have a <what>=<this> pair or a stand-alone word here */
- name[0] = what[0] = 0; /* init the buffers */
- if(1 <= sscanf(ptr, "%" MAX_NAME_TXT "[^;\t\r\n=] =%"
- MAX_NAME_TXT "[^;\r\n]",
- name, what)) {
- /*
- * Use strstore() below to properly deal with received cookie
- * headers that have the same string property set more than once,
- * and then we use the last one.
- */
- const char *whatptr;
+ size_t vlen;
+ size_t nlen;
+
+ while(*ptr && ISBLANK(*ptr))
+ ptr++;
+
+ /* we have a <name>=<value> pair or a stand-alone word here */
+ nlen = strcspn(ptr, ";\t\r\n=");
+ if(nlen) {
bool done = FALSE;
- bool sep;
- size_t len = strlen(what);
- size_t nlen = strlen(name);
- const char *endofn = &ptr[ nlen ];
+ bool sep = FALSE;
- /*
- * Check for too long individual name or contents, or too long
- * combination of name + contents. Chrome and Firefox support 4095 or
- * 4096 bytes combo
- */
- if(nlen >= (MAX_NAME-1) || len >= (MAX_NAME-1) ||
- ((nlen + len) > MAX_NAME)) {
- freecookie(co);
- infof(data, "oversized cookie dropped, name/val %zu + %zu bytes",
- nlen, len);
- return NULL;
- }
+ namep = ptr;
+ ptr += nlen;
- /* name ends with a '=' ? */
- sep = (*endofn == '=')?TRUE:FALSE;
+ /* trim trailing spaces and tabs after name */
+ while(nlen && ISBLANK(namep[nlen - 1]))
+ nlen--;
- if(nlen) {
- endofn--; /* move to the last character */
- if(ISBLANK(*endofn)) {
- /* skip trailing spaces in name */
- while(*endofn && ISBLANK(*endofn) && nlen) {
- endofn--;
- nlen--;
- }
- name[nlen] = 0; /* new end of name */
+ if(*ptr == '=') {
+ vlen = strcspn(++ptr, ";\r\n");
+ valuep = ptr;
+ sep = TRUE;
+ ptr = &valuep[vlen];
+
+ /* Strip off trailing whitespace from the value */
+ while(vlen && ISBLANK(valuep[vlen-1]))
+ vlen--;
+
+ /* Skip leading whitespace from the value */
+ while(vlen && ISBLANK(*valuep)) {
+ valuep++;
+ vlen--;
}
- }
- /* Strip off trailing whitespace from the 'what' */
- while(len && ISBLANK(what[len-1])) {
- what[len-1] = 0;
- len--;
+ /* Reject cookies with a TAB inside the value */
+ if(memchr(valuep, '\t', vlen)) {
+ freecookie(co);
+ infof(data, "cookie contains TAB, dropping");
+ return NULL;
+ }
+ }
+ else {
+ valuep = NULL;
+ vlen = 0;
}
- /* Skip leading whitespace from the 'what' */
- whatptr = what;
- while(*whatptr && ISBLANK(*whatptr))
- whatptr++;
-
- /* Reject cookies with a TAB inside the content */
- if(strchr(whatptr, '\t')) {
+ /*
+ * Check for too long individual name or contents, or too long
+ * combination of name + contents. Chrome and Firefox support 4095 or
+ * 4096 bytes combo
+ */
+ if(nlen >= (MAX_NAME-1) || vlen >= (MAX_NAME-1) ||
+ ((nlen + vlen) > MAX_NAME)) {
freecookie(co);
- infof(data, "cookie contains TAB, dropping");
+ infof(data, "oversized cookie dropped, name/val %zu + %zu bytes",
+ nlen, vlen);
return NULL;
}
@@ -601,13 +602,19 @@ Curl_cookie_add(struct Curl_easy *data, * "the rest". Prefixes must start with '__' and end with a '-', so
* only test for names where that can possibly be true.
*/
- if(nlen > 3 && name[0] == '_' && name[1] == '_') {
- if(strncasecompare("__Secure-", name, 9))
+ if(nlen >= 7 && namep[0] == '_' && namep[1] == '_') {
+ if(strncasecompare("__Secure-", namep, 9))
co->prefix |= COOKIE_PREFIX__SECURE;
- else if(strncasecompare("__Host-", name, 7))
+ else if(strncasecompare("__Host-", namep, 7))
co->prefix |= COOKIE_PREFIX__HOST;
}
+ /*
+ * Use strstore() below to properly deal with received cookie
+ * headers that have the same string property set more than once,
+ * and then we use the last one.
+ */
+
if(!co->name) {
/* The very first name/value pair is the actual cookie name */
if(!sep) {
@@ -615,20 +622,20 @@ Curl_cookie_add(struct Curl_easy *data, badcookie = TRUE;
break;
}
- co->name = strdup(name);
- co->value = strdup(whatptr);
+ strstore(&co->name, namep, nlen);
+ strstore(&co->value, valuep, vlen);
done = TRUE;
if(!co->name || !co->value) {
badcookie = TRUE;
break;
}
- if(invalid_octets(whatptr) || invalid_octets(name)) {
+ if(invalid_octets(co->value) || invalid_octets(co->name)) {
infof(data, "invalid octets in name/value, cookie dropped");
badcookie = TRUE;
break;
}
}
- else if(!len) {
+ else if(!vlen) {
/*
* this was a "<name>=" with no content, and we must allow
* 'secure' and 'httponly' specified this weirdly
@@ -639,7 +646,7 @@ Curl_cookie_add(struct Curl_easy *data, * using a secure protocol, or when the cookie is being set by
* reading from file
*/
- if(strcasecompare("secure", name)) {
+ if((nlen == 6) && strncasecompare("secure", namep, 6)) {
if(secure || !c->running) {
co->secure = TRUE;
}
@@ -648,7 +655,7 @@ Curl_cookie_add(struct Curl_easy *data, break;
}
}
- else if(strcasecompare("httponly", name))
+ else if((nlen == 8) && strncasecompare("httponly", namep, 8))
co->httponly = TRUE;
else if(sep)
/* there was a '=' so we're not done parsing this field */
@@ -656,8 +663,8 @@ Curl_cookie_add(struct Curl_easy *data, }
if(done)
;
- else if(strcasecompare("path", name)) {
- strstore(&co->path, whatptr);
+ else if((nlen == 4) && strncasecompare("path", namep, 4)) {
+ strstore(&co->path, valuep, vlen);
if(!co->path) {
badcookie = TRUE; /* out of memory bad */
break;
@@ -669,7 +676,8 @@ Curl_cookie_add(struct Curl_easy *data, break;
}
}
- else if(strcasecompare("domain", name) && whatptr[0]) {
+ else if((nlen == 6) &&
+ strncasecompare("domain", namep, 6) && vlen) {
bool is_ip;
/*
@@ -677,8 +685,10 @@ Curl_cookie_add(struct Curl_easy *data, * the given domain is not valid and thus cannot be set.
*/
- if('.' == whatptr[0])
- whatptr++; /* ignore preceding dot */
+ if('.' == valuep[0]) {
+ valuep++; /* ignore preceding dot */
+ vlen--;
+ }
#ifndef USE_LIBPSL
/*
@@ -686,16 +696,17 @@ Curl_cookie_add(struct Curl_easy *data, * TLD or otherwise "protected" suffix. To reduce risk, we require a
* dot OR the exact host name being "localhost".
*/
- if(bad_domain(whatptr))
+ if(bad_domain(valuep, vlen))
domain = ":";
#endif
- is_ip = Curl_host_is_ipnum(domain ? domain : whatptr);
+ is_ip = Curl_host_is_ipnum(domain ? domain : valuep);
if(!domain
- || (is_ip && !strcmp(whatptr, domain))
- || (!is_ip && tailmatch(whatptr, domain))) {
- strstore(&co->domain, whatptr);
+ || (is_ip && !strncmp(valuep, domain, vlen) &&
+ (vlen == strlen(domain)))
+ || (!is_ip && tailmatch(valuep, vlen, domain))) {
+ strstore(&co->domain, valuep, vlen);
if(!co->domain) {
badcookie = TRUE;
break;
@@ -711,17 +722,17 @@ Curl_cookie_add(struct Curl_easy *data, */
badcookie = TRUE;
infof(data, "skipped cookie with bad tailmatch domain: %s",
- whatptr);
+ valuep);
}
}
- else if(strcasecompare("version", name)) {
- strstore(&co->version, whatptr);
+ else if((nlen == 7) && strncasecompare("version", namep, 7)) {
+ strstore(&co->version, valuep, vlen);
if(!co->version) {
badcookie = TRUE;
break;
}
}
- else if(strcasecompare("max-age", name)) {
+ else if((nlen == 7) && strncasecompare("max-age", namep, 7)) {
/*
* Defined in RFC2109:
*
@@ -731,14 +742,14 @@ Curl_cookie_add(struct Curl_easy *data, * client should discard the cookie. A value of zero means the
* cookie should be discarded immediately.
*/
- strstore(&co->maxage, whatptr);
+ strstore(&co->maxage, valuep, vlen);
if(!co->maxage) {
badcookie = TRUE;
break;
}
}
- else if(strcasecompare("expires", name)) {
- strstore(&co->expirestr, whatptr);
+ else if((nlen == 7) && strncasecompare("expires", namep, 7)) {
+ strstore(&co->expirestr, valuep, vlen);
if(!co->expirestr) {
badcookie = TRUE;
break;
@@ -753,24 +764,13 @@ Curl_cookie_add(struct Curl_easy *data, /* this is an "illegal" <what>=<this> pair */
}
- if(!semiptr || !*semiptr) {
- /* we already know there are no more cookies */
- semiptr = NULL;
- continue;
- }
-
- ptr = semiptr + 1;
while(*ptr && ISBLANK(*ptr))
ptr++;
- semiptr = strchr(ptr, ';'); /* now, find the next semicolon */
-
- if(!semiptr && *ptr)
- /*
- * There are no more semicolons, but there's a final name=value pair
- * coming up
- */
- semiptr = strchr(ptr, '\0');
- } while(semiptr);
+ if(*ptr == ';')
+ ptr++;
+ else
+ break;
+ } while(1);
if(co->maxage) {
CURLofft offt;
@@ -1057,7 +1057,7 @@ Curl_cookie_add(struct Curl_easy *data, Curl_psl_release(data);
}
else
- acceptable = !bad_domain(domain);
+ acceptable = !bad_domain(domain, strlen(domain));
if(!acceptable) {
infof(data, "cookie '%s' dropped, domain '%s' must not "
@@ -1447,7 +1447,8 @@ struct Cookie *Curl_cookie_getlist(struct Curl_easy *data, /* now check if the domain is correct */
if(!co->domain ||
- (co->tailmatch && !is_ip && tailmatch(co->domain, host)) ||
+ (co->tailmatch && !is_ip &&
+ tailmatch(co->domain, co->domain? strlen(co->domain):0, host)) ||
((!co->tailmatch || is_ip) && strcasecompare(host, co->domain)) ) {
/*
* the right part of the host matches the domain stuff in the
@@ -1798,11 +1799,6 @@ void Curl_flush_cookies(struct Curl_easy *data, bool cleanup) CURLcode res;
if(data->set.str[STRING_COOKIEJAR]) {
- /* If there is a list of cookie files to read, do it first so that
- we have all the told files read before we write the new jar.
- Curl_cookie_loadfiles() LOCKS and UNLOCKS the share itself! */
- Curl_cookie_loadfiles(data);
-
Curl_share_lock(data, CURL_LOCK_DATA_COOKIE, CURL_LOCK_ACCESS_SINGLE);
/* if we have a destination file for all the cookies to get dumped to */
diff --git a/libs/libcurl/src/curl_config.h.in b/libs/libcurl/src/curl_config.h.in index 9770e36c07..2aa6ef4803 100644 --- a/libs/libcurl/src/curl_config.h.in +++ b/libs/libcurl/src/curl_config.h.in @@ -141,6 +141,9 @@ /* Define to 1 if you have the alarm function. */
#undef HAVE_ALARM
+/* Define to 1 if you have the `arc4random' function. */
+#undef HAVE_ARC4RANDOM
+
/* Define to 1 if you have the <arpa/inet.h> header file. */
#undef HAVE_ARPA_INET_H
diff --git a/libs/libcurl/src/curl_gssapi.c b/libs/libcurl/src/curl_gssapi.c index e4c26397a0..10506bf674 100644 --- a/libs/libcurl/src/curl_gssapi.c +++ b/libs/libcurl/src/curl_gssapi.c @@ -34,10 +34,16 @@ #include "curl_memory.h"
#include "memdebug.h"
-gss_OID_desc Curl_spnego_mech_oid = {
+#if defined(__GNUC__)
+#define CURL_ALIGN8 __attribute__ ((aligned(8)))
+#else
+#define CURL_ALIGN8
+#endif
+
+gss_OID_desc Curl_spnego_mech_oid CURL_ALIGN8 = {
6, (char *)"\x2b\x06\x01\x05\x05\x02"
};
-gss_OID_desc Curl_krb5_mech_oid = {
+gss_OID_desc Curl_krb5_mech_oid CURL_ALIGN8 = {
9, (char *)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x02"
};
diff --git a/libs/libcurl/src/curl_log.c b/libs/libcurl/src/curl_log.c index 0825e27183..ab1cf29ed6 100644 --- a/libs/libcurl/src/curl_log.c +++ b/libs/libcurl/src/curl_log.c @@ -38,7 +38,7 @@ #include "connect.h"
#include "http2.h"
#include "http_proxy.h"
-#include "cf-http.h"
+#include "cf-https-connect.h"
#include "socks.h"
#include "strtok.h"
#include "vtls/vtls.h"
diff --git a/libs/libcurl/src/curl_path.c b/libs/libcurl/src/curl_path.c index e861698c65..0b2f796d1f 100644 --- a/libs/libcurl/src/curl_path.c +++ b/libs/libcurl/src/curl_path.c @@ -32,70 +32,65 @@ #include "escape.h"
#include "memdebug.h"
+#define MAX_SSHPATH_LEN 100000 /* arbitrary */
+
/* figure out the path to work with in this particular request */
CURLcode Curl_getworkingpath(struct Curl_easy *data,
char *homedir, /* when SFTP is used */
char **path) /* returns the allocated
real path to work with */
{
- char *real_path = NULL;
char *working_path;
size_t working_path_len;
+ struct dynbuf npath;
CURLcode result =
Curl_urldecode(data->state.up.path, 0, &working_path,
&working_path_len, REJECT_ZERO);
if(result)
return result;
+ /* new path to switch to in case we need to */
+ Curl_dyn_init(&npath, MAX_SSHPATH_LEN);
+
/* Check for /~/, indicating relative to the user's home directory */
- if(data->conn->handler->protocol & CURLPROTO_SCP) {
- real_path = malloc(working_path_len + 1);
- if(!real_path) {
+ if((data->conn->handler->protocol & CURLPROTO_SCP) &&
+ (working_path_len > 3) && (!memcmp(working_path, "/~/", 3))) {
+ /* It is referenced to the home directory, so strip the leading '/~/' */
+ if(Curl_dyn_addn(&npath, &working_path[3], working_path_len - 3)) {
free(working_path);
return CURLE_OUT_OF_MEMORY;
}
- if((working_path_len > 3) && (!memcmp(working_path, "/~/", 3)))
- /* It is referenced to the home directory, so strip the leading '/~/' */
- memcpy(real_path, working_path + 3, working_path_len - 2);
- else
- memcpy(real_path, working_path, 1 + working_path_len);
}
- else if(data->conn->handler->protocol & CURLPROTO_SFTP) {
- if((working_path_len > 1) && (working_path[1] == '~')) {
- size_t homelen = strlen(homedir);
- real_path = malloc(homelen + working_path_len + 1);
- if(!real_path) {
- free(working_path);
- return CURLE_OUT_OF_MEMORY;
- }
- /* It is referenced to the home directory, so strip the
- leading '/' */
- memcpy(real_path, homedir, homelen);
- /* Only add a trailing '/' if homedir does not end with one */
- if(homelen == 0 || real_path[homelen - 1] != '/') {
- real_path[homelen] = '/';
- homelen++;
- real_path[homelen] = '\0';
- }
- if(working_path_len > 3) {
- memcpy(real_path + homelen, working_path + 3,
- 1 + working_path_len -3);
- }
+ else if((data->conn->handler->protocol & CURLPROTO_SFTP) &&
+ (working_path_len > 2) && !memcmp(working_path, "/~/", 3)) {
+ size_t len;
+ const char *p;
+ int copyfrom = 3;
+ if(Curl_dyn_add(&npath, homedir)) {
+ free(working_path);
+ return CURLE_OUT_OF_MEMORY;
}
- else {
- real_path = malloc(working_path_len + 1);
- if(!real_path) {
- free(working_path);
- return CURLE_OUT_OF_MEMORY;
- }
- memcpy(real_path, working_path, 1 + working_path_len);
+ /* Copy a separating '/' if homedir does not end with one */
+ len = Curl_dyn_len(&npath);
+ p = Curl_dyn_ptr(&npath);
+ if(len && (p[len-1] != '/'))
+ copyfrom = 2;
+
+ if(Curl_dyn_addn(&npath,
+ &working_path[copyfrom], working_path_len - copyfrom)) {
+ free(working_path);
+ return CURLE_OUT_OF_MEMORY;
}
}
- free(working_path);
+ if(Curl_dyn_len(&npath)) {
+ free(working_path);
- /* store the pointer for the caller to receive */
- *path = real_path;
+ /* store the pointer for the caller to receive */
+ *path = Curl_dyn_ptr(&npath);
+ }
+ else
+ *path = working_path;
return CURLE_OK;
}
diff --git a/libs/libcurl/src/curl_setup.h b/libs/libcurl/src/curl_setup.h index 888e2b76a9..bf95ff1a7d 100644 --- a/libs/libcurl/src/curl_setup.h +++ b/libs/libcurl/src/curl_setup.h @@ -61,6 +61,16 @@ # ifndef NOGDI
# define NOGDI
# endif
+/* Detect Windows App environment which has a restricted access
+ * to the Win32 APIs. */
+# if (defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0602)) || \
+ defined(WINAPI_FAMILY)
+# include <winapifamily.h>
+# if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && \
+ !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
+# define CURL_WINDOWS_APP
+# endif
+# endif
#endif
/*
@@ -431,8 +441,8 @@ # endif
#endif
-#if (SIZEOF_CURL_OFF_T == 4)
-# define CURL_OFF_T_MAX CURL_OFF_T_C(0x7FFFFFFF)
+#if (SIZEOF_CURL_OFF_T < 8)
+#error "too small curl_off_t"
#else
/* assume SIZEOF_CURL_OFF_T == 8 */
# define CURL_OFF_T_MAX CURL_OFF_T_C(0x7FFFFFFFFFFFFFFF)
diff --git a/libs/libcurl/src/curl_setup_once.h b/libs/libcurl/src/curl_setup_once.h index a228c84f55..98e481ddc8 100644 --- a/libs/libcurl/src/curl_setup_once.h +++ b/libs/libcurl/src/curl_setup_once.h @@ -69,6 +69,14 @@ #include <unistd.h>
#endif
+#ifdef USE_WOLFSSL
+# if defined(HAVE_STDINT_H)
+# include <stdint.h>
+# elif defined(HAVE_INTTYPES_H)
+# include <inttypes.h>
+# endif
+#endif
+
#ifdef __hpux
# if !defined(_XOPEN_SOURCE_EXTENDED) || defined(_KERNEL)
# ifdef _APP32_64BIT_OFF_T
diff --git a/libs/libcurl/src/doh.c b/libs/libcurl/src/doh.c index 6ab8a7836f..c0173d8160 100644 --- a/libs/libcurl/src/doh.c +++ b/libs/libcurl/src/doh.c @@ -952,7 +952,7 @@ CURLcode Curl_doh_is_resolved(struct Curl_easy *data, Curl_share_lock(data, CURL_LOCK_DATA_DNS, CURL_LOCK_ACCESS_SINGLE);
/* we got a response, store it in the cache */
- dns = Curl_cache_addr(data, ai, dohp->host, dohp->port);
+ dns = Curl_cache_addr(data, ai, dohp->host, 0, dohp->port);
if(data->share)
Curl_share_unlock(data, CURL_LOCK_DATA_DNS);
diff --git a/libs/libcurl/src/dynbuf.c b/libs/libcurl/src/dynbuf.c index 0a041b74a4..124377b367 100644 --- a/libs/libcurl/src/dynbuf.c +++ b/libs/libcurl/src/dynbuf.c @@ -99,8 +99,7 @@ static CURLcode dyn_nappend(struct dynbuf *s, include that as well when it uses this code */
void *p = realloc(s->bufr, a);
if(!p) {
- Curl_safefree(s->bufr);
- s->leng = s->allc = 0;
+ Curl_dyn_free(s);
return CURLE_OUT_OF_MEMORY;
}
s->bufr = p;
diff --git a/libs/libcurl/src/easy.c b/libs/libcurl/src/easy.c index 630c81fcd8..497a3570d3 100644 --- a/libs/libcurl/src/easy.c +++ b/libs/libcurl/src/easy.c @@ -1228,7 +1228,6 @@ CURLcode curl_easy_recv(struct Curl_easy *data, void *buffer, size_t buflen, return result;
*n = (size_t)n1;
- infof(data, "reached %s:%d", __FILE__, __LINE__);
return CURLE_OK;
}
diff --git a/libs/libcurl/src/ftp.c b/libs/libcurl/src/ftp.c index 0970419340..f785a7db7f 100644 --- a/libs/libcurl/src/ftp.c +++ b/libs/libcurl/src/ftp.c @@ -436,6 +436,12 @@ static CURLcode InitiateTransfer(struct Curl_easy *data) bool connected;
DEBUGF(infof(data, "ftp InitiateTransfer()"));
+ if(conn->bits.ftp_use_data_ssl && data->set.ftp_use_port &&
+ !Curl_conn_is_ssl(conn, SECONDARYSOCKET)) {
+ result = Curl_ssl_cfilter_add(data, conn, SECONDARYSOCKET);
+ if(result)
+ return result;
+ }
result = Curl_conn_connect(data, SECONDARYSOCKET, TRUE, &connected);
if(result || !connected)
return result;
@@ -1795,6 +1801,29 @@ static char *control_address(struct connectdata *conn) return conn->primary_ip;
}
+static bool match_pasv_6nums(const char *p,
+ unsigned int *array) /* 6 numbers */
+{
+ int i;
+ for(i = 0; i < 6; i++) {
+ unsigned long num;
+ char *endp;
+ if(i) {
+ if(*p != ',')
+ return FALSE;
+ p++;
+ }
+ if(!ISDIGIT(*p))
+ return FALSE;
+ num = strtoul(p, &endp, 10);
+ if(num > 255)
+ return FALSE;
+ array[i] = (unsigned int)num;
+ p = endp;
+ }
+ return TRUE;
+}
+
static CURLcode ftp_state_pasv_resp(struct Curl_easy *data,
int ftpcode)
{
@@ -1814,27 +1843,18 @@ static CURLcode ftp_state_pasv_resp(struct Curl_easy *data, /* positive EPSV response */
char *ptr = strchr(str, '(');
if(ptr) {
- unsigned int num;
- char separator[4];
+ char sep;
ptr++;
- if(5 == sscanf(ptr, "%c%c%c%u%c",
- &separator[0],
- &separator[1],
- &separator[2],
- &num,
- &separator[3])) {
- const char sep1 = separator[0];
- int i;
-
- /* The four separators should be identical, or else this is an oddly
- formatted reply and we bail out immediately. */
- for(i = 1; i<4; i++) {
- if(separator[i] != sep1) {
- ptr = NULL; /* set to NULL to signal error */
- break;
- }
- }
- if(num > 0xffff) {
+ /* |||12345| */
+ sep = ptr[0];
+ /* the ISDIGIT() check here is because strtoul() accepts leading minus
+ etc */
+ if((ptr[1] == sep) && (ptr[2] == sep) && ISDIGIT(ptr[3])) {
+ char *endp;
+ unsigned long num = strtoul(&ptr[3], &endp, 10);
+ if(*endp != sep)
+ ptr = NULL;
+ else if(num > 0xffff) {
failf(data, "Illegal port number in EPSV reply");
return CURLE_FTP_WEIRD_PASV_REPLY;
}
@@ -1856,8 +1876,7 @@ static CURLcode ftp_state_pasv_resp(struct Curl_easy *data, else if((ftpc->count1 == 1) &&
(ftpcode == 227)) {
/* positive PASV response */
- unsigned int ip[4] = {0, 0, 0, 0};
- unsigned int port[2] = {0, 0};
+ unsigned int ip[6];
/*
* Scan for a sequence of six comma-separated numbers and use them as
@@ -1869,15 +1888,12 @@ static CURLcode ftp_state_pasv_resp(struct Curl_easy *data, * "227 Entering passive mode. 127,0,0,1,4,51"
*/
while(*str) {
- if(6 == sscanf(str, "%u,%u,%u,%u,%u,%u",
- &ip[0], &ip[1], &ip[2], &ip[3],
- &port[0], &port[1]))
+ if(match_pasv_6nums(str, ip))
break;
str++;
}
- if(!*str || (ip[0] > 255) || (ip[1] > 255) || (ip[2] > 255) ||
- (ip[3] > 255) || (port[0] > 255) || (port[1] > 255) ) {
+ if(!*str) {
failf(data, "Couldn't interpret the 227-response");
return CURLE_FTP_WEIRD_227_FORMAT;
}
@@ -1897,7 +1913,7 @@ static CURLcode ftp_state_pasv_resp(struct Curl_easy *data, if(!ftpc->newhost)
return CURLE_OUT_OF_MEMORY;
- ftpc->newport = (unsigned short)(((port[0]<<8) + port[1]) & 0xffff);
+ ftpc->newport = (unsigned short)(((ip[4]<<8) + ip[5]) & 0xffff);
}
else if(ftpc->count1 == 0) {
/* EPSV failed, move on to PASV */
@@ -2032,6 +2048,30 @@ static CURLcode ftp_state_port_resp(struct Curl_easy *data, return result;
}
+static int twodigit(const char *p)
+{
+ return (p[0]-'0') * 10 + (p[1]-'0');
+}
+
+static bool ftp_213_date(const char *p, int *year, int *month, int *day,
+ int *hour, int *minute, int *second)
+{
+ size_t len = strlen(p);
+ if(len < 14)
+ return FALSE;
+ *year = twodigit(&p[0]) * 100 + twodigit(&p[2]);
+ *month = twodigit(&p[4]);
+ *day = twodigit(&p[6]);
+ *hour = twodigit(&p[8]);
+ *minute = twodigit(&p[10]);
+ *second = twodigit(&p[12]);
+
+ if((*month > 12) || (*day > 31) || (*hour > 23) || (*minute > 59) ||
+ (*second > 60))
+ return FALSE;
+ return TRUE;
+}
+
static CURLcode ftp_state_mdtm_resp(struct Curl_easy *data,
int ftpcode)
{
@@ -2046,8 +2086,8 @@ static CURLcode ftp_state_mdtm_resp(struct Curl_easy *data, /* we got a time. Format should be: "YYYYMMDDHHMMSS[.sss]" where the
last .sss part is optional and means fractions of a second */
int year, month, day, hour, minute, second;
- if(6 == sscanf(&data->state.buffer[4], "%04d%02d%02d%02d%02d%02d",
- &year, &month, &day, &hour, &minute, &second)) {
+ if(ftp_213_date(&data->state.buffer[4],
+ &year, &month, &day, &hour, &minute, &second)) {
/* we have a time, reformat it */
char timebuf[24];
msnprintf(timebuf, sizeof(timebuf),
@@ -2635,7 +2675,7 @@ static CURLcode ftp_statemachine(struct Curl_easy *data, int ftpcode;
struct ftp_conn *ftpc = &conn->proto.ftpc;
struct pingpong *pp = &ftpc->pp;
- static const char ftpauth[][4] = { "SSL", "TLS" };
+ static const char * const ftpauth[] = { "SSL", "TLS" };
size_t nread = 0;
if(pp->sendleft)
@@ -3221,7 +3261,7 @@ static CURLcode ftp_done(struct Curl_easy *data, CURLcode status, if(data->state.wildcardmatch) {
if(data->set.chunk_end && ftpc->file) {
Curl_set_in_callback(data, true);
- data->set.chunk_end(data->wildcard.customptr);
+ data->set.chunk_end(data->set.wildcardptr);
Curl_set_in_callback(data, false);
}
ftpc->known_filesize = -1;
@@ -3727,7 +3767,7 @@ static CURLcode init_wc_data(struct Curl_easy *data) char *last_slash;
struct FTP *ftp = data->req.p.ftp;
char *path = ftp->path;
- struct WildcardData *wildcard = &(data->wildcard);
+ struct WildcardData *wildcard = data->wildcard;
CURLcode result = CURLE_OK;
struct ftp_wc *ftpwc = NULL;
@@ -3775,7 +3815,7 @@ static CURLcode init_wc_data(struct Curl_easy *data) goto fail;
}
- wildcard->protdata = ftpwc; /* put it to the WildcardData tmp pointer */
+ wildcard->ftpwc = ftpwc; /* put it to the WildcardData tmp pointer */
wildcard->dtor = wc_data_dtor;
/* wildcard does not support NOCWD option (assert it?) */
@@ -3813,13 +3853,13 @@ static CURLcode init_wc_data(struct Curl_easy *data) }
Curl_safefree(wildcard->pattern);
wildcard->dtor = ZERO_NULL;
- wildcard->protdata = NULL;
+ wildcard->ftpwc = NULL;
return result;
}
static CURLcode wc_statemach(struct Curl_easy *data)
{
- struct WildcardData * const wildcard = &(data->wildcard);
+ struct WildcardData * const wildcard = data->wildcard;
struct connectdata *conn = data->conn;
CURLcode result = CURLE_OK;
@@ -3836,7 +3876,7 @@ static CURLcode wc_statemach(struct Curl_easy *data) case CURLWC_MATCHING: {
/* In this state is LIST response successfully parsed, so lets restore
previous WRITEFUNCTION callback and WRITEDATA pointer */
- struct ftp_wc *ftpwc = wildcard->protdata;
+ struct ftp_wc *ftpwc = wildcard->ftpwc;
data->set.fwrite_func = ftpwc->backup.write_function;
data->set.out = ftpwc->backup.file_descriptor;
ftpwc->backup.write_function = ZERO_NULL;
@@ -3875,7 +3915,7 @@ static CURLcode wc_statemach(struct Curl_easy *data) long userresponse;
Curl_set_in_callback(data, true);
userresponse = data->set.chunk_bgn(
- finfo, wildcard->customptr, (int)wildcard->filelist.size);
+ finfo, data->set.wildcardptr, (int)wildcard->filelist.size);
Curl_set_in_callback(data, false);
switch(userresponse) {
case CURL_CHUNK_BGN_FUNC_SKIP:
@@ -3915,7 +3955,7 @@ static CURLcode wc_statemach(struct Curl_easy *data) case CURLWC_SKIP: {
if(data->set.chunk_end) {
Curl_set_in_callback(data, true);
- data->set.chunk_end(data->wildcard.customptr);
+ data->set.chunk_end(data->set.wildcardptr);
Curl_set_in_callback(data, false);
}
Curl_llist_remove(&wildcard->filelist, wildcard->filelist.head, NULL);
@@ -3925,7 +3965,7 @@ static CURLcode wc_statemach(struct Curl_easy *data) }
case CURLWC_CLEAN: {
- struct ftp_wc *ftpwc = wildcard->protdata;
+ struct ftp_wc *ftpwc = wildcard->ftpwc;
result = CURLE_OK;
if(ftpwc)
result = Curl_ftp_parselist_geterror(ftpwc->parser);
@@ -3938,7 +3978,7 @@ static CURLcode wc_statemach(struct Curl_easy *data) case CURLWC_ERROR:
case CURLWC_CLEAR:
if(wildcard->dtor)
- wildcard->dtor(wildcard->protdata);
+ wildcard->dtor(wildcard->ftpwc);
return result;
}
}
@@ -3965,8 +4005,8 @@ static CURLcode ftp_do(struct Curl_easy *data, bool *done) if(data->state.wildcardmatch) {
result = wc_statemach(data);
- if(data->wildcard.state == CURLWC_SKIP ||
- data->wildcard.state == CURLWC_DONE) {
+ if(data->wildcard->state == CURLWC_SKIP ||
+ data->wildcard->state == CURLWC_DONE) {
/* do not call ftp_regular_transfer */
return CURLE_OK;
}
@@ -4052,6 +4092,8 @@ static CURLcode ftp_disconnect(struct Curl_easy *data, }
freedirs(ftpc);
+ Curl_safefree(ftpc->account);
+ Curl_safefree(ftpc->alternative_to_user);
Curl_safefree(ftpc->prevpath);
Curl_safefree(ftpc->server_os);
Curl_pp_disconnect(pp);
@@ -4321,11 +4363,31 @@ static CURLcode ftp_setup_connection(struct Curl_easy *data, char *type;
struct FTP *ftp;
CURLcode result = CURLE_OK;
+ struct ftp_conn *ftpc = &conn->proto.ftpc;
- data->req.p.ftp = ftp = calloc(sizeof(struct FTP), 1);
+ ftp = calloc(sizeof(struct FTP), 1);
if(!ftp)
return CURLE_OUT_OF_MEMORY;
+ /* clone connection related data that is FTP specific */
+ if(data->set.str[STRING_FTP_ACCOUNT]) {
+ ftpc->account = strdup(data->set.str[STRING_FTP_ACCOUNT]);
+ if(!ftpc->account) {
+ free(ftp);
+ return CURLE_OUT_OF_MEMORY;
+ }
+ }
+ if(data->set.str[STRING_FTP_ALTERNATIVE_TO_USER]) {
+ ftpc->alternative_to_user =
+ strdup(data->set.str[STRING_FTP_ALTERNATIVE_TO_USER]);
+ if(!ftpc->alternative_to_user) {
+ Curl_safefree(ftpc->account);
+ free(ftp);
+ return CURLE_OUT_OF_MEMORY;
+ }
+ }
+ data->req.p.ftp = ftp;
+
ftp->path = &data->state.up.path[1]; /* don't include the initial slash */
/* FTP URLs support an extension like ";type=<typecode>" that
@@ -4360,7 +4422,9 @@ static CURLcode ftp_setup_connection(struct Curl_easy *data, /* get some initial data into the ftp struct */
ftp->transfer = PPTRANSFER_BODY;
ftp->downloadsize = 0;
- conn->proto.ftpc.known_filesize = -1; /* unknown size for now */
+ ftpc->known_filesize = -1; /* unknown size for now */
+ ftpc->use_ssl = data->set.use_ssl;
+ ftpc->ccc = data->set.ftp_ccc;
return result;
}
diff --git a/libs/libcurl/src/ftp.h b/libs/libcurl/src/ftp.h index 8395ee5619..dfd17fcc46 100644 --- a/libs/libcurl/src/ftp.h +++ b/libs/libcurl/src/ftp.h @@ -120,6 +120,8 @@ struct FTP { struct */
struct ftp_conn {
struct pingpong pp;
+ char *account;
+ char *alternative_to_user;
char *entrypath; /* the PWD reply when we logged on */
char *file; /* url-decoded file name (or path) */
char **dirs; /* realloc()ed array for path components */
@@ -143,6 +145,9 @@ struct ftp_conn { ftpstate state; /* always use ftp.c:state() to change state! */
ftpstate state_saved; /* transfer type saved to be reloaded after data
connection is established */
+ unsigned char use_ssl; /* if AUTH TLS is to be attempted etc, for FTP or
+ IMAP or POP3 or others! (type: curl_usessl)*/
+ unsigned char ccc; /* ccc level for this connection */
BIT(ftp_trying_alternative);
BIT(dont_check); /* Set to TRUE to prevent the final (post-transfer)
file size and 226/250 status check. It should still
diff --git a/libs/libcurl/src/ftplistparser.c b/libs/libcurl/src/ftplistparser.c index c71ddadbb3..6ad56b9601 100644 --- a/libs/libcurl/src/ftplistparser.c +++ b/libs/libcurl/src/ftplistparser.c @@ -181,6 +181,43 @@ struct ftp_parselist_data { } offsets;
};
+static void fileinfo_dtor(void *user, void *element)
+{
+ (void)user;
+ Curl_fileinfo_cleanup(element);
+}
+
+CURLcode Curl_wildcard_init(struct WildcardData *wc)
+{
+ Curl_llist_init(&wc->filelist, fileinfo_dtor);
+ wc->state = CURLWC_INIT;
+
+ return CURLE_OK;
+}
+
+void Curl_wildcard_dtor(struct WildcardData **wcp)
+{
+ struct WildcardData *wc = *wcp;
+ if(!wc)
+ return;
+
+ if(wc->dtor) {
+ wc->dtor(wc->ftpwc);
+ wc->dtor = ZERO_NULL;
+ wc->ftpwc = NULL;
+ }
+ DEBUGASSERT(wc->ftpwc == NULL);
+
+ Curl_llist_destroy(&wc->filelist, NULL);
+ free(wc->path);
+ wc->path = NULL;
+ free(wc->pattern);
+ wc->pattern = NULL;
+ wc->state = CURLWC_INIT;
+ free(wc);
+ *wcp = NULL;
+}
+
struct ftp_parselist_data *Curl_ftp_parselist_data_alloc(void)
{
return calloc(1, sizeof(struct ftp_parselist_data));
@@ -274,8 +311,8 @@ static CURLcode ftp_pl_insert_finfo(struct Curl_easy *data, struct fileinfo *infop)
{
curl_fnmatch_callback compare;
- struct WildcardData *wc = &data->wildcard;
- struct ftp_wc *ftpwc = wc->protdata;
+ struct WildcardData *wc = data->wildcard;
+ struct ftp_wc *ftpwc = wc->ftpwc;
struct Curl_llist *llist = &wc->filelist;
struct ftp_parselist_data *parser = ftpwc->parser;
bool add = TRUE;
@@ -330,7 +367,7 @@ size_t Curl_ftp_parselist(char *buffer, size_t size, size_t nmemb, {
size_t bufflen = size*nmemb;
struct Curl_easy *data = (struct Curl_easy *)connptr;
- struct ftp_wc *ftpwc = data->wildcard.protdata;
+ struct ftp_wc *ftpwc = data->wildcard->ftpwc;
struct ftp_parselist_data *parser = ftpwc->parser;
struct fileinfo *infop;
struct curl_fileinfo *finfo;
diff --git a/libs/libcurl/src/ftplistparser.h b/libs/libcurl/src/ftplistparser.h index 509df48f0a..e789fc21cc 100644 --- a/libs/libcurl/src/ftplistparser.h +++ b/libs/libcurl/src/ftplistparser.h @@ -39,5 +39,39 @@ struct ftp_parselist_data *Curl_ftp_parselist_data_alloc(void); void Curl_ftp_parselist_data_free(struct ftp_parselist_data **pl_data);
+/* list of wildcard process states */
+typedef enum {
+ CURLWC_CLEAR = 0,
+ CURLWC_INIT = 1,
+ CURLWC_MATCHING, /* library is trying to get list of addresses for
+ downloading */
+ CURLWC_DOWNLOADING,
+ CURLWC_CLEAN, /* deallocate resources and reset settings */
+ CURLWC_SKIP, /* skip over concrete file */
+ CURLWC_ERROR, /* error cases */
+ CURLWC_DONE /* if is wildcard->state == CURLWC_DONE wildcard loop
+ will end */
+} wildcard_states;
+
+typedef void (*wildcard_dtor)(void *ptr);
+
+/* struct keeping information about wildcard download process */
+struct WildcardData {
+ char *path; /* path to the directory, where we trying wildcard-match */
+ char *pattern; /* wildcard pattern */
+ struct Curl_llist filelist; /* llist with struct Curl_fileinfo */
+ struct ftp_wc *ftpwc; /* pointer to FTP wildcard data */
+ wildcard_dtor dtor;
+ unsigned char state; /* wildcard_states */
+};
+
+CURLcode Curl_wildcard_init(struct WildcardData *wc);
+void Curl_wildcard_dtor(struct WildcardData **wcp);
+
+struct Curl_easy;
+
+#else
+/* FTP is disabled */
+#define Curl_wildcard_dtor(x)
#endif /* CURL_DISABLE_FTP */
#endif /* HEADER_CURL_FTPLISTPARSER_H */
diff --git a/libs/libcurl/src/headers.c b/libs/libcurl/src/headers.c index 051639b667..e05552dd3b 100644 --- a/libs/libcurl/src/headers.c +++ b/libs/libcurl/src/headers.c @@ -38,14 +38,13 @@ /* Generate the curl_header struct for the user. This function MUST assign all
struct fields in the output struct. */
-static void copy_header_external(struct Curl_easy *data,
- struct Curl_header_store *hs,
+static void copy_header_external(struct Curl_header_store *hs,
size_t index,
size_t amount,
struct Curl_llist_element *e,
- struct curl_header **hout)
+ struct curl_header *hout)
{
- struct curl_header *h = *hout = &data->state.headerout;
+ struct curl_header *h = hout;
h->name = hs->name;
h->value = hs->value;
h->amount = amount;
@@ -118,7 +117,9 @@ CURLHcode curl_easy_header(CURL *easy, return CURLHE_MISSING;
}
/* this is the name we want */
- copy_header_external(data, hs, nameindex, amount, e_pick, hout);
+ copy_header_external(hs, nameindex, amount, e_pick,
+ &data->state.headerout[0]);
+ *hout = &data->state.headerout[0];
return CURLHE_OK;
}
@@ -132,7 +133,6 @@ struct curl_header *curl_easy_nextheader(CURL *easy, struct Curl_llist_element *pick;
struct Curl_llist_element *e;
struct Curl_header_store *hs;
- struct curl_header *hout;
size_t amount = 0;
size_t index = 0;
@@ -179,8 +179,9 @@ struct curl_header *curl_easy_nextheader(CURL *easy, index = amount - 1;
}
- copy_header_external(data, hs, index, amount, pick, &hout);
- return hout;
+ copy_header_external(hs, index, amount, pick,
+ &data->state.headerout[1]);
+ return &data->state.headerout[1];
}
static CURLcode namevalue(char *header, size_t hlen, unsigned int type,
diff --git a/libs/libcurl/src/hostasyn.c b/libs/libcurl/src/hostasyn.c index d46576dcc0..59a009ce33 100644 --- a/libs/libcurl/src/hostasyn.c +++ b/libs/libcurl/src/hostasyn.c @@ -78,7 +78,7 @@ CURLcode Curl_addrinfo_callback(struct Curl_easy *data, Curl_share_lock(data, CURL_LOCK_DATA_DNS, CURL_LOCK_ACCESS_SINGLE);
dns = Curl_cache_addr(data, ai,
- data->state.async.hostname,
+ data->state.async.hostname, 0,
data->state.async.port);
if(data->share)
Curl_share_unlock(data, CURL_LOCK_DATA_DNS);
diff --git a/libs/libcurl/src/hostip.c b/libs/libcurl/src/hostip.c index af5c18df43..0731075ba6 100644 --- a/libs/libcurl/src/hostip.c +++ b/libs/libcurl/src/hostip.c @@ -167,18 +167,25 @@ void Curl_printable_address(const struct Curl_addrinfo *ai, char *buf, /*
* Create a hostcache id string for the provided host + port, to be used by
- * the DNS caching. Without alloc.
+ * the DNS caching. Without alloc. Return length of the id string.
*/
-static void
-create_hostcache_id(const char *name, int port, char *ptr, size_t buflen)
+static size_t
+create_hostcache_id(const char *name,
+ size_t nlen, /* 0 or actual name length */
+ int port, char *ptr, size_t buflen)
{
- size_t len = strlen(name);
+ size_t len = nlen ? nlen : strlen(name);
+ size_t olen = 0;
+ DEBUGASSERT(buflen >= MAX_HOSTCACHE_LEN);
if(len > (buflen - 7))
len = buflen - 7;
/* store and lower case the name */
- while(len--)
+ while(len--) {
*ptr++ = Curl_raw_tolower(*name++);
- msnprintf(ptr, 7, ":%u", port);
+ olen++;
+ }
+ olen += msnprintf(ptr, 7, ":%u", port);
+ return olen;
}
struct hostcache_prune_data {
@@ -260,20 +267,18 @@ static struct Curl_dns_entry *fetch_addr(struct Curl_easy *data, int port)
{
struct Curl_dns_entry *dns = NULL;
- size_t entry_len;
char entry_id[MAX_HOSTCACHE_LEN];
/* Create an entry id, based upon the hostname and port */
- create_hostcache_id(hostname, port, entry_id, sizeof(entry_id));
- entry_len = strlen(entry_id);
+ size_t entry_len = create_hostcache_id(hostname, 0, port,
+ entry_id, sizeof(entry_id));
/* See if its already in our dns cache */
dns = Curl_hash_pick(data->dns.hostcache, entry_id, entry_len + 1);
/* No entry found in cache, check if we might have a wildcard entry */
if(!dns && data->state.wildcard_resolve) {
- create_hostcache_id("*", port, entry_id, sizeof(entry_id));
- entry_len = strlen(entry_id);
+ entry_len = create_hostcache_id("*", 1, port, entry_id, sizeof(entry_id));
/* See if it's already in our dns cache */
dns = Curl_hash_pick(data->dns.hostcache, entry_id, entry_len + 1);
@@ -438,6 +443,7 @@ struct Curl_dns_entry * Curl_cache_addr(struct Curl_easy *data,
struct Curl_addrinfo *addr,
const char *hostname,
+ size_t hostlen, /* length or zero */
int port)
{
char entry_id[MAX_HOSTCACHE_LEN];
@@ -461,8 +467,8 @@ Curl_cache_addr(struct Curl_easy *data, }
/* Create an entry id, based upon the hostname and port */
- create_hostcache_id(hostname, port, entry_id, sizeof(entry_id));
- entry_len = strlen(entry_id);
+ entry_len = create_hostcache_id(hostname, hostlen, port,
+ entry_id, sizeof(entry_id));
dns->inuse = 1; /* the cache has the first reference */
dns->addr = addr; /* this is the address(es) */
@@ -791,7 +797,7 @@ enum resolve_t Curl_resolv(struct Curl_easy *data, Curl_share_lock(data, CURL_LOCK_DATA_DNS, CURL_LOCK_ACCESS_SINGLE);
/* we got a response, store it in the cache */
- dns = Curl_cache_addr(data, addr, hostname, port);
+ dns = Curl_cache_addr(data, addr, hostname, 0, port);
if(data->share)
Curl_share_unlock(data, CURL_LOCK_DATA_DNS);
@@ -1059,8 +1065,7 @@ void Curl_hostcache_clean(struct Curl_easy *data, CURLcode Curl_loadhostpairs(struct Curl_easy *data)
{
struct curl_slist *hostp;
- char hostname[256];
- int port = 0;
+ char *host_end;
/* Default is no wildcard found */
data->state.wildcard_resolve = false;
@@ -1070,18 +1075,25 @@ CURLcode Curl_loadhostpairs(struct Curl_easy *data) if(!hostp->data)
continue;
if(hostp->data[0] == '-') {
+ unsigned long num = 0;
size_t entry_len;
-
- if(2 != sscanf(hostp->data + 1, "%255[^:]:%d", hostname, &port)) {
- infof(data, "Couldn't parse CURLOPT_RESOLVE removal entry '%s'",
+ size_t hlen = 0;
+ host_end = strchr(&hostp->data[1], ':');
+
+ if(host_end) {
+ hlen = host_end - &hostp->data[1];
+ num = strtoul(++host_end, NULL, 10);
+ if(!hlen || (num > 0xffff))
+ host_end = NULL;
+ }
+ if(!host_end) {
+ infof(data, "Bad syntax CURLOPT_RESOLVE removal entry '%s'",
hostp->data);
continue;
}
-
/* Create an entry id, based upon the hostname and port */
- create_hostcache_id(hostname, port, entry_id, sizeof(entry_id));
- entry_len = strlen(entry_id);
-
+ entry_len = create_hostcache_id(&hostp->data[1], hlen, (int)num,
+ entry_id, sizeof(entry_id));
if(data->share)
Curl_share_lock(data, CURL_LOCK_DATA_DNS, CURL_LOCK_ACCESS_SINGLE);
@@ -1102,25 +1114,22 @@ CURLcode Curl_loadhostpairs(struct Curl_easy *data) char *addr_begin;
char *addr_end;
char *port_ptr;
+ int port = 0;
char *end_ptr;
bool permanent = TRUE;
- char *host_begin;
- char *host_end;
unsigned long tmp_port;
bool error = true;
+ char *host_begin = hostp->data;
+ size_t hlen = 0;
- host_begin = hostp->data;
if(host_begin[0] == '+') {
host_begin++;
permanent = FALSE;
}
host_end = strchr(host_begin, ':');
- if(!host_end ||
- ((host_end - host_begin) >= (ptrdiff_t)sizeof(hostname)))
+ if(!host_end)
goto err;
-
- memcpy(hostname, host_begin, host_end - host_begin);
- hostname[host_end - host_begin] = '\0';
+ hlen = host_end - host_begin;
port_ptr = host_end + 1;
tmp_port = strtoul(port_ptr, &end_ptr, 10);
@@ -1196,8 +1205,8 @@ CURLcode Curl_loadhostpairs(struct Curl_easy *data) }
/* Create an entry id, based upon the hostname and port */
- create_hostcache_id(hostname, port, entry_id, sizeof(entry_id));
- entry_len = strlen(entry_id);
+ entry_len = create_hostcache_id(host_begin, hlen, port,
+ entry_id, sizeof(entry_id));
if(data->share)
Curl_share_lock(data, CURL_LOCK_DATA_DNS, CURL_LOCK_ACCESS_SINGLE);
@@ -1206,8 +1215,8 @@ CURLcode Curl_loadhostpairs(struct Curl_easy *data) dns = Curl_hash_pick(data->dns.hostcache, entry_id, entry_len + 1);
if(dns) {
- infof(data, "RESOLVE %s:%d is - old addresses discarded",
- hostname, port);
+ infof(data, "RESOLVE %.*s:%d is - old addresses discarded",
+ (int)hlen, host_begin, port);
/* delete old entry, there are two reasons for this
1. old entry may have different addresses.
2. even if entry with correct addresses is already in the cache,
@@ -1223,7 +1232,7 @@ CURLcode Curl_loadhostpairs(struct Curl_easy *data) }
/* put this new host in the cache */
- dns = Curl_cache_addr(data, head, hostname, port);
+ dns = Curl_cache_addr(data, head, host_begin, hlen, port);
if(dns) {
if(permanent)
dns->timestamp = 0; /* mark as permanent */
@@ -1239,13 +1248,13 @@ CURLcode Curl_loadhostpairs(struct Curl_easy *data) Curl_freeaddrinfo(head);
return CURLE_OUT_OF_MEMORY;
}
- infof(data, "Added %s:%d:%s to DNS cache%s",
- hostname, port, addresses, permanent ? "" : " (non-permanent)");
+ infof(data, "Added %.*s:%d:%s to DNS cache%s",
+ (int)hlen, host_begin, port, addresses,
+ permanent ? "" : " (non-permanent)");
/* Wildcard hostname */
- if(hostname[0] == '*' && hostname[1] == '\0') {
- infof(data, "RESOLVE %s:%d is wildcard, enabling wildcard checks",
- hostname, port);
+ if((hlen == 1) && (host_begin[0] == '*')) {
+ infof(data, "RESOLVE *:%d using wildcard", port);
data->state.wildcard_resolve = true;
}
}
diff --git a/libs/libcurl/src/hostip.h b/libs/libcurl/src/hostip.h index 3628c950bc..018af6b5c7 100644 --- a/libs/libcurl/src/hostip.h +++ b/libs/libcurl/src/hostip.h @@ -178,7 +178,7 @@ Curl_fetch_addr(struct Curl_easy *data, */
struct Curl_dns_entry *
Curl_cache_addr(struct Curl_easy *data, struct Curl_addrinfo *addr,
- const char *hostname, int port);
+ const char *hostname, size_t hostlen, int port);
#ifndef INADDR_NONE
#define CURL_INADDR_NONE (in_addr_t) ~0
diff --git a/libs/libcurl/src/http.c b/libs/libcurl/src/http.c index 4a3a4eb5b6..055e250e2d 100644 --- a/libs/libcurl/src/http.c +++ b/libs/libcurl/src/http.c @@ -88,6 +88,7 @@ #include "hsts.h"
#include "ws.h"
#include "c-hyper.h"
+#include "curl_ctype.h"
/* The last 3 #include files should be in this order */
#include "curl_printf.h"
@@ -233,15 +234,12 @@ static CURLcode http_setup_conn(struct Curl_easy *data, Curl_mime_initpart(&http->form);
data->req.p.http = http;
+ connkeep(conn, "HTTP default");
- if((data->state.httpwant == CURL_HTTP_VERSION_3)
- || (data->state.httpwant == CURL_HTTP_VERSION_3ONLY)) {
+ if(data->state.httpwant == CURL_HTTP_VERSION_3ONLY) {
CURLcode result = Curl_conn_may_http3(data, conn);
if(result)
return result;
-
- /* TODO: HTTP lower version eyeballing */
- conn->transport = TRNSPRT_QUIC;
}
return CURLE_OK;
@@ -2342,7 +2340,16 @@ CURLcode Curl_http_bodysend(struct Curl_easy *data, struct connectdata *conn, return result;
}
- if(http->postsize) {
+ /* For really small puts we don't use Expect: headers at all, and for
+ the somewhat bigger ones we allow the app to disable it. Just make
+ sure that the expect100header is always set to the preferred value
+ here. */
+ ptr = Curl_checkheaders(data, STRCONST("Expect"));
+ if(ptr) {
+ data->state.expect100header =
+ Curl_compareheader(ptr, STRCONST("Expect:"), STRCONST("100-continue"));
+ }
+ else if(http->postsize > EXPECT_100_THRESHOLD || http->postsize < 0) {
result = expect100(data, conn, r);
if(result)
return result;
@@ -4155,11 +4162,7 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data, if(!k->headerline++) {
/* This is the first header, it MUST be the error code line
or else we consider this to be the body right away! */
- int httpversion_major;
- int rtspversion_major;
- int nc = 0;
-#define HEADER1 headp /* no conversion needed, just use headp */
-
+ bool fine_statusline = FALSE;
if(conn->handler->protocol & PROTO_FAMILY_HTTP) {
/*
* https://datatracker.ietf.org/doc/html/rfc7230#section-3.1.2
@@ -4168,39 +4171,60 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data, * says. We allow any three-digit number here, but we cannot make
* guarantees on future behaviors since it isn't within the protocol.
*/
- char separator;
- char twoorthree[2];
int httpversion = 0;
- char digit4 = 0;
- nc = sscanf(HEADER1,
- " HTTP/%1d.%1d%c%3d%c",
- &httpversion_major,
- &httpversion,
- &separator,
- &k->httpcode,
- &digit4);
-
- if(nc == 1 && httpversion_major >= 2 &&
- 2 == sscanf(HEADER1, " HTTP/%1[23] %d", twoorthree, &k->httpcode)) {
- conn->httpversion = 0;
- nc = 4;
- separator = ' ';
- }
-
- /* There can only be a 4th response code digit stored in 'digit4' if
- all the other fields were parsed and stored first, so nc is 5 when
- digit4 a digit.
-
- The sscanf() line above will also allow zero-prefixed and negative
- numbers, so we check for that too here.
- */
- else if(ISDIGIT(digit4) || (nc >= 4 && k->httpcode < 100)) {
- failf(data, "Unsupported response code in HTTP response");
- return CURLE_UNSUPPORTED_PROTOCOL;
+ char *p = headp;
+
+ while(*p && ISBLANK(*p))
+ p++;
+ if(!strncmp(p, "HTTP/", 5)) {
+ p += 5;
+ switch(*p) {
+ case '1':
+ p++;
+ if((p[0] == '.') && (p[1] == '0' || p[1] == '1')) {
+ if(ISBLANK(p[2])) {
+ httpversion = 10 + (p[1] - '0');
+ p += 3;
+ if(ISDIGIT(p[0]) && ISDIGIT(p[1]) && ISDIGIT(p[2])) {
+ k->httpcode = (p[0] - '0') * 100 + (p[1] - '0') * 10 +
+ (p[2] - '0');
+ p += 3;
+ if(ISSPACE(*p))
+ fine_statusline = TRUE;
+ }
+ }
+ }
+ if(!fine_statusline) {
+ failf(data, "Unsupported HTTP/1 subversion in response");
+ return CURLE_UNSUPPORTED_PROTOCOL;
+ }
+ break;
+ case '2':
+ case '3':
+ if(!ISBLANK(p[1]))
+ break;
+ httpversion = (*p - '0') * 10;
+ p += 2;
+ if(ISDIGIT(p[0]) && ISDIGIT(p[1]) && ISDIGIT(p[2])) {
+ k->httpcode = (p[0] - '0') * 100 + (p[1] - '0') * 10 +
+ (p[2] - '0');
+ p += 3;
+ if(!ISSPACE(*p))
+ break;
+ fine_statusline = TRUE;
+ }
+ break;
+ default: /* unsupported */
+ failf(data, "Unsupported HTTP version in response");
+ return CURLE_UNSUPPORTED_PROTOCOL;
+ }
}
- if((nc >= 4) && (' ' == separator)) {
- httpversion += 10 * httpversion_major;
+ if(fine_statusline) {
+ if(k->httpcode < 100) {
+ failf(data, "Unsupported response code in HTTP response");
+ return CURLE_UNSUPPORTED_PROTOCOL;
+ }
switch(httpversion) {
case 10:
case 11:
@@ -4227,51 +4251,50 @@ CURLcode Curl_http_readwrite_headers(struct Curl_easy *data, conn->bundle->multiuse = BUNDLE_NO_MULTIUSE;
}
}
- else if(!nc) {
- /* this is the real world, not a Nirvana
- NCSA 1.5.x returns this crap when asked for HTTP/1.1
- */
- nc = sscanf(HEADER1, " HTTP %3d", &k->httpcode);
- conn->httpversion = 10;
-
+ else {
/* If user has set option HTTP200ALIASES,
compare header line against list of aliases
*/
- if(!nc) {
- statusline check =
- checkhttpprefix(data,
- Curl_dyn_ptr(&data->state.headerb),
- Curl_dyn_len(&data->state.headerb));
- if(check == STATUS_DONE) {
- nc = 1;
- k->httpcode = 200;
- conn->httpversion = 10;
- }
+ statusline check =
+ checkhttpprefix(data,
+ Curl_dyn_ptr(&data->state.headerb),
+ Curl_dyn_len(&data->state.headerb));
+ if(check == STATUS_DONE) {
+ fine_statusline = TRUE;
+ k->httpcode = 200;
+ conn->httpversion = 10;
}
}
- else {
- failf(data, "Unsupported HTTP version in response");
- return CURLE_UNSUPPORTED_PROTOCOL;
- }
}
else if(conn->handler->protocol & CURLPROTO_RTSP) {
- char separator;
- int rtspversion;
- nc = sscanf(HEADER1,
- " RTSP/%1d.%1d%c%3d",
- &rtspversion_major,
- &rtspversion,
- &separator,
- &k->httpcode);
- if((nc == 4) && (' ' == separator)) {
- conn->httpversion = 11; /* For us, RTSP acts like HTTP 1.1 */
- }
- else {
- nc = 0;
+ char *p = headp;
+ while(*p && ISBLANK(*p))
+ p++;
+ if(!strncmp(p, "RTSP/", 5)) {
+ p += 5;
+ if(ISDIGIT(*p)) {
+ p++;
+ if((p[0] == '.') && ISDIGIT(p[1])) {
+ if(ISBLANK(p[2])) {
+ p += 3;
+ if(ISDIGIT(p[0]) && ISDIGIT(p[1]) && ISDIGIT(p[2])) {
+ k->httpcode = (p[0] - '0') * 100 + (p[1] - '0') * 10 +
+ (p[2] - '0');
+ p += 3;
+ if(ISSPACE(*p)) {
+ fine_statusline = TRUE;
+ conn->httpversion = 11; /* RTSP acts like HTTP 1.1 */
+ }
+ }
+ }
+ }
+ }
+ if(!fine_statusline)
+ return CURLE_WEIRD_SERVER_REPLY;
}
}
- if(nc) {
+ if(fine_statusline) {
result = Curl_http_statusline(data, conn);
if(result)
return result;
diff --git a/libs/libcurl/src/http2.c b/libs/libcurl/src/http2.c index 8d72977e59..4defa7e2f7 100644 --- a/libs/libcurl/src/http2.c +++ b/libs/libcurl/src/http2.c @@ -98,7 +98,6 @@ static size_t populate_binsettings(uint8_t *binsettings, struct cf_h2_ctx {
nghttp2_session *h2;
uint32_t max_concurrent_streams;
- bool enable_push;
/* The easy handle used in the current filter call, cleared at return */
struct cf_call_data call_data;
@@ -116,6 +115,10 @@ struct cf_h2_ctx { int32_t pause_stream_id; /* stream ID which paused
nghttp2_session_mem_recv */
size_t drain_total; /* sum of all stream's UrlState.drain */
+ int32_t goaway_error;
+ int32_t last_stream_id;
+ BIT(goaway);
+ BIT(enable_push);
};
/* How to access `call_data` from a cf_h2 filter */
@@ -364,41 +367,42 @@ static void http2_stream_free(struct HTTP *stream) }
/*
+ * Returns nonzero if current HTTP/2 session should be closed.
+ */
+static int should_close_session(struct cf_h2_ctx *ctx)
+{
+ return ctx->drain_total == 0 && !nghttp2_session_want_read(ctx->h2) &&
+ !nghttp2_session_want_write(ctx->h2);
+}
+
+/*
* The server may send us data at any point (e.g. PING frames). Therefore,
* we cannot assume that an HTTP/2 socket is dead just because it is readable.
*
* Check the lower filters first and, if successful, peek at the socket
* and distinguish between closed and data.
*/
-static bool http2_connisdead(struct Curl_cfilter *cf, struct Curl_easy *data)
+static bool http2_connisalive(struct Curl_cfilter *cf, struct Curl_easy *data,
+ bool *input_pending)
{
struct cf_h2_ctx *ctx = cf->ctx;
- int sval;
- bool dead = TRUE;
+ bool alive = TRUE;
- if(!cf->next || !cf->next->cft->is_alive(cf->next, data))
- return TRUE;
+ *input_pending = FALSE;
+ if(!cf->next || !cf->next->cft->is_alive(cf->next, data, input_pending))
+ return FALSE;
- sval = SOCKET_READABLE(Curl_conn_cf_get_socket(cf, data), 0);
- if(sval == 0) {
- /* timeout */
- dead = FALSE;
- }
- else if(sval & CURL_CSELECT_ERR) {
- /* socket is in an error state */
- dead = TRUE;
- }
- else if(sval & CURL_CSELECT_IN) {
+ if(*input_pending) {
/* This happens before we've sent off a request and the connection is
not in use by any other transfer, there shouldn't be any data here,
only "protocol frames" */
CURLcode result;
ssize_t nread = -1;
+ *input_pending = FALSE;
Curl_attach_connection(data, cf->conn);
nread = Curl_conn_cf_recv(cf->next, data,
ctx->inbuf, H2_BUFSIZE, &result);
- dead = FALSE;
if(nread != -1) {
DEBUGF(LOG_CF(data, cf, "%d bytes stray data read before trying "
"h2 connection", (int)nread));
@@ -406,15 +410,19 @@ static bool http2_connisdead(struct Curl_cfilter *cf, struct Curl_easy *data) ctx->inbuflen = nread;
if(h2_process_pending_input(cf, data, &result) < 0)
/* immediate error, considered dead */
- dead = TRUE;
+ alive = FALSE;
+ else {
+ alive = !should_close_session(ctx);
+ }
}
- else
+ else {
/* the read failed so let's say this is dead anyway */
- dead = TRUE;
+ alive = FALSE;
+ }
Curl_detach_connection(data);
}
- return dead;
+ return alive;
}
static CURLcode http2_send_ping(struct Curl_cfilter *cf,
@@ -815,7 +823,7 @@ static int on_frame_recv(nghttp2_session *session, const nghttp2_frame *frame, ctx->max_concurrent_streams = nghttp2_session_get_remote_settings(
session, NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS);
ctx->enable_push = nghttp2_session_get_remote_settings(
- session, NGHTTP2_SETTINGS_ENABLE_PUSH);
+ session, NGHTTP2_SETTINGS_ENABLE_PUSH) != 0;
DEBUGF(LOG_CF(data, cf, "MAX_CONCURRENT_STREAMS == %d",
ctx->max_concurrent_streams));
DEBUGF(LOG_CF(data, cf, "ENABLE_PUSH == %s",
@@ -829,9 +837,12 @@ static int on_frame_recv(nghttp2_session *session, const nghttp2_frame *frame, break;
}
case NGHTTP2_GOAWAY:
+ ctx->goaway = TRUE;
+ ctx->goaway_error = frame->goaway.error_code;
+ ctx->last_stream_id = frame->goaway.last_stream_id;
if(data) {
infof(data, "recveived GOAWAY, error=%d, last_stream=%u",
- frame->goaway.error_code, frame->goaway.last_stream_id);
+ ctx->goaway_error, ctx->last_stream_id);
multi_connchanged(data->multi);
}
break;
@@ -858,7 +869,7 @@ static int on_frame_recv(nghttp2_session *session, const nghttp2_frame *frame, switch(frame->hd.type) {
case NGHTTP2_DATA:
- /* If body started on this stream, then receiving DATA is illegal. */
+ /* If !body started on this stream, then receiving DATA is illegal. */
DEBUGF(LOG_CF(data_s, cf, "[h2sid=%u] recv frame DATA", stream_id));
if(!stream->bodystarted) {
rv = nghttp2_submit_rst_stream(session, NGHTTP2_FLAG_NONE,
@@ -940,7 +951,21 @@ static int on_frame_recv(nghttp2_session *session, const nghttp2_frame *frame, break;
case NGHTTP2_RST_STREAM:
DEBUGF(LOG_CF(data_s, cf, "[h2sid=%u] recv RST", stream_id));
+ stream->closed = TRUE;
stream->reset = TRUE;
+ drain_this(cf, data);
+ Curl_expire(data, 0, EXPIRE_RUN_NOW);
+ break;
+ case NGHTTP2_WINDOW_UPDATE:
+ DEBUGF(LOG_CF(data, cf, "[h2sid=%u] recv WINDOW_UPDATE", stream_id));
+ if((data_s->req.keepon & KEEP_SEND_HOLD) &&
+ (data_s->req.keepon & KEEP_SEND)) {
+ data_s->req.keepon &= ~KEEP_SEND_HOLD;
+ drain_this(cf, data_s);
+ Curl_expire(data_s, 0, EXPIRE_RUN_NOW);
+ DEBUGF(LOG_CF(data, cf, "[h2sid=%u] un-holding after win update",
+ stream_id));
+ }
break;
default:
DEBUGF(LOG_CF(data_s, cf, "[h2sid=%u] recv frame %x",
@@ -1006,18 +1031,6 @@ static int on_data_chunk_recv(nghttp2_session *session, uint8_t flags, return NGHTTP2_ERR_PAUSE;
}
-#if 0
- /* pause execution of nghttp2 if we received data for another handle
- in order to process them first. */
- if(CF_DATA_CURRENT(cf) != data_s) {
- ctx->pause_stream_id = stream_id;
- DEBUGF(LOG_CF(data_s, cf, "[h2sid=%u] not call_data -> NGHTTP2_ERR_PAUSE",
- stream_id));
- drain_this(cf, data_s);
- return NGHTTP2_ERR_PAUSE;
- }
-#endif
-
return 0;
}
@@ -1030,44 +1043,43 @@ static int on_stream_close(nghttp2_session *session, int32_t stream_id, struct HTTP *stream;
int rv;
(void)session;
- (void)stream_id;
- if(stream_id) {
- /* get the stream from the hash based on Stream ID, stream ID zero is for
- connection-oriented stuff */
- data_s = nghttp2_session_get_stream_user_data(session, stream_id);
- if(!data_s) {
- /* We could get stream ID not in the hash. For example, if we
- decided to reject stream (e.g., PUSH_PROMISE). */
- return 0;
- }
- DEBUGF(LOG_CF(data_s, cf, "[h2sid=%u] on_stream_close(), %s (err %d)",
- stream_id, nghttp2_http2_strerror(error_code), error_code));
- stream = data_s->req.p.http;
- if(!stream)
- return NGHTTP2_ERR_CALLBACK_FAILURE;
+ /* get the stream from the hash based on Stream ID, stream ID zero is for
+ connection-oriented stuff */
+ data_s = stream_id?
+ nghttp2_session_get_stream_user_data(session, stream_id) : NULL;
+ if(!data_s) {
+ return 0;
+ }
+ stream = data_s->req.p.http;
+ DEBUGF(LOG_CF(data_s, cf, "[h2sid=%u] on_stream_close(), %s (err %d)",
+ stream_id, nghttp2_http2_strerror(error_code), error_code));
+ if(!stream)
+ return NGHTTP2_ERR_CALLBACK_FAILURE;
- stream->closed = TRUE;
- if(CF_DATA_CURRENT(cf) != data_s) {
- drain_this(cf, data_s);
- Curl_expire(data_s, 0, EXPIRE_RUN_NOW);
- }
- stream->error = error_code;
+ stream->closed = TRUE;
+ stream->error = error_code;
+ if(stream->error)
+ stream->reset = TRUE;
- /* remove the entry from the hash as the stream is now gone */
- rv = nghttp2_session_set_stream_user_data(session, stream_id, 0);
- if(rv) {
- infof(data_s, "http/2: failed to clear user_data for stream %u",
- stream_id);
- DEBUGASSERT(0);
- }
- if(stream_id == ctx->pause_stream_id) {
- DEBUGF(LOG_CF(data_s, cf, "[h2sid=%u] closed the pause stream",
- stream_id));
- ctx->pause_stream_id = 0;
- }
- DEBUGF(LOG_CF(data_s, cf, "[h2sid=%u] closed, cleared", stream_id));
+ if(CF_DATA_CURRENT(cf) != data_s) {
+ drain_this(cf, data_s);
+ Curl_expire(data_s, 0, EXPIRE_RUN_NOW);
}
+
+ /* remove `data_s` from the nghttp2 stream */
+ rv = nghttp2_session_set_stream_user_data(session, stream_id, 0);
+ if(rv) {
+ infof(data_s, "http/2: failed to clear user_data for stream %u",
+ stream_id);
+ DEBUGASSERT(0);
+ }
+ if(stream_id == ctx->pause_stream_id) {
+ DEBUGF(LOG_CF(data_s, cf, "[h2sid=%u] closed the pause stream",
+ stream_id));
+ ctx->pause_stream_id = 0;
+ }
+ DEBUGF(LOG_CF(data_s, cf, "[h2sid=%u] closed now", stream_id));
return 0;
}
@@ -1383,7 +1395,8 @@ static void http2_data_done(struct Curl_cfilter *cf, ctx->pause_stream_id = 0;
}
- if(premature || (!stream->closed && stream->stream_id)) {
+ (void)premature;
+ if(!stream->closed && stream->stream_id) {
/* RST_STREAM */
DEBUGF(LOG_CF(data, cf, "[h2sid=%u] RST", stream->stream_id));
if(!nghttp2_submit_rst_stream(ctx->h2, NGHTTP2_FLAG_NONE,
@@ -1446,15 +1459,6 @@ CURLcode Curl_http2_request_upgrade(struct dynbuf *req, }
/*
- * Returns nonzero if current HTTP/2 session should be closed.
- */
-static int should_close_session(struct cf_h2_ctx *ctx)
-{
- return ctx->drain_total == 0 && !nghttp2_session_want_read(ctx->h2) &&
- !nghttp2_session_want_write(ctx->h2);
-}
-
-/*
* h2_process_pending_input() processes pending input left in
* httpc->inbuf. Then, call h2_session_send() to send pending data.
* This function returns 0 if it succeeds, or -1 and error code will
@@ -1586,8 +1590,6 @@ static ssize_t http2_handle_stream_close(struct Curl_cfilter *cf, }
}
- /* Reset to FALSE to prevent infinite loop in readwrite_data function. */
- stream->closed = FALSE;
if(stream->error == NGHTTP2_REFUSED_STREAM) {
DEBUGF(LOG_CF(data, cf, "[h2sid=%u] REFUSED_STREAM, try again on a new "
"connection", stream->stream_id));
@@ -1603,6 +1605,11 @@ static ssize_t http2_handle_stream_close(struct Curl_cfilter *cf, *err = CURLE_HTTP2_STREAM;
return -1;
}
+ else if(stream->reset) {
+ failf(data, "HTTP/2 stream %u was reset", stream->stream_id);
+ *err = stream->bodystarted? CURLE_PARTIAL_FILE : CURLE_RECV_ERROR;
+ return -1;
+ }
if(!stream->bodystarted) {
failf(data, "HTTP/2 stream %u was closed cleanly, but before getting "
@@ -1638,7 +1645,7 @@ static ssize_t http2_handle_stream_close(struct Curl_cfilter *cf, stream->close_handled = TRUE;
- DEBUGF(LOG_CF(data, cf, "http2_recv returns 0, http2_handle_stream_close"));
+ DEBUGF(LOG_CF(data, cf, "[h2sid=%u] closed cleanly", stream->stream_id));
return 0;
}
@@ -1720,9 +1727,29 @@ static ssize_t cf_h2_recv(struct Curl_cfilter *cf, struct Curl_easy *data, struct HTTP *stream = data->req.p.http;
ssize_t nread = -1;
struct cf_call_data save;
+ bool conn_is_closed = FALSE;
CF_DATA_SAVE(save, cf, data);
+ /* If the h2 session has told us to GOAWAY with an error AND
+ * indicated the highest stream id it has processes AND
+ * the stream we are trying to read has a higher id, this
+ * means we will most likely not receive any more for it.
+ * Treat this as if the server explicitly had RST the stream */
+ if((ctx->goaway && ctx->goaway_error &&
+ ctx->last_stream_id > 0 &&
+ ctx->last_stream_id < stream->stream_id)) {
+ stream->reset = TRUE;
+ }
+
+ /* If a stream is RST, it does not matter what state the h2 session
+ * is in, our answer to receiving data is always the same. */
+ if(stream->reset) {
+ *err = stream->bodystarted? CURLE_PARTIAL_FILE : CURLE_RECV_ERROR;
+ nread = -1;
+ goto out;
+ }
+
if(should_close_session(ctx)) {
DEBUGF(LOG_CF(data, cf, "http2_recv: nothing to do in this session"));
if(cf->conn->bits.close) {
@@ -1763,7 +1790,7 @@ static ssize_t cf_h2_recv(struct Curl_cfilter *cf, struct Curl_easy *data, goto out;
}
- DEBUGF(LOG_CF(data, cf, "[h2sid=%u] recv: win %u/%u",
+ DEBUGF(LOG_CF(data, cf, "[h2sid=%u] cf_recv: win %u/%u",
stream->stream_id,
nghttp2_session_get_local_window_size(ctx->h2),
nghttp2_session_get_stream_local_window_size(ctx->h2,
@@ -1846,57 +1873,40 @@ static ssize_t cf_h2_recv(struct Curl_cfilter *cf, struct Curl_easy *data, stream->memlen = 0;
if(ctx->inbuflen > 0) {
- DEBUGF(LOG_CF(data, cf, "Use data left in connection buffer, nread=%zd",
- ctx->inbuflen - ctx->nread_inbuf));
+ DEBUGF(LOG_CF(data, cf, "[h2sid=%u] %zd bytes in inbuf",
+ stream->stream_id, ctx->inbuflen - ctx->nread_inbuf));
if(h2_process_pending_input(cf, data, err))
return -1;
}
- while(stream->memlen == 0 /* have no data for this stream */
- && !ctx->pause_stream_id /* we are not paused either */
- && ctx->inbuflen == 0) { /* and out input buffer is empty */
+ while(stream->memlen == 0 && /* have no data for this stream */
+ !stream->closed && /* and it is not closed/reset */
+ !ctx->pause_stream_id && /* we are not paused either */
+ ctx->inbuflen == 0 && /* and out input buffer is empty */
+ !conn_is_closed) { /* and connection is not closed */
/* Receive data from the "lower" filters */
nread = Curl_conn_cf_recv(cf->next, data, ctx->inbuf, H2_BUFSIZE, err);
if(nread < 0) {
- if(*err != CURLE_AGAIN)
- failf(data, "Failed receiving HTTP2 data");
- else if(stream->closed) {
- /* received when the stream was already closed! */
- nread = http2_handle_stream_close(cf, data, stream, err);
- goto out;
+ DEBUGASSERT(*err);
+ if(*err == CURLE_AGAIN) {
+ break;
}
-
- /* nothing to read from the lower layers, clear drain */
- drained_transfer(cf, data);
- nread = -1;
- goto out;
+ failf(data, "Failed receiving HTTP2 data");
+ conn_is_closed = TRUE;
}
else if(nread == 0) {
- if(!stream->closed) {
- /* This will happen when the server or proxy server is SIGKILLed
- during data transfer. We should emit an error since our data
- received may be incomplete. */
- failf(data, "HTTP/2 stream %u was not closed cleanly before"
- " end of the underlying stream",
- stream->stream_id);
- drained_transfer(cf, data);
- *err = CURLE_PARTIAL_FILE;
- nread = -1;
- goto out;
- }
-
- DEBUGF(LOG_CF(data, cf, "[h2sid=%u] end of stream",
+ DEBUGF(LOG_CF(data, cf, "[h2sid=%u] underlying connection is closed",
stream->stream_id));
- *err = CURLE_OK;
- nread = 0;
- goto out;
+ conn_is_closed = TRUE;
+ }
+ else {
+ DEBUGF(LOG_CF(data, cf, "[h2sid=%u] read %zd from connection",
+ stream->stream_id, nread));
+ ctx->inbuflen = nread;
+ DEBUGASSERT(ctx->nread_inbuf == 0);
+ if(h2_process_pending_input(cf, data, err))
+ return -1;
}
-
- DEBUGF(LOG_CF(data, cf, "read %zd from connection", nread));
- ctx->inbuflen = nread;
- DEBUGASSERT(ctx->nread_inbuf == 0);
- if(h2_process_pending_input(cf, data, err))
- return -1;
}
}
@@ -1933,11 +1943,18 @@ static ssize_t cf_h2_recv(struct Curl_cfilter *cf, struct Curl_easy *data, *err = CURLE_OK;
nread = retlen;
- DEBUGF(LOG_CF(data, cf, "[h2sid=%u] cf_h2_recv -> %zd",
- stream->stream_id, nread));
goto out;
}
+ if(conn_is_closed && !stream->closed) {
+ /* underlying connection is closed and we have nothing for the stream.
+ * Treat this as a RST */
+ stream->closed = stream->reset = TRUE;
+ failf(data, "HTTP/2 stream %u was not closed cleanly before"
+ " end of the underlying connection",
+ stream->stream_id);
+ }
+
if(stream->closed) {
nread = http2_handle_stream_close(cf, data, stream, err);
goto out;
@@ -1950,9 +1967,9 @@ static ssize_t cf_h2_recv(struct Curl_cfilter *cf, struct Curl_easy *data, }
*err = CURLE_AGAIN;
nread = -1;
- DEBUGF(LOG_CF(data, cf, "[h2sid=%u] recv -> AGAIN",
- stream->stream_id));
out:
+ DEBUGF(LOG_CF(data, cf, "[h2sid=%u] cf_recv -> %zd, %d",
+ stream->stream_id, nread, *err));
CF_DATA_RESTORE(cf, save);
return nread;
}
@@ -1976,19 +1993,20 @@ static ssize_t cf_h2_send(struct Curl_cfilter *cf, struct Curl_easy *data, CURLcode result;
struct h2h3req *hreq;
struct cf_call_data save;
+ ssize_t nwritten;
CF_DATA_SAVE(save, cf, data);
- DEBUGF(LOG_CF(data, cf, "send len=%zu", len));
+ DEBUGF(LOG_CF(data, cf, "cf_send(len=%zu) start", len));
if(stream->stream_id != -1) {
if(stream->close_handled) {
infof(data, "stream %u closed", stream->stream_id);
*err = CURLE_HTTP2_STREAM;
- len = -1;
+ nwritten = -1;
goto out;
}
else if(stream->closed) {
- len = http2_handle_stream_close(cf, data, stream, err);
+ nwritten = http2_handle_stream_close(cf, data, stream, err);
goto out;
}
/* If stream_id != -1, we have dispatched request HEADERS, and now
@@ -1998,26 +2016,24 @@ static ssize_t cf_h2_send(struct Curl_cfilter *cf, struct Curl_easy *data, rv = nghttp2_session_resume_data(ctx->h2, stream->stream_id);
if(nghttp2_is_fatal(rv)) {
*err = CURLE_SEND_ERROR;
- len = -1;
+ nwritten = -1;
goto out;
}
result = h2_session_send(cf, data);
if(result) {
*err = result;
- len = -1;
+ nwritten = -1;
goto out;
}
- len -= stream->upload_len;
- /* Nullify here because we call nghttp2_session_send() and they
- might refer to the old buffer. */
+ nwritten = (ssize_t)len - (ssize_t)stream->upload_len;
stream->upload_mem = NULL;
stream->upload_len = 0;
if(should_close_session(ctx)) {
DEBUGF(LOG_CF(data, cf, "send: nothing to do in this session"));
*err = CURLE_HTTP2;
- len = -1;
+ nwritten = -1;
goto out;
}
@@ -2029,26 +2045,36 @@ static ssize_t cf_h2_send(struct Curl_cfilter *cf, struct Curl_easy *data, nghttp2_session_resume_data(ctx->h2, stream->stream_id);
}
-#ifdef DEBUG_HTTP2
- if(!len) {
- infof(data, "http2_send: easy %p (stream %u) win %u/%u",
- data, stream->stream_id,
- nghttp2_session_get_remote_window_size(ctx->h2),
- nghttp2_session_get_stream_remote_window_size(ctx->h2,
- stream->stream_id)
- );
-
+ if(!nwritten) {
+ size_t rwin = nghttp2_session_get_stream_remote_window_size(ctx->h2,
+ stream->stream_id);
+ DEBUGF(LOG_CF(data, cf, "[h2sid=%u] cf_send: win %u/%zu",
+ stream->stream_id,
+ nghttp2_session_get_remote_window_size(ctx->h2), rwin));
+ if(rwin == 0) {
+ /* We cannot upload more as the stream's remote window size
+ * is 0. We need to receive WIN_UPDATEs before we can continue.
+ */
+ data->req.keepon |= KEEP_SEND_HOLD;
+ DEBUGF(LOG_CF(data, cf, "[h2sid=%u] holding send as remote flow "
+ "window is exhausted", stream->stream_id));
+ }
}
- infof(data, "http2_send returns %zu for stream %u", len,
- stream->stream_id);
-#endif
+ DEBUGF(LOG_CF(data, cf, "[h2sid=%u] cf_send returns %zd ",
+ stream->stream_id, nwritten));
+
+ /* handled writing BODY for open stream. */
goto out;
}
-
+ /* Stream has not been opened yet. `buf` is expected to contain
+ * request headers. */
+ /* TODO: this assumes that the `buf` and `len` we are called with
+ * is *all* HEADERs and no body. We have no way to determine here
+ * if that is indeed the case. */
result = Curl_pseudo_headers(data, buf, len, NULL, &hreq);
if(result) {
*err = result;
- len = -1;
+ nwritten = -1;
goto out;
}
nheader = hreq->entries;
@@ -2057,7 +2083,7 @@ static ssize_t cf_h2_send(struct Curl_cfilter *cf, struct Curl_easy *data, if(!nva) {
Curl_pseudo_free(hreq);
*err = CURLE_OUT_OF_MEMORY;
- len = -1;
+ nwritten = -1;
goto out;
}
else {
@@ -2104,25 +2130,28 @@ static ssize_t cf_h2_send(struct Curl_cfilter *cf, struct Curl_easy *data, DEBUGF(LOG_CF(data, cf, "send: nghttp2_submit_request error (%s)%u",
nghttp2_strerror(stream_id), stream_id));
*err = CURLE_SEND_ERROR;
- len = -1;
+ nwritten = -1;
goto out;
}
infof(data, "Using Stream ID: %u (easy handle %p)",
stream_id, (void *)data);
stream->stream_id = stream_id;
+ /* See TODO above. We assume that the whole buf was consumed by
+ * generating the request headers. */
+ nwritten = len;
result = h2_session_send(cf, data);
if(result) {
*err = result;
- len = -1;
+ nwritten = -1;
goto out;
}
if(should_close_session(ctx)) {
DEBUGF(LOG_CF(data, cf, "send: nothing to do in this session"));
*err = CURLE_HTTP2;
- len = -1;
+ nwritten = -1;
goto out;
}
@@ -2137,7 +2166,7 @@ static ssize_t cf_h2_send(struct Curl_cfilter *cf, struct Curl_easy *data, out:
CF_DATA_RESTORE(cf, save);
- return len;
+ return nwritten;
}
static int cf_h2_get_select_socks(struct Curl_cfilter *cf,
@@ -2160,7 +2189,7 @@ static int cf_h2_get_select_socks(struct Curl_cfilter *cf, /* we're (still uploading OR the HTTP/2 layer wants to send data) AND
there's a window to send data in */
- if((((k->keepon & (KEEP_SEND|KEEP_SEND_PAUSE)) == KEEP_SEND) ||
+ if((((k->keepon & KEEP_SENDBITS) == KEEP_SEND) ||
nghttp2_session_want_write(ctx->h2)) &&
(nghttp2_session_get_remote_window_size(ctx->h2) &&
nghttp2_session_get_stream_remote_window_size(ctx->h2,
@@ -2329,14 +2358,17 @@ static bool cf_h2_data_pending(struct Curl_cfilter *cf, }
static bool cf_h2_is_alive(struct Curl_cfilter *cf,
- struct Curl_easy *data)
+ struct Curl_easy *data,
+ bool *input_pending)
{
struct cf_h2_ctx *ctx = cf->ctx;
CURLcode result;
struct cf_call_data save;
CF_DATA_SAVE(save, cf, data);
- result = (ctx && ctx->h2 && !http2_connisdead(cf, data));
+ result = (ctx && ctx->h2 && http2_connisalive(cf, data, input_pending));
+ DEBUGF(LOG_CF(data, cf, "conn alive -> %d, input_pending=%d",
+ result, *input_pending));
CF_DATA_RESTORE(cf, save);
return result;
}
@@ -2479,7 +2511,8 @@ bool Curl_http2_may_switch(struct Curl_easy *data, int sockindex)
{
(void)sockindex;
- if(data->state.httpwant == CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE) {
+ if(!Curl_conn_is_http2(data, conn, sockindex) &&
+ data->state.httpwant == CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE) {
#ifndef CURL_DISABLE_PROXY
if(conn->bits.httpproxy && !conn->bits.tunnel_proxy) {
/* We don't support HTTP/2 proxies yet. Also it's debatable
diff --git a/libs/libcurl/src/http_aws_sigv4.c b/libs/libcurl/src/http_aws_sigv4.c index fa9af9fd97..24228d2e65 100644 --- a/libs/libcurl/src/http_aws_sigv4.c +++ b/libs/libcurl/src/http_aws_sigv4.c @@ -58,13 +58,15 @@ #define TIMESTAMP_SIZE 17
-static void sha256_to_hex(char *dst, unsigned char *sha, size_t dst_l)
+/* hex-encoded with trailing null */
+#define SHA256_HEX_LENGTH (2 * SHA256_DIGEST_LENGTH + 1)
+
+static void sha256_to_hex(char *dst, unsigned char *sha)
{
int i;
- DEBUGASSERT(dst_l >= 65);
- for(i = 0; i < 32; ++i) {
- msnprintf(dst + (i * 2), dst_l - (i * 2), "%02x", sha[i]);
+ for(i = 0; i < SHA256_DIGEST_LENGTH; ++i) {
+ msnprintf(dst + (i * 2), SHA256_HEX_LENGTH - (i * 2), "%02x", sha[i]);
}
}
@@ -135,6 +137,7 @@ static CURLcode make_headers(struct Curl_easy *data, char *timestamp,
char *provider1,
char **date_header,
+ char *content_sha256_header,
struct dynbuf *canonical_headers,
struct dynbuf *signed_headers)
{
@@ -189,6 +192,13 @@ static CURLcode make_headers(struct Curl_easy *data, }
+ if (*content_sha256_header) {
+ tmp_head = curl_slist_append(head, content_sha256_header);
+ if(!tmp_head)
+ goto fail;
+ head = tmp_head;
+ }
+
for(l = data->set.headers; l; l = l->next) {
tmp_head = curl_slist_append(head, l->data);
if(!tmp_head)
@@ -267,6 +277,9 @@ fail: }
#define CONTENT_SHA256_KEY_LEN (MAX_SIGV4_LEN + sizeof("X--Content-Sha256"))
+/* add 2 for ": " between header name and value */
+#define CONTENT_SHA256_HDR_LEN (CONTENT_SHA256_KEY_LEN + 2 + \
+ SHA256_HEX_LENGTH)
/* try to parse a payload hash from the content-sha256 header */
static char *parse_content_sha_hdr(struct Curl_easy *data,
@@ -300,6 +313,63 @@ static char *parse_content_sha_hdr(struct Curl_easy *data, return value;
}
+static CURLcode calc_payload_hash(struct Curl_easy *data,
+ unsigned char *sha_hash, char *sha_hex)
+{
+ const char *post_data = data->set.postfields;
+ size_t post_data_len = 0;
+ CURLcode result;
+
+ if(post_data) {
+ if(data->set.postfieldsize < 0)
+ post_data_len = strlen(post_data);
+ else
+ post_data_len = (size_t)data->set.postfieldsize;
+ }
+ result = Curl_sha256it(sha_hash, (const unsigned char *) post_data,
+ post_data_len);
+ if(!result)
+ sha256_to_hex(sha_hex, sha_hash);
+ return result;
+}
+
+#define S3_UNSIGNED_PAYLOAD "UNSIGNED-PAYLOAD"
+
+static CURLcode calc_s3_payload_hash(struct Curl_easy *data,
+ Curl_HttpReq httpreq, char *provider1,
+ unsigned char *sha_hash,
+ char *sha_hex, char *header)
+{
+ bool empty_method = (httpreq == HTTPREQ_GET || httpreq == HTTPREQ_HEAD);
+ /* The request method or filesize indicate no request payload */
+ bool empty_payload = (empty_method || data->set.filesize == 0);
+ /* The POST payload is in memory */
+ bool post_payload = (httpreq == HTTPREQ_POST && data->set.postfields);
+ CURLcode ret = CURLE_OUT_OF_MEMORY;
+
+ if(empty_payload || post_payload) {
+ /* Calculate a real hash when we know the request payload */
+ ret = calc_payload_hash(data, sha_hash, sha_hex);
+ if(ret)
+ goto fail;
+ }
+ else {
+ /* Fall back to s3's UNSIGNED-PAYLOAD */
+ size_t len = sizeof(S3_UNSIGNED_PAYLOAD) - 1;
+ DEBUGASSERT(len < SHA256_HEX_LENGTH); /* 16 < 65 */
+ memcpy(sha_hex, S3_UNSIGNED_PAYLOAD, len);
+ sha_hex[len] = 0;
+ }
+
+ /* format the required content-sha256 header */
+ msnprintf(header, CONTENT_SHA256_HDR_LEN,
+ "x-%s-content-sha256: %s", provider1, sha_hex);
+
+ ret = CURLE_OK;
+fail:
+ return ret;
+}
+
CURLcode Curl_output_aws_sigv4(struct Curl_easy *data, bool proxy)
{
CURLcode ret = CURLE_OUT_OF_MEMORY;
@@ -310,6 +380,7 @@ CURLcode Curl_output_aws_sigv4(struct Curl_easy *data, bool proxy) char provider1[MAX_SIGV4_LEN + 1]="";
char region[MAX_SIGV4_LEN + 1]="";
char service[MAX_SIGV4_LEN + 1]="";
+ bool sign_as_s3 = false;
const char *hostname = conn->host.name;
time_t clock;
struct tm tm;
@@ -318,20 +389,21 @@ CURLcode Curl_output_aws_sigv4(struct Curl_easy *data, bool proxy) struct dynbuf canonical_headers;
struct dynbuf signed_headers;
char *date_header = NULL;
+ Curl_HttpReq httpreq;
+ const char *method = NULL;
char *payload_hash = NULL;
size_t payload_hash_len = 0;
- const char *post_data = data->set.postfields;
- size_t post_data_len = 0;
- unsigned char sha_hash[32];
- char sha_hex[65];
+ unsigned char sha_hash[SHA256_DIGEST_LENGTH];
+ char sha_hex[SHA256_HEX_LENGTH];
+ char content_sha256_hdr[CONTENT_SHA256_HDR_LEN + 2] = ""; /* add \r\n */
char *canonical_request = NULL;
char *request_type = NULL;
char *credential_scope = NULL;
char *str_to_sign = NULL;
const char *user = data->state.aptr.user ? data->state.aptr.user : "";
char *secret = NULL;
- unsigned char sign0[32] = {0};
- unsigned char sign1[32] = {0};
+ unsigned char sign0[SHA256_DIGEST_LENGTH] = {0};
+ unsigned char sign1[SHA256_DIGEST_LENGTH] = {0};
char *auth_headers = NULL;
DEBUGASSERT(!proxy);
@@ -408,6 +480,29 @@ CURLcode Curl_output_aws_sigv4(struct Curl_easy *data, bool proxy) }
}
+ Curl_http_method(data, conn, &method, &httpreq);
+
+ /* AWS S3 requires a x-amz-content-sha256 header, and supports special
+ * values like UNSIGNED-PAYLOAD */
+ sign_as_s3 = (strcasecompare(provider0, "aws") &&
+ strcasecompare(service, "s3"));
+
+ payload_hash = parse_content_sha_hdr(data, provider1, &payload_hash_len);
+
+ if(!payload_hash) {
+ if(sign_as_s3)
+ ret = calc_s3_payload_hash(data, httpreq, provider1, sha_hash,
+ sha_hex, content_sha256_hdr);
+ else
+ ret = calc_payload_hash(data, sha_hash, sha_hex);
+ if(ret)
+ goto fail;
+
+ payload_hash = sha_hex;
+ /* may be shorter than SHA256_HEX_LENGTH, like S3_UNSIGNED_PAYLOAD */
+ payload_hash_len = strlen(sha_hex);
+ }
+
#ifdef DEBUGBUILD
{
char *force_timestamp = getenv("CURL_FORCETIME");
@@ -429,54 +524,37 @@ CURLcode Curl_output_aws_sigv4(struct Curl_easy *data, bool proxy) }
ret = make_headers(data, hostname, timestamp, provider1,
- &date_header, &canonical_headers, &signed_headers);
+ &date_header, content_sha256_hdr,
+ &canonical_headers, &signed_headers);
if(ret)
goto fail;
ret = CURLE_OUT_OF_MEMORY;
+ if(*content_sha256_hdr) {
+ /* make_headers() needed this without the \r\n for canonicalization */
+ size_t hdrlen = strlen(content_sha256_hdr);
+ DEBUGASSERT(hdrlen + 3 < sizeof(content_sha256_hdr));
+ memcpy(content_sha256_hdr + hdrlen, "\r\n", 3);
+ }
+
memcpy(date, timestamp, sizeof(date));
date[sizeof(date) - 1] = 0;
- payload_hash = parse_content_sha_hdr(data, provider1, &payload_hash_len);
-
- if(!payload_hash) {
- if(post_data) {
- if(data->set.postfieldsize < 0)
- post_data_len = strlen(post_data);
- else
- post_data_len = (size_t)data->set.postfieldsize;
- }
- if(Curl_sha256it(sha_hash, (const unsigned char *) post_data,
- post_data_len))
- goto fail;
-
- sha256_to_hex(sha_hex, sha_hash, sizeof(sha_hex));
- payload_hash = sha_hex;
- payload_hash_len = strlen(sha_hex);
- }
-
- {
- Curl_HttpReq httpreq;
- const char *method;
-
- Curl_http_method(data, conn, &method, &httpreq);
-
- canonical_request =
- curl_maprintf("%s\n" /* HTTPRequestMethod */
- "%s\n" /* CanonicalURI */
- "%s\n" /* CanonicalQueryString */
- "%s\n" /* CanonicalHeaders */
- "%s\n" /* SignedHeaders */
- "%.*s", /* HashedRequestPayload in hex */
- method,
- data->state.up.path,
- data->state.up.query ? data->state.up.query : "",
- Curl_dyn_ptr(&canonical_headers),
- Curl_dyn_ptr(&signed_headers),
- (int)payload_hash_len, payload_hash);
- if(!canonical_request)
- goto fail;
- }
+ canonical_request =
+ curl_maprintf("%s\n" /* HTTPRequestMethod */
+ "%s\n" /* CanonicalURI */
+ "%s\n" /* CanonicalQueryString */
+ "%s\n" /* CanonicalHeaders */
+ "%s\n" /* SignedHeaders */
+ "%.*s", /* HashedRequestPayload in hex */
+ method,
+ data->state.up.path,
+ data->state.up.query ? data->state.up.query : "",
+ Curl_dyn_ptr(&canonical_headers),
+ Curl_dyn_ptr(&signed_headers),
+ (int)payload_hash_len, payload_hash);
+ if(!canonical_request)
+ goto fail;
/* provider 0 lowercase */
Curl_strntolower(provider0, provider0, strlen(provider0));
@@ -493,7 +571,7 @@ CURLcode Curl_output_aws_sigv4(struct Curl_easy *data, bool proxy) strlen(canonical_request)))
goto fail;
- sha256_to_hex(sha_hex, sha_hash, sizeof(sha_hex));
+ sha256_to_hex(sha_hex, sha_hash);
/* provider 0 uppercase */
Curl_strntoupper(provider0, provider0, strlen(provider0));
@@ -527,20 +605,22 @@ CURLcode Curl_output_aws_sigv4(struct Curl_easy *data, bool proxy) HMAC_SHA256(sign0, sizeof(sign0), request_type, strlen(request_type), sign1);
HMAC_SHA256(sign1, sizeof(sign1), str_to_sign, strlen(str_to_sign), sign0);
- sha256_to_hex(sha_hex, sign0, sizeof(sha_hex));
+ sha256_to_hex(sha_hex, sign0);
/* provider 0 uppercase */
auth_headers = curl_maprintf("Authorization: %s4-HMAC-SHA256 "
"Credential=%s/%s, "
"SignedHeaders=%s, "
"Signature=%s\r\n"
- "%s\r\n",
+ "%s\r\n"
+ "%s", /* optional sha256 header includes \r\n */
provider0,
user,
credential_scope,
Curl_dyn_ptr(&signed_headers),
sha_hex,
- date_header);
+ date_header,
+ content_sha256_hdr);
if(!auth_headers) {
goto fail;
}
diff --git a/libs/libcurl/src/http_proxy.c b/libs/libcurl/src/http_proxy.c index b10429e6a9..6d2435feaf 100644 --- a/libs/libcurl/src/http_proxy.c +++ b/libs/libcurl/src/http_proxy.c @@ -403,7 +403,6 @@ static CURLcode on_resp_header(struct Curl_cfilter *cf, {
CURLcode result = CURLE_OK;
struct SingleRequest *k = &data->req;
- int subversion = 0;
(void)cf;
if((checkprefix("WWW-Authenticate:", header) &&
@@ -461,11 +460,14 @@ static CURLcode on_resp_header(struct Curl_cfilter *cf, STRCONST("Proxy-Connection:"),
STRCONST("close")))
ts->close_connection = TRUE;
- else if(2 == sscanf(header, "HTTP/1.%d %d",
- &subversion,
- &k->httpcode)) {
+ else if(!strncmp(header, "HTTP/1.", 7) &&
+ ((header[7] == '0') || (header[7] == '1')) &&
+ (header[8] == ' ') &&
+ ISDIGIT(header[9]) && ISDIGIT(header[10]) && ISDIGIT(header[11]) &&
+ !ISDIGIT(header[12])) {
/* store the HTTP code from the proxy */
- data->info.httpproxycode = k->httpcode;
+ data->info.httpproxycode = k->httpcode = (header[9] - '0') * 100 +
+ (header[10] - '0') * 10 + (header[11] - '0');
}
return result;
}
diff --git a/libs/libcurl/src/idn.c b/libs/libcurl/src/idn.c index b7c0a18b85..47b4d4655d 100644 --- a/libs/libcurl/src/idn.c +++ b/libs/libcurl/src/idn.c @@ -184,6 +184,11 @@ CURLcode Curl_idnconvert_hostname(struct hostname *host) if(!Curl_is_ASCII_name(host->name)) {
char *decoded = idn_decode(host->name);
if(decoded) {
+ if(!*decoded) {
+ /* zero length is a bad host name */
+ Curl_idn_free(decoded);
+ return CURLE_URL_MALFORMAT;
+ }
/* successful */
host->encalloc = decoded;
/* change the name pointer to point to the encoded hostname */
diff --git a/libs/libcurl/src/inet_ntop.c b/libs/libcurl/src/inet_ntop.c index e4e4a34605..e58a3b7e13 100644 --- a/libs/libcurl/src/inet_ntop.c +++ b/libs/libcurl/src/inet_ntop.c @@ -42,6 +42,15 @@ #define INT16SZ 2
/*
+ * If ENABLE_IPV6 is disabled, we still want to parse IPv6 addresses, so make
+ * sure we have _some_ value for AF_INET6 without polluting our fake value
+ * everywhere.
+ */
+#if !defined(ENABLE_IPV6) && !defined(AF_INET6)
+#define AF_INET6 (AF_INET + 1)
+#endif
+
+/*
* Format an IPv4 address, more or less like inet_ntop().
*
* Returns `dst' (as a const)
@@ -72,7 +81,6 @@ static char *inet_ntop4 (const unsigned char *src, char *dst, size_t size) return dst;
}
-#ifdef ENABLE_IPV6
/*
* Convert IPv6 binary address into presentation (printable) format.
*/
@@ -168,7 +176,6 @@ static char *inet_ntop6 (const unsigned char *src, char *dst, size_t size) strcpy(dst, tmp);
return dst;
}
-#endif /* ENABLE_IPV6 */
/*
* Convert a network format address to presentation format.
@@ -187,10 +194,8 @@ char *Curl_inet_ntop(int af, const void *src, char *buf, size_t size) switch(af) {
case AF_INET:
return inet_ntop4((const unsigned char *)src, buf, size);
-#ifdef ENABLE_IPV6
case AF_INET6:
return inet_ntop6((const unsigned char *)src, buf, size);
-#endif
default:
errno = EAFNOSUPPORT;
return NULL;
diff --git a/libs/libcurl/src/inet_pton.c b/libs/libcurl/src/inet_pton.c index 542740a393..a21679297f 100644 --- a/libs/libcurl/src/inet_pton.c +++ b/libs/libcurl/src/inet_pton.c @@ -39,14 +39,21 @@ #define INT16SZ 2
/*
+ * If ENABLE_IPV6 is disabled, we still want to parse IPv6 addresses, so make
+ * sure we have _some_ value for AF_INET6 without polluting our fake value
+ * everywhere.
+ */
+#if !defined(ENABLE_IPV6) && !defined(AF_INET6)
+#define AF_INET6 (AF_INET + 1)
+#endif
+
+/*
* WARNING: Don't even consider trying to compile this on a system where
* sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX.
*/
static int inet_pton4(const char *src, unsigned char *dst);
-#ifdef ENABLE_IPV6
static int inet_pton6(const char *src, unsigned char *dst);
-#endif
/* int
* inet_pton(af, src, dst)
@@ -70,10 +77,8 @@ Curl_inet_pton(int af, const char *src, void *dst) switch(af) {
case AF_INET:
return (inet_pton4(src, (unsigned char *)dst));
-#ifdef ENABLE_IPV6
case AF_INET6:
return (inet_pton6(src, (unsigned char *)dst));
-#endif
default:
errno = EAFNOSUPPORT;
return (-1);
@@ -135,7 +140,6 @@ inet_pton4(const char *src, unsigned char *dst) return (1);
}
-#ifdef ENABLE_IPV6
/* int
* inet_pton6(src, dst)
* convert presentation level address to network order binary form.
@@ -234,6 +238,5 @@ inet_pton6(const char *src, unsigned char *dst) memcpy(dst, tmp, IN6ADDRSZ);
return (1);
}
-#endif /* ENABLE_IPV6 */
#endif /* HAVE_INET_PTON */
diff --git a/libs/libcurl/src/krb5.c b/libs/libcurl/src/krb5.c index 6aed067feb..856bc7464f 100644 --- a/libs/libcurl/src/krb5.c +++ b/libs/libcurl/src/krb5.c @@ -721,8 +721,7 @@ int Curl_sec_read_msg(struct Curl_easy *data, struct connectdata *conn, return 0;
if(buf[3] != '-')
- /* safe to ignore return code */
- (void)sscanf(buf, "%d", &ret_code);
+ ret_code = atoi(buf);
if(buf[decoded_len - 1] == '\n')
buf[decoded_len - 1] = '\0';
@@ -765,8 +764,9 @@ static int sec_set_protection_level(struct Curl_easy *data) pbsz = strstr(data->state.buffer, "PBSZ=");
if(pbsz) {
- /* ignore return code, use default value if it fails */
- (void)sscanf(pbsz, "PBSZ=%u", &buffer_size);
+ /* stick to default value if the check fails */
+ if(!strncmp(pbsz, "PBSZ=", 5) && ISDIGIT(pbsz[5]))
+ buffer_size = atoi(&pbsz[5]);
if(buffer_size < conn->buffer_size)
conn->buffer_size = buffer_size;
}
diff --git a/libs/libcurl/src/ldap.c b/libs/libcurl/src/ldap.c index 9d702ffb2f..aa36b0ed66 100644 --- a/libs/libcurl/src/ldap.c +++ b/libs/libcurl/src/ldap.c @@ -140,6 +140,14 @@ static void _ldap_free_urldesc(LDAPURLDesc *ludp); #define ldap_err2string ldap_err2stringA
#endif
+#if defined(USE_WIN32_LDAP) && defined(_MSC_VER) && (_MSC_VER <= 1600)
+/* Workaround for warning:
+ 'type cast' : conversion from 'int' to 'void *' of greater size */
+#undef LDAP_OPT_ON
+#undef LDAP_OPT_OFF
+#define LDAP_OPT_ON ((void *)(size_t)1)
+#define LDAP_OPT_OFF ((void *)(size_t)0)
+#endif
static CURLcode ldap_do(struct Curl_easy *data, bool *done);
diff --git a/libs/libcurl/src/libcurl.plist b/libs/libcurl/src/libcurl.plist index 29888b765f..2cbfb0ccf2 100644 --- a/libs/libcurl/src/libcurl.plist +++ b/libs/libcurl/src/libcurl.plist @@ -15,7 +15,7 @@ <string>se.curl.libcurl</string>
<key>CFBundleVersion</key>
- <string>7.88.1</string>
+ <string>8.0.1</string>
<key>CFBundleName</key>
<string>libcurl</string>
@@ -27,9 +27,9 @@ <string>????</string>
<key>CFBundleShortVersionString</key>
- <string>libcurl 7.88.1</string>
+ <string>libcurl 8.0.1</string>
<key>CFBundleGetInfoString</key>
- <string>libcurl.plist 7.88.1</string>
+ <string>libcurl.plist 8.0.1</string>
</dict>
</plist>
diff --git a/libs/libcurl/src/mqtt.c b/libs/libcurl/src/mqtt.c index 1c147d5dd5..2d6f771be9 100644 --- a/libs/libcurl/src/mqtt.c +++ b/libs/libcurl/src/mqtt.c @@ -122,8 +122,9 @@ static CURLcode mqtt_send(struct Curl_easy *data, struct MQTT *mq = data->req.p.mqtt;
ssize_t n;
result = Curl_write(data, sockfd, buf, len, &n);
- if(!result)
- Curl_debug(data, CURLINFO_HEADER_OUT, buf, (size_t)n);
+ if(result)
+ return result;
+ Curl_debug(data, CURLINFO_HEADER_OUT, buf, (size_t)n);
if(len != (size_t)n) {
size_t nsend = len - n;
char *sendleftovers = Curl_memdup(&buf[n], nsend);
diff --git a/libs/libcurl/src/multi.c b/libs/libcurl/src/multi.c index 052bb110e6..b1ad4866a8 100644 --- a/libs/libcurl/src/multi.c +++ b/libs/libcurl/src/multi.c @@ -445,9 +445,6 @@ struct Curl_multi *Curl_multi_handle(int hashsize, /* socket hash */ sockhash_destroy(&multi->sockhash);
Curl_hash_destroy(&multi->hostcache);
Curl_conncache_destroy(&multi->conn_cache);
- Curl_llist_destroy(&multi->msglist, NULL);
- Curl_llist_destroy(&multi->pending, NULL);
-
free(multi);
return NULL;
}
@@ -459,6 +456,42 @@ struct Curl_multi *curl_multi_init(void) CURL_DNS_HASH_SIZE);
}
+static void link_easy(struct Curl_multi *multi,
+ struct Curl_easy *data)
+{
+ /* We add the new easy entry last in the list. */
+ data->next = NULL; /* end of the line */
+ if(multi->easyp) {
+ struct Curl_easy *last = multi->easylp;
+ last->next = data;
+ data->prev = last;
+ multi->easylp = data; /* the new last node */
+ }
+ else {
+ /* first node, make prev NULL! */
+ data->prev = NULL;
+ multi->easylp = multi->easyp = data; /* both first and last */
+ }
+}
+
+/* unlink the given easy handle from the linked list of easy handles */
+static void unlink_easy(struct Curl_multi *multi,
+ struct Curl_easy *data)
+{
+ /* make the previous node point to our next */
+ if(data->prev)
+ data->prev->next = data->next;
+ else
+ multi->easyp = data->next; /* point to first node */
+
+ /* make our next point to our previous node */
+ if(data->next)
+ data->next->prev = data->prev;
+ else
+ multi->easylp = data->prev; /* point to last node */
+}
+
+
CURLMcode curl_multi_add_handle(struct Curl_multi *multi,
struct Curl_easy *data)
{
@@ -554,19 +587,7 @@ CURLMcode curl_multi_add_handle(struct Curl_multi *multi, data->psl = &multi->psl;
#endif
- /* We add the new entry last in the list. */
- data->next = NULL; /* end of the line */
- if(multi->easyp) {
- struct Curl_easy *last = multi->easylp;
- last->next = data;
- data->prev = last;
- multi->easylp = data; /* the new last node */
- }
- else {
- /* first node, make prev NULL! */
- data->prev = NULL;
- multi->easylp = multi->easyp = data; /* both first and last */
- }
+ link_easy(multi, data);
/* increase the node-counter */
multi->num_easy++;
@@ -841,10 +862,6 @@ CURLMcode curl_multi_remove_handle(struct Curl_multi *multi, Curl_wildcard_dtor(&data->wildcard);
- /* destroy the timeout list that is held in the easy handle, do this *after*
- multi_done() as that may actually call Curl_expire that uses this */
- Curl_llist_destroy(&data->state.timeoutlist, NULL);
-
/* change state without using multistate(), only to make singlesocket() do
what we want */
data->mstate = MSTATE_COMPLETED;
@@ -917,17 +934,7 @@ CURLMcode curl_multi_remove_handle(struct Curl_multi *multi, }
}
- /* make the previous node point to our next */
- if(data->prev)
- data->prev->next = data->next;
- else
- multi->easyp = data->next; /* point to first node */
-
- /* make our next point to our previous node */
- if(data->next)
- data->next->prev = data->prev;
- else
- multi->easylp = data->prev; /* point to last node */
+ unlink_easy(multi, data);
/* NOTE NOTE NOTE
We do not touch the easy handle here! */
@@ -976,7 +983,7 @@ void Curl_attach_connection(struct Curl_easy *data, data->conn = conn;
Curl_llist_insert_next(&conn->easyq, conn->easyq.tail, data,
&data->conn_queue);
- if(conn->handler->attach)
+ if(conn->handler && conn->handler->attach)
conn->handler->attach(data, conn);
Curl_conn_ev_data_attach(conn, data);
}
@@ -2192,7 +2199,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, #ifndef CURL_DISABLE_FTP
/* some steps needed for wildcard matching */
if(data->state.wildcardmatch) {
- struct WildcardData *wc = &data->wildcard;
+ struct WildcardData *wc = data->wildcard;
if(wc->state == CURLWC_DONE || wc->state == CURLWC_SKIP) {
/* skip some states if it is important */
multi_done(data, CURLE_OK, FALSE);
@@ -2344,7 +2351,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, #ifndef CURL_DISABLE_FTP
if(data->state.wildcardmatch &&
((data->conn->handler->flags & PROTOPT_WILDCARD) == 0)) {
- data->wildcard.state = CURLWC_DONE;
+ data->wildcard->state = CURLWC_DONE;
}
#endif
multistate(data, MSTATE_DONE);
@@ -2574,7 +2581,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, #ifndef CURL_DISABLE_FTP
if(data->state.wildcardmatch) {
- if(data->wildcard.state != CURLWC_DONE) {
+ if(data->wildcard->state != CURLWC_DONE) {
/* if a wildcard is set and we are not ending -> lets start again
with MSTATE_INIT */
multistate(data, MSTATE_INIT);
@@ -2706,18 +2713,25 @@ CURLMcode curl_multi_perform(struct Curl_multi *multi, int *running_handles) return CURLM_RECURSIVE_API_CALL;
data = multi->easyp;
- while(data) {
+ if(data) {
CURLMcode result;
+ bool nosig = data->set.no_signal;
SIGPIPE_VARIABLE(pipe_st);
-
sigpipe_ignore(data, &pipe_st);
- result = multi_runsingle(multi, &now, data);
+ /* Do the loop and only alter the signal ignore state if the next handle
+ has a different NO_SIGNAL state than the previous */
+ do {
+ if(data->set.no_signal != nosig) {
+ sigpipe_restore(&pipe_st);
+ sigpipe_ignore(data, &pipe_st);
+ nosig = data->set.no_signal;
+ }
+ result = multi_runsingle(multi, &now, data);
+ if(result)
+ returncode = result;
+ data = data->next; /* operate on next handle */
+ } while(data);
sigpipe_restore(&pipe_st);
-
- if(result)
- returncode = result;
-
- data = data->next; /* operate on next handle */
}
/*
@@ -2788,9 +2802,6 @@ CURLMcode curl_multi_cleanup(struct Curl_multi *multi) sockhash_destroy(&multi->sockhash);
Curl_conncache_destroy(&multi->conn_cache);
- Curl_llist_destroy(&multi->msglist, NULL);
- Curl_llist_destroy(&multi->pending, NULL);
-
Curl_hash_destroy(&multi->hostcache);
Curl_psl_destroy(&multi->psl);
diff --git a/libs/libcurl/src/parsedate.c b/libs/libcurl/src/parsedate.c index cd7e3005fb..bd31aadf9e 100644 --- a/libs/libcurl/src/parsedate.c +++ b/libs/libcurl/src/parsedate.c @@ -212,56 +212,55 @@ static int checkday(const char *check, size_t len) {
int i;
const char * const *what;
- bool found = FALSE;
if(len > 3)
what = &weekday[0];
- else
+ else if(len == 3)
what = &Curl_wkday[0];
+ else
+ return -1; /* too short */
for(i = 0; i<7; i++) {
- if(strcasecompare(check, what[0])) {
- found = TRUE;
- break;
- }
+ size_t ilen = strlen(what[0]);
+ if((ilen == len) &&
+ strncasecompare(check, what[0], len))
+ return i;
what++;
}
- return found?i:-1;
+ return -1;
}
-static int checkmonth(const char *check)
+static int checkmonth(const char *check, size_t len)
{
int i;
- const char * const *what;
- bool found = FALSE;
+ const char * const *what = &Curl_month[0];
+ if(len != 3)
+ return -1; /* not a month */
- what = &Curl_month[0];
for(i = 0; i<12; i++) {
- if(strcasecompare(check, what[0])) {
- found = TRUE;
- break;
- }
+ if(strncasecompare(check, what[0], 3))
+ return i;
what++;
}
- return found?i:-1; /* return the offset or -1, no real offset is -1 */
+ return -1; /* return the offset or -1, no real offset is -1 */
}
/* return the time zone offset between GMT and the input one, in number
of seconds or -1 if the timezone wasn't found/legal */
-static int checktz(const char *check)
+static int checktz(const char *check, size_t len)
{
unsigned int i;
- const struct tzinfo *what;
- bool found = FALSE;
+ const struct tzinfo *what = tz;
+ if(len > 4) /* longer than any valid timezone */
+ return -1;
- what = tz;
for(i = 0; i< sizeof(tz)/sizeof(tz[0]); i++) {
- if(strcasecompare(check, what->name)) {
- found = TRUE;
- break;
- }
+ size_t ilen = strlen(what->name);
+ if((ilen == len) &&
+ strncasecompare(check, what->name, len))
+ return what->offset*60;
what++;
}
- return found?what->offset*60:-1;
+ return -1;
}
static void skip(const char **date)
@@ -294,6 +293,53 @@ static time_t time2epoch(int sec, int min, int hour, + hour) * 60 + min) * 60 + sec;
}
+/* Returns the value of a single-digit or two-digit decimal number, return
+ then pointer to after the number. The 'date' pointer is known to point to a
+ digit. */
+static int oneortwodigit(const char *date, const char **endp)
+{
+ int num = date[0] - '0';
+ if(ISDIGIT(date[1])) {
+ *endp = &date[2];
+ return num*10 + (date[1] - '0');
+ }
+ *endp = &date[1];
+ return num;
+}
+
+
+/* HH:MM:SS or HH:MM and accept single-digits too */
+static bool match_time(const char *date,
+ int *h, int *m, int *s, char **endp)
+{
+ const char *p;
+ int hh, mm, ss = 0;
+ hh = oneortwodigit(date, &p);
+ if((hh < 24) && (*p == ':') && ISDIGIT(p[1])) {
+ mm = oneortwodigit(&p[1], &p);
+ if(mm < 60) {
+ if((*p == ':') && ISDIGIT(p[1])) {
+ ss = oneortwodigit(&p[1], &p);
+ if(ss <= 60) {
+ /* valid HH:MM:SS */
+ goto match;
+ }
+ }
+ else {
+ /* valid HH:MM */
+ goto match;
+ }
+ }
+ }
+ return FALSE; /* not a time string */
+ match:
+ *h = hh;
+ *m = mm;
+ *s = ss;
+ *endp = (char *)p;
+ return TRUE;
+}
+
/*
* parsedate()
*
@@ -305,6 +351,9 @@ static time_t time2epoch(int sec, int min, int hour, * PARSEDATE_SOONER - time underflow at the low end of time_t
*/
+/* Wednesday is the longest name this parser knows about */
+#define NAME_LEN 12
+
static int parsedate(const char *date, time_t *output)
{
time_t t = 0;
@@ -327,32 +376,32 @@ static int parsedate(const char *date, time_t *output) if(ISALPHA(*date)) {
/* a name coming up */
- char buf[32]="";
- size_t len;
- if(sscanf(date, "%31[ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- "abcdefghijklmnopqrstuvwxyz]", buf))
- len = strlen(buf);
- else
- len = 0;
-
- if(wdaynum == -1) {
- wdaynum = checkday(buf, len);
- if(wdaynum != -1)
- found = TRUE;
- }
- if(!found && (monnum == -1)) {
- monnum = checkmonth(buf);
- if(monnum != -1)
- found = TRUE;
+ size_t len = 0;
+ const char *p = date;
+ while(ISALPHA(*p) && (len < NAME_LEN)) {
+ p++;
+ len++;
}
- if(!found && (tzoff == -1)) {
- /* this just must be a time zone string */
- tzoff = checktz(buf);
- if(tzoff != -1)
- found = TRUE;
- }
+ if(len != NAME_LEN) {
+ if(wdaynum == -1) {
+ wdaynum = checkday(date, len);
+ if(wdaynum != -1)
+ found = TRUE;
+ }
+ if(!found && (monnum == -1)) {
+ monnum = checkmonth(date, len);
+ if(monnum != -1)
+ found = TRUE;
+ }
+ if(!found && (tzoff == -1)) {
+ /* this just must be a time zone string */
+ tzoff = checktz(date, len);
+ if(tzoff != -1)
+ found = TRUE;
+ }
+ }
if(!found)
return PARSEDATE_FAIL; /* bad string */
@@ -362,18 +411,10 @@ static int parsedate(const char *date, time_t *output) /* a digit */
int val;
char *end;
- int len = 0;
if((secnum == -1) &&
- (3 == sscanf(date, "%02d:%02d:%02d%n",
- &hournum, &minnum, &secnum, &len))) {
- /* time stamp! */
- date += len;
- }
- else if((secnum == -1) &&
- (2 == sscanf(date, "%02d:%02d%n", &hournum, &minnum, &len))) {
- /* time stamp without seconds */
- date += len;
- secnum = 0;
+ match_time(date, &hournum, &minnum, &secnum, &end)) {
+ /* time stamp */
+ date = end;
}
else {
long lval;
diff --git a/libs/libcurl/src/progress.c b/libs/libcurl/src/progress.c index 0a0d1a2f2d..73e384efae 100644 --- a/libs/libcurl/src/progress.c +++ b/libs/libcurl/src/progress.c @@ -87,8 +87,6 @@ static char *max5data(curl_off_t bytes, char *max5) CURL_FORMAT_CURL_OFF_T "M", bytes/ONE_MEGABYTE,
(bytes%ONE_MEGABYTE) / (ONE_MEGABYTE/CURL_OFF_T_C(10)) );
-#if (SIZEOF_CURL_OFF_T > 4)
-
else if(bytes < CURL_OFF_T_C(10000) * ONE_MEGABYTE)
/* 'XXXXM' is good until we're at 10000MB or above */
msnprintf(max5, 6, "%4" CURL_FORMAT_CURL_OFF_T "M", bytes/ONE_MEGABYTE);
@@ -111,15 +109,8 @@ static char *max5data(curl_off_t bytes, char *max5) /* up to 10000PB, display without decimal: XXXXP */
msnprintf(max5, 6, "%4" CURL_FORMAT_CURL_OFF_T "P", bytes/ONE_PETABYTE);
- /* 16384 petabytes (16 exabytes) is the maximum a 64 bit unsigned number
- can hold, but our data type is signed so 8192PB will be the maximum. */
-
-#else
-
- else
- msnprintf(max5, 6, "%4" CURL_FORMAT_CURL_OFF_T "M", bytes/ONE_MEGABYTE);
-
-#endif
+ /* 16384 petabytes (16 exabytes) is the maximum a 64 bit unsigned number can
+ hold, but our data type is signed so 8192PB will be the maximum. */
return max5;
}
diff --git a/libs/libcurl/src/rand.c b/libs/libcurl/src/rand.c index 2fe5db7b36..126fae9e29 100644 --- a/libs/libcurl/src/rand.c +++ b/libs/libcurl/src/rand.c @@ -30,6 +30,10 @@ #ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
+#ifdef HAVE_ARC4RANDOM
+/* Some platforms might have the prototype missing (ubuntu + libressl) */
+uint32_t arc4random(void);
+#endif
#include <curl/curl.h>
#include "vtls/vtls.h"
@@ -143,6 +147,11 @@ static CURLcode randit(struct Curl_easy *data, unsigned int *rnd) }
#endif
+#ifdef HAVE_ARC4RANDOM
+ *rnd = (unsigned int)arc4random();
+ return CURLE_OK;
+#endif
+
#if defined(RANDOM_FILE) && !defined(WIN32)
if(!seeded) {
/* if there's a random file to read a seed from, use it */
diff --git a/libs/libcurl/src/rtsp.c b/libs/libcurl/src/rtsp.c index 4604b456ba..9643261242 100644 --- a/libs/libcurl/src/rtsp.c +++ b/libs/libcurl/src/rtsp.c @@ -145,7 +145,8 @@ static unsigned int rtsp_conncheck(struct Curl_easy *data, (void)data;
if(checks_to_perform & CONNCHECK_ISDEAD) {
- if(!Curl_conn_is_alive(data, conn))
+ bool input_pending;
+ if(!Curl_conn_is_alive(data, conn, &input_pending))
ret_val |= CONNRESULT_DEAD;
}
@@ -755,12 +756,14 @@ CURLcode rtp_client_write(struct Curl_easy *data, char *ptr, size_t len) CURLcode Curl_rtsp_parseheader(struct Curl_easy *data, char *header)
{
- long CSeq = 0;
-
if(checkprefix("CSeq:", header)) {
- /* Store the received CSeq. Match is verified in rtsp_done */
- int nc = sscanf(&header[4], ": %ld", &CSeq);
- if(nc == 1) {
+ long CSeq = 0;
+ char *endp;
+ char *p = &header[5];
+ while(ISBLANK(*p))
+ p++;
+ CSeq = strtol(p, &endp, 10);
+ if(p != endp) {
struct RTSP *rtsp = data->req.p.rtsp;
rtsp->CSeq_recv = CSeq; /* mark the request */
data->state.rtsp_CSeq_recv = CSeq; /* update the handle */
diff --git a/libs/libcurl/src/select.c b/libs/libcurl/src/select.c index 09f3497b18..278171a7ea 100644 --- a/libs/libcurl/src/select.c +++ b/libs/libcurl/src/select.c @@ -230,14 +230,14 @@ int Curl_socket_check(curl_socket_t readfd0, /* two sockets to read from */ if(readfd0 != CURL_SOCKET_BAD) {
if(pfd[num].revents & (POLLRDNORM|POLLIN|POLLERR|POLLHUP))
r |= CURL_CSELECT_IN;
- if(pfd[num].revents & (POLLRDBAND|POLLPRI|POLLNVAL))
+ if(pfd[num].revents & (POLLPRI|POLLNVAL))
r |= CURL_CSELECT_ERR;
num++;
}
if(readfd1 != CURL_SOCKET_BAD) {
if(pfd[num].revents & (POLLRDNORM|POLLIN|POLLERR|POLLHUP))
r |= CURL_CSELECT_IN2;
- if(pfd[num].revents & (POLLRDBAND|POLLPRI|POLLNVAL))
+ if(pfd[num].revents & (POLLPRI|POLLNVAL))
r |= CURL_CSELECT_ERR;
num++;
}
diff --git a/libs/libcurl/src/setopt.c b/libs/libcurl/src/setopt.c index 53e53ad6f5..906222d3b9 100644 --- a/libs/libcurl/src/setopt.c +++ b/libs/libcurl/src/setopt.c @@ -899,7 +899,7 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param) case CURL_HTTP_VERSION_NONE:
#ifdef USE_HTTP2
/* TODO: this seems an undesirable quirk to force a behaviour on
- * lower implementations that they should recognize independantly? */
+ * lower implementations that they should recognize independently? */
arg = CURL_HTTP_VERSION_2TLS;
#endif
/* accepted */
@@ -2369,7 +2369,7 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param) arg = va_arg(param, long);
if((arg < CURLUSESSL_NONE) || (arg >= CURLUSESSL_LAST))
return CURLE_BAD_FUNCTION_ARGUMENT;
- data->set.use_ssl = (curl_usessl)arg;
+ data->set.use_ssl = (unsigned char)arg;
break;
case CURLOPT_SSL_OPTIONS:
@@ -2849,7 +2849,7 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param) data->set.fnmatch = va_arg(param, curl_fnmatch_callback);
break;
case CURLOPT_CHUNK_DATA:
- data->wildcard.customptr = va_arg(param, void *);
+ data->set.wildcardptr = va_arg(param, void *);
break;
case CURLOPT_FNMATCH_DATA:
data->set.fnmatch_data = va_arg(param, void *);
diff --git a/libs/libcurl/src/sigpipe.h b/libs/libcurl/src/sigpipe.h index 6736238e8c..3f325f1a3c 100644 --- a/libs/libcurl/src/sigpipe.h +++ b/libs/libcurl/src/sigpipe.h @@ -50,7 +50,6 @@ static void sigpipe_ignore(struct Curl_easy *data, if(!data->set.no_signal) {
struct sigaction action;
/* first, extract the existing situation */
- memset(&ig->old_pipe_act, 0, sizeof(struct sigaction));
sigaction(SIGPIPE, NULL, &ig->old_pipe_act);
action = ig->old_pipe_act;
/* ignore this signal */
diff --git a/libs/libcurl/src/smb.c b/libs/libcurl/src/smb.c index d744044cb2..01553de971 100644 --- a/libs/libcurl/src/smb.c +++ b/libs/libcurl/src/smb.c @@ -25,8 +25,7 @@ #include "curl_setup.h"
-#if !defined(CURL_DISABLE_SMB) && defined(USE_CURL_NTLM_CORE) && \
- (SIZEOF_CURL_OFF_T > 4)
+#if !defined(CURL_DISABLE_SMB) && defined(USE_CURL_NTLM_CORE)
#define BUILDING_CURL_SMB_C
diff --git a/libs/libcurl/src/telnet.c b/libs/libcurl/src/telnet.c index 0c674c8230..d22dc8c1f9 100644 --- a/libs/libcurl/src/telnet.c +++ b/libs/libcurl/src/telnet.c @@ -770,22 +770,32 @@ static void printsub(struct Curl_easy *data, }
}
+static bool str_is_nonascii(const char *str)
+{
+ size_t len = strlen(str);
+ while(len--) {
+ if(*str & 0x80)
+ return TRUE;
+ str++;
+ }
+ return FALSE;
+}
+
static CURLcode check_telnet_options(struct Curl_easy *data)
{
struct curl_slist *head;
struct curl_slist *beg;
- char option_keyword[128] = "";
- char option_arg[256] = "";
struct TELNET *tn = data->req.p.telnet;
- struct connectdata *conn = data->conn;
CURLcode result = CURLE_OK;
- int binary_option;
/* Add the user name as an environment variable if it
was given on the command line */
if(data->state.aptr.user) {
- msnprintf(option_arg, sizeof(option_arg), "USER,%s", conn->user);
- beg = curl_slist_append(tn->telnet_vars, option_arg);
+ char buffer[256];
+ if(str_is_nonascii(data->conn->user))
+ return CURLE_BAD_FUNCTION_ARGUMENT;
+ msnprintf(buffer, sizeof(buffer), "USER,%s", data->conn->user);
+ beg = curl_slist_append(tn->telnet_vars, buffer);
if(!beg) {
curl_slist_free_all(tn->telnet_vars);
tn->telnet_vars = NULL;
@@ -795,68 +805,100 @@ static CURLcode check_telnet_options(struct Curl_easy *data) tn->us_preferred[CURL_TELOPT_NEW_ENVIRON] = CURL_YES;
}
- for(head = data->set.telnet_options; head; head = head->next) {
- if(sscanf(head->data, "%127[^= ]%*[ =]%255s",
- option_keyword, option_arg) == 2) {
-
- /* Terminal type */
- if(strcasecompare(option_keyword, "TTYPE")) {
- strncpy(tn->subopt_ttype, option_arg, 31);
- tn->subopt_ttype[31] = 0; /* String termination */
- tn->us_preferred[CURL_TELOPT_TTYPE] = CURL_YES;
+ for(head = data->set.telnet_options; head && !result; head = head->next) {
+ size_t olen;
+ char *option = head->data;
+ char *arg;
+ char *sep = strchr(option, '=');
+ if(sep) {
+ olen = sep - option;
+ arg = ++sep;
+ if(str_is_nonascii(arg))
continue;
- }
+ switch(olen) {
+ case 5:
+ /* Terminal type */
+ if(strncasecompare(option, "TTYPE", 5)) {
+ strncpy(tn->subopt_ttype, arg, 31);
+ tn->subopt_ttype[31] = 0; /* String termination */
+ tn->us_preferred[CURL_TELOPT_TTYPE] = CURL_YES;
+ }
+ else
+ result = CURLE_UNKNOWN_OPTION;
+ break;
- /* Display variable */
- if(strcasecompare(option_keyword, "XDISPLOC")) {
- strncpy(tn->subopt_xdisploc, option_arg, 127);
- tn->subopt_xdisploc[127] = 0; /* String termination */
- tn->us_preferred[CURL_TELOPT_XDISPLOC] = CURL_YES;
- continue;
- }
+ case 8:
+ /* Display variable */
+ if(strncasecompare(option, "XDISPLOC", 8)) {
+ strncpy(tn->subopt_xdisploc, arg, 127);
+ tn->subopt_xdisploc[127] = 0; /* String termination */
+ tn->us_preferred[CURL_TELOPT_XDISPLOC] = CURL_YES;
+ }
+ else
+ result = CURLE_UNKNOWN_OPTION;
+ break;
- /* Environment variable */
- if(strcasecompare(option_keyword, "NEW_ENV")) {
- beg = curl_slist_append(tn->telnet_vars, option_arg);
- if(!beg) {
- result = CURLE_OUT_OF_MEMORY;
- break;
+ case 7:
+ /* Environment variable */
+ if(strncasecompare(option, "NEW_ENV", 7)) {
+ beg = curl_slist_append(tn->telnet_vars, arg);
+ if(!beg) {
+ result = CURLE_OUT_OF_MEMORY;
+ break;
+ }
+ tn->telnet_vars = beg;
+ tn->us_preferred[CURL_TELOPT_NEW_ENVIRON] = CURL_YES;
}
- tn->telnet_vars = beg;
- tn->us_preferred[CURL_TELOPT_NEW_ENVIRON] = CURL_YES;
- continue;
- }
+ else
+ result = CURLE_UNKNOWN_OPTION;
+ break;
- /* Window Size */
- if(strcasecompare(option_keyword, "WS")) {
- if(sscanf(option_arg, "%hu%*[xX]%hu",
- &tn->subopt_wsx, &tn->subopt_wsy) == 2)
- tn->us_preferred[CURL_TELOPT_NAWS] = CURL_YES;
- else {
- failf(data, "Syntax error in telnet option: %s", head->data);
- result = CURLE_SETOPT_OPTION_SYNTAX;
- break;
+ case 2:
+ /* Window Size */
+ if(strncasecompare(option, "WS", 2)) {
+ char *p;
+ unsigned long x = strtoul(arg, &p, 10);
+ unsigned long y = 0;
+ if(x && (x <= 0xffff) && Curl_raw_tolower(*p) == 'x') {
+ p++;
+ y = strtoul(p, NULL, 10);
+ if(y && (y <= 0xffff)) {
+ tn->subopt_wsx = (unsigned short)x;
+ tn->subopt_wsy = (unsigned short)y;
+ tn->us_preferred[CURL_TELOPT_NAWS] = CURL_YES;
+ }
+ }
+ if(!y) {
+ failf(data, "Syntax error in telnet option: %s", head->data);
+ result = CURLE_SETOPT_OPTION_SYNTAX;
+ }
}
- continue;
- }
+ else
+ result = CURLE_UNKNOWN_OPTION;
+ break;
- /* To take care or not of the 8th bit in data exchange */
- if(strcasecompare(option_keyword, "BINARY")) {
- binary_option = atoi(option_arg);
- if(binary_option != 1) {
- tn->us_preferred[CURL_TELOPT_BINARY] = CURL_NO;
- tn->him_preferred[CURL_TELOPT_BINARY] = CURL_NO;
+ case 6:
+ /* To take care or not of the 8th bit in data exchange */
+ if(strncasecompare(option, "BINARY", 6)) {
+ int binary_option = atoi(arg);
+ if(binary_option != 1) {
+ tn->us_preferred[CURL_TELOPT_BINARY] = CURL_NO;
+ tn->him_preferred[CURL_TELOPT_BINARY] = CURL_NO;
+ }
}
- continue;
+ else
+ result = CURLE_UNKNOWN_OPTION;
+ break;
+ default:
+ failf(data, "Unknown telnet option %s", head->data);
+ result = CURLE_UNKNOWN_OPTION;
+ break;
}
-
- failf(data, "Unknown telnet option %s", head->data);
- result = CURLE_UNKNOWN_OPTION;
- break;
}
- failf(data, "Syntax error in telnet option: %s", head->data);
- result = CURLE_SETOPT_OPTION_SYNTAX;
- break;
+ else {
+ failf(data, "Syntax error in telnet option: %s", head->data);
+ result = CURLE_SETOPT_OPTION_SYNTAX;
+ }
}
if(result) {
@@ -881,8 +923,6 @@ static void suboption(struct Curl_easy *data) ssize_t bytes_written;
size_t len;
int err;
- char varname[128] = "";
- char varval[128] = "";
struct TELNET *tn = data->req.p.telnet;
struct connectdata *conn = data->conn;
@@ -920,19 +960,18 @@ static void suboption(struct Curl_easy *data) for(v = tn->telnet_vars; v; v = v->next) {
size_t tmplen = (strlen(v->data) + 1);
- /* Add the variable only if it fits */
+ /* Add the variable if it fits */
if(len + tmplen < (int)sizeof(temp)-6) {
- int rv;
- char sep[2] = "";
- varval[0] = 0;
- rv = sscanf(v->data, "%127[^,]%1[,]%127s", varname, sep, varval);
- if(rv == 1)
+ char *s = strchr(v->data, ',');
+ if(!s)
len += msnprintf((char *)&temp[len], sizeof(temp) - len,
- "%c%s", CURL_NEW_ENV_VAR, varname);
- else if(rv >= 2)
+ "%c%s", CURL_NEW_ENV_VAR, v->data);
+ else {
+ size_t vlen = s - v->data;
len += msnprintf((char *)&temp[len], sizeof(temp) - len,
- "%c%s%c%s", CURL_NEW_ENV_VAR, varname,
- CURL_NEW_ENV_VALUE, varval);
+ "%c%.*s%c%s", CURL_NEW_ENV_VAR,
+ (int)vlen, v->data, CURL_NEW_ENV_VALUE, ++s);
+ }
}
}
msnprintf((char *)&temp[len], sizeof(temp) - len,
diff --git a/libs/libcurl/src/transfer.c b/libs/libcurl/src/transfer.c index 6d0ed31e52..d0750c46f7 100644 --- a/libs/libcurl/src/transfer.c +++ b/libs/libcurl/src/transfer.c @@ -980,7 +980,15 @@ static CURLcode readwrite_upload(struct Curl_easy *data, if(result)
return result;
- win_update_buffer_size(conn->writesockfd);
+#if defined(WIN32) && defined(USE_WINSOCK)
+ {
+ struct curltime n = Curl_now();
+ if(Curl_timediff(n, k->last_sndbuf_update) > 1000) {
+ win_update_buffer_size(conn->writesockfd);
+ k->last_sndbuf_update = n;
+ }
+ }
+#endif
if(k->pendingheader) {
/* parts of what was sent was header */
@@ -1226,8 +1234,7 @@ CURLcode Curl_readwrite(struct connectdata *conn, }
/* Now update the "done" boolean we return */
- *done = (0 == (k->keepon&(KEEP_RECV|KEEP_SEND|
- KEEP_RECV_PAUSE|KEEP_SEND_PAUSE))) ? TRUE : FALSE;
+ *done = (0 == (k->keepon&(KEEP_RECVBITS|KEEP_SENDBITS))) ? TRUE : FALSE;
result = CURLE_OK;
out:
if(result)
@@ -1394,7 +1401,13 @@ CURLcode Curl_pretransfer(struct Curl_easy *data) #ifndef CURL_DISABLE_FTP
data->state.wildcardmatch = data->set.wildcard_enabled;
if(data->state.wildcardmatch) {
- struct WildcardData *wc = &data->wildcard;
+ struct WildcardData *wc;
+ if(!data->wildcard) {
+ data->wildcard = calloc(1, sizeof(struct WildcardData));
+ if(!data->wildcard)
+ return CURLE_OUT_OF_MEMORY;
+ }
+ wc = data->wildcard;
if(wc->state < CURLWC_INIT) {
result = Curl_wildcard_init(wc); /* init wildcard structures */
if(result)
diff --git a/libs/libcurl/src/url.c b/libs/libcurl/src/url.c index 3a81266424..48616be963 100644 --- a/libs/libcurl/src/url.c +++ b/libs/libcurl/src/url.c @@ -288,33 +288,6 @@ static const struct Curl_handler * const protocols[] = { (struct Curl_handler *) NULL
};
-/*
- * Dummy handler for undefined protocol schemes.
- */
-
-static const struct Curl_handler Curl_handler_dummy = {
- "<no protocol>", /* scheme */
- ZERO_NULL, /* setup_connection */
- ZERO_NULL, /* do_it */
- ZERO_NULL, /* done */
- ZERO_NULL, /* do_more */
- ZERO_NULL, /* connect_it */
- ZERO_NULL, /* connecting */
- ZERO_NULL, /* doing */
- ZERO_NULL, /* proto_getsock */
- ZERO_NULL, /* doing_getsock */
- ZERO_NULL, /* domore_getsock */
- ZERO_NULL, /* perform_getsock */
- ZERO_NULL, /* disconnect */
- ZERO_NULL, /* readwrite */
- ZERO_NULL, /* connection_check */
- ZERO_NULL, /* attach connection */
- 0, /* defport */
- 0, /* protocol */
- 0, /* family */
- PROTOPT_NONE /* flags */
-};
-
void Curl_freeset(struct Curl_easy *data)
{
/* Free all dynamic strings stored in the data->set substructure. */
@@ -341,6 +314,11 @@ void Curl_freeset(struct Curl_easy *data) data->state.url = NULL;
Curl_mime_cleanpart(&data->set.mimepost);
+
+#ifndef CURL_DISABLE_COOKIES
+ curl_slist_free_all(data->set.cookielist);
+ data->set.cookielist = NULL;
+#endif
}
/* free the URL pieces */
@@ -431,9 +409,6 @@ CURLcode Curl_close(struct Curl_easy **datap) Curl_dyn_free(&data->state.headerb);
Curl_safefree(data->state.ulbuf);
Curl_flush_cookies(data, TRUE);
-#ifndef CURL_DISABLE_COOKIES
- curl_slist_free_all(data->set.cookielist); /* clean up list */
-#endif
Curl_altsvc_save(data, data->asi, data->set.str[STRING_ALTSVC]);
Curl_altsvc_cleanup(&data->asi);
Curl_hsts_save(data, data->hsts, data->set.str[STRING_HSTS]);
@@ -752,8 +727,6 @@ static void conn_free(struct Curl_easy *data, struct connectdata *conn) Curl_safefree(conn->conn_to_host.rawalloc); /* host name buffer */
Curl_safefree(conn->hostname_resolve);
Curl_safefree(conn->secondaryhostname);
-
- Curl_llist_destroy(&conn->easyq, NULL);
Curl_safefree(conn->localdev);
Curl_free_primary_ssl_config(&conn->ssl_config);
@@ -823,7 +796,7 @@ void Curl_disconnect(struct Curl_easy *data, disconnect and shutdown */
Curl_attach_connection(data, conn);
- if(conn->handler->disconnect)
+ if(conn->handler && conn->handler->disconnect)
/* This is set if protocol-specific cleanups should be made */
conn->handler->disconnect(data, conn, dead_connection);
@@ -965,7 +938,20 @@ static bool extract_if_dead(struct connectdata *conn, }
else {
- dead = !Curl_conn_is_alive(data, conn);
+ bool input_pending;
+
+ dead = !Curl_conn_is_alive(data, conn, &input_pending);
+ if(input_pending) {
+ /* For reuse, we want a "clean" connection state. The includes
+ * that we expect - in general - no waiting input data. Input
+ * waiting might be a TLS Notify Close, for example. We reject
+ * that.
+ * For protocols where data from other other end may arrive at
+ * any time (HTTP/2 PING for example), the protocol handler needs
+ * to install its own `connection_check` callback.
+ */
+ dead = TRUE;
+ }
}
if(dead) {
@@ -1170,14 +1156,14 @@ ConnectionExists(struct Curl_easy *data, continue;
}
}
+ }
- if(!Curl_conn_is_connected(check, FIRSTSOCKET)) {
- foundPendingCandidate = TRUE;
- /* Don't pick a connection that hasn't connected yet */
- infof(data, "Connection #%ld isn't open enough, can't reuse",
- check->connection_id);
- continue;
- }
+ if(!Curl_conn_is_connected(check, FIRSTSOCKET)) {
+ foundPendingCandidate = TRUE;
+ /* Don't pick a connection that hasn't connected yet */
+ infof(data, "Connection #%ld isn't open enough, can't reuse",
+ check->connection_id);
+ continue;
}
#ifdef USE_UNIX_SOCKETS
@@ -1291,6 +1277,11 @@ ConnectionExists(struct Curl_easy *data, }
}
+ /* GSS delegation differences do not actually affect every connection
+ and auth method, but this check takes precaution before efficiency */
+ if(needle->gssapi_delegation != check->gssapi_delegation)
+ continue;
+
/* If multiplexing isn't enabled on the h2 connection and h1 is
explicitly requested, handle it: */
if((needle->handler->protocol & PROTO_FAMILY_HTTP) &&
@@ -1299,11 +1290,24 @@ ConnectionExists(struct Curl_easy *data, || ((check->httpversion >= 30) &&
(data->state.httpwant < CURL_HTTP_VERSION_3))))
continue;
-
- if(get_protocol_family(needle->handler) == PROTO_FAMILY_SSH) {
+#ifdef USE_SSH
+ else if(get_protocol_family(needle->handler) & PROTO_FAMILY_SSH) {
if(!ssh_config_matches(needle, check))
continue;
}
+#endif
+#ifndef CURL_DISABLE_FTP
+ else if(get_protocol_family(needle->handler) & PROTO_FAMILY_FTP) {
+ /* Also match ACCOUNT, ALTERNATIVE-TO-USER, USE_SSL and CCC options */
+ if(Curl_timestrcmp(needle->proto.ftpc.account,
+ check->proto.ftpc.account) ||
+ Curl_timestrcmp(needle->proto.ftpc.alternative_to_user,
+ check->proto.ftpc.alternative_to_user) ||
+ (needle->proto.ftpc.use_ssl != check->proto.ftpc.use_ssl) ||
+ (needle->proto.ftpc.ccc != check->proto.ftpc.ccc))
+ continue;
+ }
+#endif
if((needle->handler->flags&PROTOPT_SSL)
#ifndef CURL_DISABLE_PROXY
@@ -1494,10 +1498,6 @@ static struct connectdata *allocate_conn(struct Curl_easy *data) if(!conn)
return NULL;
- conn->handler = &Curl_handler_dummy; /* Be sure we have a handler defined
- already from start to avoid NULL
- situations and checks */
-
/* and we setup a few fields in case we end up actually using this struct */
conn->sock[FIRSTSOCKET] = CURL_SOCKET_BAD; /* no file descriptor */
@@ -1589,11 +1589,11 @@ static struct connectdata *allocate_conn(struct Curl_easy *data) conn->fclosesocket = data->set.fclosesocket;
conn->closesocket_client = data->set.closesocket_client;
conn->lastused = Curl_now(); /* used now */
+ conn->gssapi_delegation = data->set.gssapi_delegation;
return conn;
error:
- Curl_llist_destroy(&conn->easyq, NULL);
free(conn->localdev);
free(conn);
return NULL;
diff --git a/libs/libcurl/src/urlapi.c b/libs/libcurl/src/urlapi.c index 94266c1f4f..780a26747a 100644 --- a/libs/libcurl/src/urlapi.c +++ b/libs/libcurl/src/urlapi.c @@ -57,6 +57,15 @@ /* scheme is not URL encoded, the longest libcurl supported ones are... */
#define MAX_SCHEME_LEN 40
+/*
+ * If ENABLE_IPV6 is disabled, we still want to parse IPv6 addresses, so make
+ * sure we have _some_ value for AF_INET6 without polluting our fake value
+ * everywhere.
+ */
+#if !defined(ENABLE_IPV6) && !defined(AF_INET6)
+#define AF_INET6 (AF_INET + 1)
+#endif
+
/* Internal representation of CURLU. Point to URL-encoded strings. */
struct Curl_URL {
char *scheme;
@@ -599,7 +608,8 @@ static CURLUcode hostname_check(struct Curl_URL *u, char *hostname, return CURLUE_BAD_IPV6;
/* hostname is fine */
}
-#ifdef ENABLE_IPV6
+
+ /* Check the IPv6 address. */
{
char dest[16]; /* fits a binary IPv6 address */
char norm[MAX_IPADR_LEN];
@@ -616,11 +626,10 @@ static CURLUcode hostname_check(struct Curl_URL *u, char *hostname, }
hostname[hlen] = ']'; /* restore ending bracket */
}
-#endif
}
else {
/* letters from the second string are not ok */
- len = strcspn(hostname, " \r\n\t/:#?!@{}[]\\$\'\"^`*<>=;,+&()");
+ len = strcspn(hostname, " \r\n\t/:#?!@{}[]\\$\'\"^`*<>=;,+&()%");
if(hlen != len)
/* hostname with bad content */
return CURLUE_BAD_HOSTNAME;
@@ -1341,7 +1350,7 @@ void curl_url_cleanup(CURLU *u) } \
} while(0)
-CURLU *curl_url_dup(CURLU *in)
+CURLU *curl_url_dup(const CURLU *in)
{
struct Curl_URL *u = calloc(sizeof(struct Curl_URL), 1);
if(u) {
@@ -1362,10 +1371,10 @@ CURLU *curl_url_dup(CURLU *in) return NULL;
}
-CURLUcode curl_url_get(CURLU *u, CURLUPart what,
+CURLUcode curl_url_get(const CURLU *u, CURLUPart what,
char **part, unsigned int flags)
{
- char *ptr;
+ const char *ptr;
CURLUcode ifmissing = CURLUE_UNKNOWN_PART;
char portbuf[7];
bool urldecode = (flags & CURLU_URLDECODE)?1:0;
@@ -1432,11 +1441,8 @@ CURLUcode curl_url_get(CURLU *u, CURLUPart what, break;
case CURLUPART_PATH:
ptr = u->path;
- if(!ptr) {
- ptr = u->path = strdup("/");
- if(!u->path)
- return CURLUE_OUT_OF_MEMORY;
- }
+ if(!ptr)
+ ptr = "/";
break;
case CURLUPART_QUERY:
ptr = u->query;
@@ -1546,8 +1552,7 @@ CURLUcode curl_url_get(CURLU *u, CURLUPart what, return CURLUE_OUT_OF_MEMORY;
host++;
}
- free(u->host);
- u->host = Curl_dyn_ptr(&enc);
+ allochost = Curl_dyn_ptr(&enc);
}
}
diff --git a/libs/libcurl/src/urldata.h b/libs/libcurl/src/urldata.h index c1efd65a8b..0905e1bc51 100644 --- a/libs/libcurl/src/urldata.h +++ b/libs/libcurl/src/urldata.h @@ -168,7 +168,7 @@ typedef CURLcode (*Curl_datastream)(struct Curl_easy *data, #include "rtsp.h"
#include "smb.h"
#include "mqtt.h"
-#include "wildcard.h"
+#include "ftplistparser.h"
#include "multihandle.h"
#include "c-hyper.h"
#include "cf-socket.h"
@@ -687,6 +687,10 @@ struct SingleRequest { #ifndef CURL_DISABLE_DOH
struct dohdata *doh; /* DoH specific data for this request */
#endif
+#if defined(WIN32) && defined(USE_WINSOCK)
+ struct curltime last_sndbuf_update; /* last time readwrite_upload called
+ win_update_buffer_size */
+#endif
unsigned char setcookies;
unsigned char writer_stack_depth; /* Unencoding stack depth. */
BIT(header); /* incoming data has HTTP header */
@@ -1057,6 +1061,7 @@ struct connectdata { unsigned char ip_version; /* copied from the Curl_easy at creation time */
unsigned char httpversion; /* the HTTP version*10 reported by the server */
unsigned char connect_only;
+ unsigned char gssapi_delegation; /* inherited from set.gssapi_delegation */
};
/* The end of connectdata. */
@@ -1374,7 +1379,7 @@ struct UrlState { struct dynbuf trailers_buf; /* a buffer containing the compiled trailing
headers */
struct Curl_llist httphdrs; /* received headers */
- struct curl_header headerout; /* for external purposes */
+ struct curl_header headerout[2]; /* for external purposes */
struct Curl_header_store *prevhead; /* the latest added header */
trailers_state trailers_state; /* whether we are sending trailers
and what stage are we at */
@@ -1713,8 +1718,6 @@ struct UserDefined { #ifndef CURL_DISABLE_NETRC
unsigned char use_netrc; /* enum CURL_NETRC_OPTION values */
#endif
- curl_usessl use_ssl; /* if AUTH TLS is to be attempted etc, for FTP or
- IMAP or POP3 or others! */
unsigned int new_file_perms; /* when creating remote files */
char *str[STRING_LAST]; /* array of strings, pointing to allocated memory */
struct curl_blob *blobs[BLOB_LAST];
@@ -1739,6 +1742,7 @@ struct UserDefined { curl_fnmatch_callback fnmatch; /* callback to decide which file corresponds
to pattern (e.g. if WILDCARDMATCH is on) */
void *fnmatch_data;
+ void *wildcardptr;
#endif
/* GSS-API credential delegation, see the documentation of
CURLOPT_GSSAPI_DELEGATION */
@@ -1773,6 +1777,8 @@ struct UserDefined { BIT(mail_rcpt_allowfails); /* allow RCPT TO command to fail for some
recipients */
#endif
+ unsigned char use_ssl; /* if AUTH TLS is to be attempted etc, for FTP or
+ IMAP or POP3 or others! (type: curl_usessl)*/
unsigned char connect_only; /* make connection/request, then let
application use the socket */
BIT(is_fread_set); /* has read callback been set to non-NULL? */
@@ -1934,7 +1940,7 @@ struct Curl_easy { struct UrlState state; /* struct for fields used for state info and
other dynamic purposes */
#ifndef CURL_DISABLE_FTP
- struct WildcardData wildcard; /* wildcard download state info */
+ struct WildcardData *wildcard; /* wildcard download state info */
#endif
struct PureInfo info; /* stats, reports and info data */
struct curl_tlssessioninfo tsi; /* Information about the TLS session, only
diff --git a/libs/libcurl/src/version.c b/libs/libcurl/src/version.c index 62b8f09aa4..c43e69fc3c 100644 --- a/libs/libcurl/src/version.c +++ b/libs/libcurl/src/version.c @@ -62,7 +62,15 @@ #endif
#ifdef HAVE_BROTLI
+#if defined(__GNUC__)
+/* Ignore -Wvla warnings in brotli headers */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+#endif
#include <brotli/decode.h>
+#if defined(__GNUC__)
+#pragma GCC diagnostic pop
+#endif
#endif
#ifdef HAVE_ZSTD
@@ -357,8 +365,7 @@ static const char * const protocols[] = { #ifdef USE_SSH
"sftp",
#endif
-#if !defined(CURL_DISABLE_SMB) && defined(USE_CURL_NTLM_CORE) && \
- (SIZEOF_CURL_OFF_T > 4)
+#if !defined(CURL_DISABLE_SMB) && defined(USE_CURL_NTLM_CORE)
"smb",
# ifdef USE_SSL
"smbs",
diff --git a/libs/libcurl/src/vquic/curl_msh3.c b/libs/libcurl/src/vquic/curl_msh3.c index 1b400ab5b9..94c0f829cb 100644 --- a/libs/libcurl/src/vquic/curl_msh3.c +++ b/libs/libcurl/src/vquic/curl_msh3.c @@ -548,7 +548,6 @@ static CURLcode cf_msh3_data_event(struct Curl_cfilter *cf, struct Curl_easy *data,
int event, int arg1, void *arg2)
{
- struct cf_msh3_ctx *ctx = cf->ctx;
struct HTTP *stream = data->req.p.http;
CURLcode result = CURLE_OK;
@@ -579,11 +578,6 @@ static CURLcode cf_msh3_data_event(struct Curl_cfilter *cf, DEBUGF(LOG_CF(data, cf, "req: update info"));
cf_msh3_active(cf, data);
break;
- case CF_CTRL_CONN_REPORT_STATS:
- if(cf->sockindex == FIRSTSOCKET)
- Curl_pgrsTimeWas(data, TIMER_APPCONNECT, ctx->handshake_at);
- break;
-
default:
break;
}
@@ -753,6 +747,19 @@ static CURLcode cf_msh3_query(struct Curl_cfilter *cf, *pres1 = 100;
return CURLE_OK;
}
+ case CF_QUERY_TIMER_CONNECT: {
+ struct curltime *when = pres2;
+ /* we do not know when the first byte arrived */
+ if(cf->connected)
+ *when = ctx->handshake_at;
+ return CURLE_OK;
+ }
+ case CF_QUERY_TIMER_APPCONNECT: {
+ struct curltime *when = pres2;
+ if(cf->connected)
+ *when = ctx->handshake_at;
+ return CURLE_OK;
+ }
default:
break;
}
@@ -762,11 +769,13 @@ static CURLcode cf_msh3_query(struct Curl_cfilter *cf, }
static bool cf_msh3_conn_is_alive(struct Curl_cfilter *cf,
- struct Curl_easy *data)
+ struct Curl_easy *data,
+ bool *input_pending)
{
struct cf_msh3_ctx *ctx = cf->ctx;
(void)data;
+ *input_pending = FALSE;
return ctx && ctx->sock[SP_LOCAL] != CURL_SOCKET_BAD && ctx->qconn &&
ctx->connected;
}
diff --git a/libs/libcurl/src/vquic/curl_ngtcp2.c b/libs/libcurl/src/vquic/curl_ngtcp2.c index f42e220783..73d2ca5e5e 100644 --- a/libs/libcurl/src/vquic/curl_ngtcp2.c +++ b/libs/libcurl/src/vquic/curl_ngtcp2.c @@ -64,6 +64,8 @@ #include "vtls/vtls.h"
#include "curl_ngtcp2.h"
+#include "warnless.h"
+
/* The last 3 #include files should be in this order */
#include "curl_printf.h"
#include "curl_memory.h"
@@ -901,7 +903,7 @@ static int cf_ngtcp2_get_select_socks(struct Curl_cfilter *cf, rv |= GETSOCK_READSOCK(0);
/* we're still uploading or the HTTP/2 layer wants to send data */
- if((k->keepon & (KEEP_SEND|KEEP_SEND_PAUSE)) == KEEP_SEND &&
+ if((k->keepon & KEEP_SENDBITS) == KEEP_SEND &&
(!stream->h3out || stream->h3out->used < H3_SEND_SIZE) &&
ngtcp2_conn_get_cwnd_left(ctx->qconn) &&
ngtcp2_conn_get_max_data_left(ctx->qconn) &&
@@ -951,7 +953,7 @@ static int cb_h3_stream_close(nghttp3_conn *conn, int64_t stream_id, }
/*
- * write_resp_raw() copies resonse data in raw format to the `data`'s
+ * write_resp_raw() copies response data in raw format to the `data`'s
* receive buffer. If not enough space is available, it appends to the
* `data`'s overflow buffer.
*/
@@ -1762,7 +1764,7 @@ static CURLcode cf_process_ingress(struct Curl_cfilter *cf, ssize_t recvd;
int rv;
uint8_t buf[65536];
- size_t bufsize = sizeof(buf);
+ int bufsize = (int)sizeof(buf);
size_t pktcount = 0, total_recvd = 0;
struct sockaddr_storage remote_addr;
socklen_t remote_addrlen;
@@ -2107,13 +2109,6 @@ static CURLcode cf_ngtcp2_data_event(struct Curl_cfilter *cf, }
}
break;
- case CF_CTRL_CONN_REPORT_STATS:
- if(cf->sockindex == FIRSTSOCKET) {
- if(ctx->got_first_byte)
- Curl_pgrsTimeWas(data, TIMER_CONNECT, ctx->first_byte_at);
- Curl_pgrsTimeWas(data, TIMER_APPCONNECT, ctx->handshake_at);
- }
- break;
default:
break;
}
@@ -2127,7 +2122,6 @@ static void cf_ngtcp2_ctx_clear(struct cf_ngtcp2_ctx *ctx) if(ctx->qlogfd != -1) {
close(ctx->qlogfd);
- ctx->qlogfd = -1;
}
#ifdef USE_OPENSSL
if(ctx->ssl)
@@ -2155,6 +2149,7 @@ static void cf_ngtcp2_ctx_clear(struct cf_ngtcp2_ctx *ctx) ngtcp2_conn_del(ctx->qconn);
memset(ctx, 0, sizeof(*ctx));
+ ctx->qlogfd = -1;
ctx->call_data = save;
}
@@ -2176,7 +2171,7 @@ static void cf_ngtcp2_close(struct Curl_cfilter *cf, struct Curl_easy *data) (uint8_t *)buffer, sizeof(buffer),
&ctx->last_error, ts);
if(rc > 0) {
- while((send(ctx->q.sockfd, buffer, rc, 0) == -1) &&
+ while((send(ctx->q.sockfd, buffer, (SEND_TYPE_ARG3)rc, 0) == -1) &&
SOCKERRNO == EINTR);
}
@@ -2200,6 +2195,7 @@ static void cf_ngtcp2_destroy(struct Curl_cfilter *cf, struct Curl_easy *data) }
cf->ctx = NULL;
/* No CF_DATA_RESTORE(cf, save) possible */
+ (void)save;
}
/*
@@ -2428,6 +2424,18 @@ static CURLcode cf_ngtcp2_query(struct Curl_cfilter *cf, else
*pres1 = -1;
return CURLE_OK;
+ case CF_QUERY_TIMER_CONNECT: {
+ struct curltime *when = pres2;
+ if(ctx->got_first_byte)
+ *when = ctx->first_byte_at;
+ return CURLE_OK;
+ }
+ case CF_QUERY_TIMER_APPCONNECT: {
+ struct curltime *when = pres2;
+ if(cf->connected)
+ *when = ctx->handshake_at;
+ return CURLE_OK;
+ }
default:
break;
}
@@ -2436,6 +2444,32 @@ static CURLcode cf_ngtcp2_query(struct Curl_cfilter *cf, CURLE_UNKNOWN_OPTION;
}
+static bool cf_ngtcp2_conn_is_alive(struct Curl_cfilter *cf,
+ struct Curl_easy *data,
+ bool *input_pending)
+{
+ bool alive = TRUE;
+
+ *input_pending = FALSE;
+ if(!cf->next || !cf->next->cft->is_alive(cf->next, data, input_pending))
+ return FALSE;
+
+ if(*input_pending) {
+ /* This happens before we've sent off a request and the connection is
+ not in use by any other transfer, there shouldn't be any data here,
+ only "protocol frames" */
+ *input_pending = FALSE;
+ Curl_attach_connection(data, cf->conn);
+ if(cf_process_ingress(cf, data))
+ alive = FALSE;
+ else {
+ alive = TRUE;
+ }
+ Curl_detach_connection(data);
+ }
+
+ return alive;
+}
struct Curl_cftype Curl_cft_http3 = {
"HTTP/3",
@@ -2450,7 +2484,7 @@ struct Curl_cftype Curl_cft_http3 = { cf_ngtcp2_send,
cf_ngtcp2_recv,
cf_ngtcp2_data_event,
- Curl_cf_def_conn_is_alive,
+ cf_ngtcp2_conn_is_alive,
Curl_cf_def_conn_keep_alive,
cf_ngtcp2_query,
};
@@ -2470,6 +2504,7 @@ CURLcode Curl_cf_ngtcp2_create(struct Curl_cfilter **pcf, result = CURLE_OUT_OF_MEMORY;
goto out;
}
+ ctx->qlogfd = -1;
cf_ngtcp2_ctx_clear(ctx);
result = Curl_cf_create(&cf, &Curl_cft_http3, ctx);
diff --git a/libs/libcurl/src/vquic/curl_quiche.c b/libs/libcurl/src/vquic/curl_quiche.c index 14f48b5c07..90f98a69d1 100644 --- a/libs/libcurl/src/vquic/curl_quiche.c +++ b/libs/libcurl/src/vquic/curl_quiche.c @@ -444,7 +444,7 @@ static CURLcode cf_process_ingress(struct Curl_cfilter *cf, struct cf_quiche_ctx *ctx = cf->ctx;
int64_t stream3_id = data->req.p.http? data->req.p.http->stream3_id : -1;
uint8_t buf[65536];
- size_t bufsize = sizeof(buf);
+ int bufsize = (int)sizeof(buf);
struct sockaddr_storage remote_addr;
socklen_t remote_addrlen;
quiche_recv_info recv_info;
@@ -950,7 +950,7 @@ static int cf_quiche_get_select_socks(struct Curl_cfilter *cf, rv |= GETSOCK_READSOCK(0);
/* we're still uploading or the HTTP/3 layer wants to send data */
- if(((k->keepon & (KEEP_SEND|KEEP_SEND_PAUSE)) == KEEP_SEND)
+ if(((k->keepon & KEEP_SENDBITS) == KEEP_SEND)
&& stream_is_writeable(cf, data))
rv |= GETSOCK_WRITESOCK(0);
@@ -1016,13 +1016,6 @@ static CURLcode cf_quiche_data_event(struct Curl_cfilter *cf, case CF_CTRL_DATA_IDLE:
/* anything to do? */
break;
- case CF_CTRL_CONN_REPORT_STATS:
- if(cf->sockindex == FIRSTSOCKET) {
- if(ctx->got_first_byte)
- Curl_pgrsTimeWas(data, TIMER_CONNECT, ctx->first_byte_at);
- Curl_pgrsTimeWas(data, TIMER_APPCONNECT, ctx->handshake_at);
- }
- break;
default:
break;
}
@@ -1346,6 +1339,18 @@ static CURLcode cf_quiche_query(struct Curl_cfilter *cf, else
*pres1 = -1;
return CURLE_OK;
+ case CF_QUERY_TIMER_CONNECT: {
+ struct curltime *when = pres2;
+ if(ctx->got_first_byte)
+ *when = ctx->first_byte_at;
+ return CURLE_OK;
+ }
+ case CF_QUERY_TIMER_APPCONNECT: {
+ struct curltime *when = pres2;
+ if(cf->connected)
+ *when = ctx->handshake_at;
+ return CURLE_OK;
+ }
default:
break;
}
@@ -1354,6 +1359,32 @@ static CURLcode cf_quiche_query(struct Curl_cfilter *cf, CURLE_UNKNOWN_OPTION;
}
+static bool cf_quiche_conn_is_alive(struct Curl_cfilter *cf,
+ struct Curl_easy *data,
+ bool *input_pending)
+{
+ bool alive = TRUE;
+
+ *input_pending = FALSE;
+ if(!cf->next || !cf->next->cft->is_alive(cf->next, data, input_pending))
+ return FALSE;
+
+ if(*input_pending) {
+ /* This happens before we've sent off a request and the connection is
+ not in use by any other transfer, there shouldn't be any data here,
+ only "protocol frames" */
+ *input_pending = FALSE;
+ Curl_attach_connection(data, cf->conn);
+ if(cf_process_ingress(cf, data))
+ alive = FALSE;
+ else {
+ alive = TRUE;
+ }
+ Curl_detach_connection(data);
+ }
+
+ return alive;
+}
struct Curl_cftype Curl_cft_http3 = {
"HTTP/3",
@@ -1368,7 +1399,7 @@ struct Curl_cftype Curl_cft_http3 = { cf_quiche_send,
cf_quiche_recv,
cf_quiche_data_event,
- Curl_cf_def_conn_is_alive,
+ cf_quiche_conn_is_alive,
Curl_cf_def_conn_keep_alive,
cf_quiche_query,
};
diff --git a/libs/libcurl/src/vquic/vquic.c b/libs/libcurl/src/vquic/vquic.c index ae5dc09e60..be9e151669 100644 --- a/libs/libcurl/src/vquic/vquic.c +++ b/libs/libcurl/src/vquic/vquic.c @@ -167,7 +167,8 @@ static CURLcode do_sendmsg(struct Curl_cfilter *cf, *psent = 0;
- while((sent = send(qctx->sockfd, (const char *)pkt, pktlen, 0)) == -1 &&
+ while((sent = send(qctx->sockfd,
+ (const char *)pkt, (SEND_TYPE_ARG3)pktlen, 0)) == -1 &&
SOCKERRNO == EINTR)
;
@@ -363,6 +364,10 @@ bool Curl_conn_is_http3(const struct Curl_easy *data, CURLcode Curl_conn_may_http3(struct Curl_easy *data,
const struct connectdata *conn)
{
+ if(conn->transport == TRNSPRT_UNIX) {
+ /* cannot do QUIC over a unix domain socket */
+ return CURLE_QUIC_CONNECT_ERROR;
+ }
if(!(conn->handler->flags & PROTOPT_SSL)) {
failf(data, "HTTP/3 requested for non-HTTPS URL");
return CURLE_URL_MALFORMAT;
diff --git a/libs/libcurl/src/vssh/libssh.c b/libs/libcurl/src/vssh/libssh.c index 50e225f806..3fdec459d9 100644 --- a/libs/libcurl/src/vssh/libssh.c +++ b/libs/libcurl/src/vssh/libssh.c @@ -685,7 +685,6 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block) struct ssh_conn *sshc = &conn->proto.sshc;
curl_socket_t sock = conn->sock[FIRSTSOCKET];
int rc = SSH_NO_ERROR, err;
- char *new_readdir_line;
int seekerr = CURL_SEEKFUNC_OK;
const char *err_msg;
*block = 0; /* we're not blocking by default */
@@ -1432,7 +1431,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block) break;
case SSH_SFTP_READDIR:
-
+ Curl_dyn_reset(&sshc->readdir_buf);
if(sshc->readdir_attrs)
sftp_attributes_free(sshc->readdir_attrs);
@@ -1468,17 +1467,12 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block) sshc->readdir_len);
}
else {
- sshc->readdir_currLen = strlen(sshc->readdir_longentry);
- sshc->readdir_totalLen = 80 + sshc->readdir_currLen;
- sshc->readdir_line = calloc(sshc->readdir_totalLen, 1);
- if(!sshc->readdir_line) {
- state(data, SSH_SFTP_CLOSE);
+ if(Curl_dyn_add(&sshc->readdir_buf, sshc->readdir_longentry)) {
sshc->actualcode = CURLE_OUT_OF_MEMORY;
+ state(data, SSH_STOP);
break;
}
- memcpy(sshc->readdir_line, sshc->readdir_longentry,
- sshc->readdir_currLen);
if((sshc->readdir_attrs->flags & SSH_FILEXFER_ATTR_PERMISSIONS) &&
((sshc->readdir_attrs->permissions & SSH_S_IFMT) ==
SSH_S_IFLNK)) {
@@ -1541,24 +1535,11 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block) Curl_safefree(sshc->readdir_linkPath);
- /* get room for the filename and extra output */
- sshc->readdir_totalLen += 4 + sshc->readdir_len;
- new_readdir_line = Curl_saferealloc(sshc->readdir_line,
- sshc->readdir_totalLen);
- if(!new_readdir_line) {
- sshc->readdir_line = NULL;
- state(data, SSH_SFTP_CLOSE);
+ if(Curl_dyn_addf(&sshc->readdir_buf, " -> %s",
+ sshc->readdir_filename)) {
sshc->actualcode = CURLE_OUT_OF_MEMORY;
break;
}
- sshc->readdir_line = new_readdir_line;
-
- sshc->readdir_currLen += msnprintf(sshc->readdir_line +
- sshc->readdir_currLen,
- sshc->readdir_totalLen -
- sshc->readdir_currLen,
- " -> %s",
- sshc->readdir_filename);
sftp_attributes_free(sshc->readdir_link_attrs);
sshc->readdir_link_attrs = NULL;
@@ -1568,21 +1549,19 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block) state(data, SSH_SFTP_READDIR_BOTTOM);
/* FALLTHROUGH */
case SSH_SFTP_READDIR_BOTTOM:
- sshc->readdir_currLen += msnprintf(sshc->readdir_line +
- sshc->readdir_currLen,
- sshc->readdir_totalLen -
- sshc->readdir_currLen, "\n");
- result = Curl_client_write(data, CLIENTWRITE_BODY,
- sshc->readdir_line,
- sshc->readdir_currLen);
+ if(Curl_dyn_addn(&sshc->readdir_buf, "\n", 1))
+ result = CURLE_OUT_OF_MEMORY;
+ else
+ result = Curl_client_write(data, CLIENTWRITE_BODY,
+ Curl_dyn_ptr(&sshc->readdir_buf),
+ Curl_dyn_len(&sshc->readdir_buf));
if(!result) {
/* output debug output if that is requested */
- Curl_debug(data, CURLINFO_DATA_OUT, sshc->readdir_line,
- sshc->readdir_currLen);
- data->req.bytecount += sshc->readdir_currLen;
+ Curl_debug(data, CURLINFO_DATA_OUT, Curl_dyn_ptr(&sshc->readdir_buf),
+ Curl_dyn_len(&sshc->readdir_buf));
+ data->req.bytecount += Curl_dyn_len(&sshc->readdir_buf);
}
- Curl_safefree(sshc->readdir_line);
ssh_string_free_char(sshc->readdir_tmp);
sshc->readdir_tmp = NULL;
@@ -2021,7 +2000,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block) Curl_safefree(sshc->rsa);
Curl_safefree(sshc->quote_path1);
Curl_safefree(sshc->quote_path2);
- Curl_safefree(sshc->readdir_line);
+ Curl_dyn_free(&sshc->readdir_buf);
Curl_safefree(sshc->readdir_linkPath);
SSH_STRING_FREE_CHAR(sshc->homedir);
@@ -2166,11 +2145,12 @@ static CURLcode myssh_setup_connection(struct Curl_easy *data, struct connectdata *conn)
{
struct SSHPROTO *ssh;
- (void)conn;
+ struct ssh_conn *sshc = &conn->proto.sshc;
data->req.p.ssh = ssh = calloc(1, sizeof(struct SSHPROTO));
if(!ssh)
return CURLE_OUT_OF_MEMORY;
+ Curl_dyn_init(&sshc->readdir_buf, PATH_MAX * 2);
return CURLE_OK;
}
diff --git a/libs/libcurl/src/vssh/libssh2.c b/libs/libcurl/src/vssh/libssh2.c index 19ad6c2f66..edc1c8f158 100644 --- a/libs/libcurl/src/vssh/libssh2.c +++ b/libs/libcurl/src/vssh/libssh2.c @@ -100,10 +100,11 @@ /* Local functions: */
static const char *sftp_libssh2_strerror(unsigned long err);
+#ifdef CURL_LIBSSH2_DEBUG
static LIBSSH2_ALLOC_FUNC(my_libssh2_malloc);
static LIBSSH2_REALLOC_FUNC(my_libssh2_realloc);
static LIBSSH2_FREE_FUNC(my_libssh2_free);
-
+#endif
static CURLcode ssh_force_knownhost_key_type(struct Curl_easy *data);
static CURLcode ssh_connect(struct Curl_easy *data, bool *done);
static CURLcode ssh_multi_statemach(struct Curl_easy *data, bool *done);
@@ -283,6 +284,8 @@ static CURLcode libssh2_session_error_to_CURLE(int err) return CURLE_SSH;
}
+#ifdef CURL_LIBSSH2_DEBUG
+
static LIBSSH2_ALLOC_FUNC(my_libssh2_malloc)
{
(void)abstract; /* arg not used */
@@ -302,6 +305,8 @@ static LIBSSH2_FREE_FUNC(my_libssh2_free) free(ptr);
}
+#endif
+
/*
* SSH State machine related code
*/
@@ -2400,7 +2405,6 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block) result = Curl_dyn_addf(&sshp->readdir, " -> %s", sshp->readdir_filename);
if(result) {
- sshc->readdir_line = NULL;
Curl_safefree(sshp->readdir_filename);
Curl_safefree(sshp->readdir_longentry);
state(data, SSH_SFTP_CLOSE);
@@ -3004,12 +3008,9 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block) Curl_safefree(sshc->rsa_pub);
Curl_safefree(sshc->rsa);
-
Curl_safefree(sshc->quote_path1);
Curl_safefree(sshc->quote_path2);
-
Curl_safefree(sshc->homedir);
- Curl_safefree(sshc->readdir_line);
/* the code we are about to return */
result = sshc->actualcode;
@@ -3268,9 +3269,13 @@ static CURLcode ssh_connect(struct Curl_easy *data, bool *done) sock = conn->sock[FIRSTSOCKET];
#endif /* CURL_LIBSSH2_DEBUG */
+#ifdef CURL_LIBSSH2_DEBUG
sshc->ssh_session = libssh2_session_init_ex(my_libssh2_malloc,
my_libssh2_free,
my_libssh2_realloc, data);
+#else
+ sshc->ssh_session = libssh2_session_init();
+#endif
if(!sshc->ssh_session) {
failf(data, "Failure initialising ssh session");
return CURLE_FAILED_INIT;
diff --git a/libs/libcurl/src/vssh/ssh.h b/libs/libcurl/src/vssh/ssh.h index 8fbe3a41b6..d310066369 100644 --- a/libs/libcurl/src/vssh/ssh.h +++ b/libs/libcurl/src/vssh/ssh.h @@ -147,7 +147,6 @@ struct ssh_conn { char *homedir; /* when doing SFTP we figure out home dir in the
connect phase */
- char *readdir_line;
/* end of READDIR stuff */
int secondCreateDirs; /* counter use by the code to see if the
@@ -158,7 +157,8 @@ struct ssh_conn { #if defined(USE_LIBSSH)
char *readdir_linkPath;
- size_t readdir_len, readdir_totalLen, readdir_currLen;
+ size_t readdir_len;
+ struct dynbuf readdir_buf;
/* our variables */
unsigned kbd_state; /* 0 or 1 */
ssh_key privkey;
diff --git a/libs/libcurl/src/vtls/nss.c b/libs/libcurl/src/vtls/nss.c index a327255a7e..2bbf96ab96 100644 --- a/libs/libcurl/src/vtls/nss.c +++ b/libs/libcurl/src/vtls/nss.c @@ -1536,36 +1536,6 @@ static void nss_cleanup(void) initialized = 0;
}
-/*
- * This function uses SSL_peek to determine connection status.
- *
- * Return codes:
- * 1 means the connection is still in place
- * 0 means the connection has been closed
- * -1 means the connection status is unknown
- */
-static int nss_check_cxn(struct Curl_cfilter *cf, struct Curl_easy *data)
-{
- struct ssl_connect_data *connssl = cf->ctx;
- struct ssl_backend_data *backend = connssl->backend;
- int rc;
- char buf;
-
- (void)data;
- DEBUGASSERT(backend);
-
- rc =
- PR_Recv(backend->handle, (void *)&buf, 1, PR_MSG_PEEK,
- PR_SecondsToInterval(1));
- if(rc > 0)
- return 1; /* connection still in place */
-
- if(rc == 0)
- return 0; /* connection has been closed */
-
- return -1; /* connection status unknown */
-}
-
static void close_one(struct ssl_connect_data *connssl)
{
/* before the cleanup, check whether we are using a client certificate */
@@ -2524,7 +2494,7 @@ const struct Curl_ssl Curl_ssl_nss = { nss_init, /* init */
nss_cleanup, /* cleanup */
nss_version, /* version */
- nss_check_cxn, /* check_cxn */
+ Curl_none_check_cxn, /* check_cxn */
/* NSS has no shutdown function provided and thus always fail */
Curl_none_shutdown, /* shutdown */
nss_data_pending, /* data_pending */
diff --git a/libs/libcurl/src/vtls/openssl.c b/libs/libcurl/src/vtls/openssl.c index 9d100a6d0d..c9cc52a184 100644 --- a/libs/libcurl/src/vtls/openssl.c +++ b/libs/libcurl/src/vtls/openssl.c @@ -1780,63 +1780,6 @@ static void ossl_cleanup(void) Curl_tls_keylog_close();
}
-/*
- * This function is used to determine connection status.
- *
- * Return codes:
- * 1 means the connection is still in place
- * 0 means the connection has been closed
- * -1 means the connection status is unknown
- */
-static int ossl_check_cxn(struct Curl_cfilter *cf, struct Curl_easy *data)
-{
- /* SSL_peek takes data out of the raw recv buffer without peeking so we use
- recv MSG_PEEK instead. Bug #795 */
-#ifdef MSG_PEEK
- char buf;
- ssize_t nread;
- curl_socket_t sock = Curl_conn_cf_get_socket(cf, data);
- if(sock == CURL_SOCKET_BAD)
- return 0; /* no socket, consider closed */
- nread = recv((RECV_TYPE_ARG1)sock,
- (RECV_TYPE_ARG2)&buf, (RECV_TYPE_ARG3)1,
- (RECV_TYPE_ARG4)MSG_PEEK);
- if(nread == 0)
- return 0; /* connection has been closed */
- if(nread == 1)
- return 1; /* connection still in place */
- else if(nread == -1) {
- int err = SOCKERRNO;
- if(err == EINPROGRESS ||
-#if defined(EAGAIN) && (EAGAIN != EWOULDBLOCK)
- err == EAGAIN ||
-#endif
- err == EWOULDBLOCK)
- return 1; /* connection still in place */
- if(err == ECONNRESET ||
-#ifdef ECONNABORTED
- err == ECONNABORTED ||
-#endif
-#ifdef ENETDOWN
- err == ENETDOWN ||
-#endif
-#ifdef ENETRESET
- err == ENETRESET ||
-#endif
-#ifdef ESHUTDOWN
- err == ESHUTDOWN ||
-#endif
-#ifdef ETIMEDOUT
- err == ETIMEDOUT ||
-#endif
- err == ENOTCONN)
- return 0; /* connection has been closed */
- }
-#endif
- (void)data;
- return -1; /* connection status unknown */
-}
-
/* Selects an OpenSSL crypto engine
*/
static CURLcode ossl_set_engine(struct Curl_easy *data, const char *engine)
@@ -4820,7 +4763,7 @@ const struct Curl_ssl Curl_ssl_openssl = { ossl_init, /* init */
ossl_cleanup, /* cleanup */
ossl_version, /* version */
- ossl_check_cxn, /* check_cxn */
+ Curl_none_check_cxn, /* check_cxn */
ossl_shutdown, /* shutdown */
ossl_data_pending, /* data_pending */
ossl_random, /* random */
diff --git a/libs/libcurl/src/vtls/schannel.c b/libs/libcurl/src/vtls/schannel.c index 63e5c7670d..63f9b07690 100644 --- a/libs/libcurl/src/vtls/schannel.c +++ b/libs/libcurl/src/vtls/schannel.c @@ -264,128 +264,133 @@ set_ssl_version_min_max(DWORD *enabled_protocols, /* longest is 26, buffer is slightly bigger */
#define LONGEST_ALG_ID 32
-#define CIPHEROPTION(X) \
- if(strcmp(#X, tmp) == 0) \
- return X
+#define CIPHEROPTION(x) {#x, x}
-static int
-get_alg_id_by_name(char *name)
-{
- char tmp[LONGEST_ALG_ID] = { 0 };
- char *nameEnd = strchr(name, ':');
- size_t n = nameEnd ? (size_t)(nameEnd - name) : strlen(name);
+struct algo {
+ const char *name;
+ int id;
+};
- /* reject too-long alg names */
- if(n > (LONGEST_ALG_ID - 1))
- return 0;
-
- strncpy(tmp, name, n);
- tmp[n] = 0;
- CIPHEROPTION(CALG_MD2);
- CIPHEROPTION(CALG_MD4);
- CIPHEROPTION(CALG_MD5);
- CIPHEROPTION(CALG_SHA);
- CIPHEROPTION(CALG_SHA1);
- CIPHEROPTION(CALG_MAC);
- CIPHEROPTION(CALG_RSA_SIGN);
- CIPHEROPTION(CALG_DSS_SIGN);
+static const struct algo algs[]= {
+ CIPHEROPTION(CALG_MD2),
+ CIPHEROPTION(CALG_MD4),
+ CIPHEROPTION(CALG_MD5),
+ CIPHEROPTION(CALG_SHA),
+ CIPHEROPTION(CALG_SHA1),
+ CIPHEROPTION(CALG_MAC),
+ CIPHEROPTION(CALG_RSA_SIGN),
+ CIPHEROPTION(CALG_DSS_SIGN),
/* ifdefs for the options that are defined conditionally in wincrypt.h */
#ifdef CALG_NO_SIGN
- CIPHEROPTION(CALG_NO_SIGN);
+ CIPHEROPTION(CALG_NO_SIGN),
#endif
- CIPHEROPTION(CALG_RSA_KEYX);
- CIPHEROPTION(CALG_DES);
+ CIPHEROPTION(CALG_RSA_KEYX),
+ CIPHEROPTION(CALG_DES),
#ifdef CALG_3DES_112
- CIPHEROPTION(CALG_3DES_112);
+ CIPHEROPTION(CALG_3DES_112),
#endif
- CIPHEROPTION(CALG_3DES);
- CIPHEROPTION(CALG_DESX);
- CIPHEROPTION(CALG_RC2);
- CIPHEROPTION(CALG_RC4);
- CIPHEROPTION(CALG_SEAL);
+ CIPHEROPTION(CALG_3DES),
+ CIPHEROPTION(CALG_DESX),
+ CIPHEROPTION(CALG_RC2),
+ CIPHEROPTION(CALG_RC4),
+ CIPHEROPTION(CALG_SEAL),
#ifdef CALG_DH_SF
- CIPHEROPTION(CALG_DH_SF);
+ CIPHEROPTION(CALG_DH_SF),
#endif
- CIPHEROPTION(CALG_DH_EPHEM);
+ CIPHEROPTION(CALG_DH_EPHEM),
#ifdef CALG_AGREEDKEY_ANY
- CIPHEROPTION(CALG_AGREEDKEY_ANY);
+ CIPHEROPTION(CALG_AGREEDKEY_ANY),
#endif
#ifdef CALG_HUGHES_MD5
- CIPHEROPTION(CALG_HUGHES_MD5);
+ CIPHEROPTION(CALG_HUGHES_MD5),
#endif
- CIPHEROPTION(CALG_SKIPJACK);
+ CIPHEROPTION(CALG_SKIPJACK),
#ifdef CALG_TEK
- CIPHEROPTION(CALG_TEK);
+ CIPHEROPTION(CALG_TEK),
#endif
- CIPHEROPTION(CALG_CYLINK_MEK);
- CIPHEROPTION(CALG_SSL3_SHAMD5);
+ CIPHEROPTION(CALG_CYLINK_MEK),
+ CIPHEROPTION(CALG_SSL3_SHAMD5),
#ifdef CALG_SSL3_MASTER
- CIPHEROPTION(CALG_SSL3_MASTER);
+ CIPHEROPTION(CALG_SSL3_MASTER),
#endif
#ifdef CALG_SCHANNEL_MASTER_HASH
- CIPHEROPTION(CALG_SCHANNEL_MASTER_HASH);
+ CIPHEROPTION(CALG_SCHANNEL_MASTER_HASH),
#endif
#ifdef CALG_SCHANNEL_MAC_KEY
- CIPHEROPTION(CALG_SCHANNEL_MAC_KEY);
+ CIPHEROPTION(CALG_SCHANNEL_MAC_KEY),
#endif
#ifdef CALG_SCHANNEL_ENC_KEY
- CIPHEROPTION(CALG_SCHANNEL_ENC_KEY);
+ CIPHEROPTION(CALG_SCHANNEL_ENC_KEY),
#endif
#ifdef CALG_PCT1_MASTER
- CIPHEROPTION(CALG_PCT1_MASTER);
+ CIPHEROPTION(CALG_PCT1_MASTER),
#endif
#ifdef CALG_SSL2_MASTER
- CIPHEROPTION(CALG_SSL2_MASTER);
+ CIPHEROPTION(CALG_SSL2_MASTER),
#endif
#ifdef CALG_TLS1_MASTER
- CIPHEROPTION(CALG_TLS1_MASTER);
+ CIPHEROPTION(CALG_TLS1_MASTER),
#endif
#ifdef CALG_RC5
- CIPHEROPTION(CALG_RC5);
+ CIPHEROPTION(CALG_RC5),
#endif
#ifdef CALG_HMAC
- CIPHEROPTION(CALG_HMAC);
+ CIPHEROPTION(CALG_HMAC),
#endif
#ifdef CALG_TLS1PRF
- CIPHEROPTION(CALG_TLS1PRF);
+ CIPHEROPTION(CALG_TLS1PRF),
#endif
#ifdef CALG_HASH_REPLACE_OWF
- CIPHEROPTION(CALG_HASH_REPLACE_OWF);
+ CIPHEROPTION(CALG_HASH_REPLACE_OWF),
#endif
#ifdef CALG_AES_128
- CIPHEROPTION(CALG_AES_128);
+ CIPHEROPTION(CALG_AES_128),
#endif
#ifdef CALG_AES_192
- CIPHEROPTION(CALG_AES_192);
+ CIPHEROPTION(CALG_AES_192),
#endif
#ifdef CALG_AES_256
- CIPHEROPTION(CALG_AES_256);
+ CIPHEROPTION(CALG_AES_256),
#endif
#ifdef CALG_AES
- CIPHEROPTION(CALG_AES);
+ CIPHEROPTION(CALG_AES),
#endif
#ifdef CALG_SHA_256
- CIPHEROPTION(CALG_SHA_256);
+ CIPHEROPTION(CALG_SHA_256),
#endif
#ifdef CALG_SHA_384
- CIPHEROPTION(CALG_SHA_384);
+ CIPHEROPTION(CALG_SHA_384),
#endif
#ifdef CALG_SHA_512
- CIPHEROPTION(CALG_SHA_512);
+ CIPHEROPTION(CALG_SHA_512),
#endif
#ifdef CALG_ECDH
- CIPHEROPTION(CALG_ECDH);
+ CIPHEROPTION(CALG_ECDH),
#endif
#ifdef CALG_ECMQV
- CIPHEROPTION(CALG_ECMQV);
+ CIPHEROPTION(CALG_ECMQV),
#endif
#ifdef CALG_ECDSA
- CIPHEROPTION(CALG_ECDSA);
+ CIPHEROPTION(CALG_ECDSA),
#endif
#ifdef CALG_ECDH_EPHEM
- CIPHEROPTION(CALG_ECDH_EPHEM);
+ CIPHEROPTION(CALG_ECDH_EPHEM),
#endif
- return 0;
+ {NULL, 0},
+};
+
+static int
+get_alg_id_by_name(char *name)
+{
+ char *nameEnd = strchr(name, ':');
+ size_t n = nameEnd ? (size_t)(nameEnd - name) : strlen(name);
+ int i;
+
+ for(i = 0; algs[i].name; i++) {
+ if((n == strlen(algs[i].name) && !strncmp(algs[i].name, name, n)))
+ return algs[i].id;
+ }
+ return 0; /* not found */
}
#define NUM_CIPHERS 47 /* There are 47 options listed above */
@@ -1201,18 +1206,18 @@ schannel_connect_step1(struct Curl_cfilter *cf, struct Curl_easy *data) /* The first four bytes will be an unsigned int indicating number
of bytes of data in the rest of the buffer. */
extension_len = (unsigned int *)(void *)(&alpn_buffer[cur]);
- cur += sizeof(unsigned int);
+ cur += (int)sizeof(unsigned int);
/* The next four bytes are an indicator that this buffer will contain
ALPN data, as opposed to NPN, for example. */
*(unsigned int *)(void *)&alpn_buffer[cur] =
SecApplicationProtocolNegotiationExt_ALPN;
- cur += sizeof(unsigned int);
+ cur += (int)sizeof(unsigned int);
/* The next two bytes will be an unsigned short indicating the number
of bytes used to list the preferred protocols. */
list_len = (unsigned short*)(void *)(&alpn_buffer[cur]);
- cur += sizeof(unsigned short);
+ cur += (int)sizeof(unsigned short);
list_start_index = cur;
@@ -1225,7 +1230,9 @@ schannel_connect_step1(struct Curl_cfilter *cf, struct Curl_easy *data) cur += proto.len;
*list_len = curlx_uitous(cur - list_start_index);
- *extension_len = *list_len + sizeof(unsigned int) + sizeof(unsigned short);
+ *extension_len = *list_len +
+ (unsigned short)sizeof(unsigned int) +
+ (unsigned short)sizeof(unsigned short);
InitSecBuffer(&inbuf, SECBUFFER_APPLICATION_PROTOCOLS, alpn_buffer, cur);
InitSecBufferDesc(&inbuf_desc, &inbuf, 1);
diff --git a/libs/libcurl/src/vtls/sectransp.c b/libs/libcurl/src/vtls/sectransp.c index 953b624f2b..81ab9ab061 100644 --- a/libs/libcurl/src/vtls/sectransp.c +++ b/libs/libcurl/src/vtls/sectransp.c @@ -2150,50 +2150,39 @@ static long pem_to_der(const char *in, unsigned char **out, size_t *outlen) return sep_end - in;
}
+#define MAX_CERTS_SIZE (50*1024*1024) /* arbitrary - to catch mistakes */
+
static int read_cert(const char *file, unsigned char **out, size_t *outlen)
{
int fd;
- ssize_t n, len = 0, cap = 512;
- unsigned char buf[512], *data;
+ ssize_t n;
+ unsigned char buf[512];
+ struct dynbuf certs;
+
+ Curl_dyn_init(&certs, MAX_CERTS_SIZE);
fd = open(file, 0);
if(fd < 0)
return -1;
- data = malloc(cap);
- if(!data) {
- close(fd);
- return -1;
- }
-
for(;;) {
n = read(fd, buf, sizeof(buf));
+ if(!n)
+ break;
if(n < 0) {
close(fd);
- free(data);
+ Curl_dyn_free(&certs);
return -1;
}
- else if(n == 0) {
+ if(Curl_dyn_addn(&certs, buf, n)) {
close(fd);
- break;
- }
-
- if(len + n >= cap) {
- cap *= 2;
- data = Curl_saferealloc(data, cap);
- if(!data) {
- close(fd);
- return -1;
- }
+ return -1;
}
-
- memcpy(data + len, buf, n);
- len += n;
}
- data[len] = '\0';
+ close(fd);
- *out = data;
- *outlen = len;
+ *out = Curl_dyn_uptr(&certs);
+ *outlen = Curl_dyn_len(&certs);
return 0;
}
@@ -2202,16 +2191,18 @@ static int append_cert_to_array(struct Curl_easy *data, const unsigned char *buf, size_t buflen,
CFMutableArrayRef array)
{
- CFDataRef certdata = CFDataCreate(kCFAllocatorDefault, buf, buflen);
char *certp;
CURLcode result;
+ SecCertificateRef cacert;
+ CFDataRef certdata;
+
+ certdata = CFDataCreate(kCFAllocatorDefault, buf, buflen);
if(!certdata) {
failf(data, "SSL: failed to allocate array for CA certificate");
return CURLE_OUT_OF_MEMORY;
}
- SecCertificateRef cacert =
- SecCertificateCreateWithData(kCFAllocatorDefault, certdata);
+ cacert = SecCertificateCreateWithData(kCFAllocatorDefault, certdata);
CFRelease(certdata);
if(!cacert) {
failf(data, "SSL: failed to create SecCertificate from CA certificate");
@@ -2425,11 +2416,15 @@ static CURLcode pkp_pin_peer_pubkey(struct Curl_easy *data, do {
SecTrustRef trust;
- OSStatus ret = SSLCopyPeerTrust(ctx, &trust);
+ OSStatus ret;
+ SecKeyRef keyRef;
+ OSStatus success;
+
+ ret = SSLCopyPeerTrust(ctx, &trust);
if(ret != noErr || !trust)
break;
- SecKeyRef keyRef = SecTrustCopyPublicKey(trust);
+ keyRef = SecTrustCopyPublicKey(trust);
CFRelease(trust);
if(!keyRef)
break;
@@ -2443,8 +2438,8 @@ static CURLcode pkp_pin_peer_pubkey(struct Curl_easy *data, #elif SECTRANSP_PINNEDPUBKEY_V2
- OSStatus success = SecItemExport(keyRef, kSecFormatOpenSSL, 0, NULL,
- &publicKeyBits);
+ success = SecItemExport(keyRef, kSecFormatOpenSSL, 0, NULL,
+ &publicKeyBits);
CFRelease(keyRef);
if(success != errSecSuccess || !publicKeyBits)
break;
@@ -2987,12 +2982,13 @@ static CURLcode sectransp_connect_step3(struct Curl_cfilter *cf, struct Curl_easy *data)
{
struct ssl_connect_data *connssl = cf->ctx;
+ CURLcode result;
DEBUGF(LOG_CF(data, cf, "connect_step3"));
/* There is no step 3!
* Well, okay, let's collect server certificates, and if verbose mode is on,
* let's print the details of the server certificates. */
- const CURLcode result = collect_server_cert(cf, data);
+ result = collect_server_cert(cf, data);
if(result)
return result;
@@ -3237,35 +3233,6 @@ static size_t sectransp_version(char *buffer, size_t size) return msnprintf(buffer, size, "SecureTransport");
}
-/*
- * This function uses SSLGetSessionState to determine connection status.
- *
- * Return codes:
- * 1 means the connection is still in place
- * 0 means the connection has been closed
- * -1 means the connection status is unknown
- */
-static int sectransp_check_cxn(struct Curl_cfilter *cf,
- struct Curl_easy *data)
-{
- struct ssl_connect_data *connssl = cf->ctx;
- struct ssl_backend_data *backend = connssl->backend;
- OSStatus err;
- SSLSessionState state;
-
- (void)data;
- DEBUGASSERT(backend);
-
- if(backend->ssl_ctx) {
- DEBUGF(LOG_CF(data, cf, "check connection"));
- err = SSLGetSessionState(backend->ssl_ctx, &state);
- if(err == noErr)
- return state == kSSLConnected || state == kSSLHandshake;
- return -1;
- }
- return 0;
-}
-
static bool sectransp_data_pending(struct Curl_cfilter *cf,
const struct Curl_easy *data)
{
@@ -3410,13 +3377,15 @@ static ssize_t sectransp_recv(struct Curl_cfilter *cf, DEBUGASSERT(backend);
again:
+ *curlcode = CURLE_OK;
err = SSLRead(backend->ssl_ctx, buf, buffersize, &processed);
if(err != noErr) {
switch(err) {
case errSSLWouldBlock: /* return how much we read (if anything) */
- if(processed)
+ if(processed) {
return (ssize_t)processed;
+ }
*curlcode = CURLE_AGAIN;
return -1L;
break;
@@ -3428,7 +3397,7 @@ static ssize_t sectransp_recv(struct Curl_cfilter *cf, case errSSLClosedGraceful:
case errSSLClosedNoNotify:
*curlcode = CURLE_OK;
- return -1L;
+ return 0;
break;
/* The below is errSSLPeerAuthCompleted; it's not defined in
@@ -3439,8 +3408,10 @@ static ssize_t sectransp_recv(struct Curl_cfilter *cf, CURLcode result = verify_cert(cf, data, conn_config->CAfile,
conn_config->ca_info_blob,
backend->ssl_ctx);
- if(result)
- return result;
+ if(result) {
+ *curlcode = result;
+ return -1;
+ }
}
goto again;
default:
@@ -3477,7 +3448,7 @@ const struct Curl_ssl Curl_ssl_sectransp = { Curl_none_init, /* init */
Curl_none_cleanup, /* cleanup */
sectransp_version, /* version */
- sectransp_check_cxn, /* check_cxn */
+ Curl_none_check_cxn, /* check_cxn */
sectransp_shutdown, /* shutdown */
sectransp_data_pending, /* data_pending */
sectransp_random, /* random */
diff --git a/libs/libcurl/src/vtls/vtls.c b/libs/libcurl/src/vtls/vtls.c index fd1d7fc075..1f618d9aac 100644 --- a/libs/libcurl/src/vtls/vtls.c +++ b/libs/libcurl/src/vtls/vtls.c @@ -1604,16 +1604,11 @@ static CURLcode ssl_cf_cntrl(struct Curl_cfilter *cf, struct Curl_easy *data,
int event, int arg1, void *arg2)
{
- struct ssl_connect_data *connssl = cf->ctx;
struct cf_call_data save;
(void)arg1;
(void)arg2;
switch(event) {
- case CF_CTRL_CONN_REPORT_STATS:
- if(cf->sockindex == FIRSTSOCKET && !Curl_ssl_cf_is_proxy(cf))
- Curl_pgrsTimeWas(data, TIMER_APPCONNECT, connssl->handshake_done);
- break;
case CF_CTRL_DATA_ATTACH:
if(Curl_ssl->attach_data) {
CF_DATA_SAVE(save, cf, data);
@@ -1634,10 +1629,32 @@ static CURLcode ssl_cf_cntrl(struct Curl_cfilter *cf, return CURLE_OK;
}
-static bool cf_ssl_is_alive(struct Curl_cfilter *cf, struct Curl_easy *data)
+static CURLcode ssl_cf_query(struct Curl_cfilter *cf,
+ struct Curl_easy *data,
+ int query, int *pres1, void *pres2)
+{
+ struct ssl_connect_data *connssl = cf->ctx;
+
+ switch(query) {
+ case CF_QUERY_TIMER_APPCONNECT: {
+ struct curltime *when = pres2;
+ if(cf->connected && !Curl_ssl_cf_is_proxy(cf))
+ *when = connssl->handshake_done;
+ return CURLE_OK;
+ }
+ default:
+ break;
+ }
+ return cf->next?
+ cf->next->cft->query(cf->next, data, query, pres1, pres2) :
+ CURLE_UNKNOWN_OPTION;
+}
+
+static bool cf_ssl_is_alive(struct Curl_cfilter *cf, struct Curl_easy *data,
+ bool *input_pending)
{
struct cf_call_data save;
- bool result;
+ int result;
/*
* This function tries to determine connection status.
*
@@ -1647,9 +1664,20 @@ static bool cf_ssl_is_alive(struct Curl_cfilter *cf, struct Curl_easy *data) * -1 means the connection status is unknown
*/
CF_DATA_SAVE(save, cf, data);
- result = Curl_ssl->check_cxn(cf, data) != 0;
+ result = Curl_ssl->check_cxn(cf, data);
CF_DATA_RESTORE(cf, save);
- return result;
+ if(result > 0) {
+ *input_pending = TRUE;
+ return TRUE;
+ }
+ if(result == 0) {
+ *input_pending = FALSE;
+ return FALSE;
+ }
+ /* ssl backend does not know */
+ return cf->next?
+ cf->next->cft->is_alive(cf->next, data, input_pending) :
+ FALSE; /* pessimistic in absence of data */
}
struct Curl_cftype Curl_cft_ssl = {
@@ -1667,7 +1695,7 @@ struct Curl_cftype Curl_cft_ssl = { ssl_cf_cntrl,
cf_ssl_is_alive,
Curl_cf_def_conn_keep_alive,
- Curl_cf_def_query,
+ ssl_cf_query,
};
struct Curl_cftype Curl_cft_ssl_proxy = {
diff --git a/libs/libcurl/src/vtls/wolfssl.c b/libs/libcurl/src/vtls/wolfssl.c index b3e6cf4d19..8918e3554a 100644 --- a/libs/libcurl/src/vtls/wolfssl.c +++ b/libs/libcurl/src/vtls/wolfssl.c @@ -94,6 +94,7 @@ struct ssl_backend_data {
SSL_CTX* ctx;
SSL* handle;
+ CURLcode io_result; /* result of last BIO cfilter operation */
};
#ifdef OPENSSL_EXTRA
@@ -279,12 +280,16 @@ static long bio_cf_ctrl(WOLFSSL_BIO *bio, int cmd, long num, void *ptr) static int bio_cf_out_write(WOLFSSL_BIO *bio, const char *buf, int blen)
{
struct Curl_cfilter *cf = wolfSSL_BIO_get_data(bio);
+ struct ssl_connect_data *connssl = cf->ctx;
struct Curl_easy *data = CF_DATA_CURRENT(cf);
ssize_t nwritten;
CURLcode result = CURLE_OK;
DEBUGASSERT(data);
nwritten = Curl_conn_cf_send(cf->next, data, buf, blen, &result);
+ connssl->backend->io_result = result;
+ DEBUGF(LOG_CF(data, cf, "bio_write(len=%d) -> %zd, %d",
+ blen, nwritten, result));
wolfSSL_BIO_clear_retry_flags(bio);
if(nwritten < 0 && CURLE_AGAIN == result)
BIO_set_retry_read(bio);
@@ -294,6 +299,7 @@ static int bio_cf_out_write(WOLFSSL_BIO *bio, const char *buf, int blen) static int bio_cf_in_read(WOLFSSL_BIO *bio, char *buf, int blen)
{
struct Curl_cfilter *cf = wolfSSL_BIO_get_data(bio);
+ struct ssl_connect_data *connssl = cf->ctx;
struct Curl_easy *data = CF_DATA_CURRENT(cf);
ssize_t nread;
CURLcode result = CURLE_OK;
@@ -304,6 +310,9 @@ static int bio_cf_in_read(WOLFSSL_BIO *bio, char *buf, int blen) return 0;
nread = Curl_conn_cf_recv(cf->next, data, buf, blen, &result);
+ connssl->backend->io_result = result;
+ DEBUGF(LOG_CF(data, cf, "bio_read(len=%d) -> %zd, %d",
+ blen, nread, result));
wolfSSL_BIO_clear_retry_flags(bio);
if(nread < 0 && CURLE_AGAIN == result)
BIO_set_retry_read(bio);
@@ -789,6 +798,9 @@ wolfssl_connect_step2(struct Curl_cfilter *cf, struct Curl_easy *data) }
}
#endif
+ else if(backend->io_result == CURLE_AGAIN) {
+ return CURLE_OK;
+ }
else {
failf(data, "SSL_connect failed with error %d: %s", detail,
ERR_error_string(detail, error_buffer));
@@ -948,7 +960,6 @@ static ssize_t wolfssl_send(struct Curl_cfilter *cf, ERR_clear_error();
rc = SSL_write(backend->handle, mem, memlen);
-
if(rc <= 0) {
int err = SSL_get_error(backend->handle, rc);
@@ -956,9 +967,17 @@ static ssize_t wolfssl_send(struct Curl_cfilter *cf, case SSL_ERROR_WANT_READ:
case SSL_ERROR_WANT_WRITE:
/* there's data pending, re-invoke SSL_write() */
+ DEBUGF(LOG_CF(data, cf, "wolfssl_send(len=%zu) -> AGAIN", len));
*curlcode = CURLE_AGAIN;
return -1;
default:
+ if(backend->io_result == CURLE_AGAIN) {
+ DEBUGF(LOG_CF(data, cf, "wolfssl_send(len=%zu) -> AGAIN", len));
+ *curlcode = CURLE_AGAIN;
+ return -1;
+ }
+ DEBUGF(LOG_CF(data, cf, "wolfssl_send(len=%zu) -> %d, %d",
+ len, rc, err));
failf(data, "SSL write: %s, errno %d",
ERR_error_string(err, error_buffer),
SOCKERRNO);
@@ -966,6 +985,7 @@ static ssize_t wolfssl_send(struct Curl_cfilter *cf, return -1;
}
}
+ DEBUGF(LOG_CF(data, cf, "wolfssl_send(len=%zu) -> %d", len, rc));
return rc;
}
@@ -995,19 +1015,19 @@ static void wolfssl_close(struct Curl_cfilter *cf, struct Curl_easy *data) static ssize_t wolfssl_recv(struct Curl_cfilter *cf,
struct Curl_easy *data,
- char *buf,
- size_t buffersize,
+ char *buf, size_t blen,
CURLcode *curlcode)
{
struct ssl_connect_data *connssl = cf->ctx;
struct ssl_backend_data *backend = connssl->backend;
char error_buffer[WOLFSSL_MAX_ERROR_SZ];
- int buffsize = (buffersize > (size_t)INT_MAX) ? INT_MAX : (int)buffersize;
+ int buffsize = (blen > (size_t)INT_MAX) ? INT_MAX : (int)blen;
int nread;
DEBUGASSERT(backend);
ERR_clear_error();
+ *curlcode = CURLE_OK;
nread = SSL_read(backend->handle, buf, buffsize);
@@ -1016,22 +1036,31 @@ static ssize_t wolfssl_recv(struct Curl_cfilter *cf, switch(err) {
case SSL_ERROR_ZERO_RETURN: /* no more data */
- break;
+ DEBUGF(LOG_CF(data, cf, "wolfssl_recv(len=%zu) -> CLOSED", blen));
+ *curlcode = CURLE_OK;
+ return 0;
case SSL_ERROR_NONE:
/* FALLTHROUGH */
case SSL_ERROR_WANT_READ:
/* FALLTHROUGH */
case SSL_ERROR_WANT_WRITE:
/* there's data pending, re-invoke SSL_read() */
+ DEBUGF(LOG_CF(data, cf, "wolfssl_recv(len=%zu) -> AGAIN", blen));
*curlcode = CURLE_AGAIN;
return -1;
default:
+ if(backend->io_result == CURLE_AGAIN) {
+ DEBUGF(LOG_CF(data, cf, "wolfssl_recv(len=%zu) -> AGAIN", blen));
+ *curlcode = CURLE_AGAIN;
+ return -1;
+ }
failf(data, "SSL read: %s, errno %d",
ERR_error_string(err, error_buffer), SOCKERRNO);
*curlcode = CURLE_RECV_ERROR;
return -1;
}
}
+ DEBUGF(LOG_CF(data, cf, "wolfssl_recv(len=%zu) -> %d", blen, nread));
return nread;
}
diff --git a/libs/libcurl/src/vtls/x509asn1.c b/libs/libcurl/src/vtls/x509asn1.c index 31b84dc448..cf673b349f 100644 --- a/libs/libcurl/src/vtls/x509asn1.c +++ b/libs/libcurl/src/vtls/x509asn1.c @@ -1118,7 +1118,7 @@ CURLcode Curl_extract_certinfo(struct Curl_easy *data, for(ccp = cert.version.beg; ccp < cert.version.end; ccp++)
version = (version << 8) | *(const unsigned char *) ccp;
if(data->set.ssl.certinfo) {
- ccp = curl_maprintf("%lx", version);
+ ccp = curl_maprintf("%x", version);
if(!ccp)
return CURLE_OUT_OF_MEMORY;
result = Curl_ssl_push_certinfo(data, certnum, "Version", ccp);
@@ -1127,7 +1127,7 @@ CURLcode Curl_extract_certinfo(struct Curl_easy *data, return result;
}
if(!certnum)
- infof(data, " Version: %lu (0x%lx)", version + 1, version);
+ infof(data, " Version: %u (0x%x)", version + 1, version);
/* Serial number. */
ccp = ASN1tostr(&cert.serialNumber, 0);
diff --git a/libs/libcurl/src/wildcard.c b/libs/libcurl/src/wildcard.c deleted file mode 100644 index ba7f4e0d7f..0000000000 --- a/libs/libcurl/src/wildcard.c +++ /dev/null @@ -1,75 +0,0 @@ -/***************************************************************************
- * _ _ ____ _
- * Project ___| | | | _ \| |
- * / __| | | | |_) | |
- * | (__| |_| | _ <| |___
- * \___|\___/|_| \_\_____|
- *
- * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
- *
- * This software is licensed as described in the file COPYING, which
- * you should have received as part of this distribution. The terms
- * are also available at https://curl.se/docs/copyright.html.
- *
- * You may opt to use, copy, modify, merge, publish, distribute and/or sell
- * copies of the Software, and permit persons to whom the Software is
- * furnished to do so, under the terms of the COPYING file.
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
- * KIND, either express or implied.
- *
- * SPDX-License-Identifier: curl
- *
- ***************************************************************************/
-
-#include "curl_setup.h"
-
-#ifndef CURL_DISABLE_FTP
-
-#include "wildcard.h"
-#include "llist.h"
-#include "fileinfo.h"
-/* The last 3 #include files should be in this order */
-#include "curl_printf.h"
-#include "curl_memory.h"
-#include "memdebug.h"
-
-static void fileinfo_dtor(void *user, void *element)
-{
- (void)user;
- Curl_fileinfo_cleanup(element);
-}
-
-CURLcode Curl_wildcard_init(struct WildcardData *wc)
-{
- Curl_llist_init(&wc->filelist, fileinfo_dtor);
- wc->state = CURLWC_INIT;
-
- return CURLE_OK;
-}
-
-void Curl_wildcard_dtor(struct WildcardData *wc)
-{
- if(!wc)
- return;
-
- if(wc->dtor) {
- wc->dtor(wc->protdata);
- wc->dtor = ZERO_NULL;
- wc->protdata = NULL;
- }
- DEBUGASSERT(wc->protdata == NULL);
-
- Curl_llist_destroy(&wc->filelist, NULL);
-
-
- free(wc->path);
- wc->path = NULL;
- free(wc->pattern);
- wc->pattern = NULL;
-
- wc->customptr = NULL;
- wc->state = CURLWC_INIT;
-}
-
-#endif /* if disabled */
diff --git a/libs/libcurl/src/wildcard.h b/libs/libcurl/src/wildcard.h deleted file mode 100644 index b028818402..0000000000 --- a/libs/libcurl/src/wildcard.h +++ /dev/null @@ -1,70 +0,0 @@ -#ifndef HEADER_CURL_WILDCARD_H
-#define HEADER_CURL_WILDCARD_H
-/***************************************************************************
- * _ _ ____ _
- * Project ___| | | | _ \| |
- * / __| | | | |_) | |
- * | (__| |_| | _ <| |___
- * \___|\___/|_| \_\_____|
- *
- * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
- *
- * This software is licensed as described in the file COPYING, which
- * you should have received as part of this distribution. The terms
- * are also available at https://curl.se/docs/copyright.html.
- *
- * You may opt to use, copy, modify, merge, publish, distribute and/or sell
- * copies of the Software, and permit persons to whom the Software is
- * furnished to do so, under the terms of the COPYING file.
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
- * KIND, either express or implied.
- *
- * SPDX-License-Identifier: curl
- *
- ***************************************************************************/
-
-#include "curl_setup.h"
-
-#ifndef CURL_DISABLE_FTP
-#include <curl/curl.h>
-#include "llist.h"
-
-/* list of wildcard process states */
-typedef enum {
- CURLWC_CLEAR = 0,
- CURLWC_INIT = 1,
- CURLWC_MATCHING, /* library is trying to get list of addresses for
- downloading */
- CURLWC_DOWNLOADING,
- CURLWC_CLEAN, /* deallocate resources and reset settings */
- CURLWC_SKIP, /* skip over concrete file */
- CURLWC_ERROR, /* error cases */
- CURLWC_DONE /* if is wildcard->state == CURLWC_DONE wildcard loop
- will end */
-} wildcard_states;
-
-typedef void (*wildcard_dtor)(void *ptr);
-
-/* struct keeping information about wildcard download process */
-struct WildcardData {
- wildcard_states state;
- char *path; /* path to the directory, where we trying wildcard-match */
- char *pattern; /* wildcard pattern */
- struct Curl_llist filelist; /* llist with struct Curl_fileinfo */
- void *protdata; /* pointer to protocol specific temporary data */
- wildcard_dtor dtor;
- void *customptr; /* for CURLOPT_CHUNK_DATA pointer */
-};
-
-CURLcode Curl_wildcard_init(struct WildcardData *wc);
-void Curl_wildcard_dtor(struct WildcardData *wc);
-
-struct Curl_easy;
-
-#else
-/* FTP is disabled */
-#define Curl_wildcard_dtor(x)
-#endif
-
-#endif /* HEADER_CURL_WILDCARD_H */
diff --git a/libs/libcurl/src/ws.c b/libs/libcurl/src/ws.c index 861c766525..998f75af72 100644 --- a/libs/libcurl/src/ws.c +++ b/libs/libcurl/src/ws.c @@ -166,10 +166,6 @@ CURLcode Curl_ws_accept(struct Curl_easy *data, }
k->upgr101 = UPGR101_RECEIVED;
- if(data->set.connect_only)
- /* switch off non-blocking sockets */
- (void)curlx_nonblock(conn->sock[FIRSTSOCKET], FALSE);
-
return result;
}
@@ -750,9 +746,6 @@ CURLcode Curl_ws_disconnect(struct Curl_easy *data, (void)data;
(void)dead_connection;
Curl_dyn_free(&wsc->early);
-
- /* make sure this is non-blocking to avoid getting stuck in shutdown */
- (void)curlx_nonblock(conn->sock[FIRSTSOCKET], TRUE);
return CURLE_OK;
}
|