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

12700 Коммитов

Автор SHA1 Сообщение Дата
Viktor Szakats 784400806c
Makefile.m32: deduplicate build rules [ci skip]
After this patch, we reduce the three copies of most `Makefile.m32`
logic to one. This now resides in `lib/Makefile.m32`. It makes future
updates easier, the code shorter, with a small amount of added
complexity.

`Makefile.m32` reduction:

|                   |  bytes | LOC total |  blank |  comment |  code |
|-------------------|-------:|----------:|-------:|---------:|------:|
| 7.85.0            |  34772 |      1337 |     79 |      192 |  1066 |
| before this patch |  17601 |       625 |     62 |      106 |   457 |
| after this patch  |  11680 |       392 |     52 |      104 |   236 |

Details:

- Change rules to create objects for the `v*` subdirs in the `lib` dir.
  This allows to use a shared compile rule and assumes that filenames
  are not (and will not be) colliding across these directories.
  `Makefile.m32` now also stores a list of these subdirs. They are
  changing rarely though.

- Sync as much as possible between the three `Makefile.m32` scripts'
  rules and their source/target sections.

- After this patch `CPPFLAGS` are all applied to the `src` sources once
  again. This matches the behaviour of cmake/autotools. Only zlib ones
  are actually required there.

- Use `.rc` names from `Makefile.inc` instead of keeping a duplicate.

- Change examples to link `libcurl.dll` by default. This makes building
  trivial, even as a cross-build:
    `CC=x86_64-w64-mingw32-gcc make -f Makefile.m32`
  To run them, you need to move/copy or add-to-path `libcurl.dll`.
  You can select static mode via `CFG=-static`.

- List more of the `Makefile.m32` config variables.

- Drop `.rc` support from examples. It made it fragile without much
  benefit.

- Include a necessary system lib for the `externalsocket.c` example.

- Exclude unnecessary systems libs when building in `-dyn` mode.

Closes #9642
2022-10-04 17:11:02 +00:00
Jay Satiro 2b309560c1
connect: change verbose IPv6 address:port to [address]:port
- Use brackets for the IPv6 address shown in verbose message when the
  format is address:port so that it is less confusing.

Before: Trying 2606:4700:4700::1111:443...
After: Trying [2606:4700:4700::1111]:443...

Bug: https://curl.se/mail/archive-2022-02/0041.html
Reported-by: David Hu

Closes #9635
2022-10-04 10:07:41 +02:00
Viktor Szakats 10fbd8b4e3
Makefile.m32: major rework [ci skip]
This patch overhauls `Makefile.m32` scripts, fixing a list of quirks,
making its behaviour and customization envvars align better with other
build systems, aiming for less code, that is easier to read, use and
maintain.

Details:
- Rename customization envvars:
  `CURL_CC` -> `CC`
  `CURL_RC` -> `RC`
  `CURL_AR` -> `AR`
  `CURL_LDFLAG_EXTRAS_DLL` -> `CURL_LDFLAGS_LIB`
  `CURL_LDFLAG_EXTRAS_EXE` -> `CURL_LDFLAGS_BIN`
- Drop `CURL_STRIP` and `CURL_RANLIB`. These tools are no longer used.
- Accept `CFLAGS`, `CPPFLAGS`, `RCFLAGS`, `LDFLAGS` and `LIBS` envvars.
- Drop `CURL_CFLAG_EXTRAS`, `CURL_LDFLAG_EXTRAS`, `CURL_RCFLAG_EXTRAS` in
  favor of the above.
- Do not automatically enable `zlib` with `libssh2`. `zlib` is optional
  with `libssh2`.
- Omit unnecessary `CPPFLAGS` options when building `curl.exe` and
  examples.
- Drop support for deprecated `-winssl` `CFG` option. Use `-schannel`
  instead.
- Avoid late evaluation where not necessary (`=` -> `:=`).
- Drop support for `CURL_DLL_A_SUFFIX` to override the implib suffix.
  Instead, use the standard naming scheme by default: `libcurl.dll.a`.
  The toolchain recognizes the name, and selects it automatically when
  asking for a `-shared` vs. `-static` build.
- Stop applying `strip` to `libcurl.a`. Follow-up from
  16a58e9f93. There was no debug info to
  strip since then.
- Stop setting `-O3`, `-W`, `-Wall` options. You can add these to
  `CFLAGS` as desired.
- Always enable `-DCURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG` with OpenSSL,
  to avoid that vulnerability on Windows.
- Add `-lbrotlicommon` to `LIBS` when using `brotli`.
- Do not enable `-nghttp3` without `-ngtcp2`.
- `-ssh2` and `-rtmp` options no longer try to auto-select a TLS-backend.
  You need to set the backend explicitly. This scales better and avoids
  issues with certain combinations (e.g. `libssh2` + `wolfssl` with no
  `schannel`).
- Default to OpenSSL TLS-backend with `ngtcp2`. Possible to override via
  `NGTCP2_LIBS`.
- Old, alternate method of enabling components (e.g. `SSH2=1`) no longer
  supported.
- Delete `SPNEGO` references. They were no-ops.
- Drop support for Win9x environments.
- Allow setting `OPENSSL_LIBS` independently from `OPENSSL_LIBPATH`.
- Support autotools/CMake `libssh2` builds by default.
- Respect `CURL_DLL_SUFFIX` in `-dyn` mode when building `curl.exe` and
  examples.
