3 - * [*cgi] Use physical base dir (alias, userdir) as DOCUMENT_ROOT in cgi environments (fixes #2216)
5 --- lighttpd-1.4.36/src/mod_fastcgi.c~ 2015-07-26 18:30:29.000000000 +0300
6 +++ lighttpd-1.4.36/src/mod_fastcgi.c 2015-07-26 18:31:50.285226477 +0300
8 if (!buffer_string_is_empty(host->docroot)) {
9 buffer_copy_buffer(p->path, host->docroot);
11 - buffer_copy_buffer(p->path, con->physical.basedir);
12 + buffer_copy_buffer(p->path, con->physical.doc_root);
14 buffer_append_string_buffer(p->path, con->request.pathinfo);
15 FCGI_ENV_ADD_CHECK(fcgi_env_add(p->fcgi_env, CONST_STR_LEN("PATH_TRANSLATED"), CONST_BUF_LEN(p->path)),con)
19 FCGI_ENV_ADD_CHECK(fcgi_env_add(p->fcgi_env, CONST_STR_LEN("SCRIPT_FILENAME"), CONST_BUF_LEN(p->path)),con)
20 - FCGI_ENV_ADD_CHECK(fcgi_env_add(p->fcgi_env, CONST_STR_LEN("DOCUMENT_ROOT"), CONST_BUF_LEN(con->physical.basedir)),con)
21 + FCGI_ENV_ADD_CHECK(fcgi_env_add(p->fcgi_env, CONST_STR_LEN("DOCUMENT_ROOT"), CONST_BUF_LEN(con->physical.doc_root)),con)
24 if (host->strip_request_uri->used > 1) {
28 buffer_copy_buffer(con->physical.doc_root, host->docroot);
29 - buffer_copy_buffer(con->physical.basedir, host->docroot);
31 buffer_copy_buffer(con->physical.path, host->docroot);
32 buffer_append_string_buffer(con->physical.path, con->uri.path);
33 --- lighttpd-1.4.36/src/mod_scgi.c~ 2015-07-26 18:30:29.000000000 +0300
34 +++ lighttpd-1.4.36/src/mod_scgi.c 2015-07-26 18:33:12.406160926 +0300
36 if (!buffer_string_is_empty(host->docroot)) {
37 buffer_copy_buffer(p->path, host->docroot);
39 - buffer_copy_buffer(p->path, con->physical.basedir);
40 + buffer_copy_buffer(p->path, con->physical.doc_root);
42 buffer_append_string_buffer(p->path, con->request.pathinfo);
43 scgi_env_add(p->scgi_env, CONST_STR_LEN("PATH_TRANSLATED"), CONST_BUF_LEN(p->path));
45 buffer_copy_string_buffer(p->path, con->physical.path);
47 scgi_env_add(p->scgi_env, CONST_STR_LEN("SCRIPT_FILENAME"), CONST_BUF_LEN(p->path));
48 - scgi_env_add(p->scgi_env, CONST_STR_LEN("DOCUMENT_ROOT"), CONST_BUF_LEN(con->physical.basedir));
49 + scgi_env_add(p->scgi_env, CONST_STR_LEN("DOCUMENT_ROOT"), CONST_BUF_LEN(con->physical.doc_root));
51 scgi_env_add(p->scgi_env, CONST_STR_LEN("REQUEST_URI"), CONST_BUF_LEN(con->request.orig_uri));
52 if (!buffer_is_equal(con->request.uri, con->request.orig_uri)) {
54 ===================================================================
55 --- ./src/mod_cgi.c (revision 2794)
56 +++ ./src/mod_cgi.c (revision 2793)
58 cgi_env_add(&env, CONST_STR_LEN("CONTENT_LENGTH"), buf, strlen(buf));
59 cgi_env_add(&env, CONST_STR_LEN("SCRIPT_FILENAME"), CONST_BUF_LEN(con->physical.path));
60 cgi_env_add(&env, CONST_STR_LEN("SCRIPT_NAME"), CONST_BUF_LEN(con->uri.path));
61 - cgi_env_add(&env, CONST_STR_LEN("DOCUMENT_ROOT"), CONST_BUF_LEN(con->physical.basedir));
62 + cgi_env_add(&env, CONST_STR_LEN("DOCUMENT_ROOT"), CONST_BUF_LEN(con->physical.doc_root));
65 if (NULL != (s = getenv("LD_PRELOAD"))) {