Browse Source

WebUI: Add charset attribute to text content types.

adaptive-webui-19844
Vladimir Golovnev (Glassez) 10 years ago
parent
commit
d85c3170b2
  1. 2
      src/webui/abstractrequesthandler.cpp
  2. 8
      src/webui/httptypes.h
  3. 2
      src/webui/requesthandler.cpp

2
src/webui/abstractrequesthandler.cpp

@ -50,7 +50,7 @@ HttpResponse AbstractRequestHandler::run()
if (isBanned()) if (isBanned())
{ {
status(403, "Forbidden"); status(403, "Forbidden");
print(QObject::tr("Your IP address has been banned after too many failed authentication attempts.")); print(QObject::tr("Your IP address has been banned after too many failed authentication attempts."), CONTENT_TYPE_TXT);
} }
else else
{ {

8
src/webui/httptypes.h

@ -40,12 +40,12 @@ const QString HEADER_CONTENT_TYPE = "Content-Type";
const QString HEADER_CONTENT_ENCODING = "Content-Encoding"; const QString HEADER_CONTENT_ENCODING = "Content-Encoding";
const QString HEADER_CONTENT_LENGTH = "Content-Length"; const QString HEADER_CONTENT_LENGTH = "Content-Length";
const QString CONTENT_TYPE_CSS = "text/css"; const QString CONTENT_TYPE_CSS = "text/css; charset=UTF-8";
const QString CONTENT_TYPE_GIF = "image/gif"; const QString CONTENT_TYPE_GIF = "image/gif";
const QString CONTENT_TYPE_HTML = "text/html"; const QString CONTENT_TYPE_HTML = "text/html; charset=UTF-8";
const QString CONTENT_TYPE_JS = "text/javascript"; const QString CONTENT_TYPE_JS = "text/javascript; charset=UTF-8";
const QString CONTENT_TYPE_PNG = "image/png"; const QString CONTENT_TYPE_PNG = "image/png";
const QString CONTENT_TYPE_TXT = "text/plain"; const QString CONTENT_TYPE_TXT = "text/plain; charset=UTF-8";
struct HttpEnvironment struct HttpEnvironment
{ {

2
src/webui/requesthandler.cpp

@ -268,7 +268,7 @@ void RequestHandler::action_command_upload()
{ {
qWarning() << "I/O Error: Could not create temporary file"; qWarning() << "I/O Error: Could not create temporary file";
status(500, "Internal Server Error"); status(500, "Internal Server Error");
print(QByteArray("I/O Error: Could not create temporary file."), CONTENT_TYPE_TXT); print(QObject::tr("I/O Error: Could not create temporary file."), CONTENT_TYPE_TXT);
} }
} }
} }

Loading…
Cancel
Save