41 lines
1004 B
C++
41 lines
1004 B
C++
|
|
# include "cgi_utils.hpp"
|
|
|
|
int main ()
|
|
{
|
|
std::vector<std::string> split_str;
|
|
std::vector<std::string> sub_split_str;
|
|
std::vector<std::string>::const_iterator it;
|
|
std::string input;
|
|
std::string http_header;
|
|
std::string http_body;
|
|
|
|
std::cin >> input;
|
|
|
|
http_body = HTML_BODY_TOP;
|
|
|
|
http_body += fill_env("REQUEST_METHOD", "h3");
|
|
|
|
split_str = split(input, "&");
|
|
for (it = split_str.begin(); it != split_str.end(); ++it)
|
|
{
|
|
sub_split_str = split(*it, "=");
|
|
http_body += "<h3>";
|
|
http_body += sub_split_str[0];
|
|
http_body += "</h3>";
|
|
http_body += "<p>";
|
|
http_body += sub_split_str[1];
|
|
http_body += "</p>";
|
|
}
|
|
|
|
http_body += HTML_BODY_BOTTOM;
|
|
|
|
http_header = "Content-Type: text/html; charset=UTF-8" CRLF;
|
|
http_header += "Content-Length: ";
|
|
http_header += itos(http_body.size());
|
|
|
|
std::cout << http_header << CRLF CRLF << http_body;
|
|
return 0;
|
|
}
|
|
|