From 33a17a01fe75c122304a836346731cf712fa9202 Mon Sep 17 00:00:00 2001 From: Andrew Bettison Date: Fri, 29 Sep 2017 15:32:53 +0930 Subject: [PATCH] Improve HTTP authorization diagnostics --- httpd.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/httpd.c b/httpd.c index 1960ed92..1708421c 100644 --- a/httpd.c +++ b/httpd.c @@ -391,6 +391,11 @@ int authorize_restful(struct http_request *r) return 200; } if (!is_authorized_restful(&r->request_header.authorization)) { + DEBUGF(httpd, "Authorization failed: scheme=%d user=%s password=%s", + r->request_header.authorization.scheme, + alloca_str_toprint(r->request_header.authorization.scheme == BASIC ? r->request_header.authorization.credentials.basic.user : NULL), + alloca_str_toprint(r->request_header.authorization.scheme == BASIC ? r->request_header.authorization.credentials.basic.password : NULL) + ); r->response.header.www_authenticate.scheme = BASIC; r->response.header.www_authenticate.realm = "Serval RESTful API"; return 401;