From 1a7a5ad9e8cb6300b6ec9c1d8a0e90f7b7e0aff7 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Thu, 29 Jan 2026 09:30:45 +0200 Subject: HTML-escape command outputs for W3C compliance Amp-Thread-ID: https://ampcode.com/threads/T-019c086d-c760-779d-b740-0f748094b62a Co-authored-by: Amp --- docker-image/Justfile | 2 +- docker-image/index.pl | 20 ++++++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) (limited to 'docker-image') 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 "
You are using " . do {
 } . "\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/&/&/g;
+    $str =~ s//>/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 <