- Assume standard directory layout with `LIBCARES_PATH`. (Instead of the
  long gone embedded one.)
- Stop static linking with c-ares by default. Add
  `CPPFLAGS=-DCARES_STATICLIB` to enable it.
- Reorganize internal layout to avoid redundancy and emit clean diffs
  between src/lib and example make files.
- Delete unused variables.
- Code cleanups/rework.
- Comment and indentation fixes.

Closes #9632
2022-10-03 19:46:56 +00:00
Viktor Szakats e604a82cae
Makefile.m32: delete legacy component bits [ci skip]
- Drop auto-detection of OpenSSL 1.0.2 and earlier. Now always defaulting
  to OpenSSL 1.1.0 and later, LibreSSL and BoringSSL.

- Drop `Invalid path to OpenSSL package` detection. OpenSSL has been
  using a standard file layout since 1.1.0, so this seems unnecessary
  now.

- Drop special logic to enable Novell LDAP SDK support.

- Drop special logic to enable OpenLDAP LDAP SDK support. This seems
  to be distinct from native OpenLDAP, with support implemented inside
  `lib/ldap.c` (vs. `lib/openldap.c`) back when the latter did not exist
  yet in curl.

- Add `-lwldap32` only if there is no other LDAP library (either native
  OpenLDAP, or SDKs above) present.

- Update `doc/INSTALL.md` accordingly.

After this patch, it's necessary to make configration changes when using
OpenSSL 1.0.2 or earlier, or the two LDAP SDKs.

OpenSSL 1.0.2 and earlier:
```
export OPENSSL_INCLUDE = <path-to-openssl>/outinc
export OPENSSL_LIBPATH = <path-to-openssl>/out
export OPENSSL_LIBS = -lssl32 -leay32 -lgdi32
```

Novell LDAP SDK, previously enabled via `USE_LDAP_NOVELL=1`:
```
export CURL_CFLAG_EXTRAS = -I<path-to-sdk>/inc -DCURL_HAS_NOVELL_LDAPSDK
export CURL_LDFLAG_EXTRAS = -L<path-to-sdk>/lib/mscvc -lldapsdk -lldapssl -lldapx
```

OpenLDAP LDAP SDK, previously enabled via `USE_LDAP_OPENLDAP=1`:
```
export CURL_CFLAG_EXTRAS = -I<path-to-sdk>/include -DCURL_HAS_OPENLDAP_LDAPSDK
export CURL_LDFLAG_EXTRAS = -L<path-to-sdk>/lib -lldap -llber
```

I haven't tested these scenarios, and in general we recommend using
a recent OpenSSL release. Also, WinLDAP (the Windows default) and
OpenLDAP (via `-DUSE_OPENLDAP`) are the LDAP options actively worked on
in curl.

Closes #9631
2022-10-02 09:50:10 +00:00
Daniel Stenberg 37b3fb1c6a
vauth/ntlm.h: make line shorter than 80 columns
Follow-up from 265fbd937
2022-10-02 00:21:18 +02:00
Viktor Szakats 265fbd937e
docs: update sourceforge project links [ci skip]
SourceForge projects can now choose between two hostnames, with .io and
.net ending. Both support HTTPS by default now. Opening the other variant
will perm-redirected to the one chosen by the project.

The .io -> .net redirection is done insecurely.

Let's update the URLs to point to the current canonical endpoints to
avoid any redirects.

Closes #9630
2022-10-01 18:40:47 +00:00
Viktor Szakats 07a0047882
Makefile.m32: cleanups and fixes [ci skip]
- Add `-lcrypt32` once, and add it always for simplicity.
- Delete broken link and reference to the pre-Vista WinIDN add-on.
  MS no longer distribute it.
- Delete related `WINIDN_PATH` option. IDN is a system lib since Vista.
- Sync `LIBCARES_PATH` default with the rest of dependencies.
- Delete version numbers from dependency path defaults.
- `libgsasl` package is now called `gsasl`.
- Delete `libexpat` and `libxml2` references. No longer used by curl.
- Delete `Edit the path below...` comments. We recommend to predefine
  those envvars instead.
- `libcares.a` is not an internal dependency anymore. Stop using it as
  such.
- `windres` `--include-dir` -> `-I`, `-F` -> `--target=` for readability.
- Delete `STRIP`, `CURL_STRIP`, `AR` references from `src/Makefile.m32`.
  They were never used.
- Stop to `clean` some objects twice in `src/Makefile.m32`.
- Delete cvs-specific leftovers.
- Finish resource support in examples make file.
- Delete `-I<root>/lib` from examples make file.
- Fix copyright start year in examples make file.
- Delete duplicate `ftpuploadresume` input in examples make file.
- Sync OpenSSL lib order, `SYNC` support, `PROOT` use, dependency path
  defaults, variables names and other internal bits between the three
  make files.
- `lib/Makefile.m32` accepted custom options via `DLL_LIBS` envvar. This
  was lib-specific and possibly accidental. Use `CURL_LDFLAG_EXTRAS_DLL`
  envvar for the same effect.
- Fix linking `curl.exe` and examples to wrong static libs with
  auto-detected OpenSSL 1.0.2 or earlier.
