Commit Graph

29600 Commits

Author SHA1 Message Date
Ryan Schmidt
e007ace30d
curl_endian: remove Curl_write64_le from header
The actual function was already removed in 4331c6dc.

See #7280
Closes #9968
2022-11-23 09:07:12 +01:00
Daniel Stenberg
66ca8ace1a
docs: add more "SEE ALSO" links to CA related pages
Closes #9959
2022-11-22 14:43:38 +01:00
Daniel Stenberg
c1cdc08cbb
examples: update descriptions
Make them not say "this is an example showing..." and instead just say
what the example shows.

Closes #9960
2022-11-22 14:41:15 +01:00
Stefan Eissing
af22c2a546
vtls: localization of state data in filters
- almost all backend calls pass the Curl_cfilter intance instead of
   connectdata+sockindex
 - ssl_connect_data is remove from struct connectdata and made internal
   to vtls
 - ssl_connect_data is allocated in the added filter, kept at cf->ctx

 - added function to let a ssl filter access its ssl_primary_config and
   ssl_config_data this selects the propert subfields in conn and data,
   for filters added as plain or proxy
 - adjusted all backends to use the changed api
 - adjusted all backends to access config data via the exposed
   functions, no longer using conn or data directly

cfilter renames for clear purpose:

 - methods `Curl_conn_*(data, conn, sockindex)` work on the complete
   filter chain at `sockindex` and connection `conn`.
 - methods `Curl_cf_*(cf, ...)` work on a specific Curl_cfilter
   instance.
 - methods `Curl_conn_cf()` work on/with filter instances at a
   connection.
 - rebased and resolved some naming conflicts
 - hostname validation (und session lookup) on SECONDARY use the same
   name as on FIRST (again).

new debug macros and removing connectdata from function signatures where not
needed.

adapting schannel for new Curl_read_plain paramter.

Closes #9919
2022-11-22 14:25:50 +01:00
Daniel Stenberg
a28a80d59e examples/10-at-a-time: fix possible skipped final transfers
Prior to this change if curl_multi_perform returned 0 running handles
and then all remaining transfers were added, then the perform loop would
end immediately without performing those transfers.

Reported-by: Mikhail Kuznetsov

Fixes https://github.com/curl/curl/issues/9953
Closes https://github.com/curl/curl/pull/9954
2022-11-22 03:34:01 -05:00
Viktor Szakats
a8861b6ccd
Makefile.mk: portable Makefile.m32
Update bare GNU Make `Makefile.m32` to:

- Move objects into a subdirectory.
- Add support for MS-DOS. Tested with DJGPP.
- Add support for Watt-32 (on MS-DOS).
- Add support for AmigaOS.
- Rename `Makefile.m32` to `Makefile.mk`
- Replace `ARCH` with `TRIPLET`.
- Build `tool_hugehelp.c` proper (when tools are available).
- Drop MS-DOS compatibility macro `USE_ZLIB` (replaced by `HAVE_LIBZ`)
- Add support for `ZLIB_LIBS` to override `-lz`.
- Omit object files when building examples.
- Default `CC` to `gcc` once again, for convenience. (Caveat: compiler
  name `cc` cannot be set now.)
- Set `-DCURL_NO_OLDIES` for examples, like autotools does.
- Delete `makefile.dj` files. Notice the configuration details and
  defaults are not retained with the new method.
- Delete `makefile.amiga` files. A successful build needs a few custom
  options. We're also not retaining all build details from the existing
  Amiga make files.
- Rename `Makefile.m32` to `Makefile.mk` to reflect that they are not
  Windows/MinGW32-specific anymore.
- Add support for new `CFG` options: `-map`, `-debug`, `-trackmem`
- Set `-DNDEBUG` by default.
- Allow using `-DOS=...` in all `lib/config-*.h` headers, syncing this
  with `config-win32.h`.
- Look for zlib parts in `ZLIB_PATH/include` and `ZLIB_PATH/lib`
  instead of bare `ZLIB_PATH`.

