mirror of
https://github.com/php/php-src.git
synced 2025-08-18 15:08:55 +02:00
Set SG(request_info).path_translated to the path of the main script.
This commit is contained in:
parent
b1d4fcb33c
commit
e97c8ff013
1 changed files with 15 additions and 17 deletions
|
@ -191,18 +191,12 @@ static sapi_module_struct sapi_module = {
|
||||||
static void thttpd_module_main(TLS_D SLS_DC)
|
static void thttpd_module_main(TLS_D SLS_DC)
|
||||||
{
|
{
|
||||||
zend_file_handle file_handle;
|
zend_file_handle file_handle;
|
||||||
char cwd[4096];
|
|
||||||
char *filename;
|
|
||||||
CLS_FETCH();
|
CLS_FETCH();
|
||||||
ELS_FETCH();
|
ELS_FETCH();
|
||||||
PLS_FETCH();
|
PLS_FETCH();
|
||||||
|
|
||||||
V_GETCWD(cwd, sizeof(cwd));
|
|
||||||
filename = alloca(strlen(cwd) + strlen(TG(hc)->expnfilename) + 2);
|
|
||||||
sprintf(filename, "%s%c%s", cwd, PHP_DIR_SEPARATOR, TG(hc)->expnfilename); /* SAFE */
|
|
||||||
|
|
||||||
file_handle.type = ZEND_HANDLE_FILENAME;
|
file_handle.type = ZEND_HANDLE_FILENAME;
|
||||||
file_handle.filename = filename;
|
file_handle.filename = SG(request_info).path_translated;
|
||||||
file_handle.free_filename = 0;
|
file_handle.free_filename = 0;
|
||||||
file_handle.opened_path = NULL;
|
file_handle.opened_path = NULL;
|
||||||
|
|
||||||
|
@ -216,22 +210,26 @@ static void thttpd_module_main(TLS_D SLS_DC)
|
||||||
|
|
||||||
static void thttpd_request_ctor(TLS_D SLS_DC)
|
static void thttpd_request_ctor(TLS_D SLS_DC)
|
||||||
{
|
{
|
||||||
char *cp2;
|
char *cp;
|
||||||
int l;
|
size_t cp_len;
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
int offset;
|
int offset;
|
||||||
size_t pathinfo_len;
|
size_t filename_len;
|
||||||
size_t cwd_len;
|
size_t cwd_len;
|
||||||
|
|
||||||
pathinfo_len = strlen(TG(hc)->pathinfo);
|
|
||||||
cwd_len = strlen(TG(hc)->hs->cwd);
|
|
||||||
|
|
||||||
SG(request_info).query_string = TG(hc)->query;
|
SG(request_info).query_string = TG(hc)->query;
|
||||||
|
|
||||||
l = cwd_len + pathinfo_len + 1;
|
filename_len = strlen(TG(hc)->expnfilename);
|
||||||
cp2 = (char *) malloc(l);
|
cwd_len = strlen(TG(hc)->hs->cwd);
|
||||||
sprintf(cp2, "%s%s", TG(hc)->hs->cwd, TG(hc)->pathinfo);
|
|
||||||
SG(request_info).path_translated = cp2;
|
cp_len = cwd_len + filename_len;
|
||||||
|
cp = (char *) malloc(cp_len + 1);
|
||||||
|
/* cwd always ends in "/", so this is safe */
|
||||||
|
memcpy(cp, TG(hc)->hs->cwd, cwd_len);
|
||||||
|
memcpy(cp + cwd_len, TG(hc)->expnfilename, filename_len);
|
||||||
|
cp[cp_len] = '\0';
|
||||||
|
|
||||||
|
SG(request_info).path_translated = cp;
|
||||||
|
|
||||||
snprintf(buf, 1023, "/%s", TG(hc)->origfilename);
|
snprintf(buf, 1023, "/%s", TG(hc)->origfilename);
|
||||||
SG(request_info).request_uri = strdup(buf);
|
SG(request_info).request_uri = strdup(buf);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue