[prev in list] [next in list] [prev in thread] [next in thread]
List: thttpd
Subject: [THTTPD] PATH_TRANSLATED bug
From: kevin graham <kgraham () dotnetdotcom ! org>
Date: 2001-03-06 22:06:54
[Download RAW message or body]
While playing with vhosts and a cgi that does some text mangling, I
noticed that PATH_TRANSLATED is always cwd + path_info. However, based on
my understanding of PATH_TRANSLATED, it should incorporate the
vhost-specific root.
Presuming '-d /home/httpd/':
query VHOST PATH_TRANSLATED
GET /cgi-bin/foo.sh n/a null
GET /cgi-bin/foo.sh/html/ foo.net.com /home/httpd/html
GET /cgi-bin/foo.sh/html/ bar.net.com /home/httpd/html
with the patch, this would be better behaved:
query VHOST PATH_TRANSLATED
GET /cgi-bin/foo.sh n/a null
GET /cgi-bin/foo.sh/html/ foo.net.com /home/httpd/foo.net.com/html
GET /cgi-bin/foo.sh/html/ bar.net.com /home/httpd/bar.net.com/html
..kg..
["fix_vhost_path_translated.patch" (TEXT/PLAIN)]
diff -rc thttpd-2.20b-orig/libhttpd.c thttpd-2.20b/libhttpd.c
*** thttpd-2.20b-orig/libhttpd.c Wed Sep 27 11:13:24 2000
--- thttpd-2.20b/libhttpd.c Tue Mar 6 13:36:46 2001
***************
*** 2673,2684 ****
char* cp2;
int l;
envp[envn++] = build_env( "PATH_INFO=/%s", hc->pathinfo );
! l = strlen( hc->hs->cwd ) + strlen( hc->pathinfo ) + 1;
cp2 = NEW( char, l );
if ( cp2 != (char*) 0 )
{
(void) my_snprintf( cp2, l,
! "%s%s", hc->hs->cwd, hc->pathinfo );
envp[envn++] = build_env( "PATH_TRANSLATED=%s", cp2 );
}
}
--- 2673,2684 ----
char* cp2;
int l;
envp[envn++] = build_env( "PATH_INFO=/%s", hc->pathinfo );
! l = strlen( hc->hs->cwd ) + strlen( hc->hostdir ) + strlen( hc->pathinfo ) + 2;
cp2 = NEW( char, l );
if ( cp2 != (char*) 0 )
{
(void) my_snprintf( cp2, l,
! "%s%s/%s", hc->hs->cwd, hc->hostdir, hc->pathinfo );
envp[envn++] = build_env( "PATH_TRANSLATED=%s", cp2 );
}
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic