diff --git a/lib/malloy/core/http/request.hpp b/lib/malloy/core/http/request.hpp index d9086aa..5fb51ce 100644 --- a/lib/malloy/core/http/request.hpp +++ b/lib/malloy/core/http/request.hpp @@ -1,12 +1,9 @@ #pragma once -#include "cookie.hpp" #include "types.hpp" #include -#include - namespace malloy::http { @@ -51,22 +48,6 @@ namespace malloy::http // Underlying msg_t::operator=(std::move(raw)); - - // Cookies - { - const auto &[begin, end] = msg_t::base().equal_range(field::cookie); - for (auto it = begin; it != end; it++) { - const auto &str = it->value(); - - const auto &sep_pos = it->value().find('='); - if (sep_pos == std::string::npos) - continue; - - std::string key{str.substr(0, sep_pos)}; - std::string value{str.substr(sep_pos + 1)}; - m_cookies.insert_or_assign(std::move(key), std::move(value)); - } - } } /** @@ -119,54 +100,8 @@ namespace malloy::http return m_port; } - /** - * Returns the request's cookies. - * - * @return The cookies. - */ - [[nodiscard]] - std::unordered_map - cookies() const noexcept - { - return m_cookies; - } - - /** - * Checks whether a particular cookie is present. - * - * @return Whether the specified cookie is present. - */ - [[nodiscard]] - bool - has_cookie(const std::string& name) const - { - return m_cookies.contains(name); - } - - /** - * Gets the value of a cookie. - */ - [[nodiscard]] - std::string_view - cookie(const std::string_view& name) const - { - const auto& it = std::find_if( - std::cbegin(m_cookies), - std::cend(m_cookies), - [&name](const auto& pair) { - return pair.first == name; - } - ); - - if (it == std::cend(m_cookies)) - return { }; - - return it->second; - } - private: std::uint16_t m_port = 0; - std::unordered_map m_cookies; }; } diff --git a/lib/malloy/core/http/response.hpp b/lib/malloy/core/http/response.hpp index b196cf2..7696637 100644 --- a/lib/malloy/core/http/response.hpp +++ b/lib/malloy/core/http/response.hpp @@ -130,6 +130,8 @@ namespace malloy::http /** * Adds a cookie. * + * @note This adds to the `Set-Cookie` field. + * * @param c The cookie. */ void diff --git a/lib/malloy/server/routing/router.hpp b/lib/malloy/server/routing/router.hpp index eb20064..ecb10f4 100644 --- a/lib/malloy/server/routing/router.hpp +++ b/lib/malloy/server/routing/router.hpp @@ -444,7 +444,8 @@ namespace malloy::server bool isWebsocket = false, typename Derived, typename Connection> - void handle_request( + void + handle_request( const std::filesystem::path& doc_root, const req_generator& req, Connection&& connection @@ -525,7 +526,8 @@ namespace malloy::server * @param connection The HTTP connection. */ template - void handle_http_request( + void + handle_http_request( const std::filesystem::path&, const req_generator& req, const http::connection_t& connection @@ -570,7 +572,8 @@ namespace malloy::server * @param connection The WebSocket connection. */ template - void handle_ws_request( + void + handle_ws_request( const req_generator& gen, const std::shared_ptr& connection )