From c9885115615671466a7e2888db2e333442960a95 Mon Sep 17 00:00:00 2001 From: Veloman Yunkan Date: Sun, 26 Jun 2022 13:42:29 +0400 Subject: [PATCH] Removed unused param from ContentResponse::build() Removed the isHomePage param from one of the variants of `ContentResponse::build()`. The other overload is dangerous since failing to review&update all of its call site may result in changed semantics. Will do it in a couple of separate commits. --- src/server/internalServer.cpp | 2 +- src/server/response.cpp | 5 ++--- src/server/response.h | 3 +-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/server/internalServer.cpp b/src/server/internalServer.cpp index 0e8dc6aa1..9ff0dddb0 100644 --- a/src/server/internalServer.cpp +++ b/src/server/internalServer.cpp @@ -623,7 +623,7 @@ InternalServer::get_matching_if_none_match_etag(const RequestContext& r) const std::unique_ptr InternalServer::build_homepage(const RequestContext& request) { - return ContentResponse::build(*this, m_indexTemplateString, get_default_data(), "text/html; charset=utf-8", true); + return ContentResponse::build(*this, m_indexTemplateString, get_default_data(), "text/html; charset=utf-8"); } /** diff --git a/src/server/response.cpp b/src/server/response.cpp index 8cf5c0c62..a38ef9789 100644 --- a/src/server/response.cpp +++ b/src/server/response.cpp @@ -445,11 +445,10 @@ std::unique_ptr ContentResponse::build( const InternalServer& server, const std::string& template_str, kainjow::mustache::data data, - const std::string& mimetype, - bool isHomePage) + const std::string& mimetype) { auto content = render_template(template_str, data); - return ContentResponse::build(server, content, mimetype, isHomePage); + return ContentResponse::build(server, content, mimetype); } ItemResponse::ItemResponse(bool verbose, const zim::Item& item, const std::string& mimetype, const ByteRange& byterange) : diff --git a/src/server/response.h b/src/server/response.h index 34b9676dd..657ecc5d7 100644 --- a/src/server/response.h +++ b/src/server/response.h @@ -99,8 +99,7 @@ class ContentResponse : public Response { const InternalServer& server, const std::string& template_str, kainjow::mustache::data data, - const std::string& mimetype, - bool isHomePage = false); + const std::string& mimetype); private: MHD_Response* create_mhd_response(const RequestContext& request);