Commit graph

61 commits

Author SHA1 Message Date
Richard Hansen
e272caa385 use=web, use=<fw>: Strip HTTP headers before searching for IP 2024-07-27 04:40:34 -04:00
Richard Hansen
b563e9c2fd use=web: Add tests 2024-07-27 04:40:34 -04:00
Richard Hansen
b1752c2622 logging: Delete unused msg function 2024-07-27 03:59:29 -04:00
Richard Hansen
6aa68f72a7 logging: Change multi-line log message designation style
Before, the first line of a multi-line log message was prefixed with a
space while all subsequent messages were prefixed with `|`.  Now the
first line is prefixed with `>` and all subsequent lines with a space.
This makes it easier to quickly discern message boundaries.
2024-07-27 03:47:47 -04:00
Richard Hansen
0ea2f06513 get_ip: Don't mutate $arg
This makes log messages easier to understand.
2024-07-26 19:05:47 -04:00
Richard Hansen
8a65264841 group_hosts_by: Return the common group configuration
This should make it easier to detect missing attribute names passed to
`group_hosts_by`.
2024-07-13 04:09:24 -04:00
Richard Hansen
b8df93febe group_hosts_by: Return a list, not a hashref
The hash key value is an implementation detail that should not be
leaked to the caller.
2024-07-13 04:08:35 -04:00
Richard Hansen
08ccc41650 group_hosts_by: Use arg list instead of arrayref
This is more idiomatic.
2024-07-13 04:08:35 -04:00
Richard Hansen
fa0bfde3cb Don't assume the default interface has a globally routable IP 2024-07-11 00:18:27 -04:00
Richard Hansen
6af76afde9 Use skip_all if test precondition is not met
Subtests can't have zero checks.
2024-07-11 00:18:27 -04:00
Richard Hansen
01d2db06c1 Invert conditions for readability 2024-07-11 00:18:27 -04:00
Richard Hansen
6e7a4fb460 Split subtest into two subtests
This makes it easier to debug failures.
2024-07-11 00:18:27 -04:00
Richard Hansen
49f5551764 Add variable default value tests 2024-06-28 15:53:40 -04:00
Richard Hansen
b426b370fd Rename %cache to %recap for readability 2024-06-22 02:48:03 -04:00
Richard Hansen
211d59fccc header_ok: Log all non-2xx HTTP status codes 2024-06-06 19:34:06 -04:00
Richard Hansen
adbac91be7 header_ok: Only keep first line of argument
This allows callers to pass the entire response without generating
overly long error messages.
2024-06-06 19:34:06 -04:00
Richard Hansen
b58a10b3e3 header_ok: Add unit tests 2024-06-06 19:34:06 -04:00
Richard Hansen
31dbd8e4ed geturl: Set raw (binary) mode when reading from curl 2024-06-03 03:13:05 -04:00
jortkoopmans
216741c9ce dnsexit2: Fix when provided with a zone and a non-identical hostname
Trim the zone from the hostname in the request to fix issue.
2024-06-02 16:58:00 -04:00
jortkoopmans
ec2d5f7f69 dnsexit2: Add tests
Needs LWP::UserAgent.
2024-06-02 16:58:00 -04:00
Richard Hansen
e60e6e804b group_hosts_by: Use Data::Dumper to make the group signature
This is a bit more robust than manually making the group signature
because it gracefully handles corner cases such as `undef`.
2024-06-01 03:06:06 -04:00
Richard Hansen
ce0a362fd0 group_hosts_by: Add tests 2024-06-01 03:05:26 -04:00
Richard Hansen
d8a9d9d089 Add support for infinite duration 2024-05-25 00:38:10 -04:00
Richard Hansen
9c6e5fdda4 Output a | character in log message continuation lines
This makes it easier to tell where multi-line log messages begin and
end.
2024-05-23 02:04:29 -04:00
Richard Hansen
ff39ce3874 Don't use sprintf if there is only one argument
This avoids problems when logging a string that might have
metacharacters.
2024-05-23 02:04:19 -04:00
Richard Hansen
065b227711 logmsg: New low-level logging interface 2024-05-23 01:57:12 -04:00
Richard Hansen
d02a9cf6db Add infrastructure for custom logic in a %builtinfw entry 2024-05-14 22:18:59 -04:00
Richard Hansen
dfb2196499 Translate Perl version string to user-friendly version string
Perl version strings are flawed in a few ways.  Convert them to
user-friendly strings when printed so that Git tags and tarball names
are easier for downstream distributions to work with.
2024-05-12 16:43:43 -04:00
Richard Hansen
0806363b57 Tell Autoconf to get the version from ddclient.in
This avoids the need to maintain the same version string in two
different places.
2024-05-12 16:43:43 -04:00
Richard Hansen
58d7be4e83 Distinguish unset --*-skip settings from set to the empty string
This prevents the `%builtinweb` or `%builtinfw` skip defaults from
overriding a user's explicitly empty `--web-skip=` or `--fw-skip=`
setting.

