cookie debug log
This commit is contained in:
@@ -26,7 +26,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
constexpr const int getValueBeforeSpaceLIMIT = 200;
|
||||
constexpr const int getValueBeforeBodyLIMIT = 1000;
|
||||
|
||||
constexpr const char* lastTrafficVolumeCookie = "trafficvolume";
|
||||
constexpr const char* LAST_TRAFFIC_VOLUME_COOKIE = "trafficvolume";
|
||||
|
||||
SocketRunnable::SocketRunnable(qintptr socketDescriptor, QObject *parent) :
|
||||
SocketRunnableBase(socketDescriptor, parent)
|
||||
@@ -37,17 +37,13 @@ void SocketRunnable::get()
|
||||
{
|
||||
if (urlPath() == "/index.html")
|
||||
{
|
||||
quint64 lastTrafficVolume = 0;
|
||||
const QString cookieString = g::getValue(m_headers, "Cookie", g::GetValueType::HttpHeader);
|
||||
if (not cookieString.isEmpty())
|
||||
{
|
||||
lastTrafficVolume = g::getValue(m_headers, lastTrafficVolumeCookie).toULongLong();
|
||||
}
|
||||
|
||||
quint64 lastTrafficVolume = g::getValue(m_headers, LAST_TRAFFIC_VOLUME_COOKIE).toULongLong();
|
||||
qDebug() << "Cookie trafficvolume: raw " << cookieString << "; parsed" << lastTrafficVolume;
|
||||
quint64 currentTrafficVolume = 0;
|
||||
httpDocument().setBody( WebPage::document(lastTrafficVolume, ¤tTrafficVolume) );
|
||||
httpDocument().setHeader(HttpDocument::CommonHeader::SetCookie,
|
||||
QString(lastTrafficVolumeCookie)+"="+QString::number(currentTrafficVolume)+"; max-age=31536000;");
|
||||
QString(LAST_TRAFFIC_VOLUME_COOKIE)+"="+QString::number(currentTrafficVolume)+"; max-age=31536000;");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user