Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Refactored the QUERY_STRING initialization so that a redirect to the index-page when visiting the top of a repo can catch the skin URL parameter. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
1b6ec17d59c765e2c1a8a877c6a02bdd |
| User & Date: | stephan 2022-01-09 10:15:58.168 |
Context
|
2022-01-10
| ||
| 05:16 | Fixed recently-broken links to makeheaders, caused by its move from src/ to tools/. Reported in the forum. ... (check-in: 78c484d153 user: stephan tags: trunk) | |
|
2022-01-09
| ||
| 10:15 | Refactored the QUERY_STRING initialization so that a redirect to the index-page when visiting the top of a repo can catch the skin URL parameter. ... (check-in: 1b6ec17d59 user: stephan tags: trunk) | |
| 00:22 | Another help text typo fix: s/clear-certs/clear-cert/. ... (check-in: c4ab04b59d user: stephan tags: trunk) | |
Changes
Changes to src/cgi.c.
| ︙ | ︙ | |||
1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 |
}
}
fputs(z, pLog);
}
/* Forward declaration */
static NORETURN void malformed_request(const char *zMsg);
/*
** Initialize the query parameter database. Information is pulled from
** the QUERY_STRING environment variable (if it exists), from standard
** input if there is POST data, and from HTTP_COOKIE.
**
** REQUEST_URI, PATH_INFO, and SCRIPT_NAME are related as follows:
| > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 |
}
}
fputs(z, pLog);
}
/* Forward declaration */
static NORETURN void malformed_request(const char *zMsg);
/*
** Checks the QUERY_STRING environment variable, sets it up
** via add_param_list() and, if found, applies its "skin"
** setting. Returns 0 if no QUERY_STRING is set, 1 if it is,
** and 2 if it sets the skin (in which case the cookie may
** still need flushing by the page, via cookie_render()).
*/
int cgi_setup_query_string(void){
int rc = 0;
char * z = (char*)P("QUERY_STRING");
if( z ){
++rc;
z = fossil_strdup(z);
add_param_list(z, '&');
z = (char*)P("skin");
if(z){
char *zErr = skin_use_alternative(z, 2);
++rc;
if(!zErr && !P("once")){
cookie_write_parameter("skin","skin",z);
}
fossil_free(zErr);
}
}
return rc;
}
/*
** Initialize the query parameter database. Information is pulled from
** the QUERY_STRING environment variable (if it exists), from standard
** input if there is POST data, and from HTTP_COOKIE.
**
** REQUEST_URI, PATH_INFO, and SCRIPT_NAME are related as follows:
|
| ︙ | ︙ | |||
1315 1316 1317 1318 1319 1320 1321 |
add_param_list(z, ';');
z = (char*)cookie_value("skin",0);
if(z){
skin_use_alternative(z, 2);
}
}
| | < < < < < < < < < < < < | 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 |
add_param_list(z, ';');
z = (char*)cookie_value("skin",0);
if(z){
skin_use_alternative(z, 2);
}
}
cgi_setup_query_string();
z = (char*)P("REMOTE_ADDR");
if( z ){
g.zIpAddr = fossil_strdup(z);
}
len = atoi(PD("CONTENT_LENGTH", "0"));
|
| ︙ | ︙ |
Changes to src/main.c.
| ︙ | ︙ | |||
1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 |
}
}
/*
** Send an HTTP redirect back to the designated Index Page.
*/
NORETURN void fossil_redirect_home(void){
cgi_redirectf("%R%s", db_get("index-page", "/index"));
}
/*
** If running as root, chroot to the directory containing the
** repository zRepo and then drop root privileges. Return the
** new repository name.
| > > > > > > > > | 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 |
}
}
/*
** Send an HTTP redirect back to the designated Index Page.
*/
NORETURN void fossil_redirect_home(void){
/* In order for ?skin=... to work when visiting the site from
** a typical external link, we have to process is here, as
** that parameter gets lost during the redirect. We "could"
** pass the whole query string along instead, but that seems
** unnecessary. */
if(cgi_setup_query_string()>1){
cookie_render();
}
cgi_redirectf("%R%s", db_get("index-page", "/index"));
}
/*
** If running as root, chroot to the directory containing the
** repository zRepo and then drop root privileges. Return the
** new repository name.
|
| ︙ | ︙ |