Differences From:
File
src/main.c
part of check-in
[6b85fd173e]
- Help message cleanup. Automatically delete cloned database files if
the clone fails.
by
drh on
2008-05-10 18:01:52.
[view]
To:
File
src/main.c
part of check-in
[c23469468b]
- Use the SCRIPT_NAME environment variable rather than REQUEST_URI to
find the base name of the CGI script.
by
drh on
2008-05-13 00:19:15.
[view]
@@ -428,23 +428,12 @@
void set_base_url(void){
int i;
const char *zHost = PD("HTTP_HOST","");
const char *zMode = PD("HTTPS","off");
- const char *zCur = PD("REQUEST_URI","/");
+ const char *zCur = PD("SCRIPT_NAME","/");
- for(i=0; zCur[i] && zCur[i]!='?' && zCur[i]!='#'; i++){}
- if( g.zExtra ){
- /* Skip to start of extra stuff, then pass over any /'s that might
- ** have separated the document root from the extra stuff. This
- ** ensures that the redirection actually redirects the root, not
- ** something deep down at the bottom of a URL.
- */
- i -= strlen(g.zExtra);
- while( i>0 && zCur[i-1]=='/' ){ i--; }
- }
- while( i>0 && zCur[i-1]!='/' ){ i--; }
- while( i>0 && zCur[i-1]=='/' ){ i--; }
-
+ i = strlen(zCur);
+ while( i>0 && zCur[i-1]=='/' ) i--;
if( strcmp(zMode,"on")==0 ){
g.zBaseURL = mprintf("https://%s%.*s", zHost, i, zCur);
g.zTop = &g.zBaseURL[8+strlen(zHost)];
}else{