From d52e9432f4a1c4b5c3bf8e2126c42607aaf29395 Mon Sep 17 00:00:00 2001 From: Dominique Fournier Date: Sun, 25 Oct 2015 14:48:21 +0000 Subject: [PATCH] route : when a 401 error is thrown, request the WWW-Authentication git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@2377 bf3deb0d-5f1a-0410-827f-c0cc1f45334c --- route.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/route.php b/route.php index 6686518..b03fd9d 100644 --- a/route.php +++ b/route.php @@ -520,6 +520,12 @@ class route $http = new http (); @header ($_SERVER["SERVER_PROTOCOL"]." $getCode ". $http->codetext ($getCode)); + if ($getCode === 401) + { + // When using the 401 "Authentication required", it must be an + // information provided to the caller. Just add it. + @header("WWW-Authenticate: Basic realm=\"Authentication needed\""); + } // TODO : If the output is HTML, add the header line : // echo " \n"; require ("domframework/renderer.php");