Overview
SHA1 Hash: | c23469468bc6a8a47bb33bb94e61dcaa5058d3d9 |
---|---|
Date: | 2008-05-13 00:19:15 |
User: | drh |
Comment: | Use the SCRIPT_NAME environment variable rather than REQUEST_URI to find the base name of the CGI script. |
Timelines: | ancestors | descendants | both | trunk |
Other Links: | files | ZIP archive | manifest |
Tags And Properties
- branch=trunk inherited from [a28c83647d]
- sym-trunk inherited from [a28c83647d]
Changes
[hide diffs]Modified src/main.c from [42f0720d46] to [d82321902f].
@@ -427,25 +427,14 @@ */ 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{ g.zBaseURL = mprintf("http://%s%.*s", zHost, i, zCur);