Browse Source

Rename function

adaptive-webui-19844
Chocobo1 5 years ago
parent
commit
d57b9be706
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 2
      src/base/http/responsebuilder.cpp
  2. 2
      src/base/http/responsebuilder.h
  3. 10
      src/webui/webapplication.cpp

2
src/base/http/responsebuilder.cpp

@ -35,7 +35,7 @@ void ResponseBuilder::status(const uint code, const QString &text) @@ -35,7 +35,7 @@ void ResponseBuilder::status(const uint code, const QString &text)
m_response.status = {code, text};
}
void ResponseBuilder::header(const Header &header)
void ResponseBuilder::setHeader(const Header &header)
{
m_response.headers[header.name] = header.value;
}

2
src/base/http/responsebuilder.h

@ -37,7 +37,7 @@ namespace Http @@ -37,7 +37,7 @@ namespace Http
{
public:
void status(uint code = 200, const QString &text = QLatin1String("OK"));
void header(const Header &header);
void setHeader(const Header &header);
void print(const QString &text, const QString &type = CONTENT_TYPE_HTML);
void print(const QByteArray &data, const QString &type = CONTENT_TYPE_HTML);
void clear();

10
src/webui/webapplication.cpp

@ -400,7 +400,7 @@ void WebApplication::sendFile(const QString &path) @@ -400,7 +400,7 @@ void WebApplication::sendFile(const QString &path)
const auto it = m_translatedFiles.constFind(path);
if ((it != m_translatedFiles.constEnd()) && (lastModified <= it->lastModified)) {
print(it->data, it->mimeType);
header({Http::HEADER_CACHE_CONTROL, getCachingInterval(it->mimeType)});
setHeader({Http::HEADER_CACHE_CONTROL, getCachingInterval(it->mimeType)});
return;
}
@ -432,7 +432,7 @@ void WebApplication::sendFile(const QString &path) @@ -432,7 +432,7 @@ void WebApplication::sendFile(const QString &path)
}
print(data, mimeType.name());
header({Http::HEADER_CACHE_CONTROL, getCachingInterval(mimeType.name())});
setHeader({Http::HEADER_CACHE_CONTROL, getCachingInterval(mimeType.name())});
}
Http::Response WebApplication::processRequest(const Http::Request &request, const Http::Environment &env)
@ -470,7 +470,7 @@ Http::Response WebApplication::processRequest(const Http::Request &request, cons @@ -470,7 +470,7 @@ Http::Response WebApplication::processRequest(const Http::Request &request, cons
}
for (const Http::Header &prebuiltHeader : asConst(m_prebuiltHeaders))
header(prebuiltHeader);
setHeader(prebuiltHeader);
return response();
}
@ -562,7 +562,7 @@ void WebApplication::sessionStart() @@ -562,7 +562,7 @@ void WebApplication::sessionStart()
QByteArray cookieRawForm = cookie.toRawForm();
if (m_isCSRFProtectionEnabled)
cookieRawForm.append("; SameSite=Strict");
header({Http::HEADER_SET_COOKIE, cookieRawForm});
setHeader({Http::HEADER_SET_COOKIE, cookieRawForm});
}
void WebApplication::sessionEnd()
@ -576,7 +576,7 @@ void WebApplication::sessionEnd() @@ -576,7 +576,7 @@ void WebApplication::sessionEnd()
delete m_sessions.take(m_currentSession->id());
m_currentSession = nullptr;
header({Http::HEADER_SET_COOKIE, cookie.toRawForm()});
setHeader({Http::HEADER_SET_COOKIE, cookie.toRawForm()});
}
bool WebApplication::isCrossSiteRequest(const Http::Request &request) const

Loading…
Cancel
Save