2017-04-04 20:58:40 +01:00
|
|
|
#include "incredis/incredis.hpp"
|
|
|
|
#include "submit_form_response.hpp"
|
2017-04-06 21:27:38 +01:00
|
|
|
#include "index_response.hpp"
|
2017-04-05 08:41:49 +01:00
|
|
|
#include "cgi_env.hpp"
|
2017-04-04 20:58:40 +01:00
|
|
|
#include <iostream>
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
//www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4150.pdf
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
} //unnamed namespace
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
//std::cout << "Content-type:text/plain\n\n";
|
|
|
|
|
|
|
|
redis::IncRedis incredis("127.0.0.1", 6379);
|
2017-04-06 22:42:43 +01:00
|
|
|
incredis.connect();
|
2017-04-04 20:58:40 +01:00
|
|
|
|
2017-04-05 08:41:49 +01:00
|
|
|
tawashi::CGIEnv cgi_env;
|
2017-04-06 21:27:38 +01:00
|
|
|
if (cgi_env.path_info() == "/index.cgi") {
|
|
|
|
tawashi::IndexResponse resp;
|
|
|
|
resp.send();
|
2017-04-04 20:58:40 +01:00
|
|
|
}
|
2017-04-06 21:27:38 +01:00
|
|
|
else if (cgi_env.path_info() == "/paste.cgi") {
|
|
|
|
tawashi::SubmitFormResponse resp(incredis);
|
|
|
|
resp.send();
|
2017-04-06 20:15:44 +01:00
|
|
|
}
|
2017-04-06 22:42:43 +01:00
|
|
|
else {
|
|
|
|
std::cout << "Content-type:text/plain\n\n";
|
|
|
|
std::cout << "you shouldn't be here\n";
|
|
|
|
}
|
2017-04-04 20:58:40 +01:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|