Note that existing build configurations for MS-DOS and AmigaOS likely
become incompatible with this change.

Example AmigaOS configuration:
```
export CROSSPREFIX=/opt/amiga/bin/m68k-amigaos-
export CC=gcc
export CPPFLAGS='-DHAVE_PROTO_BSDSOCKET_H'
export CFLAGS='-mcrt=clib2'
export LDFLAGS="${CFLAGS}"
export LIBS='-lnet -lm'
make -C lib -f Makefile.mk
make -C src -f Makefile.mk
```

Example MS-DOS configuration:
```
export CROSSPREFIX=/opt/djgpp/bin/i586-pc-msdosdjgpp-
export WATT_PATH=/opt/djgpp/net/watt
export ZLIB_PATH=/opt/djgpp
export OPENSSL_PATH=/opt/djgpp
export OPENSSL_LIBS='-lssl -lcrypt'
export CFG=-zlib-ssl
make -C lib -f Makefile.mk
make -C src -f Makefile.mk
```

Closes #9764
2022-11-22 08:28:41 +00:00
Stefan Eissing
4a8b4a1b66
cfiler: filter types have flags indicating what they do
- Adding Curl_conn_is_ip_connected() to check if network connectivity
  has been reached

- having ftp wait for network connectivity before proceeding with
  transfers.

Fixes test failures 1631 and 1632 with hyper.

Closes #9952
2022-11-22 08:20:38 +01:00
Daniel Stenberg
b7413a66bd
RELEASE-NOTES: synced 2022-11-21 13:39:18 +01:00
Jay Satiro
4f42150d04 sendf: change Curl_read_plain to wrap Curl_recv_plain (take 2)
Prior to this change Curl_read_plain would attempt to read the
socket directly. On Windows that's a problem because recv data may be
cached by libcurl and that data is only drained using Curl_recv_plain.

Rather than rewrite Curl_read_plain to handle cached recv data, I
changed it to wrap Curl_recv_plain, in much the same way that
Curl_write_plain already wraps Curl_send_plain.

Curl_read_plain -> Curl_recv_plain
Curl_write_plain -> Curl_send_plain

This fixes a bug in the schannel backend where decryption of arbitrary
TLS records fails because cached recv data is never drained. We send
data (TLS records formed by Schannel) using Curl_write_plain, which
calls Curl_send_plain, and that may do a recv-before-send
("pre-receive") to cache received data. The code calls Curl_read_plain
to read data (TLS records from the server), which prior to this change
did not call Curl_recv_plain and therefore cached recv data wasn't
retrieved, resulting in malformed TLS records and decryption failure
(SEC_E_DECRYPT_FAILURE).

The bug has only been observed during Schannel TLS 1.3 handshakes. Refer
to the issue and PR for more information.

--

This is take 2 of the original fix. It preserves the original behavior
of Curl_read_plain to write 0 to the bytes read parameter on error,
since apparently some callers expect that (SOCKS tests were hanging).
The original fix which landed in 12e1def5 and was later reverted in
18383fbf failed to work properly because it did not do that.

Also, it changes Curl_write_plain the same way to complement
Curl_read_plain, and it changes Curl_send_plain to return -1 instead of
0 on CURLE_AGAIN to complement Curl_recv_plain.

Behavior on error with these changes:

Curl_recv_plain returns -1 and *code receives error code.
Curl_send_plain returns -1 and *code receives error code.
Curl_read_plain returns error code and *n (bytes read) receives 0.
Curl_write_plain returns error code and *written receives 0.

--

Ref: https://github.com/curl/curl/issues/9431#issuecomment-1312420361

Assisted-by: Joel Depooter
Reported-by: Egor Pugin

Fixes https://github.com/curl/curl/issues/9431
Closes https://github.com/curl/curl/pull/9949
2022-11-20 03:54:36 -05:00
Sean McArthur
8c859cdb69
hyper: classify headers as CONNECT and 1XX
Closes #9947
2022-11-19 13:01:12 +01:00
Stefan Eissing
8ed97ad2bd
ftp: fix "AUTH TLS" on primary conn and for SSL in PASV second conn
Follow-up to dafdb20a26

