summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-01-29 09:30:45 +0200
committerPaul Buetow <paul@buetow.org>2026-01-29 09:30:45 +0200
commit1a7a5ad9e8cb6300b6ec9c1d8a0e90f7b7e0aff7 (patch)
treeb908e46e7029435bfd91b6e3a4da34d4572c7bae
parent004c4c3fd7b367828533821995bae2771ba23672 (diff)
HTML-escape command outputs for W3C compliance
Amp-Thread-ID: https://ampcode.com/threads/T-019c086d-c760-779d-b740-0f748094b62a Co-authored-by: Amp <amp@ampcode.com>
-rw-r--r--docker-image/Justfile2
-rw-r--r--docker-image/index.pl20
2 files changed, 15 insertions, 7 deletions
diff --git a/docker-image/Justfile b/docker-image/Justfile
index 6c5131f..f50ecca 100644
--- a/docker-image/Justfile
+++ b/docker-image/Justfile
@@ -1,4 +1,4 @@
-VERSION := "1.4.0"
+VERSION := "1.5.0"
REGISTRY := "registry.lan.buetow.org:30001"
IMAGE := "ipv6test"
diff --git a/docker-image/index.pl b/docker-image/index.pl
index c5744d8..6380748 100644
--- a/docker-image/index.pl
+++ b/docker-image/index.pl
@@ -54,12 +54,20 @@ print "<pre>You are using <b>" . do {
} . "</b>\n";
-chomp (my $remote = `host $ENV{REMOTE_ADDR}`);
-chomp (my $server = `host $ENV{SERVER_ADDR}`);
-chomp (my $server0 = `host $ENV{SERVER_NAME}`);
-chomp (my $digremote = `dig -x $ENV{REMOTE_ADDR}`);
-chomp (my $digserver = `dig -x $ENV{SERVER_ADDR}`);
-chomp (my $digserver0 = `dig -t any $ENV{SERVER_NAME}`);
+sub html_escape {
+ my $str = shift;
+ $str =~ s/&/&amp;/g;
+ $str =~ s/</&lt;/g;
+ $str =~ s/>/&gt;/g;
+ return $str;
+}
+
+chomp (my $remote = html_escape(`host $ENV{REMOTE_ADDR}`));
+chomp (my $server = html_escape(`host $ENV{SERVER_ADDR}`));
+chomp (my $server0 = html_escape(`host $ENV{SERVER_NAME}`));
+chomp (my $digremote = html_escape(`dig -x $ENV{REMOTE_ADDR}`));
+chomp (my $digserver = html_escape(`dig -x $ENV{SERVER_ADDR}`));
+chomp (my $digserver0 = html_escape(`dig -t any $ENV{SERVER_NAME}`));
print <<END;
Client address: $ENV{REMOTE_ADDR}