3 # Check http://config.privoxy.org/show-status for Conditional #defines enabled
5 # (c) 2022 Roland Rosenfeld <roland@debian.org>
10 use HTML::TreeBuilder 5 -weak;
14 my $ua = LWP::UserAgent->new(timeout => 10);
16 my $response = $ua->get('http://config.privoxy.org/show-status');
17 if (!$response->is_success) {
18 die $response->status_line;
20 my $tree = HTML::TreeBuilder->new;
21 $tree->parse($response->decoded_content);
23 # Search for "Conditional #defines:" table:
24 my $summary = 'The state of some ./configure options and what they do.';
25 my $table = $tree->look_down('_tag' => 'table',
26 'summary' => $summary);
27 unless (defined $table) {
28 die "summary '$summary' not found in tables";
31 # These features are intentionaly disabled, all others should be enabled:
32 my %disabled_features = ('FEATURE_ACCEPT_FILTER' => 1, # BSD only
33 'FEATURE_STRPTIME_SANITY_CHECKS' =>1, # BSD libc only
34 'FEATURE_GRACEFUL_TERMINATION' =>1, # devel only
40 foreach my $tr ($table->look_down('_tag' => 'tr')) {
41 my $td2 = ($tr->look_down('_tag' => 'td')) [1];
42 next unless defined $td2;
43 my $code = $tr->look_down('_tag' => 'code');
44 my $feature = $code->detach_content;
45 my $value = $td2->detach_content;
46 if ($value !~ /Yes/) {
47 # feature disabled, check whitelist
48 if ($feature eq 'FEATURE_64_BIT_TIME_T') {
49 # See https://en.wikipedia.org/wiki/Year_2038_problem
50 # On Linux >= 5.6 time_t should be 64bit, too.
51 printf "%s is disabled, which is ok on 32bit systems", $feature;
53 } elsif (! defined $disabled_features{$feature}) {
54 printf "%s is disabled, but should be enabled\n", $feature;
65 printf "%d features enabled\n", $enabled;
66 printf "%d features intentionally disabled\n", $disabled_ok;
67 printf "%d features unintentionally disabled\n", $disabled_nok;
70 printf STDERR "Found only %d Conditional #defines, seems test ist broken\n",