- Add `-lgdi32` for OpenSSL 1.0.2 and earlier only.
- Add link to Novell LDAP SDK and use a relative default path. Latest
  version is from 2016, linked to an outdated OpenSSL 1.0.1.
- Whitespace and comment cleanups.

TODO in a next commit:

Delete built-in detection/logic for OpenSSL 1.0.2 and earlier, the Novell
LDAP SDK and the other LDAP SDK (which is _not_ OpenLDAP). Write up the
necessary custom envvars to configure them.

Closes #9616
2022-10-01 10:14:18 +00:00
Daniel Stenberg bbdeb4c673
easy: fix the altsvc init for curl_easy_duphandle
It was using the old #ifdef which nothing sets anymore

Closes #9624
2022-09-30 08:20:00 +02:00
Viktor Szakats e7cf6fea7f
ldap: delete stray CURL_HAS_MOZILLA_LDAP reference
Added in 68b215157f, while adding openldap
support. This is also the single mention of this constant in the source
tree and also in that commit. Based on these, it seems like an accident.

Delete this reference.

Reviewed-by: Daniel Stenberg

Closes #9625
2022-09-29 21:29:53 +00:00
Viktor Szakats 7313ffebfe
docs: spelling nits
- MingW -> MinGW (Minimalist GNU for Windows)
- f.e. -> e.g.
- some whitespace and punctuation.

Reviewed-by: Daniel Stenberg

Closes #9622
2022-09-29 21:29:04 +00:00
Patrick Monnerat 2437fac013
lib: sanitize conditional exclusion around MIME
The introduction of CURL_DISABLE_MIME came with some additional bugs:
- Disabled MIME is compiled-in anyway if SMTP and/or IMAP is enabled.
- CURLOPT_MIMEPOST, CURLOPT_MIME_OPTIONS and CURLOPT_HTTPHEADER are
  conditioned on HTTP, although also needed for SMTP and IMAP MIME mail
  uploads.

In addition, the CURLOPT_HTTPHEADER and --header documentation does not
mention their use for MIME mail.

This commit fixes the problems above.

Closes #9610
2022-09-29 10:51:04 +02:00
Daniel Stenberg ac612dfeee
altsvc: reject bad port numbers
The existing code tried but did not properly reject alternative services
using negative or too large port numbers.

With this fix, the logic now also flushes the old entries immediately
before adding a new one, making a following header with an illegal entry
not flush the already stored entry.

Report from the ongoing source code audit by Trail of Bits.

Adjusted test 356 to verify.

Closes #9607
2022-09-28 12:44:37 +02:00
Daniel Stenberg eb33ccd533
functypes: provide the recv and send arg and return types
This header is for providing the argument types for recv() and send()
when built to not use a dedicated config-[platfor].h file.

Remove the slow brute-force checks from configure and cmake.

This change also removes the use of the types for select, as they were
not used in code.

Closes #9592
2022-09-28 09:06:11 +02:00
Daniel Stenberg eb0167ff7d
urlapi: reject more bad characters from the host name field
Extended test 1560 to verify

Report from the ongoing source code audit by Trail of Bits.

Closes #9608
2022-09-28 08:22:42 +02:00
Patrick Monnerat 72652c0613
http, vauth: always provide Curl_allow_auth_to_host() functionality
This function is currently located in the lib/http.c module and is
therefore disabled by the CURL_DISABLE_HTTP conditional token.

As it may be called by TLS backends, disabling HTTP results in an
undefined reference error at link time.

Move this function to vauth/vauth.c to always provide it and rename it
as Curl_auth_allowed_to_host() to respect the vauth module naming
convention.

Closes #9600
2022-09-27 14:05:37 +02:00
Daniel Stenberg 4adee03cd4
ngtcp2: fix C89 compliance nit 2022-09-27 14:02:27 +02:00
Daniel Stenberg 58acc69e10
openssl: make certinfo available for QUIC
Curl_ossl_certchain() is now an exported function in lib/vtls/openssl.c that
can also be used from quiche.c and ngtcp2.c to get the cert chain for QUIC
connections as well.

The *certchain function was moved to the top of the file for this reason.

Reported-by: Eloy Degen
Fixes #9584
Closes #9597
2022-09-27 14:02:27 +02:00
Daniel Stenberg 99d3682303
url: rename function due to name-clash in Watt-32
Follow-up to 2481dbe5f4 and applies the change the way it was
intended.
2022-09-27 09:34:22 +02:00
Viktor Szakats 92b9624a68
windows: adjust name of two internal public functions
According to `docs/INTERNALS.md`, internal function names spanning source
files start with uppercase `Curl_`. Bring these two functions in
alignment with this.

This also stops exporting them from `libcurl.dll` in autotools builds.

Reviewed-by: Daniel Stenberg

Closes #9598
2022-09-26 22:32:23 +00:00
Gisle Vanem 2481dbe5f4
url: rename function due to name-clash in Watt-32
Since the commit 764c958c52, there was a new function called
resolve_ip(). This clashes with an internal function in Watt-32.

Closes #9585
2022-09-26 13:20:49 +02:00
Jay Satiro 5c0d02b7a7 schannel: ban server ALPN change during recv renegotiation
By the time schannel_recv is renegotiating the connection, libcurl has
already decided on a protocol and it is too late for the server to
select a protocol via ALPN except for the originally selected protocol.

