Fossil SCM
Add the correct suffix to the URL for http requests on "fossil get". Better detection of error returns.
Commit
cfb5a8613af3ff7142932c40579cc83e5f113e66f0d54a87726c22e20708f032
Parent
489b26267427942…
1 file changed
+10
-1
+10
-1
| --- src/checkout.c | ||
| +++ src/checkout.c | ||
| @@ -558,10 +558,12 @@ | ||
| 558 | 558 | } |
| 559 | 559 | |
| 560 | 560 | /* Construct a subpath on the URL if necessary */ |
| 561 | 561 | if( g.url.isSsh || g.url.isFile ){ |
| 562 | 562 | g.url.subpath = mprintf("/sqlar/%t/%t.sqlar", zVers, zDest); |
| 563 | + }else{ | |
| 564 | + g.url.subpath = mprintf("%s/sqlar/%t/%t.sqlar", g.url.path, zVers, zDest); | |
| 563 | 565 | } |
| 564 | 566 | |
| 565 | 567 | if( bDebug ){ |
| 566 | 568 | urlparse_print(0); |
| 567 | 569 | } |
| @@ -569,11 +571,18 @@ | ||
| 569 | 571 | /* Fetch the ZIP archive for the requested check-in */ |
| 570 | 572 | blob_init(&in, 0, 0); |
| 571 | 573 | blob_init(&out, 0, 0); |
| 572 | 574 | if( bDebug ) mHttpFlags |= HTTP_VERBOSE; |
| 573 | 575 | if( bQuiet ) mHttpFlags |= HTTP_QUIET; |
| 574 | - http_exchange(&in, &out, mHttpFlags, 4, 0); | |
| 576 | + rc = http_exchange(&in, &out, mHttpFlags, 4, 0); | |
| 577 | + if( rc | |
| 578 | + || out.nUsed<512 | |
| 579 | + || (out.nUsed%512)!=0 | |
| 580 | + || memcmp(out.aData,"SQLite format 3",16)!=0 | |
| 581 | + ){ | |
| 582 | + fossil_fatal("Server did not return the requested check-in."); | |
| 583 | + } | |
| 575 | 584 | |
| 576 | 585 | if( zSqlArchive ){ |
| 577 | 586 | blob_write_to_file(&out, zSqlArchive); |
| 578 | 587 | if( bVerbose ) fossil_print("%s\n", zSqlArchive); |
| 579 | 588 | return; |
| 580 | 589 |
| --- src/checkout.c | |
| +++ src/checkout.c | |
| @@ -558,10 +558,12 @@ | |
| 558 | } |
| 559 | |
| 560 | /* Construct a subpath on the URL if necessary */ |
| 561 | if( g.url.isSsh || g.url.isFile ){ |
| 562 | g.url.subpath = mprintf("/sqlar/%t/%t.sqlar", zVers, zDest); |
| 563 | } |
| 564 | |
| 565 | if( bDebug ){ |
| 566 | urlparse_print(0); |
| 567 | } |
| @@ -569,11 +571,18 @@ | |
| 569 | /* Fetch the ZIP archive for the requested check-in */ |
| 570 | blob_init(&in, 0, 0); |
| 571 | blob_init(&out, 0, 0); |
| 572 | if( bDebug ) mHttpFlags |= HTTP_VERBOSE; |
| 573 | if( bQuiet ) mHttpFlags |= HTTP_QUIET; |
| 574 | http_exchange(&in, &out, mHttpFlags, 4, 0); |
| 575 | |
| 576 | if( zSqlArchive ){ |
| 577 | blob_write_to_file(&out, zSqlArchive); |
| 578 | if( bVerbose ) fossil_print("%s\n", zSqlArchive); |
| 579 | return; |
| 580 |
| --- src/checkout.c | |
| +++ src/checkout.c | |
| @@ -558,10 +558,12 @@ | |
| 558 | } |
| 559 | |
| 560 | /* Construct a subpath on the URL if necessary */ |
| 561 | if( g.url.isSsh || g.url.isFile ){ |
| 562 | g.url.subpath = mprintf("/sqlar/%t/%t.sqlar", zVers, zDest); |
| 563 | }else{ |
| 564 | g.url.subpath = mprintf("%s/sqlar/%t/%t.sqlar", g.url.path, zVers, zDest); |
| 565 | } |
| 566 | |
| 567 | if( bDebug ){ |
| 568 | urlparse_print(0); |
| 569 | } |
| @@ -569,11 +571,18 @@ | |
| 571 | /* Fetch the ZIP archive for the requested check-in */ |
| 572 | blob_init(&in, 0, 0); |
| 573 | blob_init(&out, 0, 0); |
| 574 | if( bDebug ) mHttpFlags |= HTTP_VERBOSE; |
| 575 | if( bQuiet ) mHttpFlags |= HTTP_QUIET; |
| 576 | rc = http_exchange(&in, &out, mHttpFlags, 4, 0); |
| 577 | if( rc |
| 578 | || out.nUsed<512 |
| 579 | || (out.nUsed%512)!=0 |
| 580 | || memcmp(out.aData,"SQLite format 3",16)!=0 |
| 581 | ){ |
| 582 | fossil_fatal("Server did not return the requested check-in."); |
| 583 | } |
| 584 | |
| 585 | if( zSqlArchive ){ |
| 586 | blob_write_to_file(&out, zSqlArchive); |
| 587 | if( bVerbose ) fossil_print("%s\n", zSqlArchive); |
| 588 | return; |
| 589 |