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

18 Коммитов

Автор SHA1 Сообщение Дата
Daniel Stenberg c074ba64a8
code: language cleanup in comments
Based on the standards and guidelines we use for our documentation.

 - expand contractions (they're => they are etc)
 - host name = > hostname
 - file name => filename
 - user name = username
 - man page => manpage
 - run-time => runtime
 - set-up => setup
 - back-end => backend
 - a HTTP => an HTTP
 - Two spaces after a period => one space after period

Closes #14073
2024-07-01 22:58:55 +02:00
Daniel Stenberg 4e71f134e5
noproxy: test bad ipv6 net size first
No need to parse anything if the size is out of range.

Added some tests to this effect to test 1614.

Closes #13902
2024-06-07 00:22:59 +02:00
Viktor Szakats 72abf7c13a
lib: tidy up types and casts
Cherry-picked from #13489
Closes #13862
2024-06-05 14:02:39 +02:00
Daniel Stenberg e78913e6b5
noproxy: patterns need to be comma separated
or they will not parse correctly.

Mentioned in DEPRECATED since Janurary 2023 (in 7ad8a7ba9e).

Closes #13789
2024-06-01 12:25:13 +02:00
Viktor Szakats e411c98f70
build: prefer `USE_IPV6` macro internally (was: `ENABLE_IPV6`)
Before this patch, two macros were used to guard IPv6 features in curl
sources: `ENABLE_IPV6` and `USE_IPV6`. This patch makes the source use
the latter for consistency with other similar switches.

`-DENABLE_IPV6` remains accepted for compatibility as a synonym for
`-DUSE_IPV6`, when passed to the compiler.

`ENABLE_IPV6` also remains the name of the CMake and `Makefile.vc`
options to control this feature.

Closes #13349
2024-04-13 08:33:26 +00:00
Viktor Szakats 3829759bd0
build: enable missing OpenSSF-recommended warnings, with fixes
https://best.openssf.org/Compiler-Hardening-Guides/Compiler-Options-Hardening-Guide-for-C-and-C++.html
as of 2023-11-29 [1].

Enable new recommended warnings (except `-Wsign-conversion`):

- enable `-Wformat=2` for clang (in both cmake and autotools).
- add `CURL_PRINTF()` internal attribute and mark functions accepting
  printf arguments with it. This is a copy of existing
  `CURL_TEMP_PRINTF()` but using `__printf__` to make it compatible
  with redefinting the `printf` symbol:
  https://gcc.gnu.org/onlinedocs/gcc-3.0.4/gcc_5.html#SEC94
- fix `CURL_PRINTF()` and existing `CURL_TEMP_PRINTF()` for
  mingw-w64 and enable it on this platform.
- enable `-Wimplicit-fallthrough`.
- enable `-Wtrampolines`.
- add `-Wsign-conversion` commented with a FIXME.
- cmake: enable `-pedantic-errors` the way we do it with autotools.
  Follow-up to d5c0351055 #2747
- lib/curl_trc.h: use `CURL_FORMAT()`, this also fixes it to enable format
  checks. Previously it was always disabled due to the internal `printf`
  macro.

Fix them:

- fix bug where an `set_ipv6_v6only()` call was missed in builds with
  `--disable-verbose` / `CURL_DISABLE_VERBOSE_STRINGS=ON`.
- add internal `FALLTHROUGH()` macro.
- replace obsolete fall-through comments with `FALLTHROUGH()`.
- fix fallthrough markups: Delete redundant ones (showing up as
  warnings in most cases). Add missing ones. Fix indentation.
- silence `-Wformat-nonliteral` warnings with llvm/clang.
- fix one `-Wformat-nonliteral` warning.
- fix new `-Wformat` and `-Wformat-security` warnings.
- fix `CURL_FORMAT_SOCKET_T` value for mingw-w64. Also move its
  definition to `lib/curl_setup.h` allowing use in `tests/server`.
- lib: fix two wrongly passed string arguments in log outputs.
  Co-authored-by: Jay Satiro
- fix new `-Wformat` warnings on mingw-w64.

[1] 56c0fde389/docs/Compiler-Hardening-Guides/Compiler-Options-Hardening-Guide-for-C-and-C%2B%2B.md

Closes #12489
2023-12-16 13:12:37 +00:00
Daniel Stenberg ca05e1afba
noproxy: pointer to local array 'hostip' is stored outside scope
Ref: #10929
Closes #10933
2023-04-12 09:00:20 +02:00
Daniel Stenberg 7ad8a7ba9e
noproxy: support for space-separated names is deprecated
To be removed in July 2024.

Assisted-by: Michael Osipov
Fixes #10209
Closes #10215
2023-01-04 09:15:37 +01:00
Daniel Stenberg 2bc1d775f5
copyright: update all copyright lines and remove year ranges
- they are mostly pointless in all major jurisdictions
- many big corporations and projects already don't use them
- saves us from pointless churn
- git keeps history for us
- the year range is kept in COPYING

checksrc is updated to allow non-year using copyright statements

Closes #10205
2023-01-03 09:19:21 +01:00
Daniel Gustafsson 60453483b5 noproxy: guard against empty hostnames in noproxy check
When checking for a noproxy setting we need to ensure that we get
a hostname passed in. If there is no hostname then there cannot be
a matching noproxy rule for it by definition.

Closes: #10057
Reported-by: Geeknik Labs
Reviewed-by: Daniel Stenberg <daniel@haxx.se>
2022-12-08 23:37:32 +01:00
Daniel Stenberg b1953c1933
noproxy: tailmatch like in 7.85.0 and earlier
A regfression in 7.86.0 (via 1e9a538e05) made the tailmatch work
differently than before. This restores the logic to how it used to work:

All names listed in NO_PROXY are tailmatched against the used domain
name, if the lengths are identical it needs a full match.

Update the docs, update test 1614.

Reported-by: Stuart Henderson
Fixes #9842
Closes #9858
2022-11-07 08:00:38 +01:00
Daniel Stenberg b830f9ba9e
noproxy: fix tail-matching
Also ignore trailing dots in both host name and comparison pattern.

Regression in 7.86.0 (from 1e9a538e05)

Extended test 1614 to verify better.

Reported-by: Henning Schild
Fixes #9821
Closes #9822
2022-10-28 17:54:48 +02:00
Daniel Stenberg efc286b7a6
noproxy: also match with adjacent comma
If the host name is an IP address and the noproxy string contained that
IP address with a following comma, it would erroneously not match.

Extended test 1614 to verify this combo as well.

Reported-by: Henning Schild

Fixes #9813
Closes #9814
2022-10-27 23:31:31 +02:00
Randall S. Becker fc8d6b2370 build: fix for NonStop
- Include arpa/inet.h in all units where htonl is called.

Signed-off-by: Randall S. Becker <rsbecker@nexbridge.com>

Closes https://github.com/curl/curl/pull/9816
2022-10-27 16:57:53 -04:00
Viktor Szakats 86c0029047
noproxy: include netinet/in.h for htonl()
Solve the Amiga build warning by including `netinet/in.h`.

`krb5.c` and `socketpair.c` are using `htonl()` too. This header is
already included in those sources.

Regression from 1e9a538e05

Reviewed-by: Daniel Stenberg
Closes #9787
2022-10-25 15:20:45 +00:00
Viktor Szakats 9b63dda16e
noproxy: silence unused variable warnings with no ipv6
Follow-up to 36474f1050

Reviewed-by: Daniel Stenberg
Closes #9782
2022-10-22 23:20:26 +00:00
Viktor Szakats 36474f1050
noproxy: fix builds without AF_INET6
Regression from 1e9a538e05

Reviewed-by: Daniel Stenberg

Closes #9778
2022-10-21 19:06:25 +00:00
Daniel Stenberg 1e9a538e05
noproxy: support proxies specified using cidr notation
For both IPv4 and IPv6 addresses. Now also checks IPv6 addresses "correctly"
and not with string comparisons.

Split out the noproxy checks and functionality into noproxy.c

Added unit test 1614 to verify checking functions.

Reported-by: Mathieu Carbonneaux

Fixes #9773
Fixes #5745
Closes #9775
2022-10-21 13:39:20 +02:00