Fossil SCM
Make a sync round-trip fail when the reply is empty. Previously "fossil sync", "fossil push" and "fossil clone" reported success when the request never reached a Fossil server.
Commit
516bb19ea81589e05aab1b6d463ce9c203f33c41ed9d956a245ac220b0323a99
Parent
e196b5f8dd4cc87…
1 file changed
+12
+12
| --- src/xfer.c | ||
| +++ src/xfer.c | ||
| @@ -2431,10 +2431,22 @@ | ||
| 2431 | 2431 | if( http_exchange(&send, &recv, mHttpFlags, MAX_REDIRECTS, 0) ){ |
| 2432 | 2432 | nErr++; |
| 2433 | 2433 | go = 2; |
| 2434 | 2434 | break; |
| 2435 | 2435 | } |
| 2436 | + | |
| 2437 | + /* Every reply from a Fossil server holds at least one card: the | |
| 2438 | + ** "# timestamp" line that ends a normal reply, or an "error" card. | |
| 2439 | + ** A reply with no content at all means that the request never reached | |
| 2440 | + ** a Fossil server, or that the reply was lost on the way back. Either | |
| 2441 | + ** way the round-trip failed. */ | |
| 2442 | + if( blob_size(&recv)==0 ){ | |
| 2443 | + fossil_warning("server sent an empty reply"); | |
| 2444 | + nErr++; | |
| 2445 | + go = 2; | |
| 2446 | + break; | |
| 2447 | + } | |
| 2436 | 2448 | |
| 2437 | 2449 | /* Remember the URL of the sync target in the config file on the |
| 2438 | 2450 | ** first successful round-trip */ |
| 2439 | 2451 | if( nCycle==0 && db_is_writeable("repository") ){ |
| 2440 | 2452 | xfer_syncwith(g.url.canonical, 0); |
| 2441 | 2453 |
| --- src/xfer.c | |
| +++ src/xfer.c | |
| @@ -2431,10 +2431,22 @@ | |
| 2431 | if( http_exchange(&send, &recv, mHttpFlags, MAX_REDIRECTS, 0) ){ |
| 2432 | nErr++; |
| 2433 | go = 2; |
| 2434 | break; |
| 2435 | } |
| 2436 | |
| 2437 | /* Remember the URL of the sync target in the config file on the |
| 2438 | ** first successful round-trip */ |
| 2439 | if( nCycle==0 && db_is_writeable("repository") ){ |
| 2440 | xfer_syncwith(g.url.canonical, 0); |
| 2441 |
| --- src/xfer.c | |
| +++ src/xfer.c | |
| @@ -2431,10 +2431,22 @@ | |
| 2431 | if( http_exchange(&send, &recv, mHttpFlags, MAX_REDIRECTS, 0) ){ |
| 2432 | nErr++; |
| 2433 | go = 2; |
| 2434 | break; |
| 2435 | } |
| 2436 | |
| 2437 | /* Every reply from a Fossil server holds at least one card: the |
| 2438 | ** "# timestamp" line that ends a normal reply, or an "error" card. |
| 2439 | ** A reply with no content at all means that the request never reached |
| 2440 | ** a Fossil server, or that the reply was lost on the way back. Either |
| 2441 | ** way the round-trip failed. */ |
| 2442 | if( blob_size(&recv)==0 ){ |
| 2443 | fossil_warning("server sent an empty reply"); |
| 2444 | nErr++; |
| 2445 | go = 2; |
| 2446 | break; |
| 2447 | } |
| 2448 | |
| 2449 | /* Remember the URL of the sync target in the config file on the |
| 2450 | ** first successful round-trip */ |
| 2451 | if( nCycle==0 && db_is_writeable("repository") ){ |
| 2452 | xfer_syncwith(g.url.canonical, 0); |
| 2453 |