2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
|
/* Use the first element of PATH_INFO as the page name
** and deliver the appropriate page back to the user.
*/
set_base_url(0);
if( fossil_redirect_to_https_if_needed(2) ) return;
if( zPathInfo==0 || zPathInfo[0]==0
|| (zPathInfo[0]=='/' && zPathInfo[1]==0) ){
/* Second special case: If the PATH_INFO is blank, issue a redirect:
** (1) to "/ckout" if g.useLocalauth and g.localOpen are both set.
** (2) to the home page identified by the "index-page" setting
** in the repository CONFIG table
** (3) to "/index" if there no "index-page" setting in CONFIG
*/
#ifdef FOSSIL_ENABLE_JSON
if(g.json.isJsonMode){
|
|
>
|
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
|
/* Use the first element of PATH_INFO as the page name
** and deliver the appropriate page back to the user.
*/
set_base_url(0);
if( fossil_redirect_to_https_if_needed(2) ) return;
if( zPathInfo==0 || zPathInfo[0]==0
|| (zPathInfo[0]=='/' && zPathInfo[1]==0) ){
/* Second special case: If the PATH_INFO is blank, issue a
** temporary 302 redirect:
** (1) to "/ckout" if g.useLocalauth and g.localOpen are both set.
** (2) to the home page identified by the "index-page" setting
** in the repository CONFIG table
** (3) to "/index" if there no "index-page" setting in CONFIG
*/
#ifdef FOSSIL_ENABLE_JSON
if(g.json.isJsonMode){
|
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
|
** website we have an CGI at http://fossil.com/index.html (note
** ".com" instead of ".org") that looks like this:
**
** #!/usr/bin/fossil
** redirect: * https://fossil-scm.org/home
**
** Thus requests to the .com website redirect to the .org website.
*/
static void redirect_web_page(int nRedirect, char **azRedirect){
int i; /* Loop counter */
const char *zNotFound = 0; /* Not found URL */
const char *zName = P("name");
set_base_url(0);
if( zName==0 ){
|
>
>
>
>
>
>
>
>
>
>
>
|
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
|
** website we have an CGI at http://fossil.com/index.html (note
** ".com" instead of ".org") that looks like this:
**
** #!/usr/bin/fossil
** redirect: * https://fossil-scm.org/home
**
** Thus requests to the .com website redirect to the .org website.
** This form uses a 301 Permanent redirect.
**
** On a "*" redirect, the PATH_INFO and QUERY_STRING of the query
** that provoked the redirect are appended to the target. So, for
** example, if the input URL for the redirect above were
** "http://www.fossil.com/index.html/timeline?c=20250404", then
** the redirect would be to:
**
** https://fossil-scm.org/home/timeline?c=20250404
** ^^^^^^^^^^^^^^^^^^^^
** Copied from input URL
*/
static void redirect_web_page(int nRedirect, char **azRedirect){
int i; /* Loop counter */
const char *zNotFound = 0; /* Not found URL */
const char *zName = P("name");
set_base_url(0);
if( zName==0 ){
|
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
|
}
}
}
if( zNotFound ){
Blob to;
const char *z;
if( strstr(zNotFound, "%s") ){
cgi_redirectf(zNotFound /*works-like:"%s"*/, zName);
}
if( strchr(zNotFound, '?') ){
cgi_redirect(zNotFound);
}
blob_init(&to, zNotFound, -1);
z = P("PATH_INFO");
if( z && z[0]=='/' ) blob_append(&to, z, -1);
z = P("QUERY_STRING");
if( z && z[0]!=0 ) blob_appendf(&to, "?%s", z);
cgi_redirect(blob_str(&to));
}else{
@ <html>
@ <head><title>No Such Object</title></head>
@ <body>
@ <p>No such object: <b>%h(zName)</b></p>
@ </body>
cgi_reply();
|
|
>
|
|
|
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
|
}
}
}
if( zNotFound ){
Blob to;
const char *z;
if( strstr(zNotFound, "%s") ){
char *zTarget = mprintf(zNotFound /*works-like:"%s"*/, zName);
cgi_redirect_perm(zTarget);
}
if( strchr(zNotFound, '?') ){
cgi_redirect_perm(zNotFound);
}
blob_init(&to, zNotFound, -1);
z = P("PATH_INFO");
if( z && z[0]=='/' ) blob_append(&to, z, -1);
z = P("QUERY_STRING");
if( z && z[0]!=0 ) blob_appendf(&to, "?%s", z);
cgi_redirect_perm(blob_str(&to));
}else{
@ <html>
@ <head><title>No Such Object</title></head>
@ <body>
@ <p>No such object: <b>%h(zName)</b></p>
@ </body>
cgi_reply();
|
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
|
**
** redirect: REPO URL Extract the "name" query parameter and search
** REPO for a check-in or ticket that matches the
** value of "name", then redirect to URL. There
** can be multiple "redirect:" lines that are
** processed in order. If the REPO is "*", then
** an unconditional redirect to URL is taken.
**
** jsmode: VALUE Specifies the delivery mode for JavaScript
** files. See the help text for the --jsmode
** flag of the http command.
**
** mainmenu: FILE Override the mainmenu config setting with the
** contents of the given file.
|
>
>
>
|
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
|
**
** redirect: REPO URL Extract the "name" query parameter and search
** REPO for a check-in or ticket that matches the
** value of "name", then redirect to URL. There
** can be multiple "redirect:" lines that are
** processed in order. If the REPO is "*", then
** an unconditional redirect to URL is taken.
** When "*" is used a 301 permanent redirect is
** issued and the tail and query string from the
** original query are appeneded onto URL.
**
** jsmode: VALUE Specifies the delivery mode for JavaScript
** files. See the help text for the --jsmode
** flag of the http command.
**
** mainmenu: FILE Override the mainmenu config setting with the
** contents of the given file.
|