Ref: https://github.com/curl/curl/issues/9451

Closes https://github.com/curl/curl/pull/9463
2022-09-26 03:26:49 -04:00
Daniel Stenberg 1a87a1efba
url: a zero-length userinfo part in the URL is still a (blank) user
Adjusted test 1560 to verify

Reported-by: Jay Satiro

Fixes #9088
Closes #9590
2022-09-26 07:45:53 +02:00
Randall S. Becker 7801cb9fd9
curl_setup: disable use of FLOSS for 64-bit NonStop builds
Older 32-bit builds currently need FLOSS. This dependency may be removed
in future OS releases.

Signed-off-by: Randall S. Becker <randall.becker@nexbridge.ca>

Closes #9575
2022-09-23 13:57:32 +02:00
Patrick Monnerat 91e06e687a
lib: prepare the incoming of additional protocols
Move the curl_prot_t to its own conditional block. Introduce symbol
PROTO_TYPE_SMALL to control it.

Fix a cast in a curl_prot_t assignment.
Remove an outdated comment.

Follow-up to cd5ca80.

Closes #9534
2022-09-23 08:39:44 +02:00
Daniel Stenberg d4b1ad59a3
msh3: change the static_assert to make the code C89 2022-09-23 08:27:50 +02:00
Daniel Stenberg 5263bbb316
bearssl: make it proper C89 compliant 2022-09-23 08:27:50 +02:00
Daniel Stenberg 935b1bd454
mprintf: use snprintf if available
This is the single place in libcurl code where it uses the "native"
s(n)printf() function. Used for writing floats. The use has been
reviewed and vetted and uses a HUGE target buffer, but switching to
snprintf() still makes this safer and removes build-time warnings.

Reported-by: Philip Heiduck

Fixes #9569
Closes #9570
2022-09-22 23:06:26 +02:00
Patrick Monnerat 677266c769
tool: remove protocol count limitation
Replace bit mask protocol sets by null-terminated arrays of protocol
tokens. These are the addresses of the protocol names returned by
curl_version_info().

Protocol names are sorted case-insensitively before output to satisfy CI
tests matches consistency.

The protocol list returned by curl_version_info() is augmented with all
RTMP protocol variants.

Test 1401 adjusted for new alpha ordered output.

Closes #9546
2022-09-22 13:49:10 +02:00
Daniel Stenberg 46f3fe0e75
hostip: lazily wait to figure out if IPv6 works until needed
The check may take many milliseconds, so now it is performed once the
value is first needed. Also, this change makes sure that the value is
not used if the resolve is set to be IPv4-only.

Closes #9553
2022-09-22 09:47:59 +02:00
Daniel Stenberg 1998f34d54
easy: fix the #include order
The mentioned "last 3 includes" order should be respected. easy_lock.h should
be included before those three.

Reported-by: Yuriy Chernyshov
Fixes #9560
Closes #9561
2022-09-21 23:15:15 +02:00
Daniel Stenberg 6267244161
connect: fix the wrong error message on connect failures
The "Failed to connect to" message after a connection failure would
include the strerror message based on the presumed previous socket
error, but in times it seems that error number is not set when reaching
this code and therefore it would include the wrong error message.

The strerror message is now removed from here and the curl_easy_strerror
error is used instead.

Reported-by: Edoardo Lolletti
Fixes #9549
Closes #9554
2022-09-21 14:23:37 +02:00
Daniel Stenberg a2fa5f86d6
ws: fix a C89 compliance nit
Closes #9541
2022-09-21 09:19:42 +02:00
Dmitry Karpov 1902e8fc51
resolve: make forced IPv4 resolve only use A queries
This protects IPv4-only transfers from undesired bad IPv6-related side
effects and make IPv4 transfers in dual-stack libcurl behave the same
way as in IPv4 single-stack libcurl.

Closes #9540
2022-09-20 15:43:27 +02:00
Daniel Stenberg 660cf3d4ed
lib: the number four in a sequence is the "fourth"
Spelling is hard

Closes #9535
2022-09-19 08:48:49 +02:00
John Bampton a46e412464
misc: fix spelling in two source files
Closes #9529
2022-09-19 08:47:55 +02:00
Viktor Szakats 6de7322c03
windows: add .rc support to autotools builds
After this update autotools builds will compile and link `.rc` resources
to Windows executables. Bringing this feature on par with CMake and
Makefile.m32 builds. And also making it unnecessary to improvise these
steps manually, while monkey patching build files, e.g. [0].

You can customize the resource compiler via the `RC` envvar, and its
options via `RCFLAGS`.

This harmless warning may appear throughout the build, even though the
autotools manual documents [1] `RC` as a valid tag, and it fails when
omitting one:
`libtool:   error: ignoring unknown tag RC`

[0] 535f19060d/curl-autotools.sh (L376-L382)
[1] https://www.gnu.org/software/libtool/manual/html_node/Tags.html

Closes #9521
2022-09-18 12:05:35 +00:00
Daniel Stenberg 307b7543ea
misc: null-terminate
Make use of this term consistently.

Closes #9527
2022-09-17 23:19:29 +02:00
Patrick Monnerat 9d51329047
setopt: use the handler table for protocol name to number conversions
This also returns error CURLE_UNSUPPORTED_PROTOCOL rather than
CURLE_BAD_FUNCTION_ARGUMENT when a listed protocol name is not found.

