set SERVER_NAME to the vhost when executing CGI scripts

This commit is contained in:
Omar Polo 2021-01-15 19:23:43 +00:00
parent 98c8f038ac
commit bd726b55be
2 changed files with 6 additions and 1 deletions

View File

@ -1,5 +1,7 @@
2021-01-15 Omar Polo <op@omarpolo.com>
* cgi.c (start_cgi): set SERVER_NAME to the vhost when executing CGI scripts
* parse.y (option): add ability to specify the tls versions with "protocols"
* gmid.c (handle_open_conn): ensure the port number of the request matches

5
cgi.c
View File

@ -119,7 +119,10 @@ start_cgi(const char *spath, const char *relpath, const char *query,
safe_setenv("GATEWAY_INTERFACE", "CGI/1.1");
safe_setenv("SERVER_SOFTWARE", "gmid");
safe_setenv("SERVER_PORT", portno);
/* setenv("SERVER_NAME", "", 1); */
if (!strcmp(c->host->domain, "*"))
safe_setenv("SERVER_NAME", c->host->domain)
safe_setenv("SCRIPT_NAME", spath);
safe_setenv("SCRIPT_EXECUTABLE", ex);
safe_setenv("REQUEST_URI", requri);