changeset 5224:cd5cf4cc6304

mod_http_oauth2: Fail early when no authorization header present Fixes traceback.
author Matthew Wild <mwild1@gmail.com>
date Tue, 07 Mar 2023 15:31:19 +0000
parents 8b2a36847912
children 3439eb37f23b
files mod_http_oauth2/mod_http_oauth2.lua
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mod_http_oauth2/mod_http_oauth2.lua	Tue Mar 07 15:27:50 2023 +0000
+++ b/mod_http_oauth2/mod_http_oauth2.lua	Tue Mar 07 15:31:19 2023 +0000
@@ -342,6 +342,8 @@
 end
 
 local function get_request_credentials(request)
+	if not request.headers.authorization then return; end
+
 	local auth_type, auth_data = string.match(request.headers.authorization, "^(%S+)%s(.+)$");
 
 	if auth_type == "Basic" then