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".
Commit
1ef35bf12c008c47df3dc7ec61c400b2133dbb34493a72de2fd856edb8440efe
Parent
a5ff4ba843504fb…
1 file changed
+5
-3
+5
-3
| --- src/http.c | ||
| +++ src/http.c | ||
| @@ -439,17 +439,19 @@ | ||
| 439 | 439 | ** It still might return a NULL pointer if for some reason it cannot |
| 440 | 440 | ** find and open the last http-reply-N.txt file. |
| 441 | 441 | */ |
| 442 | 442 | char *http_last_trace_reply(void){ |
| 443 | 443 | Blob x; |
| 444 | - int n; | |
| 445 | 444 | char *zFilename; |
| 446 | 445 | if( g.fHttpTrace==0 ) return 0; |
| 447 | 446 | 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); | |
| 449 | 452 | fossil_free(zFilename); |
| 450 | - if( n<=0 ) return 0; | |
| 451 | 453 | return blob_str(&x); |
| 452 | 454 | } |
| 453 | 455 | |
| 454 | 456 | /* |
| 455 | 457 | ** Return true if z is a valud extension according to RFC 9112 s 7.1.1. |
| 456 | 458 |
| --- 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 |