1
0
mirror of https://github.com/lxsang/antd-cgi-plugin synced 2024-12-27 10:28:22 +01:00

fix to new lib

This commit is contained in:
lxsang 2020-01-08 22:26:13 +01:00
parent 206bc5654b
commit efeb2d8bce

6
cgi.c
View File

@ -109,10 +109,12 @@ static void get_env_vars(antd_request_t *rq, envar_arr_t* env_vars)
{ {
char *tmp = NULL; char *tmp = NULL;
char *sub = NULL; char *sub = NULL;
char* root;
dictionary_t request = (dictionary_t)rq->request; dictionary_t request = (dictionary_t)rq->request;
dictionary_t header = (dictionary_t)dvalue(rq->request, "REQUEST_HEADER"); dictionary_t header = (dictionary_t)dvalue(rq->request, "REQUEST_HEADER");
add_vars(env_vars, "GATEWAY_INTERFACE", "CGI/1.1"); add_vars(env_vars, "GATEWAY_INTERFACE", "CGI/1.1");
add_vars(env_vars, "SERVER_SOFTWARE", SERVER_NAME); add_vars(env_vars, "SERVER_SOFTWARE", SERVER_NAME);
root = (char*)dvalue(header, "SERVER_WWW_ROOT");
tmp = (char *)dvalue(request, "REQUEST_QUERY"); tmp = (char *)dvalue(request, "REQUEST_QUERY");
if (!tmp) if (!tmp)
add_vars(env_vars, "QUERY_STRING", ""); add_vars(env_vars, "QUERY_STRING", "");
@ -141,7 +143,7 @@ static void get_env_vars(antd_request_t *rq, envar_arr_t* env_vars)
add_vars(env_vars, "CONTENT_LENGTH", tmp); add_vars(env_vars, "CONTENT_LENGTH", tmp);
else else
add_vars(env_vars, "CONTENT_LENGTH", ""); add_vars(env_vars, "CONTENT_LENGTH", "");
add_vars(env_vars, "DOCUMENT_ROOT", rq->client->port_config->htdocs); add_vars(env_vars, "DOCUMENT_ROOT", root);
tmp = (char *)dvalue(request, "REQUEST_PATH"); tmp = (char *)dvalue(request, "REQUEST_PATH");
if (tmp) if (tmp)
{ {
@ -185,7 +187,7 @@ static void get_env_vars(antd_request_t *rq, envar_arr_t* env_vars)
if (tmp) if (tmp)
{ {
add_vars(env_vars, "SCRIPT_NAME", tmp); add_vars(env_vars, "SCRIPT_NAME", tmp);
tmp = __s("%s/%s", rq->client->port_config->htdocs, tmp); tmp = __s("%s/%s", root, tmp);
add_vars(env_vars, "SCRIPT_FILENAME", tmp); add_vars(env_vars, "SCRIPT_FILENAME", tmp);
add_vars(env_vars, "PATH_TRANSLATED", tmp); add_vars(env_vars, "PATH_TRANSLATED", tmp);
free(tmp); free(tmp);