A new schemelen parameter is added to Curl_builtin_scheme() to support
this extended use.

Note that disabled protocols are not recognized anymore.

Tests adapted accordingly.

Closes #9472
2022-09-16 23:29:01 +02:00
Daniel Stenberg 1bbffa0833
altsvc: use 'h3' for h3
Since the official and real version has been out for a while now and servers
are deployed out there using it, there is no point in sticking to h3-29.

Reported-by: ウさん
Fixes #9515
Closes #9516
2022-09-16 22:31:25 +02:00
Daniel Stenberg ec51f00480
ws: the infof() flags should be %zu
Follow-up to e5e9e0c5e4

Closes #9518
2022-09-16 21:35:15 +02:00
Daniel Stenberg a64e3e5993
setopt: when POST is set, reset the 'upload' field
Reported-by: RobBotic1 on github
Fixes #9507
Closes #9511
2022-09-15 23:44:15 +02:00
Daniel Stenberg 846678541b
urlapi: detect scheme better when not guessing
When the parser is not allowed to guess scheme, it should consider the
word ending at the first colon to be the scheme, independently of number
of slashes.

The parser now checks that the scheme is known before it counts slashes,
to improve the error messge for URLs with unknown schemes and maybe no
slashes.

When following redirects, no scheme guessing is allowed and therefore
this change effectively prevents redirects to unknown schemes such as
"data".

Fixes #9503
2022-09-15 09:31:40 +02:00
Daniel Stenberg 7f5fe74323
strerror: improve two URL API error messages 2022-09-15 09:31:29 +02:00
Daniel Stenberg 889c132c38
cmake: define BUILDING_LIBCURL in lib/CMakeLists, not config.h
Since the config file might also get included by the tool code at times.
This syncs with how other builds do it.

Closes #9498
2022-09-14 08:06:41 +02:00
Daniel Stenberg ddda4fdf3d
setopt: fix compiler warning
Follow-up to cd5ca80f00

closes #9502
2022-09-14 08:02:27 +02:00
Daniel Stenberg fd840cdead
formdata: typecast the va_arg return value
To avoid "enumerated type mixed with another type" warnings

Follow-up from 0f52dd5fd5

Closes #9499
2022-09-13 15:38:48 +02:00
Daniel Stenberg cd5ca80f00
urldata: use a curl_prot_t type for storing protocol bits
This internal-use-only storage type can be bumped to a curl_off_t once
we need to use bit 32 as the previous 'unsigned int' can no longer hold
them all then.

The websocket protocols take bit 30 and 31 so they are the last ones
that fit within 32 bits - but cannot properly be exported through APIs
since those use *signed* 32 bit types (long) in places.

Closes #9481
2022-09-13 11:26:49 +02:00
zhanghu 0f52dd5fd5
formdata: fix warning: 'CURLformoption' is promoted to 'int'
curl/lib/formdata.c: In function 'FormAdd':
curl/lib/formdata.c:249:31: warning: 'CURLformoption' is promoted to 'int' when passed through '...'
  249 |       option = va_arg(params, CURLformoption);
      |                               ^
curl/lib/formdata.c:249:31: note: (so you should pass 'int' not 'CURLformoption' to 'va_arg')
curl/lib/formdata.c:249:31: note: if this code is reached, the program will abort

Closes #9484
2022-09-13 11:24:40 +02:00
Hayden Roche d797339202
wolfSSL: fix session management bug.
Prior to this commit, non-persistent pointers were being used to store
sessions.  When a WOLFSSL object was then freed, that freed the session
it owned, and thus invalidated the pointer held in curl's cache. This
commit makes it so we get a persistent (deep copied) session pointer
that we then add to the cache.  Accordingly, wolfssl_session_free, which
was previously a no-op, now needs to actually call SSL_SESSION_free.

This bug was discovered by a wolfSSL customer.

Closes #9492
2022-09-13 10:15:40 +02:00
Marcel Raad 7740530ced
ws: fix build without `USE_WEBSOCKETS`
The curl.h include is required unconditionally.
2022-09-12 10:22:42 +02:00
Marcel Raad a0ff4dba8b
ws: add missing curl.h include
A conflict between commits 664249d095 and e5839f4ee7 broke the build.
2022-09-12 10:12:32 +02:00
Daniel Stenberg e5e9e0c5e4
ws: fix an infof() call to use %uz for size_t output
Detected by Coverity, CID 1514665.

Closes #9480
2022-09-12 10:02:38 +02:00
Marcel Raad e5839f4ee7
curl_setup: include only system.h instead of curl.h
As done before commit 9506d01ee5.

Ref: https://github.com/curl/curl/pull/9375#discussion_r957010158
Closes https://github.com/curl/curl/pull/9453
2022-09-12 09:41:55 +02:00
Marcel Raad b921a1676f
lib: add missing limits.h includes
Closes https://github.com/curl/curl/pull/9453
2022-09-12 09:41:50 +02:00
Marcel Raad d7dceb57d1
lib and tests: add missing curl.h includes
Closes https://github.com/curl/curl/pull/9453
2022-09-12 09:41:47 +02:00
Marcel Raad 4a7c10c6cc
curl_setup: include curl.h after platform setup headers
The platform setup headers might set definitions required for the
includes in curl.h.

