diff options
Diffstat (limited to 'bpkg/fetch.hxx')
-rw-r--r-- | bpkg/fetch.hxx | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/bpkg/fetch.hxx b/bpkg/fetch.hxx index c077079..78e77a7 100644 --- a/bpkg/fetch.hxx +++ b/bpkg/fetch.hxx @@ -138,11 +138,41 @@ namespace bpkg // option for details). // process - start_fetch (const common_options& o, + start_fetch (const common_options&, const string& url, const path& out = {}, const string& user_agent = {}, const butl::url& proxy = {}); + + // Similar to the above but can only be used for HTTP(S) URLs. Additionally + // return the HTTP status code, if the underlying fetch program provides an + // easy way to retrieve it, and 0 otherwise. + // + // In the former case redirect the fetch process stderr to a pipe, so that + // depending on the returned status code the caller can either drop or dump + // the fetch process diagnostics. May also redirect stderr in the latter + // case for some implementation-specific reasons (to prevent the underlying + // fetch program from interacting with the user, etc). The caller can detect + // whether stderr is redirected by checking process::in_efd. + // + // In contrast to start_fetch() always fetch to stdout, which can be read by + // the caller from the specified stream. + // + // If the quiet argument is true, then, if stderr is redirected, minimize + // the amount of diagnostics printed by the fetch program by only printing + // errors. That allows the caller to read stdout and stderr streams + // sequentially in the blocking mode by assuming that the diagnostics always + // fits into the pipe buffer. If stderr is not redirected, then the quiet + // argument is ignored in favor of the more informative diagnostics. + // + pair<process, uint16_t> + start_fetch_http (const common_options&, + const string& url, + ifdstream& out, + fdstream_mode out_mode, + bool quiet, + const string& user_agent = {}, + const butl::url& proxy = {}); } #endif // BPKG_FETCH_HXX |