Loading editor/src/webedit_server.cpp +13 −1 Original line number Diff line number Diff line Loading @@ -65,13 +65,25 @@ webedit::Server::~Server() { std::string webedit::Server::getCookie(libhttppp::HttpRequest &curreq, const std::string &name) { auto normalizeCookieValue = [](std::string value) { while (!value.empty() && std::isspace(static_cast<unsigned char>(value.front()))) value.erase(value.begin()); while (!value.empty() && std::isspace(static_cast<unsigned char>(value.back()))) value.pop_back(); if (value.size() >= 2 && value.front() == '"' && value.back() == '"') value = value.substr(1, value.size() - 2); return value; }; try { libhttppp::HttpCookie cookie; cookie.parse(curreq); auto *cd = cookie.getfirstCookieData(); while (cd) { if (cd->getKey() == name) return cd->getValue(); return normalizeCookieValue(cd->getValue()); cd = cd->nextCookieData(); } } catch (...) { Loading Loading
editor/src/webedit_server.cpp +13 −1 Original line number Diff line number Diff line Loading @@ -65,13 +65,25 @@ webedit::Server::~Server() { std::string webedit::Server::getCookie(libhttppp::HttpRequest &curreq, const std::string &name) { auto normalizeCookieValue = [](std::string value) { while (!value.empty() && std::isspace(static_cast<unsigned char>(value.front()))) value.erase(value.begin()); while (!value.empty() && std::isspace(static_cast<unsigned char>(value.back()))) value.pop_back(); if (value.size() >= 2 && value.front() == '"' && value.back() == '"') value = value.substr(1, value.size() - 2); return value; }; try { libhttppp::HttpCookie cookie; cookie.parse(curreq); auto *cd = cookie.getfirstCookieData(); while (cd) { if (cd->getKey() == name) return cd->getValue(); return normalizeCookieValue(cd->getValue()); cd = cd->nextCookieData(); } } catch (...) { Loading