Ref: https://github.com/curl/curl/pull/9375#discussion_r956998269
Closes https://github.com/curl/curl/pull/9453
2022-09-12 09:41:42 +02:00
Daniel Stenberg 9ac40bfcf0
setopt: make protocol2num use a curl_off_t for the protocol bit
... since WSS does not fit within 32 bit.

Bug: https://github.com/curl/curl/pull/9467#issuecomment-1243014887
Closes #9476
2022-09-12 08:35:51 +02:00
Patrick Monnerat 4399b0303a
content_encoding: use writer struct subclasses for different encodings
The variable-sized encoding-specific storage of a struct contenc_writer
currently relies on void * alignment that may be insufficient with
regards to the specific storage fields, although having not caused any
problems yet.

In addition, gcc 11.3 issues a warning on access to fields of partially
allocated structures that can occur when the specific storage size is 0:

  content_encoding.c: In function ‘Curl_build_unencoding_stack’:
  content_encoding.c:980:21: warning: array subscript ‘struct contenc_writer[0]’ is partly outside array bounds of ‘unsigned char[16]’ [-Warray-bounds]
    980 |     writer->handler = handler;
        |     ~~~~~~~~~~~~~~~~^~~~~~~~~
  In file included from content_encoding.c:49:
  memdebug.h:115:29: note: referencing an object of size 16 allocated by ‘curl_dbg_calloc’
    115 | #define calloc(nbelem,size) curl_dbg_calloc(nbelem, size, __LINE__, __FILE__)
        |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  content_encoding.c:977:60: note: in expansion of macro ‘calloc’
    977 |   struct contenc_writer *writer = (struct contenc_writer *)calloc(1, sz);

To solve both these problems, the current commit replaces the
contenc_writer/params structure pairs by "subclasses" of struct
contenc_writer. These are structures that contain a contenc_writer at
offset 0. Proper field alignment is therefore handled by the compiler and
full structure allocation is performed, silencing the warnings.

Closes #9455
2022-09-11 14:46:52 +02:00
Daniel Stenberg ce753e3c31
setopt: make protocols2num() work with websockets
So that CURLOPT_PROTOCOLS_STR and CURLOPT_REDIR_PROTOCOLS_STR can
specify those as well.

Reported-by: Patrick Monnerat
Bug: https://curl.se/mail/lib-2022-09/0016.html
Closes #9467
2022-09-10 23:11:47 +02:00
Orgad Shaneh 1c52e8a379
fix Cygwin/MSYS compilation
_getpid is Windows API. On Cygwin variants it should remain getpid.

Fixes #8220
Closes #9255
2022-09-10 16:34:13 +02:00
Daniel Stenberg eebfa3279d
curl_ws_meta: initial implementation 2022-09-09 15:11:14 +02:00
Daniel Stenberg 664249d095
ws: initial websockets support
Closes #8995
2022-09-09 15:11:14 +02:00
Daniel Stenberg 60a3b25dbf
version: add ws + wss 2022-09-09 15:11:14 +02:00
Daniel Stenberg 279f638b74
strtoofft: after space, there cannot be a control code
With the change from ISSPACE() to ISBLANK() this function no longer
deals with (ignores) control codes the same way, which could lead to
this function returning unexpected values like in the case of
"Content-Length: \r-12354".

Follow-up to 6f9fb7ec2d

Detected by OSS-fuzz
Bug: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=51140
Assisted-by: Max Dymond
Closes #9458
2022-09-09 15:02:15 +02:00
Daniel Stenberg 9c9e83931e
headers: reset the requests counter at transfer start
If not, reusing an easy handle to do a subsequent transfer would
continue the counter from the previous invoke, which then would make use
of the header API difficult/impossible as the request counter
mismatched.

Add libtest 1947 to verify.

Reported-by: Andrew Lambert
Fixes #9424
Closes #9447
2022-09-09 14:46:06 +02:00
Daniel Stenberg eafc2b14ac
http2: make nghttp2 less picky about field whitespace
In nghttp2 1.49.0 it returns error on leading and trailing whitespace in
header fields according to language in the recently shipped RFC 9113.

nghttp2 1.50.0 introduces an option to switch off this strict check and
this change enables this option by default which should make curl behave
more similar to how it did with nghttp2 1.48.0 and earlier.

We might want to consider making this an option in the future.

Closes #9448
2022-09-08 14:52:45 +02:00
Michael Heimpold d668685657
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
2022-09-07 10:26:55 +02:00
Daniel Stenberg f703cf971c
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
2022-09-07 10:21:45 +02:00
Jay Satiro 2ae81e680b 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
2022-09-07 02:55:10 -04:00
Marc Hoersken 0c68e2545c
lib: add required Win32 setup definitions in setup-win32.h
Assisted-by: Jay Satiro
Reviewed-by: Marcel Raad

Follow up to #9312
Closes #9375
2022-09-06 19:29:44 +02:00
Daniel Stenberg 5e259d7b23
pingpong: extend the response reading error with errno
To help diagnosing the cause of the problem.

See #9380
Closes #9443
2022-09-06 18:48:57 +02:00
Emanuele Torre f1b76e53ae
curl_ctype: add space around <= operator in ISSPACE macro
Follow-up to f65f750

