diff --git a/src/tawashi_implem/response.cpp b/src/tawashi_implem/response.cpp index d547cf1..c5692c1 100644 --- a/src/tawashi_implem/response.cpp +++ b/src/tawashi_implem/response.cpp @@ -185,6 +185,7 @@ namespace tawashi { break; case Location: SPDLOG_TRACE(statuslog, "Response is a Location (redirect)"); + *m_stream_out << "Status: 303 See Other" << "\n"; *m_stream_out << "Location: " << m_resp_value << "\n\n"; render_page = false; break; diff --git a/src/tawashi_implem/submit_paste_response.cpp b/src/tawashi_implem/submit_paste_response.cpp index a68fb78..cd6d434 100644 --- a/src/tawashi_implem/submit_paste_response.cpp +++ b/src/tawashi_implem/submit_paste_response.cpp @@ -127,8 +127,10 @@ namespace tawashi { const SettingsBag& settings = this->settings(); const auto max_sz = settings.as("max_pastie_size"); - if (pastie.size() < settings.as("min_pastie_size")) + if (pastie.size() < settings.as("min_pastie_size")) { + error_redirect(431, ErrorReasons::PostLengthNotInRange); return; + } if (max_sz and pastie.size() > max_sz) { if (settings.as("truncate_long_pasties")) { pastie = pastie.substr(0, max_sz); @@ -147,11 +149,13 @@ namespace tawashi { if (token) { std::ostringstream oss; oss << base_uri() << '/' << *token; + statuslog->info("Pastie token=\"{}\" redirect=\"{}\"", *token, oss.str()); if (not lang.empty()) oss << '?' << lang; this->change_type(Response::Location, oss.str()); } else { + statuslog->info("Empty pastie token (possibly due to a previous failure)"); return; } }