WebUI: Set correct HTTP Content-Type in case of forbidden access

The error message is an utf-8 string. With no charset specified,
web browsers will likely use the wrong one making reading the message
in some languages impossibile.
This commit is contained in:
Gabriele 2014-10-16 23:10:18 +01:00
commit 83b6619b16

View file

@ -193,6 +193,7 @@ void HttpConnection::respond() {
if (nb_fail >= MAX_AUTH_FAILED_ATTEMPTS) {
m_generator.setStatusLine(403, "Forbidden");
m_generator.setMessage(tr("Your IP address has been banned after too many failed authentication attempts."));
m_generator.setContentType("text/plain; charset=utf-8");
m_generator.setContentEncoding(m_parser.acceptsEncoding());
write();
return;