Fossil SCM

Set g.syncInfo.bLoginCardHeader=1 if that inbound header is detected, rather than delaying it until the /xfer handling. Internal doc additions.

stephan 2025-07-22 15:51 xfer-login-card
Commit 4fc13c5c8812f5632997dce75d956088116e889fb8dc56dbbcb40ae6210613ec
+1
--- src/cgi.c
+++ src/cgi.c
@@ -2223,10 +2223,11 @@
22232223
rangeStart = x1;
22242224
rangeEnd = x2+1;
22252225
}
22262226
}else if( fossil_strcmp(zFieldName, "x-fossil-xfer-login:")==0 ){
22272227
g.syncInfo.zLoginCard = fossil_strdup(zVal);
2228
+ g.syncInfo.bLoginCardHeader = 1;
22282229
/*fprintf(stderr, "X-Fossil-Xfer-Login: %s\n", g.syncInfo.zLoginCard);*/
22292230
}
22302231
}
22312232
cgi_setenv("REQUEST_SCHEME",zScheme);
22322233
cgi_init();
22332234
--- src/cgi.c
+++ src/cgi.c
@@ -2223,10 +2223,11 @@
2223 rangeStart = x1;
2224 rangeEnd = x2+1;
2225 }
2226 }else if( fossil_strcmp(zFieldName, "x-fossil-xfer-login:")==0 ){
2227 g.syncInfo.zLoginCard = fossil_strdup(zVal);
 
2228 /*fprintf(stderr, "X-Fossil-Xfer-Login: %s\n", g.syncInfo.zLoginCard);*/
2229 }
2230 }
2231 cgi_setenv("REQUEST_SCHEME",zScheme);
2232 cgi_init();
2233
--- src/cgi.c
+++ src/cgi.c
@@ -2223,10 +2223,11 @@
2223 rangeStart = x1;
2224 rangeEnd = x2+1;
2225 }
2226 }else if( fossil_strcmp(zFieldName, "x-fossil-xfer-login:")==0 ){
2227 g.syncInfo.zLoginCard = fossil_strdup(zVal);
2228 g.syncInfo.bLoginCardHeader = 1;
2229 /*fprintf(stderr, "X-Fossil-Xfer-Login: %s\n", g.syncInfo.zLoginCard);*/
2230 }
2231 }
2232 cgi_setenv("REQUEST_SCHEME",zScheme);
2233 cgi_init();
2234
+9 -3
--- src/main.c
+++ src/main.c
@@ -288,14 +288,20 @@
288288
int allowSymlinks; /* Cached "allow-symlinks" option */
289289
int mainTimerId; /* Set to fossil_timer_start() */
290290
int nPendingRequest; /* # of HTTP requests in "fossil server" */
291291
int nRequest; /* Total # of HTTP request */
292292
int bAvoidDeltaManifests; /* Avoid using delta manifests if true */
293
+
294
+ /* State for communicating specific details between the inbound HTTP
295
+ ** header parser (cgi.c), xfer.c, and http.c. */
293296
struct {
294
- char *zLoginCard; /* X-Fossil-Xfer-Login request header value */
295
- int bLoginCardHeader; /* If true, emit login cards as HTTP headers
296
- ** instead of as part of the payload */
297
+ char *zLoginCard; /* Inbound X-Fossil-Xfer-Login request header */
298
+ int bLoginCardHeader; /* If true, emit login cards in outbound
299
+ ** requests as HTTP headers instead of as
300
+ ** part of the payload. Gets activated
301
+ ** on-demand based on xfer traffic
302
+ ** contents. */
297303
} syncInfo;
298304
#ifdef FOSSIL_ENABLE_JSON
299305
struct FossilJsonBits {
300306
int isJsonMode; /* True if running in JSON mode, else
301307
false. This changes how errors are
302308
--- src/main.c
+++ src/main.c
@@ -288,14 +288,20 @@
288 int allowSymlinks; /* Cached "allow-symlinks" option */
289 int mainTimerId; /* Set to fossil_timer_start() */
290 int nPendingRequest; /* # of HTTP requests in "fossil server" */
291 int nRequest; /* Total # of HTTP request */
292 int bAvoidDeltaManifests; /* Avoid using delta manifests if true */
 
 
 
293 struct {
294 char *zLoginCard; /* X-Fossil-Xfer-Login request header value */
295 int bLoginCardHeader; /* If true, emit login cards as HTTP headers
296 ** instead of as part of the payload */
 
 
 
297 } syncInfo;
298 #ifdef FOSSIL_ENABLE_JSON
299 struct FossilJsonBits {
300 int isJsonMode; /* True if running in JSON mode, else
301 false. This changes how errors are
302
--- src/main.c
+++ src/main.c
@@ -288,14 +288,20 @@
288 int allowSymlinks; /* Cached "allow-symlinks" option */
289 int mainTimerId; /* Set to fossil_timer_start() */
290 int nPendingRequest; /* # of HTTP requests in "fossil server" */
291 int nRequest; /* Total # of HTTP request */
292 int bAvoidDeltaManifests; /* Avoid using delta manifests if true */
293
294 /* State for communicating specific details between the inbound HTTP
295 ** header parser (cgi.c), xfer.c, and http.c. */
296 struct {
297 char *zLoginCard; /* Inbound X-Fossil-Xfer-Login request header */
298 int bLoginCardHeader; /* If true, emit login cards in outbound
299 ** requests as HTTP headers instead of as
300 ** part of the payload. Gets activated
301 ** on-demand based on xfer traffic
302 ** contents. */
303 } syncInfo;
304 #ifdef FOSSIL_ENABLE_JSON
305 struct FossilJsonBits {
306 int isJsonMode; /* True if running in JSON mode, else
307 false. This changes how errors are
308
-1
--- src/xfer.c
+++ src/xfer.c
@@ -1346,11 +1346,10 @@
13461346
#endif
13471347
fossil_free( g.syncInfo.zLoginCard );
13481348
g.syncInfo.zLoginCard = 0;
13491349
if( xfer.nToken==4
13501350
&& blob_eq(&xfer.aToken[0], "login") ){
1351
- g.syncInfo.bLoginCardHeader = 1;
13521351
goto handle_login_card;
13531352
}
13541353
}
13551354
while( blob_line(xfer.pIn, &xfer.line) ){
13561355
if( blob_buffer(&xfer.line)[0]=='#' ) continue;
13571356
--- src/xfer.c
+++ src/xfer.c
@@ -1346,11 +1346,10 @@
1346 #endif
1347 fossil_free( g.syncInfo.zLoginCard );
1348 g.syncInfo.zLoginCard = 0;
1349 if( xfer.nToken==4
1350 && blob_eq(&xfer.aToken[0], "login") ){
1351 g.syncInfo.bLoginCardHeader = 1;
1352 goto handle_login_card;
1353 }
1354 }
1355 while( blob_line(xfer.pIn, &xfer.line) ){
1356 if( blob_buffer(&xfer.line)[0]=='#' ) continue;
1357
--- src/xfer.c
+++ src/xfer.c
@@ -1346,11 +1346,10 @@
1346 #endif
1347 fossil_free( g.syncInfo.zLoginCard );
1348 g.syncInfo.zLoginCard = 0;
1349 if( xfer.nToken==4
1350 && blob_eq(&xfer.aToken[0], "login") ){
 
1351 goto handle_login_card;
1352 }
1353 }
1354 while( blob_line(xfer.pIn, &xfer.line) ){
1355 if( blob_buffer(&xfer.line)[0]=='#' ) continue;
1356

Keyboard Shortcuts

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