Fossil

Changes On Branch ext-request-scheme
Login

Changes On Branch ext-request-scheme

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

Changes In Branch ext-request-scheme Excluding Merge-Ins

This is equivalent to a diff from f0a86f3c to 0d72caae

2020-12-12
10:01
If fossil.fetch()'s beforesend() callback propagates an exception, it is now passed to the onerror() callback and aborts the fetch, rather than being silently ignored. ... (check-in: 1515f022 user: stephan tags: trunk)
08:15
Adds the Apache-style REQUEST_SCHEME environment variable to the /ext environment so that CGIs can determine whether they're running in HTTP or HTTPS. Later: See alternative implementation at [f101e94da1f80571] ... (Closed-Leaf check-in: 0d72caae user: stephan tags: ext-request-scheme)
01:20
Spell out the word "times" rather than use the unicode "x" character. ... (check-in: f0a86f3c user: drh tags: trunk)
01:12
Drop "efficiency" claims in fossil-v-git, as the term is not quite right to describe the point. Use "self-sufficient" instead. ... (check-in: 41b34915 user: drh tags: trunk)

Changes to src/extcgi.c.

65
66
67
68
69
70
71


72
73
74
75
76
77
78
   "HTTP_REFERER",
   "HTTP_USER_AGENT",
   "PATH_INFO",
   "QUERY_STRING",
   "REMOTE_ADDR",
   "REMOTE_USER",
   "REQUEST_METHOD",


   "REQUEST_URI",
   "SCRIPT_DIRECTORY",
   "SCRIPT_FILENAME",
   "SCRIPT_NAME",
   "SERVER_NAME",
   "SERVER_PORT",
   "SERVER_PROTOCOL",







>
>







65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
   "HTTP_REFERER",
   "HTTP_USER_AGENT",
   "PATH_INFO",
   "QUERY_STRING",
   "REMOTE_ADDR",
   "REMOTE_USER",
   "REQUEST_METHOD",
   "REQUEST_SCHEME", /* non-standard but supported by Apache 2.4+
                     ** Holds either "http" or "https". */
   "REQUEST_URI",
   "SCRIPT_DIRECTORY",
   "SCRIPT_FILENAME",
   "SCRIPT_NAME",
   "SERVER_NAME",
   "SERVER_PORT",
   "SERVER_PROTOCOL",
264
265
266
267
268
269
270



271
272
273
274
275
276
277
  cgi_set_parameter_nocopy("FOSSIL_NONCE", style_nonce(), 0);
  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++){
    (void)P(azCgiEnv[i]);
  }
  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);







>
>
>







266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
  cgi_set_parameter_nocopy("FOSSIL_NONCE", style_nonce(), 0);
  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");
  cgi_replace_parameter("REQUEST_SCHEME",
                        strncmp(g.zTop, "https:", 6)==0
                        ? "https" : "http");
  for(i=0; i<sizeof(azCgiEnv)/sizeof(azCgiEnv[0]); i++){
    (void)P(azCgiEnv[i]);
  }
  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);

Changes to www/serverext.wiki.

166
167
168
169
170
171
172

173
174
175
176
177
178
179
Fossil adds the following:

  *  FOSSIL_CAPABILITIES
  *  FOSSIL_NONCE
  *  FOSSIL_REPOSITORY
  *  FOSSIL_URI
  *  FOSSIL_USER


The FOSSIL_USER string is the name of the logged-in user.  This variable
is missing or is an empty string if the user is not logged in.  The
FOSSIL_CAPABILITIES string is a list of 
[./caps/ref.html|Fossil capabilities] that
indicate what permissions the user has on the Fossil repository.
The FOSSIL_REPOSITORY environment variable gives the filename of the







>







166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
Fossil adds the following:

  *  FOSSIL_CAPABILITIES
  *  FOSSIL_NONCE
  *  FOSSIL_REPOSITORY
  *  FOSSIL_URI
  *  FOSSIL_USER
  *  REQUEST_SCHEME (as used by Apache: "http" or "https")

The FOSSIL_USER string is the name of the logged-in user.  This variable
is missing or is an empty string if the user is not logged in.  The
FOSSIL_CAPABILITIES string is a list of 
[./caps/ref.html|Fossil capabilities] that
indicate what permissions the user has on the Fossil repository.
The FOSSIL_REPOSITORY environment variable gives the filename of the