Closes #9441
2022-09-06 14:31:19 +02:00
Daniel Stenberg f65f750742
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
2022-09-06 08:36:33 +02:00
Daniel Stenberg 6f9fb7ec2d
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
2022-09-06 08:34:30 +02:00
Daniel Stenberg 8dd95da35b
ctype: remove all use of <ctype.h>, use our own versions
Except in the test servers.

Closes #9433
2022-09-06 08:32:36 +02:00
Daniel Stenberg 472f1cbe7e
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
2022-09-05 07:39:02 +02:00
Viktor Szakats c9061f242b
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
2022-08-31 14:31:01 +00:00
Orgad Shaneh c40ec3178f
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 d1237ac906.

Fixes #9243
2022-08-29 17:25:29 +02:00
Orgad Shaneh 943fb2b26a
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
2022-08-29 17:24:59 +02:00
Jay Satiro 8bd03516d6
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
2022-08-29 17:24:22 +02:00
Daniel Stenberg 8dfc93e573
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
2022-08-29 11:20:37 +02:00
Daniel Stenberg 74e156d00f
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
2022-08-29 10:54:39 +02:00
Daniel Stenberg aec8d30624
Revert "schannel: when importing PFX, disable key persistence"
This reverts commit 70d010d285.

Due to further reports in #9300 that indicate this commit might
introduce problems.
2022-08-29 08:16:20 +02:00
Daniel Stenberg 7632c0d25a
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
2022-08-29 00:07:09 +02:00
Jacob Tolar 65bbb5e6f4
openssl: add cert path in error message
Closes #9349
2022-08-27 23:26:42 +02:00
Marc Hoersken 109e9730ee
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
2022-08-26 21:09:32 +02:00
Marc Hoersken bc25c9e3ee
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
2022-08-26 11:36:42 +02:00
Marc Hoersken a71fe41d2f
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
2022-08-25 23:31:24 +02:00
rcombs 07f80f968d
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
2022-08-25 17:43:08 +02:00
Somnath Kundu 89d204036a
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
2022-08-25 17:37:10 +02:00
Dustin Howett 70d010d285
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
2022-08-25 13:47:27 +02:00
Daniel Stenberg 31a41d45b7
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
2022-08-23 13:44:11 +02:00
Emil Engler 2c86f1b345
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
2022-08-22 23:36:02 +02:00
Daniel Stenberg f3c013d38c
libssh2: make atime/mtime date overflow return error
Closes #9328
2022-08-18 00:02:19 +02:00
Daniel Stenberg c988ec9f41
libssh: make atime/mtime date overflow return error
Closes #9328
2022-08-18 00:02:09 +02:00
Daniel Stenberg 8e88e52ed0
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
2022-08-16 23:16:53 +02:00
Daniel Stenberg 44a02d2532
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
2022-08-16 23:15:57 +02:00
Daniel Stenberg 14d9d79c87
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
2022-08-16 08:54:33 +02:00
Daniel Stenberg 37dbbbb6c1
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
2022-08-16 08:54:30 +02:00
Daniel Stenberg f236595ecc
asyn-thread: fix socket leak on OOM
Closes #9310
2022-08-16 08:54:25 +02:00
Daniel Stenberg 657101ec0c
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
2022-08-15 10:52:26 +02:00
Daniel Stenberg e65187e188
ngtcp2: fix picky compiler warnings with wolfSSL for QUIC
Follow-up to 8a13be227e

Closes #9315
2022-08-15 09:39:09 +02:00
Daniel Stenberg c031ec53f8
ngtcp2: remove leftover variable
Mistake leftover from my edit before push.

Follow-up from 8a13be227e
Reported-by: Viktor Szakats
Bug: https://github.com/curl/curl/pull/9290#issuecomment-1214569167
2022-08-15 08:22:20 +02:00
Viktor Szakats 5fd7cd7302
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
8a13be227e 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
2022-08-15 02:49:59 +00:00
Stefan Eissing 8a13be227e
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
2022-08-15 00:48:55 +02:00
David Carlier 6526b36271 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
2022-08-14 10:53:18 +02:00
Daniel Stenberg 011788f0b6
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
2022-08-13 00:19:29 +02:00
Daniel Stenberg ed6e0febe0
connect: close the happy eyeballs loser connection when using QUIC
Reviewed-by: Nick Banks

Closes #9303
2022-08-12 16:29:12 +02:00
Emil Engler 764c958c52
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
2022-08-12 16:27:36 +02:00
Daniel Stenberg 193772084f
schannel: re-indent to use curl style better
Only white space changes

