Fossil

Check-in [c23469468b]
Login

Check-in [c23469468b]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Use the SCRIPT_NAME environment variable rather than REQUEST_URI to find the base name of the CGI script.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: c23469468bc6a8a47bb33bb94e61dcaa5058d3d9
User & Date: drh 2008-05-13 00:19:15.000
Context
2008-05-13
13:20
Make attempts to add _FOSSIL_, manifest, and manifest.uuid warnings, not fatal errors. This allows users to say things like "fossil add *" when initially populating a new project repository. ... (check-in: 844718abbf user: drh tags: trunk)
00:19
Use the SCRIPT_NAME environment variable rather than REQUEST_URI to find the base name of the CGI script. ... (check-in: c23469468b user: drh tags: trunk)
2008-05-10
18:19
Add the -nosync option to the "open" command. We might consider making -nosync the default for "open". ... (check-in: ec82a32b80 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/main.c.
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
** the fossil tree.  Set g.zHomeURL to g.zBaseURL without the
** leading "http://" and the host and port.
*/
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","/");

  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--; }

  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);
    g.zTop = &g.zBaseURL[7+strlen(zHost)];
  }







|

<
<
<
<
<
<
<
|
|
<
<
<
<







425
426
427
428
429
430
431
432
433







434
435




436
437
438
439
440
441
442
** the fossil tree.  Set g.zHomeURL to g.zBaseURL without the
** leading "http://" and the host and port.
*/
void set_base_url(void){
  int i;
  const char *zHost = PD("HTTP_HOST","");
  const char *zMode = PD("HTTPS","off");
  const char *zCur = PD("SCRIPT_NAME","/");








  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);
    g.zTop = &g.zBaseURL[7+strlen(zHost)];
  }