Reported-by: Anthony Hu
Closes #9948
2022-11-19 12:30:29 +01:00
Jay Satiro
e08382a208 CURLOPT_POST.3: Explain setting to 0 changes request type
Bug: https://github.com/curl/curl/issues/9849
Reported-by:  MonkeybreadSoftware@users.noreply.github.com

Closes https://github.com/curl/curl/pull/9942
2022-11-19 03:19:32 -05:00
Daniel Stenberg
8a6a48957f
docs/INSTALL.md: expand on static builds
Remove from KNOWN_BUGS

Closes #9944
2022-11-19 00:13:29 +01:00
Stefan Eissing
ff8fc809c5
http: restore h3 to working condition after connection filter introduction
Follow-up to dafdb20a26

HTTP/3 needs a special filter chain, since it does the TLS handling
itself. This PR adds special setup handling in the HTTP protocol handler
that takes are of it.

When a handler, in its setup method, installs filters, the default
behaviour for managing the filter chain is overridden.

Reported-by: Karthikdasari0423 on github

Fixes #9931
Closes #9945
2022-11-19 00:00:27 +01:00
Daniel Stenberg
c7cd781a63
urldata: change port num storage to int and unsigned short
Instead of long.

Closes #9946
2022-11-18 23:54:38 +01:00
Daniel Stenberg
18383fbf72
Revert "sendf: change Curl_read_plain to wrap Curl_recv_plain"
This reverts commit 12e1def51a.

It introduced SOCKS proxy fails, like test 700 never ending.

Reopens #9431
2022-11-18 11:00:29 +01:00
Daniel Stenberg
95a8ac6bc5
HTTP-COOKIES.md: update the 6265bis link to draft-11
Closes #9940
2022-11-18 09:59:33 +01:00
Daniel Stenberg
117e3372a8
docs/WEBSOCKET.md: explain the URL use
Fixes #9936
Closes #9941
2022-11-18 09:58:07 +01:00
Jay Satiro
12e1def51a sendf: change Curl_read_plain to wrap Curl_recv_plain
Prior to this change Curl_read_plain would attempt to read the
socket directly. On Windows that's a problem because recv data may be
cached by libcurl and that data is only drained using Curl_recv_plain.

Rather than rewrite Curl_read_plain to handle cached recv data, I
changed it to wrap Curl_recv_plain, in much the same way that
Curl_write_plain already wraps Curl_send_plain.

Curl_read_plain -> Curl_recv_plain
Curl_write_plain -> Curl_send_plain

This fixes a bug in the schannel backend where decryption of arbitrary
TLS records fails because cached recv data is never drained. We send
data (TLS records formed by Schannel) using Curl_write_plain, which
calls Curl_send_plain, and that may do a recv-before-send
("pre-receive") to cache received data. The code calls Curl_read_plain
to read data (TLS records from the server), which prior to this change
did not call Curl_recv_plain and therefore cached recv data wasn't
retrieved, resulting in malformed TLS records and decryption failure
(SEC_E_DECRYPT_FAILURE).

The bug has only been observed during Schannel TLS 1.3 handshakes. Refer
to the issue and PR for more information.

Ref: https://github.com/curl/curl/issues/9431#issuecomment-1312420361

Assisted-by: Joel Depooter
Reported-by: Egor Pugin

Fixes https://github.com/curl/curl/issues/9431
Closes https://github.com/curl/curl/pull/9904
2022-11-18 03:04:13 -05:00
Jay Satiro
856b133f5d test3026: reduce runtime in legacy mingw builds
- Load Windows system libraries secur32 and iphlpapi beforehand, so
  that libcurl's repeated global init/cleanup only increases/decreases
  the library's refcount rather than causing it to load/unload.