Closes #9301
2022-08-12 16:04:08 +02:00
Daniel Stenberg b5c0fe20e3
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
2022-08-11 14:01:37 +02:00
Daniel Stenberg d48dd1573c
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
2022-08-11 09:07:06 +02:00
Futaura 55a138acc4
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
2022-08-10 14:14:27 +02:00
Emil Engler 34886a444f
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
2022-08-10 14:12:22 +02:00
Cering 6ba3047378
connect: add quic connection information
Fixes #9286
Closes #9287
2022-08-10 08:41:50 +02:00
Daniel Stenberg 15f7feac22
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
2022-08-08 19:57:49 +02:00
Daniel Stenberg ca528d1de7
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
2022-08-08 19:56:14 +02:00
Futaura 23c708cdc8
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
2022-08-08 16:42:10 +02:00
Daniel Stenberg a29d34b0b7
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
2022-08-08 14:31:06 +02:00
Daniel Stenberg a550831023
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
2022-08-08 14:30:25 +02:00
Daniel Stenberg 0f23341953
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
2022-08-08 13:26:11 +02:00
Futaura a041ed8cde
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
2022-08-08 10:48:11 +02:00
opensignature dc8c859b0c
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
2022-08-08 09:49:38 +02:00
Futaura e1acfafa49
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
2022-08-08 09:16:01 +02:00
Daniel Stenberg 0ad7c8d7d5
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
2022-08-08 08:28:04 +02:00
Evgeny Grin (Karlson2k) 3fe24ea322
digest: reject broken header with session protocol but without qop
Closes #9077
2022-08-07 14:39:57 +02:00
Andrew Lambert 4641575fcd
curl_easy_header: Add CURLH_PSEUDO to sanity check
Fixes #9235
Closes #9236
2022-08-06 17:08:16 +02:00
Wyatt O'Day 8beff43559 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
2022-08-02 13:54:31 -04:00
Nao Yonashiro 2086b69b57 quiche: fix build failure
Reviewed-by: Alessandro Ghedini
Closes #9223
2022-08-02 16:49:36 +02:00
Sean McArthur 3b52a80c05
hyper: enable obs-folded multiline headers
Closes #9216
2022-07-28 00:36:18 +02:00
Daniel Stenberg 3141062c23
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
2022-07-28 00:34:23 +02:00
Jay Satiro 9bd40e2b69 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
2022-07-26 13:23:56 -04:00
Evgeny Grin (Karlson2k) 6e241bbf1d digest: fix memory leak, fix not quoted 'opaque'
Fix leak regression introduced by 3a6fe0c.

Closes https://github.com/curl/curl/pull/9199
2022-07-25 15:06:30 -04:00
Daniel Stenberg 07535a4f87
sendf: skip storing HTTP headers if HTTP disabled
Closes #9179
2022-07-23 13:39:10 +02:00
Daniel Stenberg 3be0c67379
url: enumerated type mixed with another type
Follow-up to 1c58e7ae99ce2030213f28b

Closes #9179
2022-07-23 13:39:06 +02:00
Daniel Stenberg 8cd57d6e39
urldata: change second proxytype field to unsigned char to match
To avoid "enumerated type mixed with another type"

Closes #9179
2022-07-23 13:39:03 +02:00
Daniel Stenberg 8d1da2e172
http: typecast the httpreq assignment to avoid icc compiler warning
error #188: enumerated type mixed with another type

Closes #9179
2022-07-23 13:39:00 +02:00
Daniel Stenberg dcbc9226bc
urldata: make state.httpreq an unsigned char
To match set.method used for the same purpose.

Closes #9179
2022-07-23 13:38:57 +02:00
Daniel Stenberg 32db1ed867
splay: avoid using -1 in unsigned variable
To fix icc compiler warning integer conversion resulted in a change of sign

Closes #9179
2022-07-23 13:38:54 +02:00
Daniel Stenberg 6531c0e85a
sendf: store the header type in an usigned char to avoid icc warnings
Closes #9179
2022-07-23 13:38:50 +02:00
Daniel Stenberg 4c57fdcf87
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
2022-07-23 13:38:47 +02:00
Daniel Stenberg 74d47e22aa
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
2022-07-23 13:38:43 +02:00
Daniel Stenberg f273b59144
http_chunks: remove an assign + typecast
As it caused icc to complain: "pointer cast involving 64-bit pointed-to
type"

Closes #9179
2022-07-23 13:38:36 +02:00
Daniel Stenberg 336f7cd5af
vtls: make Curl_ssl_backend() return the enum type curl_sslbackend
To fix the icc warning enumerated type mixed with another type

Closes #9179
2022-07-23 13:38:33 +02:00
Daniel Stenberg fe8f1512e5
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
2022-07-20 00:50:19 +02:00
Daniel Stenberg 6f037100eb
sendf: fix paused header writes since after the header API
Regression since d1e4a67

Reported-by: Sergey Ogryzkov
Fixes #9180
Closes #9182
2022-07-20 00:49:06 +02:00
Daniel Stenberg 7935972b37
mprintf: fix *dyn_vprintf() when out-of-memory
Follow-up to 0e48ac1f99. Torture-testing 1455 would lead to a memory
leak otherwise.

Closes #9185
2022-07-19 23:56:03 +02:00
Daniel Stenberg c61e6de7d5
file: fix icc enumerated type mixed with another type warning
Ref: #9179
Closes #9181
2022-07-19 18:10:08 +02:00
Viktor Szakats 4d73854462
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 de71e68000)
- `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/WindowsCache.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\.cmake|^packages/vms/config_h\.com|^m4/curl-functions\.m4|^acinclude\.m4|^configure\.ac)')"
  if [ "${c}" = '0' ]; then
    echo "${def}"
  fi
done
```

Reviewed-by: Daniel Stenberg
Closes #9044
2022-07-19 15:12:19 +00:00
Daniel Stenberg 4c0ac2aa59
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
2022-07-19 11:52:54 +02:00