Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Add the "main-url" setting. Use it to send the "pragma from-url" on a sync. The server uses this to add new syncwith: entries for the client. |
|---|---|
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
2ae7a5160ffde01945e5326c97a82a5c |
| User & Date: | drh 2021-08-17 17:13:44.918 |
Context
|
2021-08-17
| ||
| 19:44 | Back out the main-url patch. On second thought, this does not add a lot of value but does introduce complication. Maybe it will get added back in later. check-in: 5bb4f12a8f user: drh tags: trunk | |
| 17:32 | Provide a warning on the security-audit page if any of the TH1 scripts that run during a syncm, push, pull, or clone are configured. check-in: cfb5be4189 user: drh tags: trunk | |
| 17:13 | Add the "main-url" setting. Use it to send the "pragma from-url" on a sync. The server uses this to add new syncwith: entries for the client. check-in: 2ae7a5160f user: drh tags: trunk | |
| 15:41 | Improvements to the /urllist page → the sync URLs and Git mirrors are combined into a single section. Add the url_unparse() interface for freeing memory from a url_parse_local(). check-in: 9bdbcd39cb user: drh tags: trunk | |
Changes
Changes to src/setup.c.
| ︙ | ︙ | |||
1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 |
@ <p>The <a href='%R/download'>/download</a> page is designed to provide
@ a convenient place for newbies
@ to download a ZIP archive or a tarball of the project. By default,
@ the latest trunk check-in is downloaded. Change this tag to something
@ else (ex: release) to alter the behavior of the /download page.
@ (Property: "download-tag")
@ </p>
@ <hr />
entry_attribute("Index Page", 60, "index-page", "idxpg", "/home", 0);
@ <p>Enter the pathname of the page to display when the "Home" menu
@ option is selected and when no pathname is
@ specified in the URL. For example, if you visit the url:</p>
@
@ <blockquote><p>%h(g.zBaseURL)</p></blockquote>
| > > > > > > > > > > | 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 |
@ <p>The <a href='%R/download'>/download</a> page is designed to provide
@ a convenient place for newbies
@ to download a ZIP archive or a tarball of the project. By default,
@ the latest trunk check-in is downloaded. Change this tag to something
@ else (ex: release) to alter the behavior of the /download page.
@ (Property: "download-tag")
@ </p>
@ <hr />
entry_attribute("Main URL", 60, "main-url", "exturl", "", 0);
@ <p>Enter the canonical URL used to access this repository from the
@ internet. If this repository is not set up as a server, leave this
@ entry blank.
@
@ <p>This entry is not required. It is informational only. Inaccurate
@ entries here will cause goofy URLs to appear under the /urllist page
@ of sync partners, but are otherwise harmless.
@ (Property: "main-url")
@ <hr />
entry_attribute("Index Page", 60, "index-page", "idxpg", "/home", 0);
@ <p>Enter the pathname of the page to display when the "Home" menu
@ option is selected and when no pathname is
@ specified in the URL. For example, if you visit the url:</p>
@
@ <blockquote><p>%h(g.zBaseURL)</p></blockquote>
|
| ︙ | ︙ |
Changes to src/xfer.c.
| ︙ | ︙ | |||
1575 1576 1577 1578 1579 1580 1581 |
if( blob_eq(&xfer.aToken[1], "send-private") ){
login_check_credentials();
if( !g.perm.Private ){
server_private_xfer_not_authorized();
}else{
xfer.syncPrivate = 1;
}
| | | | | 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 |
if( blob_eq(&xfer.aToken[1], "send-private") ){
login_check_credentials();
if( !g.perm.Private ){
server_private_xfer_not_authorized();
}else{
xfer.syncPrivate = 1;
}
}else
/* pragma send-catalog
**
** The client wants to see igot cards for all known artifacts.
** This is used as part of "sync --verily" to help ensure that
** no artifacts have been missed on prior syncs.
*/
if( blob_eq(&xfer.aToken[1], "send-catalog") ){
xfer.resync = 0x7fffffff;
}else
/* pragma client-version VERSION ?DATE? ?TIME?
**
** The client announces to the server what version of Fossil it
** is running. The DATE and TIME are a pure numeric ISO8601 time
** for the specific check-in of the client.
*/
if( xfer.nToken>=3 && blob_eq(&xfer.aToken[1], "client-version") ){
xfer.remoteVersion = atoi(blob_str(&xfer.aToken[2]));
if( xfer.nToken>=5 ){
xfer.remoteDate = atoi(blob_str(&xfer.aToken[3]));
xfer.remoteTime = atoi(blob_str(&xfer.aToken[4]));
@ pragma server-version %d(RELEASE_VERSION_NUMBER) \
@ %d(MANIFEST_NUMERIC_DATE) %d(MANIFEST_NUMERIC_TIME)
}
}else
/* pragma uv-hash HASH
**
** The client wants to make sure that unversioned files are all synced.
** If the HASH does not match, send a complete catalog of
** "uvigot" cards.
*/
|
| ︙ | ︙ | |||
1624 1625 1626 1627 1628 1629 1630 |
@ pragma uv-push-ok
}else if( g.perm.Read ){
@ pragma uv-pull-only
}
send_unversioned_catalog(&xfer);
}
uvCatalogSent = 1;
| | | 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 |
@ pragma uv-push-ok
}else if( g.perm.Read ){
@ pragma uv-pull-only
}
send_unversioned_catalog(&xfer);
}
uvCatalogSent = 1;
}else
/* pragma ci-lock CHECKIN-HASH CLIENT-ID
**
** The client wants to make non-branch commit against the check-in
** identified by CHECKIN-HASH. The server will remember this and
** subsequent ci-lock requests from different clients will generate
** a ci-lock-fail pragma in the reply.
|
| ︙ | ︙ | |||
1684 1685 1686 1687 1688 1689 1690 |
blob_str(&xfer.aToken[3])
);
db_protect_pop();
}
if( db_get_boolean("forbid-delta-manifests",0) ){
@ pragma avoid-delta-manifests
}
| | > | > > > > > > > > > > > > > > > > > > > > | > | 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 |
blob_str(&xfer.aToken[3])
);
db_protect_pop();
}
if( db_get_boolean("forbid-delta-manifests",0) ){
@ pragma avoid-delta-manifests
}
}else
/* pragma ci-unlock CLIENT-ID
**
** Remove any locks previously held by CLIENT-ID. Clients send this
** pragma with their own ID whenever they know that they no longer
** have any commits pending.
*/
if( blob_eq(&xfer.aToken[1], "ci-unlock")
&& xfer.nToken==3
&& blob_is_hname(&xfer.aToken[2])
){
db_unprotect(PROTECT_CONFIG);
db_multi_exec(
"DELETE FROM config"
" WHERE name GLOB 'ci-lock-*'"
" AND json_extract(value,'$.clientid')=%Q",
blob_str(&xfer.aToken[2])
);
db_protect_pop();
}else
/* pragma from-url URL
**
** By this pragma, the client proclaims that it can be reached
** as a server located at URL.
**
** If the user has write permission, then record the URL as a sync
** partner so that it shows up in /urllist pages.
*/
if( blob_eq(&xfer.aToken[1], "from-url") ){
if( xfer.nToken==3
&& blob_size(&xfer.aToken[2])>4
&& g.perm.Write
){
db_unprotect(PROTECT_CONFIG);
db_multi_exec(
"REPLACE INTO config(name,value,mtime)"
"VALUES('syncwith:%q',1,now())",
blob_str(&xfer.aToken[2])
);
db_protect_pop();
}
}
}else
/* Unknown message
*/
{
cgi_reset_content();
@ error bad\scommand:\s%F(blob_str(&xfer.line))
|
| ︙ | ︙ | |||
2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 |
db_lset("client-id", zClientId);
}
blob_appendf(&send, "pragma ci-lock %s %s\n", zCkinLock, zClientId);
zCkinLock = 0;
}else if( zClientId ){
blob_appendf(&send, "pragma ci-unlock %s\n", zClientId);
}
/* Append randomness to the end of the uplink message. This makes all
** messages unique so that that the login-card nonce will always
** be unique.
*/
zRandomness = db_text(0, "SELECT hex(randomblob(20))");
blob_appendf(&send, "# %s\n", zRandomness);
| > > > > > > > > > > | 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 |
db_lset("client-id", zClientId);
}
blob_appendf(&send, "pragma ci-lock %s %s\n", zCkinLock, zClientId);
zCkinLock = 0;
}else if( zClientId ){
blob_appendf(&send, "pragma ci-unlock %s\n", zClientId);
}
/* If this repository has a main-url, let the other side know about
** it.
*/
if( (syncFlags && SYNC_PUSH)!=0 && nCycle==0 ){
const char *zSelfUrl = db_get("main-url",0);
if( zSelfUrl && zSelfUrl[0]!=0 ){
blob_appendf(&send, "pragma from-url %s\n", zSelfUrl);
}
}
/* Append randomness to the end of the uplink message. This makes all
** messages unique so that that the login-card nonce will always
** be unique.
*/
zRandomness = db_text(0, "SELECT hex(randomblob(20))");
blob_appendf(&send, "# %s\n", zRandomness);
|
| ︙ | ︙ |