Assisted-by: Marc Hoersken

Closes https://github.com/curl/curl/pull/9412
2022-11-18 02:54:57 -05:00
Daniel Stenberg
37ca6f0f9a
url: move back the IDN conversion of proxy names
Regression: in commit 53bcf55 we moved the IDN conversion calls to
happen before the HSTS checks. But the HSTS checks are only done on the
server host name, not the proxy names. By moving the proxy name IDN
conversions, we accidentally broke the verbose output showing the proxy
name.

This change moves back the IDN conversions for the proxy names to the
place in the code path they were before 53bcf55.

Reported-by: Andy Stamp
Fixes #9937
Closes #9939
2022-11-18 08:22:05 +01:00
Alexandre Ferrieux
49798cac83
CURLOPT_QUICK_EXIT: don't wait for DNS thread on exit
Fixes #2975
Closes #9147
2022-11-18 00:17:27 +01:00
Daniel Stenberg
b473df52bb
HTTP-COOKIES.md: mention that http://localhost is a secure context
Reported-by: Trail of Bits

Closes #9938
2022-11-17 23:16:31 +01:00
Daniel Stenberg
e9c580de4e
lib: parse numbers with fixed known base 10
... instead of using 0 argument that allows decimal, hex or octal when
the number is documented and assumed to use base 10.

Closes #9933
2022-11-17 23:15:37 +01:00
Daniel Stenberg
0fef73ea4a
RELEASE-NOTES: synced 2022-11-17 14:41:20 +01:00
Daniel Stenberg
709aefc7ca
scripts/delta: adapt to curl.h changes for the opt counter 2022-11-17 14:41:04 +01:00
Daniel Stenberg
cc3d517e8c
cookie: expire cookies at once when max-age is negative
Update test 329 to verify

Reported-by: godmar on github
Fixes #9930
Closes #9932
2022-11-17 13:47:24 +01:00
Stefan Eissing
7a19dd8a81
proxy: haproxy filter is only available when PROXY and HTTP are
Closes #9935
2022-11-17 13:45:36 +01:00
Daniel Stenberg
14d5589032
OtherTests.cmake: check for cross-compile, not for toolchain
Build systems like vcpkg alway sets `CMAKE_TOOLCHAIN_FILE` so it should
not be used as a sign that this is a cross-compile.

Also indented the function correctly.

Reported-by: Philip Chan
Fixes #9921
Closes #9923
2022-11-16 16:05:44 +01:00
Daniel Stenberg
df00df1e60
ntlm: improve comment for encrypt_des
Reported-by: Andrei Rybak
Fixes #9903
Closes #9925
2022-11-16 11:26:22 +01:00
Daniel Stenberg
bbb36409de
include/curl/curl.h: bump the deprecated requirements to gcc 5.3
Reported-by: Stephan Guilloux
Fixes #9917
Closes #9918
2022-11-15 23:09:31 +01:00
Stefan Eissing
a8e6351e12
proxy: refactor haproxy protocol handling as connection filter
Closes #9893
2022-11-15 15:56:25 +01:00
Patrick Monnerat
6967571bf2
lib: feature deprecation warnings in gcc >= 4.3
Add a deprecated attribute to functions and enum values that should not
be used anymore.
This uses a gcc 4.3 dialect, thus is only available for this version of
gcc and newer. Note that the _Pragma() keyword is introduced by C99, but
is available as part of the gcc dialect even when compiling in C89 mode.

It is still possible to disable deprecation at a calling module compile
time by defining CURL_DISABLE_DEPRECATION.

Gcc type checking macros are made aware of possible deprecations.

Some testing support Perl programs are adapted to the extended
declaration syntax.

Several test and unit test C programs intentionally use deprecated
functions/options and are annotated to not generate a warning.

New test 1222 checks the deprecation status in doc and header files.

Closes #9667
2022-11-15 10:57:29 +01:00
Daniel Stenberg
980510926d
log2changes.pl: wrap long lines at 80 columns
Also, only use author names in the output.

