fixed in HTTP built-in to force authentication (when enabled) always, even on non-existing pages

This commit is contained in:
Jordi Sanfeliu 2018-10-05 09:54:06 +02:00
parent d768bed4fc
commit e7bd235cb3
2 changed files with 22 additions and 18 deletions

View File

@ -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

View File

@ -241,25 +241,26 @@ sub handle_request {
}
}
if(scalar(@data)) {
if($auth eq "y") {
if(http_header("401", $mimetype)) {
print("<!DOCTYPE html '-//W3C//DTD HTML 4.01 Final//EN'>\r\n");
print "<html><head>\r\n";
print "<title>401 Authorization Required</title>\r\n";
print "</head><body>\r\n";
print "<h1>Authorization Required</h1>\r\n";
print "<p>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.</p>\r\n";
print "</body></html>\r\n";
logger($url, "AUTHERR");
exit(0);
}
if($auth eq "y") {
if(http_header("401", $mimetype)) {
print("<!DOCTYPE html '-//W3C//DTD HTML 4.01 Final//EN'>\r\n");
print "<html><head>\r\n";
print "<title>401 Authorization Required</title>\r\n";
print "</head><body>\r\n";
print "<h1>Authorization Required</h1>\r\n";
print "<p>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.</p>\r\n";
print "</body></html>\r\n";
logger($url, "AUTHERR");
exit(0);
}
}
if(scalar(@data)) {
http_header("200", $mimetype);
foreach(@data) {
print $_;