mirror of
https://github.com/KingDuckZ/kamokan.git
synced 2025-02-09 09:23:56 +00:00
Fix tawashi sending back an html response even for redirects.
This commit is contained in:
parent
f19d78222f
commit
85f6781d81
2 changed files with 19 additions and 13 deletions
|
@ -177,6 +177,7 @@ namespace tawashi {
|
|||
this->on_mustache_prepare(mustache_context);
|
||||
|
||||
m_header_sent = true;
|
||||
bool render_page = true;
|
||||
switch (m_resp_type) {
|
||||
case ContentType:
|
||||
SPDLOG_TRACE(statuslog, "Response is a Content-type (data)");
|
||||
|
@ -185,21 +186,25 @@ namespace tawashi {
|
|||
case Location:
|
||||
SPDLOG_TRACE(statuslog, "Response is a Location (redirect)");
|
||||
*m_stream_out << "Location: " << m_resp_value << "\n\n";
|
||||
render_page = false;
|
||||
break;
|
||||
}
|
||||
|
||||
SPDLOG_TRACE(statuslog, "Rendering in mustache");
|
||||
*m_stream_out << mstch::render(
|
||||
on_mustache_retrieve(),
|
||||
mustache_context,
|
||||
std::bind(
|
||||
&load_whole_file,
|
||||
std::cref(m_website_root),
|
||||
".mustache",
|
||||
std::placeholders::_1,
|
||||
false
|
||||
)
|
||||
);
|
||||
if (render_page) {
|
||||
SPDLOG_TRACE(statuslog, "Rendering in mustache");
|
||||
*m_stream_out << mstch::render(
|
||||
on_mustache_retrieve(),
|
||||
mustache_context,
|
||||
std::bind(
|
||||
&load_whole_file,
|
||||
std::cref(m_website_root),
|
||||
".mustache",
|
||||
std::placeholders::_1,
|
||||
false
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
SPDLOG_TRACE(statuslog, "Flushing output");
|
||||
m_stream_out->flush();
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <string>
|
||||
#include <boost/optional.hpp>
|
||||
#include <boost/utility/string_ref.hpp>
|
||||
#include <cassert>
|
||||
|
||||
namespace tawashi {
|
||||
class SubmitPasteResponse : public Response {
|
||||
|
@ -33,7 +34,7 @@ namespace tawashi {
|
|||
);
|
||||
|
||||
protected:
|
||||
virtual boost::string_ref page_basename() const override { return boost::string_ref("paste"); }
|
||||
virtual boost::string_ref page_basename() const override { assert(false); return boost::string_ref(""); }
|
||||
|
||||
private:
|
||||
virtual void on_process() override;
|
||||
|
|
Loading…
Add table
Reference in a new issue