# include "cgi_utils.hpp" int main (int ac, char **av, char ** env) { std::string http_req_body; std::string http_resp_header; std::string http_resp_body; std::string tmp; (void)ac; (void)av; (void)env; /* rq_method = find_method(); rq_body = parse_body(); rq_query = parse_query(); method used : GET form query : key=val&key=val form body : EMPTY output : first name: John last name: Doe cgi env variables : CONTENT_TYPE: value ... */ tmp = "

PRINT ENV _________________

"; for (int i = 0; env[i] != NULL; ++i) { tmp += "

"; tmp += env[i]; tmp += "

"; } tmp += "

___________________________

"; http_req_body = parse_form_infos(); http_resp_body = HTML_BODY_TOP; http_resp_body += fill_tag("ENV:", "h3") + fill_env("REQUEST_METHOD"); http_resp_body += fill_form(http_req_body, "h3", "p"); http_resp_body += tmp; http_resp_body += HTML_BODY_BOTTOM; http_resp_header = "Content-Type: text/html; charset=UTF-8" CRLF; http_resp_header += "Content-Length: " + itos(http_resp_body.size()); std::cout << http_resp_header << CRLF CRLF << http_resp_body; return 0; }