Fossil

Check-in [ed63bdd71e]
Login

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

Overview
Comment:Clear all environment variables prior to invoking a CGI extension. (Works on posix - need to fix it for windows.)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: ed63bdd71e747401ba5044eadabc7c067830e1f3badb37082da51fabc7b12aa3
User & Date: drh 2019-08-01 19:30:01.522
Context
2019-08-01
21:05
When rendering HTML pages using the fossil-doc class and the data-title="..." attribute, reverse the HTML escapes in the argument to data-title since they will be reencoded prior to rendering. check-in: 54e01c60e2 user: drh tags: trunk
19:30
Clear all environment variables prior to invoking a CGI extension. (Works on posix - need to fix it for windows.) check-in: ed63bdd71e user: drh tags: trunk
14:17
Add the FOSSIL_URI environment variable to the CGI extension mechanism. check-in: 7b2b9d6995 user: drh tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/extcgi.c.
208
209
210
211
212
213
214

215
216
217
218
219
220
221
  }
  cgi_set_parameter_nocopy("FOSSIL_REPOSITORY", g.zRepositoryName, 0);
  cgi_set_parameter_nocopy("FOSSIL_URI", g.zTop, 0);
  cgi_set_parameter_nocopy("FOSSIL_CAPABILITIES",
     db_text("","SELECT fullcap(cap) FROM user WHERE login=%Q",
             g.zLogin ? g.zLogin : "nobody"), 0);
  cgi_replace_parameter("GATEWAY_INTERFACE","CGI/1.0");

  for(i=0; i<sizeof(azCgiEnv)/sizeof(azCgiEnv[0]); i++){
    const char *zVal = P(azCgiEnv[i]);
    if( zVal ) fossil_setenv(azCgiEnv[i], zVal);
  }
  fossil_setenv("HTTP_ACCEPT_ENCODING","");
  rc = popen2(zScript, &fdFromChild, &toChild, &pidChild, 1);
  if( rc ){







>







208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
  }
  cgi_set_parameter_nocopy("FOSSIL_REPOSITORY", g.zRepositoryName, 0);
  cgi_set_parameter_nocopy("FOSSIL_URI", g.zTop, 0);
  cgi_set_parameter_nocopy("FOSSIL_CAPABILITIES",
     db_text("","SELECT fullcap(cap) FROM user WHERE login=%Q",
             g.zLogin ? g.zLogin : "nobody"), 0);
  cgi_replace_parameter("GATEWAY_INTERFACE","CGI/1.0");
  fossil_clearenv();
  for(i=0; i<sizeof(azCgiEnv)/sizeof(azCgiEnv[0]); i++){
    const char *zVal = P(azCgiEnv[i]);
    if( zVal ) fossil_setenv(azCgiEnv[i], zVal);
  }
  fossil_setenv("HTTP_ACCEPT_ENCODING","");
  rc = popen2(zScript, &fdFromChild, &toChild, &pidChild, 1);
  if( rc ){
Changes to src/file.c.
1717
1718
1719
1720
1721
1722
1723











1724
1725
1726
1727
1728
1729
1730
#else
  rc = putenv(zString);
  /* NOTE: Cannot free the string on POSIX. */
  /* fossil_free(zString); */
#endif
  return rc;
}












/*
** Like fopen() but always takes a UTF8 argument.
**
** This function assumes ExtFILE. In other words, symbolic links
** are always followed.
*/







>
>
>
>
>
>
>
>
>
>
>







1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
#else
  rc = putenv(zString);
  /* NOTE: Cannot free the string on POSIX. */
  /* fossil_free(zString); */
#endif
  return rc;
}

/*
** Clear all environment variables
*/
int fossil_clearenv(void){
#ifdef _WIN32
  /* FIXME: Not yet supported */
#else
  return clearenv();
#endif
}

/*
** Like fopen() but always takes a UTF8 argument.
**
** This function assumes ExtFILE. In other words, symbolic links
** are always followed.
*/