diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2024-02-23 18:50:28 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2024-02-26 16:38:49 +0300 |
commit | a1ea72d719b63a4d2b6421ce2e53b7e3ab12a8a1 (patch) | |
tree | 8c5e9e1c044586cee0cc16dd66e78f70b4d33c3f /libbutl/curl.cxx | |
parent | 14049ee7c5880b9e33a3e295d19ed6b36edab567 (diff) |
Add curl constructors which allow to adjust curl command line
Diffstat (limited to 'libbutl/curl.cxx')
-rw-r--r-- | libbutl/curl.cxx | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libbutl/curl.cxx b/libbutl/curl.cxx index 0577391..7efd28d 100644 --- a/libbutl/curl.cxx +++ b/libbutl/curl.cxx @@ -142,7 +142,7 @@ namespace butl } curl::method_proto curl:: - translate (method_type m, const string& u, method_proto_options& o) + translate (method_type m, const string& u, method_proto_options& o, flags fs) { size_t n (u.find ("://")); @@ -161,8 +161,11 @@ namespace butl } else if (icasecmp (u, "http", n) == 0 || icasecmp (u, "https", n) == 0) { - o.push_back ("--fail"); // Fail on HTTP errors (e.g., 404). - o.push_back ("--location"); // Follow redirects. + if ((fs & flags::no_fail) == flags::none) + o.push_back ("--fail"); // Fail on HTTP errors (e.g., 404). + + if ((fs & flags::no_location) == flags::none) + o.push_back ("--location"); // Follow redirects. switch (m) { |