Fossil SCM

Make http_last_trace_reply() return NULL when the reply file is missing, so that "fossil clone --httptrace" reports the failed clone when the server sent no reply, in place of "no such file".

dmestas 2026-11-22 11:36 UTC small-fixes
Commit 1ef35bf12c008c47df3dc7ec61c400b2133dbb34493a72de2fd856edb8440efe
1 file changed +5 -3
+5 -3
--- src/http.c
+++ src/http.c
@@ -439,17 +439,19 @@
439439
** It still might return a NULL pointer if for some reason it cannot
440440
** find and open the last http-reply-N.txt file.
441441
*/
442442
char *http_last_trace_reply(void){
443443
Blob x;
444
- int n;
445444
char *zFilename;
446445
if( g.fHttpTrace==0 ) return 0;
447446
zFilename = mprintf("http-reply-%d.txt", traceCnt);
448
- n = blob_read_from_file(&x, zFilename, ExtFILE);
447
+ if( file_size(zFilename, ExtFILE)<=0 ){
448
+ fossil_free(zFilename);
449
+ return 0;
450
+ }
451
+ blob_read_from_file(&x, zFilename, ExtFILE);
449452
fossil_free(zFilename);
450
- if( n<=0 ) return 0;
451453
return blob_str(&x);
452454
}
453455
454456
/*
455457
** Return true if z is a valud extension according to RFC 9112 s 7.1.1.
456458
--- src/http.c
+++ src/http.c
@@ -439,17 +439,19 @@
439 ** It still might return a NULL pointer if for some reason it cannot
440 ** find and open the last http-reply-N.txt file.
441 */
442 char *http_last_trace_reply(void){
443 Blob x;
444 int n;
445 char *zFilename;
446 if( g.fHttpTrace==0 ) return 0;
447 zFilename = mprintf("http-reply-%d.txt", traceCnt);
448 n = blob_read_from_file(&x, zFilename, ExtFILE);
 
 
 
 
449 fossil_free(zFilename);
450 if( n<=0 ) return 0;
451 return blob_str(&x);
452 }
453
454 /*
455 ** Return true if z is a valud extension according to RFC 9112 s 7.1.1.
456
--- src/http.c
+++ src/http.c
@@ -439,17 +439,19 @@
439 ** It still might return a NULL pointer if for some reason it cannot
440 ** find and open the last http-reply-N.txt file.
441 */
442 char *http_last_trace_reply(void){
443 Blob x;
 
444 char *zFilename;
445 if( g.fHttpTrace==0 ) return 0;
446 zFilename = mprintf("http-reply-%d.txt", traceCnt);
447 if( file_size(zFilename, ExtFILE)<=0 ){
448 fossil_free(zFilename);
449 return 0;
450 }
451 blob_read_from_file(&x, zFilename, ExtFILE);
452 fossil_free(zFilename);
 
453 return blob_str(&x);
454 }
455
456 /*
457 ** Return true if z is a valud extension according to RFC 9112 s 7.1.1.
458

Keyboard Shortcuts

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