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.
Commit
459d0cbbc777f0d02880131835036bf8f5859582538d990e4fee9ee11bfbec01
Parent
1078a123c1c2ddb…
2 files changed
+4
-9
+1
-1
+4
-9
| --- src/http.c | ||
| +++ src/http.c | ||
| @@ -475,20 +475,15 @@ | ||
| 475 | 475 | }else{ |
| 476 | 476 | if( mHttpFlags & HTTP_USE_LOGIN ) http_build_login_card(pSend, &login); |
| 477 | 477 | if( g.syncInfo.bLoginCardHeader ) { |
| 478 | 478 | /* Send the login card as an HTTP header. */ |
| 479 | 479 | 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. */ | |
| 482 | 484 | 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 | 485 | }else{ |
| 491 | 486 | blob_compress(pSend, &payload); |
| 492 | 487 | } |
| 493 | 488 | }else{ |
| 494 | 489 | /* Prepend the login card (if set) to the payload */ |
| 495 | 490 |
| --- 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 |
+1
-1
| --- src/http_transport.c | ||
| +++ src/http_transport.c | ||
| @@ -245,11 +245,11 @@ | ||
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | /* |
| 248 | 248 | ** Send content over the wire. |
| 249 | 249 | */ |
| 250 | -void transport_send(UrlData *pUrlData, Blob *toSend){ | |
| 250 | +void transport_send(UrlData const *pUrlData, const Blob *toSend){ | |
| 251 | 251 | char *z = blob_buffer(toSend); |
| 252 | 252 | int n = blob_size(toSend); |
| 253 | 253 | transport.nSent += n; |
| 254 | 254 | if( pUrlData->isSsh ){ |
| 255 | 255 | fwrite(z, 1, n, sshOut); |
| 256 | 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 *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 |