Fossil SCM

Remove some dead code. Add some internal docs. Add a couple of const qualifiers to help me reason through the xfer payload buffer's lifetime.

stephan 2025-07-22 18:11 xfer-login-card
Commit 459d0cbbc777f0d02880131835036bf8f5859582538d990e4fee9ee11bfbec01
2 files changed +4 -9 +1 -1
+4 -9
--- src/http.c
+++ src/http.c
@@ -475,20 +475,15 @@
475475
}else{
476476
if( mHttpFlags & HTTP_USE_LOGIN ) http_build_login_card(pSend, &login);
477477
if( g.syncInfo.bLoginCardHeader ) {
478478
/* Send the login card as an HTTP header. */
479479
if( g.fHttpTrace || (mHttpFlags & HTTP_NOCOMPRESS)!=0 ){
480
-#if 1
481
- /*blob_append(&payload, blob_buffer(pSend), blob_size(pSend));*/
480
+ /* Maintenance note: we cannot blob_swap(pSend,&payload) here
481
+ ** because the HTTP 401 and redirect response handling below
482
+ ** needs pSend unmodified. payload won't be modified after
483
+ ** this point, so we can make it a proxy for pSend. */
482484
blob_init(&payload, blob_buffer(pSend), blob_size(pSend));
483
-#else
484
- /* This could save memory but looks like it would break in a
485
- ** couple of cases in the loop below where pSend is referenced
486
- ** for HTTP 401 and redirects. */
487
- blob_zero(&payload);
488
- blob_swap(pSend, &payload);
489
-#endif
490485
}else{
491486
blob_compress(pSend, &payload);
492487
}
493488
}else{
494489
/* Prepend the login card (if set) to the payload */
495490
--- src/http.c
+++ src/http.c
@@ -475,20 +475,15 @@
475 }else{
476 if( mHttpFlags & HTTP_USE_LOGIN ) http_build_login_card(pSend, &login);
477 if( g.syncInfo.bLoginCardHeader ) {
478 /* Send the login card as an HTTP header. */
479 if( g.fHttpTrace || (mHttpFlags & HTTP_NOCOMPRESS)!=0 ){
480 #if 1
481 /*blob_append(&payload, blob_buffer(pSend), blob_size(pSend));*/
 
 
482 blob_init(&payload, blob_buffer(pSend), blob_size(pSend));
483 #else
484 /* This could save memory but looks like it would break in a
485 ** couple of cases in the loop below where pSend is referenced
486 ** for HTTP 401 and redirects. */
487 blob_zero(&payload);
488 blob_swap(pSend, &payload);
489 #endif
490 }else{
491 blob_compress(pSend, &payload);
492 }
493 }else{
494 /* Prepend the login card (if set) to the payload */
495
--- src/http.c
+++ src/http.c
@@ -475,20 +475,15 @@
475 }else{
476 if( mHttpFlags & HTTP_USE_LOGIN ) http_build_login_card(pSend, &login);
477 if( g.syncInfo.bLoginCardHeader ) {
478 /* Send the login card as an HTTP header. */
479 if( g.fHttpTrace || (mHttpFlags & HTTP_NOCOMPRESS)!=0 ){
480 /* Maintenance note: we cannot blob_swap(pSend,&payload) here
481 ** because the HTTP 401 and redirect response handling below
482 ** needs pSend unmodified. payload won't be modified after
483 ** this point, so we can make it a proxy for pSend. */
484 blob_init(&payload, blob_buffer(pSend), blob_size(pSend));
 
 
 
 
 
 
 
485 }else{
486 blob_compress(pSend, &payload);
487 }
488 }else{
489 /* Prepend the login card (if set) to the payload */
490
--- src/http_transport.c
+++ src/http_transport.c
@@ -245,11 +245,11 @@
245245
}
246246
247247
/*
248248
** Send content over the wire.
249249
*/
250
-void transport_send(UrlData *pUrlData, Blob *toSend){
250
+void transport_send(UrlData const *pUrlData, const Blob *toSend){
251251
char *z = blob_buffer(toSend);
252252
int n = blob_size(toSend);
253253
transport.nSent += n;
254254
if( pUrlData->isSsh ){
255255
fwrite(z, 1, n, sshOut);
256256
--- src/http_transport.c
+++ src/http_transport.c
@@ -245,11 +245,11 @@
245 }
246
247 /*
248 ** Send content over the wire.
249 */
250 void transport_send(UrlData *pUrlData, Blob *toSend){
251 char *z = blob_buffer(toSend);
252 int n = blob_size(toSend);
253 transport.nSent += n;
254 if( pUrlData->isSsh ){
255 fwrite(z, 1, n, sshOut);
256
--- src/http_transport.c
+++ src/http_transport.c
@@ -245,11 +245,11 @@
245 }
246
247 /*
248 ** Send content over the wire.
249 */
250 void transport_send(UrlData const *pUrlData, const Blob *toSend){
251 char *z = blob_buffer(toSend);
252 int n = blob_size(toSend);
253 transport.nSent += n;
254 if( pUrlData->isSsh ){
255 fwrite(z, 1, n, sshOut);
256

Keyboard Shortcuts

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