Browse Source

Follow project coding style. Issue #2192.

adaptive-webui-19844
buinsky 10 years ago
parent
commit
dbc5ffee75
  1. 20
      src/webui/abstractrequesthandler.cpp

20
src/webui/abstractrequesthandler.cpp

@ -47,13 +47,11 @@ HttpResponse AbstractRequestHandler::run() @@ -47,13 +47,11 @@ HttpResponse AbstractRequestHandler::run()
{
response_ = HttpResponse();
if (isBanned())
{
if (isBanned()) {
status(403, "Forbidden");
print(QObject::tr("Your IP address has been banned after too many failed authentication attempts."), CONTENT_TYPE_TXT);
}
else
{
else {
processRequest();
}
@ -105,8 +103,7 @@ void AbstractRequestHandler::printFile(const QString& path) @@ -105,8 +103,7 @@ void AbstractRequestHandler::printFile(const QString& path)
QByteArray data;
QString type;
if (!app_->readFile(path, data, type))
{
if (!app_->readFile(path, data, type)) {
status(404, "Not Found");
return;
}
@ -121,8 +118,7 @@ void AbstractRequestHandler::sessionInitialize() @@ -121,8 +118,7 @@ void AbstractRequestHandler::sessionInitialize()
void AbstractRequestHandler::sessionStart()
{
if (app_->sessionStart(this))
{
if (app_->sessionStart(this)) {
QNetworkCookie cookie(C_SID.toUtf8(), session_->id.toUtf8());
cookie.setPath("/");
header(HEADER_SET_COOKIE, cookie.toRawForm());
@ -131,18 +127,15 @@ void AbstractRequestHandler::sessionStart() @@ -131,18 +127,15 @@ void AbstractRequestHandler::sessionStart()
void AbstractRequestHandler::sessionEnd()
{
if (sessionActive())
{
if (sessionActive()) {
QNetworkCookie cookie(C_SID.toUtf8(), session_->id.toUtf8());
cookie.setPath("/");
cookie.setExpirationDate(QDateTime::currentDateTime());
if (app_->sessionEnd(this))
{
header(HEADER_SET_COOKIE, cookie.toRawForm());
}
}
}
bool AbstractRequestHandler::isBanned() const
{
@ -168,8 +161,7 @@ QString AbstractRequestHandler::saveTmpFile(const QByteArray &data) @@ -168,8 +161,7 @@ QString AbstractRequestHandler::saveTmpFile(const QByteArray &data)
{
QTemporaryFile tmpfile(QDir::temp().absoluteFilePath("qBT-XXXXXX.torrent"));
tmpfile.setAutoRemove(false);
if (tmpfile.open())
{
if (tmpfile.open()) {
tmpfile.write(data);
tmpfile.close();
return tmpfile.fileName();

Loading…
Cancel
Save