Commit Graph

31803 Commits

Author SHA1 Message Date
Daniel Stenberg
f73cb3ebd2
CURLOPT_SSL_CTX_FUNCTION.md: no promises of lifetime after return
... and cleanup other language.

Closes #12999
2024-02-27 09:04:13 +01:00
Stefan Eissing
5929822114
lib: send rework
Curl_read/Curl_write clarifications

- replace `Curl_read()`, `Curl_write()` and `Curl_nwrite()` to 1clarify
  when and at what level they operate

- send/recv of transfer related data is now done via
  `Curl_xfer_send()/Curl_xfer_recv()` which no longer has
  socket/socketindex as parameter. It decides on the transfer setup of
  `conn->sockfd` and `conn->writesockfd` on which connection filter
  chain to operate.

- send/recv on a specific connection filter chain is done via
  `Curl_conn_send()/Curl_conn_recv()` which get the socket index as
  parameter.

- rename `Curl_setup_transfer()` to `Curl_xfer_setup()` for naming
  consistency

- clarify that the special CURLE_AGAIN handling to return `CURLE_OK`
  with length 0 only applies to `Curl_xfer_send()` and CURLE_AGAIN is
  returned by all other send() variants.

SingleRequest reshuffling

- move functions into request.[ch]
- differentiate between reset and free
- add Curl_req_done() to perform last actions
- add a send `bufq` to SingleRequest for future use in keeping upload data

Closes #12963
2024-02-27 08:58:10 +01:00
Daniel Stenberg
b8ed0f8259
RELEASE-NOTES: synced 2024-02-26 23:05:51 +01:00
Daniel Stenberg
9c8968e43d
http_chunks: remove unused 'endptr' variable
Closes #12996
2024-02-26 17:20:51 +01:00
Louis Solofrizzo
57446b67ba
lib: initialize output pointers to NULL before calling strto[ff,l,ul]
In order to make MSAN happy:

    ==2200945==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x596f3b3ed246 in curlx_strtoofft [...]/libcurl/src/lib/strtoofft.c:239:11
    #1 0x596f3b402156 in Curl_httpchunk_read [...]/libcurl/src/lib/http_chunks.c:149:12
    #2 0x596f3b348550 in readwrite_data [...]/libcurl/src/lib/transfer.c:607:11
    [...]

    ==2202041==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x5a3fab66a72a in Curl_parse_port [...]/libcurl/src/lib/urlapi.c:547:8
    #1 0x5a3fab650645 in parse_authority [...]/libcurl/src/lib/urlapi.c:796:12
    #2 0x5a3fab6740f6 in parseurl [...]/libcurl/src/lib/urlapi.c:1176:16
    #3 0x5a3fab664fc5 in parseurl_and_replace [...]/libcurl/src/lib/urlapi.c:1342:12
    [...]

    ==2202320==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x569076a0d6b0 in ipv4_normalize [...]/libcurl/src/lib/urlapi.c:683:12
    #1 0x5690769f2820 in parse_authority [...]/libcurl/src/lib/urlapi.c:803:10
    #2 0x569076a160f6 in parseurl [...]/libcurl/src/lib/urlapi.c:1176:16
    #3 0x569076a06fc5 in parseurl_and_replace [...]/libcurl/src/lib/urlapi.c:1342:12
    [...]

Signed-off-by: Louis Solofrizzo <lsolofrizzo@scaleway.com>
Closes #12995
2024-02-26 17:19:27 +01:00
Stefan Eissing
463472a2d6
lib: move client writer into own source
Refactoring of the client writer that passes the data to the
client/application's callback functions.

- split out into own source cw-out.[ch] from sendf.c

- move tempwrite and tempcount from data->state into the context of the
  client writer

- redesign the 3 tempwrite dynbufs as a linked list of dynbufs. On
  paused transfers, this allows to "record" interleaved HEADER/BODY
  chunks to be "played back" in the same order on unpausing.

- keep the overall size limit of all buffered data to DYN_PAUSE_BUFFER.
  On exceeding that, return CURLE_TOO_LARGE instead of
  CURLE_OUT_OF_MEMORY as before.

- add method to be called when a transfer is DONE to allow writing of
  any data still buffered

- when paused, record HEADER writes exactly as they come for later
  playback. HEADERs are documented to be written one-by-one.

