mirror of
https://github.com/KingDuckZ/kamokan.git
synced 2024-11-23 00:33:44 +00:00
Pass the istream to read_post instead of assuming std::cin.
This commit is contained in:
parent
c907e5dd49
commit
ed1343bd7b
3 changed files with 5 additions and 4 deletions
|
@ -32,7 +32,7 @@ namespace tawashi {
|
|||
namespace {
|
||||
} //unnamed namespace
|
||||
|
||||
const PostMapType& read_post (const Env& parEnv) {
|
||||
const PostMapType& read_post (std::istream& parSrc, const Env& parEnv) {
|
||||
static bool already_read = false;
|
||||
static PostMapType map;
|
||||
static std::string original_data;
|
||||
|
@ -45,7 +45,7 @@ namespace tawashi {
|
|||
if (input_len > 0) {
|
||||
original_data.reserve(input_len);
|
||||
std::copy_n(
|
||||
std::istream_iterator<char>(std::cin),
|
||||
std::istream_iterator<char>(parSrc),
|
||||
input_len,
|
||||
std::back_inserter(original_data)
|
||||
);
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
#include <boost/container/flat_map.hpp>
|
||||
#include <string>
|
||||
#include <istream>
|
||||
|
||||
namespace tawashi {
|
||||
|
||||
|
@ -27,6 +28,6 @@ namespace tawashi {
|
|||
|
||||
typedef boost::container::flat_map<std::string, std::string> PostMapType;
|
||||
|
||||
const PostMapType& read_post (const Env& parEnv);
|
||||
const PostMapType& read_post (std::istream& parSrc, const Env& parEnv);
|
||||
} //namespace cgi
|
||||
} //namespace tawashi
|
||||
|
|
|
@ -70,7 +70,7 @@ namespace tawashi {
|
|||
}
|
||||
|
||||
void SubmitPasteResponse::on_process() {
|
||||
auto post = cgi::read_post(cgi_env());
|
||||
auto post = cgi::read_post(std::cin, cgi_env());
|
||||
boost::string_ref pastie;
|
||||
boost::string_ref lang;
|
||||
boost::string_ref duration;
|
||||
|
|
Loading…
Reference in a new issue