# include # include # include int main (int ac, char **av) { std::string to_send; std::string header; std::string end_header = "\r\n\r\n"; std::string response; std::stringstream strs; header = "HTTP/1.1 200 OK\n"; header += "Content-Type: text/html; charset=UTF-8\n"; header += "Content-Length: "; response = "\n"; response += "\n"; response += "\n"; response += "CGI\n"; response += "\n"; response += "\n"; response += "

CGI request :

\n"; for (int i = 1; i < ac; i++) { response += "

"; response += av[i]; response += "

\n"; } response += "\n"; response += "\n"; strs << response.size(); header += strs.str(); header += end_header; to_send = header; to_send += response; std::cout << to_send; return 0; }