Closes #12898
2024-02-26 14:25:41 +01:00
Stefan Eissing
2254551403
urldata: move authneg bit from conn to Curl_easy
- from `conn->bits.authneg` to `data->req.authneg`
- this is a property of the request about to be made
  and not a property of the connection
- in multiuse connections, transfer could step on each others
  toes here potentially.

Closes #12949
2024-02-26 10:30:52 +01:00
Stefan Eissing
e925d0d1ff
c-hyper: add header collection writer in hyper builds
Closes #12880
2024-02-26 09:44:24 +01:00
Stefan Eissing
2abfa3833b
http: move headers collecting to writer
- add a client writer that does "push" response
  headers written to the client if the headers api
  is enabled
- remove special handling in sendf.c
- needs to be installed very early on connection
  setup to catch CONNECT response headers

Closes #12880
2024-02-26 09:44:15 +01:00
Stefan Eissing
5b41fac587
sendf: Curl_client_write(), make passed in buf const 2024-02-26 09:43:47 +01:00
MAntoniak
e26c362544
lib: remove curl_mimepart object when CURL_DISABLE_MIME
Remove curl_mimepart object from UserDefined structure when
CURL_DISABLE_MIME flag is active. Reduce size of UserDefined structure.

Also remove unreachable code: when CURL_DISABLE_MIME is set, httpreq can
never have HTTPREQ_POST_MIME value and the same goes for the
CURL_DISABLE_FORM_API flag and the HTTPREQ_POST_FORM value

Closes #12948
2024-02-26 09:22:34 +01:00
kpcyrd
e3a4273c41
rustls: make curl compile with 0.12.0
Closes #12989
2024-02-26 08:59:43 +01:00
Daniel Stenberg
e2bd0c111e
strtoofft: fix the overflow check
... to not rely on wrapping, since it is an undefined behavior that is
not what always might happen. This is in our private strtoff() parser
function, used only on platforms without a native version.

Reported-by: vulnerabilityspotter on hackerone
Closes #12990
2024-02-26 08:53:40 +01:00
Daniel Stenberg
f47487c219
libssh/libssh2: return error on too big range
If trying to get the range 0 - 2^63 and the remote file is 2^63 bytes or
larger.

Fixes #12983
Closes #12984
2024-02-25 22:40:39 +01:00
Scott Talbert
7448054c38 setopt: fix check for CURLOPT_PROXY_TLSAUTH_TYPE value
Prior to this change CURLOPT_PROXY_TLSAUTH_TYPE would return
CURLE_BAD_FUNCTION_ARGUMENT on any type other than NULL. Since there is
only one type of TLS auth and it is also the default (SRP) the TLS auth
would work anyway.

Closes https://github.com/curl/curl/pull/12981
2024-02-24 03:56:15 -05:00
Jay Satiro
e3a3bb371f mprintf: fix format prefix I32/I64 for windows compilers
- Support I32 & I64 (eg: %I64d) for all Win32 builds.

Prior to this change mprintf support for the I format prefix, which is a
Microsoft extension, was dependent on the compiler used.

When Borland compiler support was removed in fd7ef00f the prefix was
then no longer supported for that compiler; however since it's still
possible to build with Borland I'm restoring support for the prefix in
this way.

Reported-by: Paweł Witas

Fixes https://github.com/curl/curl/issues/12944
Closes https://github.com/curl/curl/pull/12950
2024-02-24 00:51:20 -05:00
Daniel Stenberg
d096809394
cd2nroff: gen: make \> in input to render as plain '>' in output
The same (copy and pasted) fix/mistake as in gen.pl
2024-02-23 13:48:14 +01:00
Daniel Stenberg
8d4ff40d7b
gen: make \> in input to render as plain '>' in output
Reported-by: Gisle Vanem
Fixes #12977
Closes #12978
2024-02-23 13:48:07 +01:00
Fabrice Fontaine
9b3f67e267
configure.ac: find libpsl with pkg-config
Find libpsl with pkg-config to avoid static build failures.

Ref: http://autobuild.buildroot.org/results/1fb15e1a99472c403d0d3b1a688902f32e78d002

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Closes #12947
2024-02-23 10:45:30 +01:00
Daniel Stenberg
8dbc3c7a6b
BUG-BOUNTY.md: clarify that the curl security team decides
Closes #12975
2024-02-23 10:29:45 +01:00
Daniel Stenberg
8e83b6b429
THANKS: add bug reporter from #740
Ref: https://github.com/curl/curl/issues/740
2024-02-23 10:13:03 +01:00
Stefan Eissing
f274fc5c68
multi: fix multi_sock handling of select_bits
- OR the event bitmask to data->state.select_bits instead of overwriting
  them. They are cleared again on use.