This is technically a backwards-incompatible change: Any config that
explicitly sets `--web-skip` or `--fw-skip` to the empty string but
depends on the built-in skip behavior will fail.  This is unlikely to
affect many (if any) users; compatibility concerns are believed to be
far less significant than the potential need to turn off the built-in
skip.
2024-05-12 15:55:28 -04:00
Richard Hansen
281b7307a8 Fix misspelled *-ssl-validate option names
There is no `ssl-validate` option, and there never has been.
2024-05-10 16:54:40 -04:00
Richard Hansen
fedf0cbf40 Update ddclient::Test::Fake::HTTPD 2024-05-09 22:32:28 -04:00
Richard Hansen
01d1d5e142 Change t/geturl_connectivity.pl to handwritten
Commit a9c1e545fb removed the
`configure.ac` substitution, so the test no longer needs to be
generated.
2024-05-07 22:39:17 -04:00
Reuben Thomas
a9c1e545fb Require curl
Use command-line curl, and remove alternative Perl and Curl-via-Perl
implementations of network code.
2023-07-19 17:11:45 +03:00
Michal Josef Špaček
c4ff6c12bd Remove setting of MultiHomed, which is default in IO::Socket::IP
From doc in IO::Socket::IP in "IO::Socket::INET" INCOMPATIBILITES
section:
-----
The behaviour enabled by "MultiHomed" is in fact implemented by
"IO::Socket::IP" as it is required to correctly support searching for a
useable address from the results of the getaddrinfo(3) call. The
constructor will ignore the value of this argument, except if it is
defined but false. An exception is thrown in this case, because that
would request it disable the getaddrinfo(3) search behaviour in the
first place.
-----
2022-12-08 14:04:33 +01:00
Michal Josef Špaček
c747f2737a Rewrite deprecated use of IO::Socket::INET6 to new solution
Module IO::Socket::INET6 is deprecated.
There is common IO::Socket::IP module, which is working with ipv4 and
ipv6 in same way. There is backward compatibility with IO::Socket::INET6
2022-12-08 13:58:21 +01:00
David Kerr
1b2f45cc59 Add get_default_interface 2020-09-21 15:16:48 -04:00
David Kerr
213cf6ad09 Add get_ip_from_interface function 2020-09-21 15:16:11 -04:00
David Kerr
d24b75960d Add support for curl and option to not validate SSL certificates for getip from web or firewall
Check exists not just length
2020-08-07 11:17:44 -04:00
David Kerr
1ad4d6737a Add is_ipv6_global and extract_ipv6_global functions 2020-08-01 19:11:28 -04:00
Richard Hansen
310810c291 Group tests by IO::Socket class
Also delete some redundant SSL tests.
2020-07-24 15:23:54 -04:00
Richard Hansen
b46d064f55 Don't show -noipv6 when ipv6_opt is false 2020-07-24 15:18:42 -04:00
Richard Hansen
92a7590846 Whitespace fixes 2020-07-24 15:13:03 -04:00
Richard Hansen
5f1dacc3bd Eliminate unnecessary hashref
Pass the key-value pairs directly instead of via a hashref.
2020-07-11 21:39:48 -04:00
David Kerr
29202f5bc1 New is_ipv6 and extract_ipv6 algorithms
Also add unit tests.
2020-07-11 11:04:47 -04:00
David Kerr
92c1294af9 Accept leading zeros in IPv4 addresses
Also add unit tests.
2020-07-11 11:04:33 -04:00
Richard Hansen
a86f40ae9b Skip IPv6 tests if IO::Socket::INET6 isn't available
Fixes #251
2020-07-10 23:10:56 -04:00
Richard Hansen
bba1ecfe27 Switch from redefine to mock 2020-07-10 12:06:45 -04:00
Richard Hansen
173865bd75 Don't test writing to a read-only directory
root can always write to a read-only directory so the test was failing
on the CI runners (which run as root).
2020-07-10 12:06:45 -04:00
Richard Hansen
192a00ad64 Don't match against locale-dependent $! 2020-07-10 12:06:45 -04:00