curl/lib/vtls
Viktor Szakats 879a1514c3
socket: introduce SOCK_EAGAIN() and use it
To contain the logic of checking for both `EWOULDBLOCK` and/or `EAGAIN`
depending on platform/availability. Also to avoid checking for both if
they mapp to the same value, and to avoid PP guards around use.

This also ensures `EAGAIN` is consistently not checked on Windows, where
headers defined it, but `SOCKERRNO` never returns it, because curl maps
it to `WSAGetLastError()`.

If they map to the same value, checking them both in an `if` expression
trips GCC warning `-Wlogical-op` (the same way it triggers duplicate
case value error in `switch`).

Also:
- replace two `switch()` statements with the new macro.
- tests/server/sws: make two outliers use the new macro that were only
  checking for `EWOULDBLOCK` before this patch, in `connect_to()`.
- move variables to the left-side of expressions, where missing.
- rustls: use a variant of this macro that uses raw `EWOULDBLOCK`.
  Tried tracing it back to the origins, but I couldn't figure out if
  this is working as expected on all supported Windows versions in
  Rust. It seems to be using `GetLastError()`, according to
  https://docs.rs/system_error/0.2.0/system_error/, which would be
  probably incorrect.

Notes:
- it's probably a good idea to assign `SOCKERRNO` to a variable before
  passing it to this macro.

Cherry-picked from #21893

Closes #21992
2026-06-12 23:27:23 +02:00
..
apple.c ngtcp2: share common functionality 2026-06-10 13:28:05 +02:00
apple.h lib: use lib source directory as base include path 2026-02-23 16:00:42 +01:00
cipher_suite.c tidy-up: drop stray comparisons with literal zero 2026-06-10 15:15:54 +02:00
cipher_suite.h lib: use lib source directory as base include path 2026-02-23 16:00:42 +01:00
gtls.c tidy-up: drop stray comparisons with literal zero 2026-06-10 15:15:54 +02:00
gtls.h gtls: fix some typos 2026-05-05 08:46:26 +02:00
hostcheck.c lib: use lib source directory as base include path 2026-02-23 16:00:42 +01:00
hostcheck.h lib: use lib source directory as base include path 2026-02-23 16:00:42 +01:00
keylog.c tidy-up: drop redundant != NULL syntax 2026-06-09 14:37:36 +02:00
keylog.h tidy-up: apply clang-format fixes 2026-05-28 00:05:47 +02:00
mbedtls.c tidy-up: drop stray comparisons with literal zero 2026-06-10 15:15:54 +02:00
mbedtls.h lib: use lib source directory as base include path 2026-02-23 16:00:42 +01:00
openssl.c build: enable -Wformat-signedness, fix issues found 2026-06-10 15:14:08 +02:00
openssl.h tidy-up: apply clang-format fixes 2026-05-28 00:05:47 +02:00
rustls.c socket: introduce SOCK_EAGAIN() and use it 2026-06-12 23:27:23 +02:00
rustls.h lib: use lib source directory as base include path 2026-02-23 16:00:42 +01:00
schannel.c schannel: fix https proxy for client cert and certinfo 2026-06-12 14:21:10 -04:00
schannel.h lib: use lib source directory as base include path 2026-02-23 16:00:42 +01:00
schannel_int.h windows: update MS SDK versions in comments 2026-05-15 03:41:33 +02:00
schannel_verify.c tidy-up: miscellaneous 2026-06-11 19:48:07 +02:00
vtls.c build: enable -Wformat-signedness, fix issues found 2026-06-10 15:14:08 +02:00
vtls.h ngtcp2: share common functionality 2026-06-10 13:28:05 +02:00
vtls_config.c ssl native_ca_store: always reinit 2026-06-08 13:53:54 +02:00
vtls_config.h vtls_config: adjust to origin 2026-06-01 09:39:17 +02:00
vtls_int.h tidy-up: apply clang-format fixes 2026-05-28 00:05:47 +02:00
vtls_scache.c build: enable -Wformat-signedness, fix issues found 2026-06-10 15:14:08 +02:00
vtls_scache.h ngtcp2: share common functionality 2026-06-10 13:28:05 +02:00
vtls_spack.c build: enable -Wformat-signedness, fix issues found 2026-06-10 15:14:08 +02:00
vtls_spack.h lib: use lib source directory as base include path 2026-02-23 16:00:42 +01:00
wolfssl.c tidy-up: drop stray comparisons with literal zero 2026-06-10 15:15:54 +02:00
wolfssl.h wolfssl: fix -Wmissing-prototypes 2026-04-21 10:09:58 +02:00
x509asn1.c x509asn1: fix DH public key parameter extraction 2026-05-16 01:06:56 +02:00
x509asn1.h x509asn1: fixed and adapted for ASN1tostr unit testing 2026-03-20 13:03:40 +01:00