Reported-by: 5533asdg on github
Fixes #12971
Closes #12972
2024-02-22 14:15:27 +01:00
Daniel Stenberg
93d8e3564e
curlver: bump to 8.7.0 for next release 2024-02-22 09:34:41 +01:00
Daniel Stenberg
32234ffcdc
RELEASE-NOTES: synced 2024-02-22 08:46:04 +01:00
Daniel Stenberg
ac208ccf6f
write-out: add '%{proxy_used}'
Returns 1 if the previous transfer used a proxy, otherwise 0. Useful to
for example determine if a `NOPROXY` pattern matched the hostname or
not.

Extended test 970 and 972
2024-02-22 08:38:53 +01:00
Daniel Stenberg
cc04c73677
CURLINFO_USED_PROXY: return bool whether the proxy was used
Adds test536 to verify

Closes #12719
2024-02-22 08:38:53 +01:00
Daniel Stenberg
d5b0fee39a
sha512_256: remove the cast macro, minor language/format edits
Follow-up to cbe41d151d

Closes #12966
2024-02-20 17:49:01 +01:00
Stefan Eissing
f7e598791f
DoH: add trace configuration
- refs #12397 where it is dicussed how to en-/disable verbose output
  of DoH operations
- introducing `struct curl_trc_feat` to track a curl feature for
  tracing
- adding `data->state.feat` optionally pointing to the feature a
  transfer belongs to
- adding trace functions and verbosity checks on features
- using trace feature in DoH code
- documenting `doh` as feature for `--trace-config`

Closes #12411
2024-02-20 14:01:59 +01:00
Stefan Eissing
f0c446ab57
websocket: fix curl_ws_recv()
- when data arrived in several chunks, the collection into
  the passed buffer always started at offset 0, overwriting
  the data already there.

adding test_20_07 to verify fix

- debug environment var CURL_WS_CHUNK_SIZE can be used to
  influence the buffer chunk size used for en-/decoding.

Closes #12945
2024-02-20 13:57:58 +01:00
Evgeny Grin
e3461bbd05
digest: support SHA-512/256
Also fix the tests. New implementation tested with GNU libmicrohttpd.
The new numbers in tests are real SHA-512/256 numbers (not just some
random ;) numbers ).
2024-02-20 11:36:12 +01:00
Evgeny Grin
6d6113e122
tests: add SHA-512/256 unit test 2024-02-20 11:36:03 +01:00
Evgeny Grin
cbe41d151d
SHA-512/256: implement hash algorithm
Closes #12897
2024-02-20 11:35:56 +01:00
Evgeny Grin
30a3880f6b
curl_setup.h: add curl_uint64_t internal type
The unsigned version of curl_off_t basically
2024-02-20 11:35:05 +01:00
Daniel Stenberg
ab027d9cbc
docs: dist curl*.1 and install without perl
Drop docs/mk-ca-bundle.1 from the tarball. It can be generated at will.

Closes #12959
Fixes #12921
Reported-by: Michael Forney
2024-02-20 10:35:13 +01:00
Stefan Eissing
bdff974f46
OpenSSL QUIC: adapt to v3.3.x
- set our idle timeout as transport parameter
- query negotiated idle timeout for connection alive checks
- query number of available bidi streams on a connection
- use write_ex2 with SSL_WRITE_FLAG_CONCLUDE to signal
  EOF on last chunk write, so stream close does not
  require an additional QUIC packet

Closes #12933
2024-02-20 10:00:37 +01:00
Ramiro Garcia
36401d0d4a
MANUAL.md: fix typo
Closes #12965
2024-02-19 19:54:42 +01:00
Daniel Stenberg
5f48ba172e
BINDINGS: add mcurl, the python binding
Ref: #12956
Closes #12962
2024-02-19 17:01:00 +01:00
Daniel Stenberg
33d3153de9
mk-ca-bundle.md: cleanups and polish
Closes #12958
2024-02-19 11:42:12 +01:00
Daniel Stenberg
8b1f3aa608
spellcheck.yml: remove .1/.3 handling, clean all man page .md files
Since we generate all .1 and .3 files from markdown now, we can limit
the spellcheck to the markdown versions only.

