Don't return a Basic realm if there is no body.

This commit is contained in:
default 2024-06-09 17:04:34 +02:00
parent c648fab797
commit 2e9e2ebd18

View file

@ -406,7 +406,7 @@ void httpd_connection(FILE *f)
if (status == HTTP_STATUS_SEE_OTHER) if (status == HTTP_STATUS_SEE_OTHER)
headers = xs_dict_append(headers, "location", body); headers = xs_dict_append(headers, "location", body);
if (status == HTTP_STATUS_UNAUTHORIZED) { if (status == HTTP_STATUS_UNAUTHORIZED && body) {
xs *www_auth = xs_fmt("Basic realm=\"@%s@%s snac login\"", xs *www_auth = xs_fmt("Basic realm=\"@%s@%s snac login\"",
body, xs_dict_get(srv_config, "host")); body, xs_dict_get(srv_config, "host"));