Fossil

Check-in [3571c871]
Login

Check-in [3571c871]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Improvements to the g= query parameter on login redirects. This is an attempt to fix the problem described by forum post forum f81625500d.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 3571c8715d512a281892724bcf32c081c963f6e0ffd501563db15a5ab62fce60
User & Date: drh 2021-08-25 13:10:20
References
2021-08-25
16:48
Fix a bad redirect associated with Logout. Problem caused by [3571c8715d512a28] ... (check-in: 85f87c8d user: drh tags: trunk)
Context
2021-08-25
16:10
Add the --webpage option to the various "diff" commands. This option causes the diff output to be in the form of a stand-alone webpage that can be sent to a remote collaborator (for example via a chat attachment). ... (check-in: ea52b7d0 user: drh tags: trunk)
13:10
Improvements to the g= query parameter on login redirects. This is an attempt to fix the problem described by forum post forum f81625500d. ... (check-in: 3571c871 user: drh tags: trunk)
2021-08-23
02:40
Minor internal doc tweaks. No code changes. ... (check-in: 49071226 user: stephan tags: trunk)
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/login.c.

103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/*
** Redirect to the page specified by the "g" query parameter.
** Or if there is no "g" query parameter, redirect to the homepage.
*/
static void redirect_to_g(void){
  const char *zGoto = P("g");
  if( zGoto ){
    cgi_redirect(zGoto);
  }else{
    fossil_redirect_home();
  }
}

/*
** Return an abbreviated project code.  The abbreviation is the first







|







103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/*
** Redirect to the page specified by the "g" query parameter.
** Or if there is no "g" query parameter, redirect to the homepage.
*/
static void redirect_to_g(void){
  const char *zGoto = P("g");
  if( zGoto ){
    cgi_redirectf("%R/%s",zGoto);
  }else{
    fossil_redirect_home();
  }
}

/*
** Return an abbreviated project code.  The abbreviation is the first
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
    json_err( FSL_JSON_E_DENIED, NULL, 1 );
    fossil_exit(0);
    /* NOTREACHED */
    assert(0);
  }else
#endif /* FOSSIL_ENABLE_JSON */
  {
    const char *zUrl = PD("REQUEST_URI", "index");
    const char *zQS = P("QUERY_STRING");
    char *zUrlNoQS;
    int i;
    Blob redir;
    blob_init(&redir, 0, 0);
    for(i=0; zUrl[i] && zUrl[i]!='?'; i++){}
    zUrlNoQS = fossil_strndup(zUrl, i);
    if( fossil_wants_https(1) ){
      blob_appendf(&redir, "%s/login?g=%T", g.zHttpsURL, zUrlNoQS);
    }else{
      blob_appendf(&redir, "%R/login?g=%T", zUrlNoQS);
    }
    if( zQS && zQS[0] ){
      blob_appendf(&redir, "%%3f%T", zQS);
    }
    if( anonOk ) blob_append(&redir, "&anon", 5);
    cgi_redirect(blob_str(&redir));
    /* NOTREACHED */







<

|
<


<
<

|

|







1477
1478
1479
1480
1481
1482
1483

1484
1485

1486
1487


1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
    json_err( FSL_JSON_E_DENIED, NULL, 1 );
    fossil_exit(0);
    /* NOTREACHED */
    assert(0);
  }else
#endif /* FOSSIL_ENABLE_JSON */
  {

    const char *zQS = P("QUERY_STRING");
    const char *zPathInfo = PD("PATH_INFO","");

    Blob redir;
    blob_init(&redir, 0, 0);


    if( fossil_wants_https(1) ){
      blob_appendf(&redir, "%s/login?g=%T", g.zHttpsURL, zPathInfo);
    }else{
      blob_appendf(&redir, "%R/login?g=%T", zPathInfo);
    }
    if( zQS && zQS[0] ){
      blob_appendf(&redir, "%%3f%T", zQS);
    }
    if( anonOk ) blob_append(&redir, "&anon", 5);
    cgi_redirect(blob_str(&redir));
    /* NOTREACHED */