From 640bc8495cc5d662935bf3ad37385ded496a5f37 Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Thu, 27 Apr 2017 23:23:14 -0700 Subject: [PATCH] IPv6 addresses need [ ] in the URL https://sourceforge.net/p/webadmin/bugs/4949/ --- miniserv.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/miniserv.pl b/miniserv.pl index af1efb471..833ce6c26 100755 --- a/miniserv.pl +++ b/miniserv.pl @@ -1327,9 +1327,9 @@ elsif ($reqline !~ /^(\S+)\s+(.*)\s+HTTP\/1\..$/) { if ($use_ssl) { # This could be an http request when it should be https $use_ssl = 0; - local $url = $config{'musthost'} ? - "https://$config{'musthost'}:$port/" : - "https://$host:$port/"; + local $urlhost = $config{'musthost'} || $host; + $urlhost = "[".$urlhost."]" if (&check_ip6address($urlhost)); + local $url = "https://$urlhost:$port/"; if ($config{'ssl_redirect'}) { # Just re-direct to the correct URL sleep(1); # Give browser a change to finish