summaryrefslogtreecommitdiffhomepage
path: root/src/html-error.c
diff options
context:
space:
mode:
authorrofl0r <rofl0r@users.noreply.github.com>2019-06-14 01:18:17 +0100
committerrofl0r <rofl0r@users.noreply.github.com>2019-06-14 01:18:19 +0100
commit734ba1d9702cd7d420c624c3574bec1470ebf590 (patch)
tree1a025bd5c2865dd7eacdd4a4947ea4da228d7a4e /src/html-error.c
parente666e4a35b07a406437e4c58a15d81adf7cb5fd7 (diff)
fix usage of stathost in combination with basic auth
http protocol requires different treatment of proxy auth vs server auth. fixes #246
Diffstat (limited to 'src/html-error.c')
-rw-r--r--src/html-error.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/html-error.c b/src/html-error.c
index 625a586..ee3c987 100644
--- a/src/html-error.c
+++ b/src/html-error.c
@@ -164,13 +164,17 @@ int send_http_headers (struct conn_s *connptr, int code, const char *message)
"%s"
"Connection: close\r\n" "\r\n";
- const char auth_str[] =
+ const char p_auth_str[] =
"Proxy-Authenticate: Basic realm=\""
PACKAGE_NAME "\"\r\n";
+ const char w_auth_str[] =
+ "WWW-Authenticate: Basic realm=\""
+ PACKAGE_NAME "\"\r\n";
+
/* according to rfc7235, the 407 error must be accompanied by
a Proxy-Authenticate header field. */
- const char *add = code == 407 ? auth_str : "";
+ const char *add = code == 407 ? p_auth_str : (code == 401 ? w_auth_str : "");
return (write_message (connptr->client_fd, headers,
code, message, PACKAGE, VERSION,