Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Untested, experimental patch for correct redirect to the /index page when only the CGI script name is specified. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
f66089ec43a9dd200b3c7d20d27ab8d5 |
| User & Date: | drh 2007-10-23 18:04:19.000 |
Context
|
2007-10-23
| ||
| 19:43 | No changes from the previous check-in. This just confirms that the previous check-in has now been tested and appears to work correctly. ... (check-in: f4c30de75a user: drh tags: trunk) | |
| 18:04 | Untested, experimental patch for correct redirect to the /index page when only the CGI script name is specified. ... (check-in: f66089ec43 user: drh tags: trunk) | |
| 16:35 | Get rid of the (silly?) int_least16_t type in sha1.c and just use good old "int" instead. Makes things easier to compile on older systems. ... (check-in: 8fb641e071 user: drh tags: trunk) | |
Changes
Changes to src/cgi.c.
| ︙ | ︙ | |||
293 294 295 296 297 298 299 |
**
** The URL must be relative to the base of the fossil server.
*/
void cgi_redirect(const char *zURL){
char *zLocation;
CGIDEBUG(("redirect to %s\n", zURL));
if( strncmp(zURL,"http:",5)==0 || strncmp(zURL,"https:",6)==0 || *zURL=='/' ){
| | | | > | 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 |
**
** The URL must be relative to the base of the fossil server.
*/
void cgi_redirect(const char *zURL){
char *zLocation;
CGIDEBUG(("redirect to %s\n", zURL));
if( strncmp(zURL,"http:",5)==0 || strncmp(zURL,"https:",6)==0 || *zURL=='/' ){
zLocation = mprintf("Location: %s\r\n", zURL);
}else{
zLocation = mprintf("Location: %s/%s\r\n", g.zBaseURL, zURL);
}
cgi_append_header(zLocation);
cgi_reset_content();
cgi_printf("<html>\n<p>Redirect to %h</p>\n</html>\n", zURL);
cgi_set_status(302, "Moved Temporarily");
free(zLocation);
cgi_reply();
exit(0);
|
| ︙ | ︙ |
Changes to src/main.c.
| ︙ | ︙ | |||
464 465 466 467 468 469 470 |
/* 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;
| < < | < < | 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];
|
| ︙ | ︙ |