Fossil SCM

fix login_needed() formatting of redirection string

sdr 2020-12-13 17:57 trunk
Commit 204e5992e4eb05922d51a4341b8e52b737a188cb06c3124b1d2fe2dd782c2fa7
1 file changed +8 -3
+8 -3
--- src/login.c
+++ src/login.c
@@ -1424,21 +1424,26 @@
14241424
}else
14251425
#endif /* FOSSIL_ENABLE_JSON */
14261426
{
14271427
const char *zUrl = PD("REQUEST_URI", "index");
14281428
const char *zQS = P("QUERY_STRING");
1429
+ /*
1430
+ ** if there is already a query string, use '&' to introduce a new
1431
+ ** parameter; otherwise use '?' to introduce a new parameter
1432
+ */
1433
+ char intro = (zQS && zQS[0]) ? '&' : '?';
14291434
Blob redir;
14301435
blob_init(&redir, 0, 0);
14311436
if( fossil_wants_https(1) ){
14321437
blob_appendf(&redir, "%s/login?g=%T", g.zHttpsURL, zUrl);
14331438
}else{
14341439
blob_appendf(&redir, "%R/login?g=%T", zUrl);
14351440
}
1436
- if( zQS && zQS[0] ){
1437
- blob_appendf(&redir, "%%3f%T", zQS);
1441
+ if( anonOk ){
1442
+ blob_appendf(&redir, "%%%02Xanon", intro);
1443
+ intro = '&'; /* change intro for subsequent parameters */
14381444
}
1439
- if( anonOk ) blob_append(&redir, "&anon", 5);
14401445
cgi_redirect(blob_str(&redir));
14411446
/* NOTREACHED */
14421447
assert(0);
14431448
}
14441449
}
14451450
--- src/login.c
+++ src/login.c
@@ -1424,21 +1424,26 @@
1424 }else
1425 #endif /* FOSSIL_ENABLE_JSON */
1426 {
1427 const char *zUrl = PD("REQUEST_URI", "index");
1428 const char *zQS = P("QUERY_STRING");
 
 
 
 
 
1429 Blob redir;
1430 blob_init(&redir, 0, 0);
1431 if( fossil_wants_https(1) ){
1432 blob_appendf(&redir, "%s/login?g=%T", g.zHttpsURL, zUrl);
1433 }else{
1434 blob_appendf(&redir, "%R/login?g=%T", zUrl);
1435 }
1436 if( zQS && zQS[0] ){
1437 blob_appendf(&redir, "%%3f%T", zQS);
 
1438 }
1439 if( anonOk ) blob_append(&redir, "&anon", 5);
1440 cgi_redirect(blob_str(&redir));
1441 /* NOTREACHED */
1442 assert(0);
1443 }
1444 }
1445
--- src/login.c
+++ src/login.c
@@ -1424,21 +1424,26 @@
1424 }else
1425 #endif /* FOSSIL_ENABLE_JSON */
1426 {
1427 const char *zUrl = PD("REQUEST_URI", "index");
1428 const char *zQS = P("QUERY_STRING");
1429 /*
1430 ** if there is already a query string, use '&' to introduce a new
1431 ** parameter; otherwise use '?' to introduce a new parameter
1432 */
1433 char intro = (zQS && zQS[0]) ? '&' : '?';
1434 Blob redir;
1435 blob_init(&redir, 0, 0);
1436 if( fossil_wants_https(1) ){
1437 blob_appendf(&redir, "%s/login?g=%T", g.zHttpsURL, zUrl);
1438 }else{
1439 blob_appendf(&redir, "%R/login?g=%T", zUrl);
1440 }
1441 if( anonOk ){
1442 blob_appendf(&redir, "%%%02Xanon", intro);
1443 intro = '&'; /* change intro for subsequent parameters */
1444 }
 
1445 cgi_redirect(blob_str(&redir));
1446 /* NOTREACHED */
1447 assert(0);
1448 }
1449 }
1450

Keyboard Shortcuts

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