464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
|
/* Find the page that the user has requested, construct and deliver that
** page.
*/
zPathInfo = P("PATH_INFO");
if( zPathInfo==0 || zPathInfo[0]==0 ){
const char *zUri;
char *zBase;
zUri = PD("REQUEST_URI","/");
for(i=0; zUri[i] && zUri[i]!='?' && zUri[i]!='#'; i++){}
for(j=i; j>0 && zUri[j-1]!='/'; j--){}
zBase = mprintf("%.*s/index", i-j, &zUri[j]);
cgi_redirect(zBase);
cgi_reply();
return;
}else{
zPath = mprintf("%s", zPathInfo);
}
/* Remove the leading "/" at the beginning of the path.
*/
g.zPath = &zPath[1];
|
<
<
|
<
<
|
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
|
/* Find the page that the user has requested, construct and deliver that
** page.
*/
zPathInfo = P("PATH_INFO");
if( zPathInfo==0 || zPathInfo[0]==0 ){
const char *zUri;
zUri = PD("REQUEST_URI","/");
for(i=0; zUri[i] && zUri[i]!='?' && zUri[i]!='#'; i++){}
for(j=i; j>0 && zUri[j-1]!='/'; j--){}
cgi_redirectf("%.*s/index", i, zUri);
}else{
zPath = mprintf("%s", zPathInfo);
}
/* Remove the leading "/" at the beginning of the path.
*/
g.zPath = &zPath[1];
|