From 098c84a29c5390608103d00cfeffa1422b621efe Mon Sep 17 00:00:00 2001
From: Tom Needham <needham.thomas@gmail.com>
Date: Wed, 16 Jan 2013 20:27:35 +0000
Subject: [PATCH] Return 401 headers when authentication is required for the
 api call

---
 lib/api.php | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/api.php b/lib/api.php
index cb67e0c2a8..da0c2417dc 100644
--- a/lib/api.php
+++ b/lib/api.php
@@ -94,6 +94,8 @@ class OC_API {
 				$response = new OC_OCS_Result(null, 998, 'Api method not found');
 			} 
 		} else {
+			 header('WWW-Authenticate: Basic realm="Authorisation Required"');
+			 header('HTTP/1.0 401 Unauthorized');
 			$response = new OC_OCS_Result(null, 997, 'Unauthorised');
 		}
 		// Send the response
-- 
GitLab