#ifndef CGI_UTILS_HPP # define CGI_UTILS_HPP # include # include # include # include # include # include // getenv # include // transform # include // sleep, close, access # define CR "\r" # define LF "\n" # define CRLF CR LF # define CRLF_SIZE 2 # define NPOS std::string::npos # define HTML_BODY_TOP ""\ ""\ " "\ " "\ " "\ " CGI"\ " "\ " "\ " "\ "

CGI


" # define HTML_BODY_BOTTOM "

END CGI

"\ " "\ "" std::string str_tolower(std::string str); std::string trim(std::string str, char del); std::vector split(const std::string & input, std::string delim, char ctrim = '\0'); std::string itos(int n); std::string parse_env(const std::string & env); std::string print_env(char **env, std::string tag = "p"); std::string get_form_infos(const std::string & rq_body); std::string get_value(const std::string & key, const std::string & rq_body); std::string print_form(std::string form, std::string key = "p", std::string val = "p"); void fill_body_basic(char **env, std::string & http_body, const std::string & rq_body); size_t eval_file_read(const std::string &path); #endif