Fossil SCM

Rename variable <var>g.zUrlSuffix</var> to <var>g.zRelReqURI</var> (Relative Request URI). Provide it to TH1 interpreter as <var></var>.

george 2022-02-13 17:54 base-href-fix
Commit 05e3fa76bee4003b8a10d90e6d3861f221f7391828e75493587bfea9ee3a91bc
2 files changed +5 -5 +6 -6
+5 -5
--- src/main.c
+++ src/main.c
@@ -179,12 +179,12 @@
179179
int fNoSync; /* Do not do an autosync ever. --nosync */
180180
int fIPv4; /* Use only IPv4, not IPv6. --ipv4 */
181181
char *zPath; /* Name of webpage being served */
182182
char *zExtra; /* Extra path information past the webpage name */
183183
char *zBaseURL; /* Full URL for the toplevel of the fossil tree */
184
- const char *zUrlSuffix; /* Suffix of the URL including query string
185
- zBaseUrl/zUrlSuffix == Full text of the URL being served */
184
+ const char *zRelReqURI; /* Relative Request URI (includes QUERY_STRING)
185
+ zBaseUrl/zRelReqURI == Full text of the URL being served */
186186
char *zHttpsURL; /* zBaseURL translated to https: */
187187
char *zTop; /* Parent directory of zPath */
188188
int nExtraURL; /* Extra bytes added to SCRIPT_NAME */
189189
const char *zExtRoot; /* Document root for the /ext sub-website */
190190
const char *zContentType; /* The content type of the input HTTP request */
@@ -1417,13 +1417,13 @@
14171417
fossil_free(z);
14181418
}
14191419
14201420
zRU = PD("REQUEST_URI","");
14211421
nTop = strlen( g.zTop );
1422
- g.zUrlSuffix = strncmp(zRU,g.zTop,nTop) ? "" : zRU+nTop;
1423
- if(g.zUrlSuffix[0]=='/') g.zUrlSuffix++;
1424
- g.zUrlSuffix = fossil_strdup( g.zUrlSuffix );
1422
+ g.zRelReqURI = strncmp(zRU,g.zTop,nTop) ? "" : zRU+nTop;
1423
+ if(g.zRelReqURI[0]=='/') g.zRelReqURI++;
1424
+ g.zRelReqURI = fossil_strdup( g.zRelReqURI );
14251425
14261426
/* Try to record the base URL as a CONFIG table entry with a name
14271427
** of the form: "baseurl:BASE". This keeps a record of how the
14281428
** the repository is used as a server, to help in answering questions
14291429
** like "where is the CGI script that references this repository?"
14301430
--- src/main.c
+++ src/main.c
@@ -179,12 +179,12 @@
179 int fNoSync; /* Do not do an autosync ever. --nosync */
180 int fIPv4; /* Use only IPv4, not IPv6. --ipv4 */
181 char *zPath; /* Name of webpage being served */
182 char *zExtra; /* Extra path information past the webpage name */
183 char *zBaseURL; /* Full URL for the toplevel of the fossil tree */
184 const char *zUrlSuffix; /* Suffix of the URL including query string
185 zBaseUrl/zUrlSuffix == Full text of the URL being served */
186 char *zHttpsURL; /* zBaseURL translated to https: */
187 char *zTop; /* Parent directory of zPath */
188 int nExtraURL; /* Extra bytes added to SCRIPT_NAME */
189 const char *zExtRoot; /* Document root for the /ext sub-website */
190 const char *zContentType; /* The content type of the input HTTP request */
@@ -1417,13 +1417,13 @@
1417 fossil_free(z);
1418 }
1419
1420 zRU = PD("REQUEST_URI","");
1421 nTop = strlen( g.zTop );
1422 g.zUrlSuffix = strncmp(zRU,g.zTop,nTop) ? "" : zRU+nTop;
1423 if(g.zUrlSuffix[0]=='/') g.zUrlSuffix++;
1424 g.zUrlSuffix = fossil_strdup( g.zUrlSuffix );
1425
1426 /* Try to record the base URL as a CONFIG table entry with a name
1427 ** of the form: "baseurl:BASE". This keeps a record of how the
1428 ** the repository is used as a server, to help in answering questions
1429 ** like "where is the CGI script that references this repository?"
1430
--- src/main.c
+++ src/main.c
@@ -179,12 +179,12 @@
179 int fNoSync; /* Do not do an autosync ever. --nosync */
180 int fIPv4; /* Use only IPv4, not IPv6. --ipv4 */
181 char *zPath; /* Name of webpage being served */
182 char *zExtra; /* Extra path information past the webpage name */
183 char *zBaseURL; /* Full URL for the toplevel of the fossil tree */
184 const char *zRelReqURI; /* Relative Request URI (includes QUERY_STRING)
185 zBaseUrl/zRelReqURI == Full text of the URL being served */
186 char *zHttpsURL; /* zBaseURL translated to https: */
187 char *zTop; /* Parent directory of zPath */
188 int nExtraURL; /* Extra bytes added to SCRIPT_NAME */
189 const char *zExtRoot; /* Document root for the /ext sub-website */
190 const char *zContentType; /* The content type of the input HTTP request */
@@ -1417,13 +1417,13 @@
1417 fossil_free(z);
1418 }
1419
1420 zRU = PD("REQUEST_URI","");
1421 nTop = strlen( g.zTop );
1422 g.zRelReqURI = strncmp(zRU,g.zTop,nTop) ? "" : zRU+nTop;
1423 if(g.zRelReqURI[0]=='/') g.zRelReqURI++;
1424 g.zRelReqURI = fossil_strdup( g.zRelReqURI );
1425
1426 /* Try to record the base URL as a CONFIG table entry with a name
1427 ** of the form: "baseurl:BASE". This keeps a record of how the
1428 ** the repository is used as a server, to help in answering questions
1429 ** like "where is the CGI script that references this repository?"
1430
+6 -6
--- src/style.c
+++ src/style.c
@@ -406,16 +406,16 @@
406406
va_end(ap);
407407
}
408408
}
409409
410410
/* Use this for the $base_href_suffix variable if it is not NULL.
411
-** If it is NULL then use g.zUrlSuffix
411
+** If it is NULL then use g.zRelReqURI
412412
*/
413413
static char *local_zBaseHrefSuffix = 0;
414414
415415
/*
416
-** Set the desired $base_href_suffix to something other than g.zUrlSuffix
416
+** Set the desired $base_href_suffix to something other than g.zRelReqURI
417417
*/
418418
void style_set_base_href_suffix(const char *zFormat, ...){
419419
fossil_free(local_zBaseHrefSuffix);
420420
if( zFormat==0 ){
421421
local_zBaseHrefSuffix = 0;
@@ -790,15 +790,15 @@
790790
Th_Store("home", g.zTop);
791791
Th_Store("index_page", db_get("index-page","/home"));
792792
if( local_zCurrentPage==0 ) style_set_current_page("%T", g.zPath);
793793
Th_Store("current_page", local_zCurrentPage);
794794
if( local_zBaseHrefSuffix==0 ){
795
- style_set_base_href_suffix("%s",g.zUrlSuffix);
796
- /* %s because g.zUrlSuffix is already encoded (FIXME: really so?) */
795
+ style_set_base_href_suffix("%s",g.zRelReqURI);
796
+ /* %s because g.zRelReqURI is already encoded (FIXME: really so?) */
797797
}
798798
Th_Store("base_href_suffix", local_zBaseHrefSuffix);
799
- Th_Store("requested_url_suffix", g.zUrlSuffix);
799
+ Th_Store("relrequri", g.zRelReqURI);
800800
Th_Store("csrf_token", g.zCsrfToken);
801801
Th_Store("release_version", RELEASE_VERSION);
802802
Th_Store("manifest_version", MANIFEST_VERSION);
803803
Th_Store("manifest_date", MANIFEST_DATE);
804804
Th_Store("compiler_name", COMPILER_NAME);
@@ -1409,11 +1409,11 @@
14091409
#if !defined(_WIN32)
14101410
@ uid=%d(getuid()), gid=%d(getgid())<br />
14111411
#endif
14121412
@ g.zBaseURL = %h(g.zBaseURL)<br />
14131413
@ g.zHttpsURL = %h(g.zHttpsURL)<br />
1414
- @ g.zUrlSuffix = %h(g.zUrlSuffix)<br />
1414
+ @ g.zRelReqURI = %h(g.zRelReqURI)<br />
14151415
@ g.zTop = %h(g.zTop)<br />
14161416
@ g.zPath = %h(g.zPath)<br />
14171417
@ g.userUid = %d(g.userUid)<br />
14181418
@ g.zLogin = %h(g.zLogin)<br />
14191419
@ g.isHuman = %d(g.isHuman)<br />
14201420
--- src/style.c
+++ src/style.c
@@ -406,16 +406,16 @@
406 va_end(ap);
407 }
408 }
409
410 /* Use this for the $base_href_suffix variable if it is not NULL.
411 ** If it is NULL then use g.zUrlSuffix
412 */
413 static char *local_zBaseHrefSuffix = 0;
414
415 /*
416 ** Set the desired $base_href_suffix to something other than g.zUrlSuffix
417 */
418 void style_set_base_href_suffix(const char *zFormat, ...){
419 fossil_free(local_zBaseHrefSuffix);
420 if( zFormat==0 ){
421 local_zBaseHrefSuffix = 0;
@@ -790,15 +790,15 @@
790 Th_Store("home", g.zTop);
791 Th_Store("index_page", db_get("index-page","/home"));
792 if( local_zCurrentPage==0 ) style_set_current_page("%T", g.zPath);
793 Th_Store("current_page", local_zCurrentPage);
794 if( local_zBaseHrefSuffix==0 ){
795 style_set_base_href_suffix("%s",g.zUrlSuffix);
796 /* %s because g.zUrlSuffix is already encoded (FIXME: really so?) */
797 }
798 Th_Store("base_href_suffix", local_zBaseHrefSuffix);
799 Th_Store("requested_url_suffix", g.zUrlSuffix);
800 Th_Store("csrf_token", g.zCsrfToken);
801 Th_Store("release_version", RELEASE_VERSION);
802 Th_Store("manifest_version", MANIFEST_VERSION);
803 Th_Store("manifest_date", MANIFEST_DATE);
804 Th_Store("compiler_name", COMPILER_NAME);
@@ -1409,11 +1409,11 @@
1409 #if !defined(_WIN32)
1410 @ uid=%d(getuid()), gid=%d(getgid())<br />
1411 #endif
1412 @ g.zBaseURL = %h(g.zBaseURL)<br />
1413 @ g.zHttpsURL = %h(g.zHttpsURL)<br />
1414 @ g.zUrlSuffix = %h(g.zUrlSuffix)<br />
1415 @ g.zTop = %h(g.zTop)<br />
1416 @ g.zPath = %h(g.zPath)<br />
1417 @ g.userUid = %d(g.userUid)<br />
1418 @ g.zLogin = %h(g.zLogin)<br />
1419 @ g.isHuman = %d(g.isHuman)<br />
1420
--- src/style.c
+++ src/style.c
@@ -406,16 +406,16 @@
406 va_end(ap);
407 }
408 }
409
410 /* Use this for the $base_href_suffix variable if it is not NULL.
411 ** If it is NULL then use g.zRelReqURI
412 */
413 static char *local_zBaseHrefSuffix = 0;
414
415 /*
416 ** Set the desired $base_href_suffix to something other than g.zRelReqURI
417 */
418 void style_set_base_href_suffix(const char *zFormat, ...){
419 fossil_free(local_zBaseHrefSuffix);
420 if( zFormat==0 ){
421 local_zBaseHrefSuffix = 0;
@@ -790,15 +790,15 @@
790 Th_Store("home", g.zTop);
791 Th_Store("index_page", db_get("index-page","/home"));
792 if( local_zCurrentPage==0 ) style_set_current_page("%T", g.zPath);
793 Th_Store("current_page", local_zCurrentPage);
794 if( local_zBaseHrefSuffix==0 ){
795 style_set_base_href_suffix("%s",g.zRelReqURI);
796 /* %s because g.zRelReqURI is already encoded (FIXME: really so?) */
797 }
798 Th_Store("base_href_suffix", local_zBaseHrefSuffix);
799 Th_Store("relrequri", g.zRelReqURI);
800 Th_Store("csrf_token", g.zCsrfToken);
801 Th_Store("release_version", RELEASE_VERSION);
802 Th_Store("manifest_version", MANIFEST_VERSION);
803 Th_Store("manifest_date", MANIFEST_DATE);
804 Th_Store("compiler_name", COMPILER_NAME);
@@ -1409,11 +1409,11 @@
1409 #if !defined(_WIN32)
1410 @ uid=%d(getuid()), gid=%d(getgid())<br />
1411 #endif
1412 @ g.zBaseURL = %h(g.zBaseURL)<br />
1413 @ g.zHttpsURL = %h(g.zHttpsURL)<br />
1414 @ g.zRelReqURI = %h(g.zRelReqURI)<br />
1415 @ g.zTop = %h(g.zTop)<br />
1416 @ g.zPath = %h(g.zPath)<br />
1417 @ g.userUid = %d(g.userUid)<br />
1418 @ g.zLogin = %h(g.zLogin)<br />
1419 @ g.isHuman = %d(g.isHuman)<br />
1420

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button