Fixes #9896
Reported-by: John Sherrill
Closes #9897
2022-11-15 10:56:09 +01:00
Daniel Stenberg
f4912407eb
cfilters: use %zu for outputting size_t
Detected by Coverity CID 1516894

Closes #9907
2022-11-14 14:54:39 +01:00
Daniel Stenberg
e1e090b89e
Curl_closesocket: avoid using 'conn' if NULL
... in debug-only code.

Reported by Coverity CID 1516896

Closes #9907
2022-11-14 14:54:29 +01:00
Daniel Stenberg
b7e4c41aa3
url: only acknowledge fresh_reuse for non-followed transfers
... to make sure NTLM auth sticks to the connection it needs, as
verified by 2032.

Follow-up to fa0b922761

Assisted-by: Stefan Eissing
Closes #9905
2022-11-14 14:53:15 +01:00
Daniel Stenberg
fb7cf93ba9
netrc.d: provide mutext info
Reported-by: xianghongai on github
Fixes #9899
Closes #9901
2022-11-14 10:06:01 +01:00
Daniel Stenberg
f20231a5f0
cmdline-opts/page-footer: remove long option nroff formatting
As gen.pl adds them
2022-11-14 10:04:58 +01:00
Daniel Stenberg
7fcfe0e009
nroff-scan.pl: detect double highlights 2022-11-14 10:04:57 +01:00
Daniel Stenberg
4154165e5e
cmdline-opts/gen.pl: fix the linkifier
Improved logic for finding existing --options in text and replacing with
the full version with nroff syntax. This also makes the web version link
options better.

Reported-by: xianghongai on github
Fixes #9899
Closes #9902
2022-11-14 10:04:31 +01:00
Patrick Monnerat
184fc6f07a
tool: use feature names instead of bit mask, when possible
If the run-time libcurl is too old to support feature names, the name
array is created locally from the bit masks. This is the only sequence
left that uses feature bit masks.

Closes #9583
2022-11-14 09:19:10 +01:00
Patrick Monnerat
e1e482517f
docs: curl_version_info is not thread-safe before libcurl initialization
Closes #9583
2022-11-14 09:19:06 +01:00
Patrick Monnerat
e780aae77a
version: add a feature names array to curl_version_info_data
Field feature_names contains a null-terminated sorted array of feature
names. Bitmask field features is deprecated.

Documentation is updated. Test 1177 and tests/version-scan.pl updated to
match new documentation format and extended to check feature names too.

Closes #9583
2022-11-14 09:18:53 +01:00
Stefan Eissing
00ea0aaf46
negtelnetserver.py: have it call its close() method
Closes #9894
2022-11-14 08:50:51 +01:00
Nathan Moinvaziri
5f8351aea3
ntlm: silence ubsan warning about copying from null target_info pointer.
runtime error: null pointer passed as argument 2, which is declared to
never be null

Closes #9898
2022-11-13 22:42:01 +01:00
Daniel Stenberg
1ec3f449fb
RELEASE-NOTES: synced 2022-11-12 00:54:35 +01:00
Stefan Eissing
13d550203e
Websocket: fixes for partial frames and buffer updates.
- buffers updated correctly when handling partial frames
- callbacks no longer invoked for incomplete payload data of 0 length
- curl_ws_recv no longer returns with 0 length partial payload

Closes #9890
2022-11-12 00:51:24 +01:00
Daniel Stenberg
7f182f7136
tool_operate: provide better errmsg for -G with bad URL
If the URL that -G would try to add a query to could not be parsed, it would
display

 curl: (27) Out of memory

It now instead shows:

 curl: (2) Could not parse the URL, failed to set query

Reported-by: Alex Xu
Fixes #9889
Closes #9892
2022-11-12 00:45:24 +01:00
Daniel Stenberg
aecc549699
vtls: fix build without proxy support
Follow-up to dafdb20a26

Closes #9895
2022-11-12 00:14:24 +01:00