mirror of
https://github.com/KingDuckZ/kamokan.git
synced 2025-08-03 12:50:02 +00:00
Rename submit form to submit paste.
This commit is contained in:
parent
dbd1a3a90a
commit
33c52b88d5
4 changed files with 9 additions and 9 deletions
|
@ -10,7 +10,7 @@ add_executable(${PROJECT_NAME}
|
||||||
main.cpp
|
main.cpp
|
||||||
split_get_vars.cpp
|
split_get_vars.cpp
|
||||||
response.cpp
|
response.cpp
|
||||||
submit_form_response.cpp
|
submit_paste_response.cpp
|
||||||
get_env.cpp
|
get_env.cpp
|
||||||
envy.cpp
|
envy.cpp
|
||||||
cgi_env.cpp
|
cgi_env.cpp
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#include "incredis/incredis.hpp"
|
#include "incredis/incredis.hpp"
|
||||||
#include "submit_form_response.hpp"
|
#include "submit_paste_response.hpp"
|
||||||
#include "index_response.hpp"
|
#include "index_response.hpp"
|
||||||
#include "cgi_env.hpp"
|
#include "cgi_env.hpp"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -22,7 +22,7 @@ int main() {
|
||||||
resp.send();
|
resp.send();
|
||||||
}
|
}
|
||||||
else if (cgi_env.path_info() == "/paste.cgi") {
|
else if (cgi_env.path_info() == "/paste.cgi") {
|
||||||
tawashi::SubmitFormResponse resp(incredis);
|
tawashi::SubmitPasteResponse resp(incredis);
|
||||||
resp.send();
|
resp.send();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include "submit_form_response.hpp"
|
#include "submit_paste_response.hpp"
|
||||||
#include "incredis/incredis.hpp"
|
#include "incredis/incredis.hpp"
|
||||||
#include "cgi_post.hpp"
|
#include "cgi_post.hpp"
|
||||||
#include "num_to_token.hpp"
|
#include "num_to_token.hpp"
|
||||||
|
@ -9,13 +9,13 @@ namespace tawashi {
|
||||||
const char g_post_key[] = "pastie";
|
const char g_post_key[] = "pastie";
|
||||||
} //unnamed namespace
|
} //unnamed namespace
|
||||||
|
|
||||||
SubmitFormResponse::SubmitFormResponse (redis::IncRedis& parRedis) :
|
SubmitPasteResponse::SubmitPasteResponse (redis::IncRedis& parRedis) :
|
||||||
Response("text/plain"),
|
Response("text/plain"),
|
||||||
m_redis(parRedis)
|
m_redis(parRedis)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void SubmitFormResponse::on_send (std::ostream& parStream) {
|
void SubmitPasteResponse::on_send (std::ostream& parStream) {
|
||||||
auto post = cgi::read_post(cgi_env());
|
auto post = cgi::read_post(cgi_env());
|
||||||
auto post_data_it = post.find(g_post_key);
|
auto post_data_it = post.find(g_post_key);
|
||||||
if (post.end() == post_data_it) {
|
if (post.end() == post_data_it) {
|
||||||
|
@ -29,7 +29,7 @@ namespace tawashi {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SubmitFormResponse::submit_to_redis (const std::string& parText) const {
|
bool SubmitPasteResponse::submit_to_redis (const std::string& parText) const {
|
||||||
if (not m_redis.is_connected()) {
|
if (not m_redis.is_connected()) {
|
||||||
m_redis.connect();
|
m_redis.connect();
|
||||||
m_redis.wait_for_connect();
|
m_redis.wait_for_connect();
|
|
@ -8,9 +8,9 @@ namespace redis {
|
||||||
} //namespace redis
|
} //namespace redis
|
||||||
|
|
||||||
namespace tawashi {
|
namespace tawashi {
|
||||||
class SubmitFormResponse : public Response {
|
class SubmitPasteResponse : public Response {
|
||||||
public:
|
public:
|
||||||
explicit SubmitFormResponse (redis::IncRedis& parRedis);
|
explicit SubmitPasteResponse (redis::IncRedis& parRedis);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void on_send (std::ostream& parStream) override;
|
virtual void on_send (std::ostream& parStream) override;
|
Loading…
Add table
Add a link
Reference in a new issue