Closes #12960
2024-02-19 11:41:12 +01:00
Daniel Stenberg
96af350661
libcurl-docs: cleanups
CURLMOPT_SOCKETDATA.md: fix typo
 CURLMOPT_TIMERDATA.md: fix typo
 CURLOPT_COOKIELIST.m: quote strings
 CURLOPT_PREREQFUNCTION.md: quote variable names
 CURLOPT_TCP_NODELAY.md: rephrased to please spell checker
 CURLOPT_WILDCARDMATCH.md: rephrased
 libcurl-tutorial.md: use correct option name
 curl_global_init_mem.md: quote headers
 curl_easy_getinfo.md: use correct symbol names in headers
 curl_global_trace.md: quote some headers
 curl_ws_meta.md: quote struct field names
 libcurl-env.md: quote headers
2024-02-19 11:41:12 +01:00
Daniel Stenberg
50f65b4ef3
cd2nroff: remove backticks from titles 2024-02-19 11:41:12 +01:00
Daniel Stenberg
b4df2c9fe8
RELEASE-NOTES: synced 2024-02-19 08:34:37 +01:00
Stefan Eissing
59e2c78af3 http_chunks: fix the accounting of consumed bytes
Prior to this change chunks were handled correctly although in verbose
mode libcurl could incorrectly warn of "Leftovers after chunking" even
if there were none.

Reported-by: Michael Kaufmann

Fixes https://github.com/curl/curl/issues/12937
Closes https://github.com/curl/curl/pull/12939
2024-02-18 02:16:29 -05:00
Stefan Eissing
0e2ffa3632 file: use xfer buf for file:// transfers
- For file:// transfers use the multi handle's transfer buffer for
  up- and downloads.

Prior to this change a6c9a33 (precedes 8.6.0) changed the file://
transfers to use a smaller stack based buffer, and that caused a
significant performance decrease in Windows.

Bug: https://github.com/curl/curl/issues/12750#issuecomment-1920103086
Reported-by: edmcln@users.noreply.github.com

Closes https://github.com/curl/curl/pull/12932
2024-02-18 02:12:45 -05:00
Karthikdasari0423
64283119fe HTTP3.md: always run nghttp3 submodule init
- For consistency change all 'build nghttp3' commands to run submodule
  init after cloning, even if the branch does not have submodules.

Follow-up to 5a4b2f93 and 4f794558.

Closes https://github.com/curl/curl/pull/12928
2024-02-18 01:59:46 -05:00
LeeRiva
ee92f3d227 CURLOPT_POSTQUOTE.md: fix typo
Closes https://github.com/curl/curl/pull/12926
2024-02-18 01:59:45 -05:00
Evgeny Grin
298c120b97 checksrc.pl: fix handling .checksrc with CRLF
- When parsing .checksrc chomp the (CR)LF line ending.

Prior to this change on Windows checksrc.pl would not process the
symbols in .checksrc properly, since many git repos in Windows use auto
crlf to check out files with CRLF line endings.

Closes https://github.com/curl/curl/pull/12924
2024-02-18 01:59:44 -05:00
Richard Levitte
b2497a8d15 cmake: fix install for older CMake versions
- Generate the docs install list by using a foreach loop instead of
  LIST:TRANSFORM since older CMake can't handle the latter.

Reported-by: Dan Fandrich

Fixes https://github.com/curl/curl/issues/12920
Closes https://github.com/curl/curl/pull/12922
2024-02-18 01:02:45 -05:00
Stefan Eissing
e87751d69a vtls: fix tls proxy peer verification
- When verifying a proxy certificate for an ip address, use the correct
  ip family.

Prior to this change the "connection" ip family was used, which was not
necessarily the same.

Reported-by: HsiehYuho@users.noreply.github.com

Fixes https://github.com/curl/curl/issues/12831
Closes https://github.com/curl/curl/pull/12931
2024-02-16 18:00:21 -05:00
Dan Fandrich
30f1cb255b CI: Bump the Circle CI base Ubuntu image to the latest 20.04
The previous ones are going to be removed soon, plus the new ones
include all the fixes since then.
2024-02-15 16:05:47 -08:00