From 19d786631a21cf4045778e80c0ffaba141d3f5ae Mon Sep 17 00:00:00 2001 From: blue Date: Wed, 17 Jan 2024 18:56:53 -0300 Subject: [PATCH] some debug --- database/mysql/mysql.cpp | 4 ++-- response/response.cpp | 14 +++++++------- server/session.cpp | 6 +++++- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/database/mysql/mysql.cpp b/database/mysql/mysql.cpp index 6a807fb..062f972 100644 --- a/database/mysql/mysql.cpp +++ b/database/mysql/mysql.cpp @@ -23,8 +23,8 @@ constexpr const char* createSessionQuery = "INSERT INTO sessions (`owner`, `acce " RETURNING id, owner"; constexpr const char* selectSession = "SELECT id, owner, access, renew FROM sessions where access = ?"; constexpr const char* selectAssets = "SELECT id, owner, currency, title, icon, archived FROM assets where owner = ?"; -constexpr const char* insertAsset = "INSERT INTO assets (`owner`, `currency`, `title`, `icon`, `archived`)" - " VALUES (?, ?, ?, ?, ?)"; +constexpr const char* insertAsset = "INSERT INTO assets (`owner`, `currency`, `title`, `icon`, `archived`, `type`)" + " VALUES (?, ?, ?, ?, ?, 1)"; static const std::filesystem::path buildSQLPath = "database"; diff --git a/response/response.cpp b/response/response.cpp index 7a4e4cb..1db90f0 100644 --- a/response/response.cpp +++ b/response/response.cpp @@ -26,8 +26,8 @@ constexpr std::array(Response::Status::__ }; constexpr std::array(Response::ContentType::__size)> contentTypes = { - "Content-type: text/plain", - "Content-type: application/json" + "Content-Type: text/plain", + "Content-Type: application/json" }; Response::Response(Request& request): @@ -50,13 +50,13 @@ void Response::send() const { // request.getErrorStream(); OStream out = request.getOutputStream(); - out << statuses[static_cast(status)]; + out << statuses[static_cast(status)] << "\r\n"; if (!body.empty()) - out << '\n' - << contentTypes[static_cast(type)] - << '\n' - << '\n' + out << contentTypes[static_cast(type)] << "\r\n" + << "\r\n" << body; + else + out << "\r\n"; request.responseIsComplete(); } diff --git a/server/session.cpp b/server/session.cpp index ef13c2a..4cd0c60 100644 --- a/server/session.cpp +++ b/server/session.cpp @@ -22,7 +22,11 @@ Session::Session( timeoutId(TM::Scheduler::none), timeout(timeout), mtx(), - cache() + cache({ + {"system", { + {"invalidate", true} + }} + }) {} Session::~Session () {