176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
|
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
|
-
+
+
+
|
int fNoHttpCompress; /* Do not compress HTTP traffic (for debugging) */
char *zSshCmd; /* SSH command string */
const char *zHttpCmd; /* External program to do HTTP requests */
int fNoSync; /* Do not do an autosync ever. --nosync */
int fIPv4; /* Use only IPv4, not IPv6. --ipv4 */
char *zPath; /* Name of webpage being served */
char *zExtra; /* Extra path information past the webpage name */
char *zBaseURL; /* Full text of the URL being served */
char *zBaseURL; /* Full URL for the toplevel of the fossil tree */
const char *zUrlSuffix; /* Suffix of the URL including query string
zBaseUrl/zUrlSuffix == Full text of the URL being served */
char *zHttpsURL; /* zBaseURL translated to https: */
char *zTop; /* Parent directory of zPath */
int nExtraURL; /* Extra bytes added to SCRIPT_NAME */
const char *zExtRoot; /* Document root for the /ext sub-website */
const char *zContentType; /* The content type of the input HTTP request */
int iErrPriority; /* Priority of current error message */
char *zErrMsg; /* Text of an error message */
|
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
|
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
|
+
+
+
|
** g.zBaseURL and g.zTop is set from that instead.
*/
void set_base_url(const char *zAltBase){
int i;
const char *zHost;
const char *zMode;
const char *zCur;
const char *zRU; /* REQUEST_URI */
const char *zQS; /* QUERY_STRING */
size_t nTop; /* length of g.zTop */
if( g.zBaseURL!=0 ) return;
if( zAltBase ){
int i, n, c;
g.zTop = g.zBaseURL = mprintf("%s", zAltBase);
i = (int)strlen(g.zBaseURL);
while( i>3 && g.zBaseURL[i-1]=='/' ){ i--; }
|
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
|
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
|
+
+
+
+
+
+
+
+
|
g.zBaseURL = mprintf("http://%s%.*s", z, i, zCur);
g.zTop = &g.zBaseURL[7+strlen(z)];
g.zHttpsURL = mprintf("https://%s%.*s", z, i, zCur);
}
fossil_free(z);
}
zRU = PD("REQUEST_URI","");
nTop = strlen( g.zTop );
g.zUrlSuffix = strncmp(zRU,g.zTop,nTop) ? "" : zRU+nTop;
if(g.zUrlSuffix[0]=='/') g.zUrlSuffix++;
zQS = PD("QUERY_STRING","");
if( zQS[0] ) g.zUrlSuffix = mprintf("%s?%s", g.zUrlSuffix, zQS);
else g.zUrlSuffix = mprintf("%s", g.zUrlSuffix);
/* Try to record the base URL as a CONFIG table entry with a name
** of the form: "baseurl:BASE". This keeps a record of how the
** the repository is used as a server, to help in answering questions
** like "where is the CGI script that references this repository?"
**
** This is just a logging hint. So don't worry if it cannot be done.
** Don't try this if the repository database is not writable, for
|