diff --git a/Changes b/Changes index db4ea2c..9b80f32 100644 --- a/Changes +++ b/Changes @@ -39,6 +39,9 @@ (thanks to Sander Bos for pointing this out) - Fixed in 'zfs.pm' the way how is collected pool's data. (thanks to Derek Dongray, derek AT valedon.co.uk) +- Fixed in HTTP built-in to force authentication (when enabled) always, even on + non-existing pages. + (thanks to Sander Bos for pointing this out) 3.10.0 - 25-Sep-2017 diff --git a/lib/HTTPServer.pm b/lib/HTTPServer.pm index 8a2186d..f239920 100644 --- a/lib/HTTPServer.pm +++ b/lib/HTTPServer.pm @@ -241,25 +241,26 @@ sub handle_request { } } - if(scalar(@data)) { - if($auth eq "y") { - if(http_header("401", $mimetype)) { - print("\r\n"); - print "\r\n"; - print "401 Authorization Required\r\n"; - print "\r\n"; - print "

Authorization Required

\r\n"; - print "

This server could not verify that you\r\n"; - print "are authorized to access the document\r\n"; - print "requested. Either you supplied the wrong\r\n"; - print "credentials (e.g., bad password), or your\r\n"; - print "browser doesn't understand how to supply\r\n"; - print "the credentials required.

\r\n"; - print "\r\n"; - logger($url, "AUTHERR"); - exit(0); - } + if($auth eq "y") { + if(http_header("401", $mimetype)) { + print("\r\n"); + print "\r\n"; + print "401 Authorization Required\r\n"; + print "\r\n"; + print "

Authorization Required

\r\n"; + print "

This server could not verify that you\r\n"; + print "are authorized to access the document\r\n"; + print "requested. Either you supplied the wrong\r\n"; + print "credentials (e.g., bad password), or your\r\n"; + print "browser doesn't understand how to supply\r\n"; + print "the credentials required.

\r\n"; + print "\r\n"; + logger($url, "AUTHERR"); + exit(0); } + } + + if(scalar(@data)) { http_header("200", $mimetype); foreach(@data) { print $_;