Fossil SCM

Send the "pragma client-version" command from the client and parse it on the server.

drh 2017-03-01 12:38 UTC fossil-2.0
Commit a5f4579d4db4485e76640cae83d74b678d156be9
1 file changed +12 -2
+12 -2
--- src/xfer.c
+++ src/xfer.c
@@ -1147,10 +1147,11 @@
11471147
char *zUuidList = 0;
11481148
int nUuidList = 0;
11491149
char **pzUuidList = 0;
11501150
int *pnUuidList = 0;
11511151
int uvCatalogSent = 0;
1152
+ int clientVersion = 0; /* Version number of the client */
11521153
11531154
if( fossil_strcmp(PD("REQUEST_METHOD","POST"),"POST") ){
11541155
fossil_redirect_home();
11551156
}
11561157
g.zLogin = "anonymous";
@@ -1301,15 +1302,14 @@
13011302
13021303
/* pull SERVERCODE PROJECTCODE
13031304
** push SERVERCODE PROJECTCODE
13041305
**
13051306
** The client wants either send or receive. The server should
1306
- ** verify that the project code matches.
1307
+ ** verify that the project code matches. The server code is ignored.
13071308
*/
13081309
if( xfer.nToken==3
13091310
&& (blob_eq(&xfer.aToken[0], "pull") || blob_eq(&xfer.aToken[0], "push"))
1310
- && blob_is_hname(&xfer.aToken[1])
13111311
&& blob_is_hname(&xfer.aToken[2])
13121312
){
13131313
const char *zPCode;
13141314
zPCode = db_get("project-code", 0);
13151315
if( zPCode==0 ){
@@ -1528,10 +1528,18 @@
15281528
** Send igot cards for all known artifacts.
15291529
*/
15301530
if( blob_eq(&xfer.aToken[1], "send-catalog") ){
15311531
xfer.resync = 0x7fffffff;
15321532
}
1533
+
1534
+ /* pragma client-version VERSION
1535
+ **
1536
+ ** Let the server know what version of Fossil is running on the client.
1537
+ */
1538
+ if( xfer.nToken>=3 && blob_eq(&xfer.aToken[1], "client-version") ){
1539
+ clientVersion = atoi(blob_str(&xfer.aToken[2]));
1540
+ }
15331541
15341542
/* pragma uv-hash HASH
15351543
**
15361544
** The client wants to make sure that unversioned files are all synced.
15371545
** If the HASH does not match, send a complete catalog of
@@ -1777,10 +1785,11 @@
17771785
}
17781786
17791787
/*
17801788
** Always begin with a clone, pull, or push message
17811789
*/
1790
+ blob_appendf(&send, "pragma client-version %d\n", RELEASE_VERSION_NUMBER);
17821791
if( syncFlags & SYNC_CLONE ){
17831792
blob_appendf(&send, "clone 3 %d\n", cloneSeqno);
17841793
syncFlags &= ~(SYNC_PUSH|SYNC_PULL);
17851794
nCardSent++;
17861795
/* TBD: Request all transferable configuration values */
@@ -1813,10 +1822,11 @@
18131822
db_record_repository_filename(0);
18141823
db_multi_exec(
18151824
"CREATE TEMP TABLE onremote(rid INTEGER PRIMARY KEY);"
18161825
);
18171826
manifest_crosslink_begin();
1827
+
18181828
18191829
/* Send back the most recently received cookie. Let the server
18201830
** figure out if this is a cookie that it cares about.
18211831
*/
18221832
zCookie = db_get("cookie", 0);
18231833
--- src/xfer.c
+++ src/xfer.c
@@ -1147,10 +1147,11 @@
1147 char *zUuidList = 0;
1148 int nUuidList = 0;
1149 char **pzUuidList = 0;
1150 int *pnUuidList = 0;
1151 int uvCatalogSent = 0;
 
1152
1153 if( fossil_strcmp(PD("REQUEST_METHOD","POST"),"POST") ){
1154 fossil_redirect_home();
1155 }
1156 g.zLogin = "anonymous";
@@ -1301,15 +1302,14 @@
1301
1302 /* pull SERVERCODE PROJECTCODE
1303 ** push SERVERCODE PROJECTCODE
1304 **
1305 ** The client wants either send or receive. The server should
1306 ** verify that the project code matches.
1307 */
1308 if( xfer.nToken==3
1309 && (blob_eq(&xfer.aToken[0], "pull") || blob_eq(&xfer.aToken[0], "push"))
1310 && blob_is_hname(&xfer.aToken[1])
1311 && blob_is_hname(&xfer.aToken[2])
1312 ){
1313 const char *zPCode;
1314 zPCode = db_get("project-code", 0);
1315 if( zPCode==0 ){
@@ -1528,10 +1528,18 @@
1528 ** Send igot cards for all known artifacts.
1529 */
1530 if( blob_eq(&xfer.aToken[1], "send-catalog") ){
1531 xfer.resync = 0x7fffffff;
1532 }
 
 
 
 
 
 
 
 
1533
1534 /* pragma uv-hash HASH
1535 **
1536 ** The client wants to make sure that unversioned files are all synced.
1537 ** If the HASH does not match, send a complete catalog of
@@ -1777,10 +1785,11 @@
1777 }
1778
1779 /*
1780 ** Always begin with a clone, pull, or push message
1781 */
 
1782 if( syncFlags & SYNC_CLONE ){
1783 blob_appendf(&send, "clone 3 %d\n", cloneSeqno);
1784 syncFlags &= ~(SYNC_PUSH|SYNC_PULL);
1785 nCardSent++;
1786 /* TBD: Request all transferable configuration values */
@@ -1813,10 +1822,11 @@
1813 db_record_repository_filename(0);
1814 db_multi_exec(
1815 "CREATE TEMP TABLE onremote(rid INTEGER PRIMARY KEY);"
1816 );
1817 manifest_crosslink_begin();
 
1818
1819 /* Send back the most recently received cookie. Let the server
1820 ** figure out if this is a cookie that it cares about.
1821 */
1822 zCookie = db_get("cookie", 0);
1823
--- src/xfer.c
+++ src/xfer.c
@@ -1147,10 +1147,11 @@
1147 char *zUuidList = 0;
1148 int nUuidList = 0;
1149 char **pzUuidList = 0;
1150 int *pnUuidList = 0;
1151 int uvCatalogSent = 0;
1152 int clientVersion = 0; /* Version number of the client */
1153
1154 if( fossil_strcmp(PD("REQUEST_METHOD","POST"),"POST") ){
1155 fossil_redirect_home();
1156 }
1157 g.zLogin = "anonymous";
@@ -1301,15 +1302,14 @@
1302
1303 /* pull SERVERCODE PROJECTCODE
1304 ** push SERVERCODE PROJECTCODE
1305 **
1306 ** The client wants either send or receive. The server should
1307 ** verify that the project code matches. The server code is ignored.
1308 */
1309 if( xfer.nToken==3
1310 && (blob_eq(&xfer.aToken[0], "pull") || blob_eq(&xfer.aToken[0], "push"))
 
1311 && blob_is_hname(&xfer.aToken[2])
1312 ){
1313 const char *zPCode;
1314 zPCode = db_get("project-code", 0);
1315 if( zPCode==0 ){
@@ -1528,10 +1528,18 @@
1528 ** Send igot cards for all known artifacts.
1529 */
1530 if( blob_eq(&xfer.aToken[1], "send-catalog") ){
1531 xfer.resync = 0x7fffffff;
1532 }
1533
1534 /* pragma client-version VERSION
1535 **
1536 ** Let the server know what version of Fossil is running on the client.
1537 */
1538 if( xfer.nToken>=3 && blob_eq(&xfer.aToken[1], "client-version") ){
1539 clientVersion = atoi(blob_str(&xfer.aToken[2]));
1540 }
1541
1542 /* pragma uv-hash HASH
1543 **
1544 ** The client wants to make sure that unversioned files are all synced.
1545 ** If the HASH does not match, send a complete catalog of
@@ -1777,10 +1785,11 @@
1785 }
1786
1787 /*
1788 ** Always begin with a clone, pull, or push message
1789 */
1790 blob_appendf(&send, "pragma client-version %d\n", RELEASE_VERSION_NUMBER);
1791 if( syncFlags & SYNC_CLONE ){
1792 blob_appendf(&send, "clone 3 %d\n", cloneSeqno);
1793 syncFlags &= ~(SYNC_PUSH|SYNC_PULL);
1794 nCardSent++;
1795 /* TBD: Request all transferable configuration values */
@@ -1813,10 +1822,11 @@
1822 db_record_repository_filename(0);
1823 db_multi_exec(
1824 "CREATE TEMP TABLE onremote(rid INTEGER PRIMARY KEY);"
1825 );
1826 manifest_crosslink_begin();
1827
1828
1829 /* Send back the most recently received cookie. Let the server
1830 ** figure out if this is a cookie that it cares about.
1831 */
1832 zCookie = db_get("cookie", 0);
1833

Keyboard Shortcuts

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