From a1ea72d719b63a4d2b6421ce2e53b7e3ab12a8a1 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 23 Feb 2024 18:50:28 +0300 Subject: Add curl constructors which allow to adjust curl command line --- libbutl/curl.cxx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'libbutl/curl.cxx') 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) { -- cgit v1.1