1
0
Fork 0
mirror of https://github.com/KingDuckZ/kamokan.git synced 2024-11-27 00:43:47 +00:00

Fix data corruption when submitting a pastie.

This commit is contained in:
King_DuckZ 2017-06-08 23:38:11 +01:00
parent f3868e5b3f
commit 43e97ee79b
4 changed files with 4 additions and 4 deletions

View file

@ -214,7 +214,7 @@ namespace tawashi {
return *m_cgi_env;
}
cgi::PostMapType Response::cgi_post() const {
const cgi::PostMapType& Response::cgi_post() const {
return cgi::read_post(std::cin, cgi_env(), settings().as<uint32_t>("max_post_size"));
}

View file

@ -50,7 +50,7 @@ namespace tawashi {
);
const cgi::Env& cgi_env() const;
tawashi_virtual_testing cgi::PostMapType cgi_post() const;
tawashi_virtual_testing const cgi::PostMapType& cgi_post() const;
const std::string& base_uri() const;
virtual boost::string_view page_basename() const = 0;

View file

@ -104,7 +104,7 @@ namespace tawashi {
const SettingsBag& settings = this->settings();
try {
auto post = this->cgi_post();
auto& post = this->cgi_post();
pastie = get_value_from_post(post, make_string_view(g_post_key));
lang = get_value_from_post_log_failure(post, make_string_view(g_language_key));
duration = get_value_from_post_log_failure(post, make_string_view(g_duration_key));

View file

@ -44,7 +44,7 @@ namespace tawashi {
{
}
virtual cgi::PostMapType cgi_post() const override {
virtual const cgi::PostMapType& cgi_post() const override {
CHECK(not m_post_data.empty());
std::istringstream iss(m_post_data);
return cgi::read_post(iss, this->cgi_env(), this->settings().as<uint32_t>("max_post_size"));