diff --git a/src/html-error.c b/src/html-error.c index 071d415..b6dd29d 100644 --- a/src/html-error.c +++ b/src/html-error.c @@ -133,7 +133,9 @@ send_html_file (FILE *infile, struct conn_s *connptr) return 1; } -int send_http_headers (struct conn_s *connptr, int code, const char *message) +int send_http_headers ( + struct conn_s *connptr, int code, + const char *message, const char *extra) { const char headers[] = "HTTP/1.0 %d %s\r\n" @@ -142,21 +144,9 @@ int send_http_headers (struct conn_s *connptr, int code, const char *message) "%s" "Connection: close\r\n" "\r\n"; - 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 ? p_auth_str : (code == 401 ? w_auth_str : ""); - return (write_message (connptr->client_fd, headers, code, message, PACKAGE, VERSION, - add)); + extra)); } /* @@ -180,8 +170,21 @@ int send_http_error_message (struct conn_s *connptr) "
Generated by %s version %s.
\n" "