Fossil SCM

Previous checkin should not have compiled - clean rebuild uncovered a stale dep. Re-map the fLoginCardMode to a bitmask so that it's possible to tell when multiple paths toggle that on, and which paths they were.

stephan 2025-07-24 03:16 xfer-login-card
Commit 780d3b2fe3234fa3031f7087219334e5a9d20f11f4e05e804be11317b3b784ce
4 files changed +2 -2 +3 -5 +7 -4 +7 -5
+2 -2
--- src/cgi.c
+++ src/cgi.c
@@ -1318,11 +1318,11 @@
13181318
** they cannot see the X-Fossil-Xfer-Login card. As a consolation
13191319
** to them, we'll accept that via this query argument. */
13201320
rc |= 0x04;
13211321
fossil_free( g.syncInfo.zLoginCard );
13221322
g.syncInfo.zLoginCard = fossil_strdup(z);
1323
- g.syncInfo.fLoginCardMode = 3;
1323
+ g.syncInfo.fLoginCardMode |= 0x10;
13241324
cgi_delete_parameter("x-f-x-l");
13251325
}
13261326
}
13271327
return rc;
13281328
}
@@ -2239,11 +2239,11 @@
22392239
rangeEnd = x2+1;
22402240
}
22412241
}else if( fossil_strcmp(zFieldName, "x-fossil-xfer-login:")==0 ){
22422242
fossil_free( g.syncInfo.zLoginCard );
22432243
g.syncInfo.zLoginCard = fossil_strdup(zVal);
2244
- g.syncInfo.fLoginCardMode = 1;
2244
+ g.syncInfo.fLoginCardMode |= 0x08;
22452245
}
22462246
}
22472247
cgi_setenv("REQUEST_SCHEME",zScheme);
22482248
cgi_init();
22492249
cgi_trace(0);
22502250
--- src/cgi.c
+++ src/cgi.c
@@ -1318,11 +1318,11 @@
1318 ** they cannot see the X-Fossil-Xfer-Login card. As a consolation
1319 ** to them, we'll accept that via this query argument. */
1320 rc |= 0x04;
1321 fossil_free( g.syncInfo.zLoginCard );
1322 g.syncInfo.zLoginCard = fossil_strdup(z);
1323 g.syncInfo.fLoginCardMode = 3;
1324 cgi_delete_parameter("x-f-x-l");
1325 }
1326 }
1327 return rc;
1328 }
@@ -2239,11 +2239,11 @@
2239 rangeEnd = x2+1;
2240 }
2241 }else if( fossil_strcmp(zFieldName, "x-fossil-xfer-login:")==0 ){
2242 fossil_free( g.syncInfo.zLoginCard );
2243 g.syncInfo.zLoginCard = fossil_strdup(zVal);
2244 g.syncInfo.fLoginCardMode = 1;
2245 }
2246 }
2247 cgi_setenv("REQUEST_SCHEME",zScheme);
2248 cgi_init();
2249 cgi_trace(0);
2250
--- src/cgi.c
+++ src/cgi.c
@@ -1318,11 +1318,11 @@
1318 ** they cannot see the X-Fossil-Xfer-Login card. As a consolation
1319 ** to them, we'll accept that via this query argument. */
1320 rc |= 0x04;
1321 fossil_free( g.syncInfo.zLoginCard );
1322 g.syncInfo.zLoginCard = fossil_strdup(z);
1323 g.syncInfo.fLoginCardMode |= 0x10;
1324 cgi_delete_parameter("x-f-x-l");
1325 }
1326 }
1327 return rc;
1328 }
@@ -2239,11 +2239,11 @@
2239 rangeEnd = x2+1;
2240 }
2241 }else if( fossil_strcmp(zFieldName, "x-fossil-xfer-login:")==0 ){
2242 fossil_free( g.syncInfo.zLoginCard );
2243 g.syncInfo.zLoginCard = fossil_strdup(zVal);
2244 g.syncInfo.fLoginCardMode |= 0x08;
2245 }
2246 }
2247 cgi_setenv("REQUEST_SCHEME",zScheme);
2248 cgi_init();
2249 cgi_trace(0);
2250
+3 -5
--- src/http.c
+++ src/http.c
@@ -147,13 +147,11 @@
147147
if( z && *z ) *z = 0;
148148
x = mprintf("%s?x-f-x-l=%T", g.url.path ? g.url.path : "/",
149149
blob_str(pLogin));
150150
fossil_free(g.url.path);
151151
g.url.path = x;
152
- if( !g.syncInfo.fLoginCardMode ){
153
- g.syncInfo.fLoginCardMode = 4;
154
- }
152
+ g.syncInfo.fLoginCardMode |= 0x04;
155153
}
156154
}
157155
158156
/*
159157
** Construct an appropriate HTTP request header. Write the header
@@ -503,11 +501,11 @@
503501
blob_zero(&login);
504502
if( blob_size(pSend)==0 ){
505503
blob_zero(&payload);
506504
}else{
507505
if( mHttpFlags & HTTP_USE_LOGIN ) http_build_login_card(pSend, &login);
508
- if( g.syncInfo.fLoginCardMode>0 ){
506
+ if( g.syncInfo.fLoginCardMode ){
509507
/* The login card will be sent via an HTTP header and/or URL flag. */
510508
if( g.fHttpTrace || (mHttpFlags & HTTP_NOCOMPRESS)!=0 ){
511509
/* Maintenance note: we cannot blob_swap(pSend,&payload) here
512510
** because the HTTP 401 and redirect response handling below
513511
** needs pSend unmodified. payload won't be modified after
@@ -696,11 +694,11 @@
696694
}
697695
}
698696
}else if( fossil_strnicmp(zLine, "x-fossil-xfer-login: ", 21)==0 ){
699697
fossil_free( g.syncInfo.zLoginCard );
700698
g.syncInfo.zLoginCard = fossil_strdup(&zLine[21]);
701
- g.syncInfo.fLoginCardMode = 1;
699
+ g.syncInfo.fLoginCardMode |= 0x02;
702700
}
703701
}
704702
if( iHttpVersion<0 ){
705703
/* We got nothing back from the server. If using the ssh: protocol,
706704
** this might mean we need to add or remove the PATH=... argument
707705
--- src/http.c
+++ src/http.c
@@ -147,13 +147,11 @@
147 if( z && *z ) *z = 0;
148 x = mprintf("%s?x-f-x-l=%T", g.url.path ? g.url.path : "/",
149 blob_str(pLogin));
150 fossil_free(g.url.path);
151 g.url.path = x;
152 if( !g.syncInfo.fLoginCardMode ){
153 g.syncInfo.fLoginCardMode = 4;
154 }
155 }
156 }
157
158 /*
159 ** Construct an appropriate HTTP request header. Write the header
@@ -503,11 +501,11 @@
503 blob_zero(&login);
504 if( blob_size(pSend)==0 ){
505 blob_zero(&payload);
506 }else{
507 if( mHttpFlags & HTTP_USE_LOGIN ) http_build_login_card(pSend, &login);
508 if( g.syncInfo.fLoginCardMode>0 ){
509 /* The login card will be sent via an HTTP header and/or URL flag. */
510 if( g.fHttpTrace || (mHttpFlags & HTTP_NOCOMPRESS)!=0 ){
511 /* Maintenance note: we cannot blob_swap(pSend,&payload) here
512 ** because the HTTP 401 and redirect response handling below
513 ** needs pSend unmodified. payload won't be modified after
@@ -696,11 +694,11 @@
696 }
697 }
698 }else if( fossil_strnicmp(zLine, "x-fossil-xfer-login: ", 21)==0 ){
699 fossil_free( g.syncInfo.zLoginCard );
700 g.syncInfo.zLoginCard = fossil_strdup(&zLine[21]);
701 g.syncInfo.fLoginCardMode = 1;
702 }
703 }
704 if( iHttpVersion<0 ){
705 /* We got nothing back from the server. If using the ssh: protocol,
706 ** this might mean we need to add or remove the PATH=... argument
707
--- src/http.c
+++ src/http.c
@@ -147,13 +147,11 @@
147 if( z && *z ) *z = 0;
148 x = mprintf("%s?x-f-x-l=%T", g.url.path ? g.url.path : "/",
149 blob_str(pLogin));
150 fossil_free(g.url.path);
151 g.url.path = x;
152 g.syncInfo.fLoginCardMode |= 0x04;
 
 
153 }
154 }
155
156 /*
157 ** Construct an appropriate HTTP request header. Write the header
@@ -503,11 +501,11 @@
501 blob_zero(&login);
502 if( blob_size(pSend)==0 ){
503 blob_zero(&payload);
504 }else{
505 if( mHttpFlags & HTTP_USE_LOGIN ) http_build_login_card(pSend, &login);
506 if( g.syncInfo.fLoginCardMode ){
507 /* The login card will be sent via an HTTP header and/or URL flag. */
508 if( g.fHttpTrace || (mHttpFlags & HTTP_NOCOMPRESS)!=0 ){
509 /* Maintenance note: we cannot blob_swap(pSend,&payload) here
510 ** because the HTTP 401 and redirect response handling below
511 ** needs pSend unmodified. payload won't be modified after
@@ -696,11 +694,11 @@
694 }
695 }
696 }else if( fossil_strnicmp(zLine, "x-fossil-xfer-login: ", 21)==0 ){
697 fossil_free( g.syncInfo.zLoginCard );
698 g.syncInfo.zLoginCard = fossil_strdup(&zLine[21]);
699 g.syncInfo.fLoginCardMode |= 0x02;
700 }
701 }
702 if( iHttpVersion<0 ){
703 /* We got nothing back from the server. If using the ssh: protocol,
704 ** this might mean we need to add or remove the PATH=... argument
705
+7 -4
--- src/main.c
+++ src/main.c
@@ -299,13 +299,16 @@
299299
int fLoginCardMode; /* If non-0, emit login cards in outbound
300300
** requests as a HTTP header or URL
301301
** parameter instead of as part of the
302302
** payload. Gets activated on-demand based
303303
** on xfer traffic contents. Values, for
304
- ** diagnostic/debugging purposes: 1=CLI
305
- ** --flag. 2=inbound HTTP header. 3=query
306
- ** string arg. 4=http_build_header(). */
304
+ ** diagnostic/debugging purposes: 0x01=CLI
305
+ ** --flag, 0x02=http_exchange(),
306
+ ** 0x04=url_append_login_card(),
307
+ ** 0x08=cgi_handle_cgi_request(),
308
+ ** 0x10=cgi_setup_query_string(),
309
+ ** 0x20=page_xfer(), 0x40=client_sync(). */
307310
int remoteVersion; /* Remote fossil version. Used for negotiating
308311
** how to handle the login card. */
309312
} syncInfo;
310313
#ifdef FOSSIL_ENABLE_JSON
311314
struct FossilJsonBits {
@@ -779,11 +782,11 @@
779782
capture_case_sensitive_option();
780783
g.syncInfo.fLoginCardMode =
781784
/* This is only for facilitating development of the
782785
** xfer-login-card branch. It will be removed or re-imagined at
783786
** some point. */
784
- !!find_option("login-card-header","lch", 0);
787
+ find_option("login-card-header","lch", 0) ? 0x01 : 0;
785788
g.zVfsName = find_option("vfs",0,1);
786789
if( g.zVfsName==0 ){
787790
g.zVfsName = fossil_getenv("FOSSIL_VFS");
788791
}
789792
if( g.zVfsName ){
790793
--- src/main.c
+++ src/main.c
@@ -299,13 +299,16 @@
299 int fLoginCardMode; /* If non-0, emit login cards in outbound
300 ** requests as a HTTP header or URL
301 ** parameter instead of as part of the
302 ** payload. Gets activated on-demand based
303 ** on xfer traffic contents. Values, for
304 ** diagnostic/debugging purposes: 1=CLI
305 ** --flag. 2=inbound HTTP header. 3=query
306 ** string arg. 4=http_build_header(). */
 
 
 
307 int remoteVersion; /* Remote fossil version. Used for negotiating
308 ** how to handle the login card. */
309 } syncInfo;
310 #ifdef FOSSIL_ENABLE_JSON
311 struct FossilJsonBits {
@@ -779,11 +782,11 @@
779 capture_case_sensitive_option();
780 g.syncInfo.fLoginCardMode =
781 /* This is only for facilitating development of the
782 ** xfer-login-card branch. It will be removed or re-imagined at
783 ** some point. */
784 !!find_option("login-card-header","lch", 0);
785 g.zVfsName = find_option("vfs",0,1);
786 if( g.zVfsName==0 ){
787 g.zVfsName = fossil_getenv("FOSSIL_VFS");
788 }
789 if( g.zVfsName ){
790
--- src/main.c
+++ src/main.c
@@ -299,13 +299,16 @@
299 int fLoginCardMode; /* If non-0, emit login cards in outbound
300 ** requests as a HTTP header or URL
301 ** parameter instead of as part of the
302 ** payload. Gets activated on-demand based
303 ** on xfer traffic contents. Values, for
304 ** diagnostic/debugging purposes: 0x01=CLI
305 ** --flag, 0x02=http_exchange(),
306 ** 0x04=url_append_login_card(),
307 ** 0x08=cgi_handle_cgi_request(),
308 ** 0x10=cgi_setup_query_string(),
309 ** 0x20=page_xfer(), 0x40=client_sync(). */
310 int remoteVersion; /* Remote fossil version. Used for negotiating
311 ** how to handle the login card. */
312 } syncInfo;
313 #ifdef FOSSIL_ENABLE_JSON
314 struct FossilJsonBits {
@@ -779,11 +782,11 @@
782 capture_case_sensitive_option();
783 g.syncInfo.fLoginCardMode =
784 /* This is only for facilitating development of the
785 ** xfer-login-card branch. It will be removed or re-imagined at
786 ** some point. */
787 find_option("login-card-header","lch", 0) ? 0x01 : 0;
788 g.zVfsName = find_option("vfs",0,1);
789 if( g.zVfsName==0 ){
790 g.zVfsName = fossil_getenv("FOSSIL_VFS");
791 }
792 if( g.zVfsName ){
793
+7 -5
--- src/xfer.c
+++ src/xfer.c
@@ -1319,11 +1319,11 @@
13191319
pnUuidList = &nUuidList;
13201320
}
13211321
if( g.syncInfo.zLoginCard ){
13221322
/* Login card received via HTTP header "X-Fossil-Xfer-Login" or
13231323
** "x-f-x-l" URL parameter. */
1324
- assert( g.syncInfo.bLoginCardHeader && "Set via HTTP header/URL arg" );
1324
+ assert( g.syncInfo.fLoginCardMode && "Set via HTTP header/URL arg" );
13251325
blob_zero(&xfer.line);
13261326
blob_append(&xfer.line, g.syncInfo.zLoginCard, -1);
13271327
xfer.nToken = blob_tokenize(&xfer.line, xfer.aToken,
13281328
count(xfer.aToken));
13291329
fossil_free( g.syncInfo.zLoginCard );
@@ -1722,12 +1722,13 @@
17221722
** for the specific check-in of the client.
17231723
*/
17241724
if( xfer.nToken>=3 && blob_eq(&xfer.aToken[1], "client-version") ){
17251725
xfer.remoteVersion = g.syncInfo.remoteVersion =
17261726
atoi(blob_str(&xfer.aToken[2]));
1727
- g.syncInfo.bLoginCardHeader =
1728
- xfer.remoteVersion>=RELEASE_VERSION_NUMBER;
1727
+ if( xfer.remoteVersion>=RELEASE_VERSION_NUMBER ){
1728
+ g.syncInfo.fLoginCardMode |= 0x20;
1729
+ }
17291730
if( xfer.nToken>=5 ){
17301731
xfer.remoteDate = atoi(blob_str(&xfer.aToken[3]));
17311732
xfer.remoteTime = atoi(blob_str(&xfer.aToken[4]));
17321733
@ pragma server-version %d(RELEASE_VERSION_NUMBER) \
17331734
@ %d(MANIFEST_NUMERIC_DATE) %d(MANIFEST_NUMERIC_TIME)
@@ -2784,12 +2785,13 @@
27842785
** for the specific check-in of the client.
27852786
*/
27862787
if( xfer.nToken>=3 && blob_eq(&xfer.aToken[1], "server-version") ){
27872788
xfer.remoteVersion = g.syncInfo.remoteVersion =
27882789
atoi(blob_str(&xfer.aToken[2]));
2789
- g.syncInfo.bLoginCardHeader =
2790
- xfer.remoteVersion>=RELEASE_VERSION_NUMBER;
2790
+ if( xfer.remoteVersion>=RELEASE_VERSION_NUMBER ){
2791
+ g.syncInfo.fLoginCardMode |= 0x40;
2792
+ }
27912793
if( xfer.nToken>=5 ){
27922794
xfer.remoteDate = atoi(blob_str(&xfer.aToken[3]));
27932795
xfer.remoteTime = atoi(blob_str(&xfer.aToken[4]));
27942796
}
27952797
}
27962798
--- src/xfer.c
+++ src/xfer.c
@@ -1319,11 +1319,11 @@
1319 pnUuidList = &nUuidList;
1320 }
1321 if( g.syncInfo.zLoginCard ){
1322 /* Login card received via HTTP header "X-Fossil-Xfer-Login" or
1323 ** "x-f-x-l" URL parameter. */
1324 assert( g.syncInfo.bLoginCardHeader && "Set via HTTP header/URL arg" );
1325 blob_zero(&xfer.line);
1326 blob_append(&xfer.line, g.syncInfo.zLoginCard, -1);
1327 xfer.nToken = blob_tokenize(&xfer.line, xfer.aToken,
1328 count(xfer.aToken));
1329 fossil_free( g.syncInfo.zLoginCard );
@@ -1722,12 +1722,13 @@
1722 ** for the specific check-in of the client.
1723 */
1724 if( xfer.nToken>=3 && blob_eq(&xfer.aToken[1], "client-version") ){
1725 xfer.remoteVersion = g.syncInfo.remoteVersion =
1726 atoi(blob_str(&xfer.aToken[2]));
1727 g.syncInfo.bLoginCardHeader =
1728 xfer.remoteVersion>=RELEASE_VERSION_NUMBER;
 
1729 if( xfer.nToken>=5 ){
1730 xfer.remoteDate = atoi(blob_str(&xfer.aToken[3]));
1731 xfer.remoteTime = atoi(blob_str(&xfer.aToken[4]));
1732 @ pragma server-version %d(RELEASE_VERSION_NUMBER) \
1733 @ %d(MANIFEST_NUMERIC_DATE) %d(MANIFEST_NUMERIC_TIME)
@@ -2784,12 +2785,13 @@
2784 ** for the specific check-in of the client.
2785 */
2786 if( xfer.nToken>=3 && blob_eq(&xfer.aToken[1], "server-version") ){
2787 xfer.remoteVersion = g.syncInfo.remoteVersion =
2788 atoi(blob_str(&xfer.aToken[2]));
2789 g.syncInfo.bLoginCardHeader =
2790 xfer.remoteVersion>=RELEASE_VERSION_NUMBER;
 
2791 if( xfer.nToken>=5 ){
2792 xfer.remoteDate = atoi(blob_str(&xfer.aToken[3]));
2793 xfer.remoteTime = atoi(blob_str(&xfer.aToken[4]));
2794 }
2795 }
2796
--- src/xfer.c
+++ src/xfer.c
@@ -1319,11 +1319,11 @@
1319 pnUuidList = &nUuidList;
1320 }
1321 if( g.syncInfo.zLoginCard ){
1322 /* Login card received via HTTP header "X-Fossil-Xfer-Login" or
1323 ** "x-f-x-l" URL parameter. */
1324 assert( g.syncInfo.fLoginCardMode && "Set via HTTP header/URL arg" );
1325 blob_zero(&xfer.line);
1326 blob_append(&xfer.line, g.syncInfo.zLoginCard, -1);
1327 xfer.nToken = blob_tokenize(&xfer.line, xfer.aToken,
1328 count(xfer.aToken));
1329 fossil_free( g.syncInfo.zLoginCard );
@@ -1722,12 +1722,13 @@
1722 ** for the specific check-in of the client.
1723 */
1724 if( xfer.nToken>=3 && blob_eq(&xfer.aToken[1], "client-version") ){
1725 xfer.remoteVersion = g.syncInfo.remoteVersion =
1726 atoi(blob_str(&xfer.aToken[2]));
1727 if( xfer.remoteVersion>=RELEASE_VERSION_NUMBER ){
1728 g.syncInfo.fLoginCardMode |= 0x20;
1729 }
1730 if( xfer.nToken>=5 ){
1731 xfer.remoteDate = atoi(blob_str(&xfer.aToken[3]));
1732 xfer.remoteTime = atoi(blob_str(&xfer.aToken[4]));
1733 @ pragma server-version %d(RELEASE_VERSION_NUMBER) \
1734 @ %d(MANIFEST_NUMERIC_DATE) %d(MANIFEST_NUMERIC_TIME)
@@ -2784,12 +2785,13 @@
2785 ** for the specific check-in of the client.
2786 */
2787 if( xfer.nToken>=3 && blob_eq(&xfer.aToken[1], "server-version") ){
2788 xfer.remoteVersion = g.syncInfo.remoteVersion =
2789 atoi(blob_str(&xfer.aToken[2]));
2790 if( xfer.remoteVersion>=RELEASE_VERSION_NUMBER ){
2791 g.syncInfo.fLoginCardMode |= 0x40;
2792 }
2793 if( xfer.nToken>=5 ){
2794 xfer.remoteDate = atoi(blob_str(&xfer.aToken[3]));
2795 xfer.remoteTime = atoi(blob_str(&xfer.aToken[4]));
2796 }
2797 }
2798

Keyboard Shortcuts

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