more script tests

+ add cgi checks for error in script output
+ fix script_path relative to absolute
+ cgi makefile more efficient
This commit is contained in:
Hugo LAMY
2022-08-16 18:24:49 +02:00
parent ff443c80b1
commit 1ed4128afc
21 changed files with 485 additions and 109 deletions

View File

@@ -8,6 +8,7 @@
# include <vector>
# include <stdlib.h> // getenv
# include <algorithm> // transform
# include <unistd.h> // sleep
# define CR "\r"
# define LF "\n"
@@ -24,42 +25,44 @@
" <link href=\"./cgi_style.css\" type=\"text/css\" rel=\"stylesheet\">"\
" </head>"\
" <body>"\
" <h1>cgi</h1><br>"
# define HTML_BODY_BOTTOM " </body>"\
" <h1>CGI</h1><br>"
# define HTML_BODY_BOTTOM " <br><h1>END CGI</h1>"\
" </body>"\
"</html>"
std::string
str_tolower(std::string str);
str_tolower(std::string str);
std::string
trim(std::string str, char del);
trim(std::string str, char del);
std::vector<std::string>
split(const std::string & input, std::string delim, char ctrim = '\0');
split(const std::string & input, std::string delim, char ctrim = '\0');
std::string
itos(int n);
itos(int n);
std::string
parse_env(const std::string & env);
parse_env(const std::string & env);
std::string
parse_body();
print_env(char **env, std::string tag = "p");
std::string
print_env(char **env, std::string tag = "p");
get_form_infos(const std::string & rq_body);
std::string
get_form_infos();
get_value(const std::string & key, const std::string & rq_body);
std::string
get_value(std::string key);
std::string
print_form(std::string form, std::string key = "p", std::string val = "p");
print_form(std::string form, std::string key = "p", std::string val = "p");
void
fill_response_basic(char **env, std::string & body, std::string & header);
fill_response_basic(
char **env,
std::string & http_body,
std::string & http_header,
const std::string & rq_body);
#endif