Fossil SCM

Add the correct suffix to the URL for http requests on "fossil get". Better detection of error returns.

drh 2025-10-15 23:11 get-command
Commit cfb5a8613af3ff7142932c40579cc83e5f113e66f0d54a87726c22e20708f032
1 file changed +10 -1
+10 -1
--- src/checkout.c
+++ src/checkout.c
@@ -558,10 +558,12 @@
558558
}
559559
560560
/* Construct a subpath on the URL if necessary */
561561
if( g.url.isSsh || g.url.isFile ){
562562
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);
563565
}
564566
565567
if( bDebug ){
566568
urlparse_print(0);
567569
}
@@ -569,11 +571,18 @@
569571
/* Fetch the ZIP archive for the requested check-in */
570572
blob_init(&in, 0, 0);
571573
blob_init(&out, 0, 0);
572574
if( bDebug ) mHttpFlags |= HTTP_VERBOSE;
573575
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
+ }
575584
576585
if( zSqlArchive ){
577586
blob_write_to_file(&out, zSqlArchive);
578587
if( bVerbose ) fossil_print("%s\n", zSqlArchive);
579588
return;
580589
--- 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

Keyboard Shortcuts

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