Backport patch Support "proxy=_none_" in main config

Resolves: rhbz#2155713
This commit is contained in:
Nicola Sella 2023-05-31 15:10:08 +02:00
parent 8e28f9ad14
commit 037bfbe5d9
2 changed files with 52 additions and 1 deletions

View File

@ -0,0 +1,47 @@
From a5fe0e0eb6457ca51fabe8123d7407951cb8fcba Mon Sep 17 00:00:00 2001
From: Jaroslav Rohel <jrohel@redhat.com>
Date: Wed, 24 May 2023 12:35:29 +0200
Subject: [PATCH] conf: Support "proxy=_none_" in main config (RhBug:2155713)
It has the same meaning as "proxy=". Introduced for compatibility with yum.
Yum does not support a proxy option with an empty value. Instead, it has
the special value "_none_". The value "_none_" is case insensitive.
Support for "proxy=_none_" in the repository configuration was added some
time ago - in commit ea749e6238cdb54fe3b5add67875ab5912d2e766
= changelog =
msg: Support "proxy=_none_" in main config
type: enhancement
resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2155713
---
libdnf/conf/ConfigMain.cpp | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/libdnf/conf/ConfigMain.cpp b/libdnf/conf/ConfigMain.cpp
index a6645d70..a775cf8c 100644
--- a/libdnf/conf/ConfigMain.cpp
+++ b/libdnf/conf/ConfigMain.cpp
@@ -476,7 +476,18 @@ ConfigMain::Impl::Impl(Config & owner)
}, nullptr, true
);
- owner.optBinds().add("proxy", proxy);
+ owner.optBinds().add("proxy", proxy,
+ [&](Option::Priority priority, const std::string & value){
+ auto tmpValue(value);
+ for (auto & ch : tmpValue)
+ ch = std::tolower(ch);
+ if (tmpValue == "_none_")
+ proxy.set(priority, "");
+ else
+ proxy.set(priority, value);
+ }, nullptr, false
+ );
+
owner.optBinds().add("proxy_username", proxy_username);
owner.optBinds().add("proxy_password", proxy_password);
owner.optBinds().add("proxy_auth_method", proxy_auth_method);
--
2.40.1

View File

@ -56,7 +56,7 @@
Name: libdnf Name: libdnf
Version: %{libdnf_major_version}.%{libdnf_minor_version}.%{libdnf_micro_version} Version: %{libdnf_major_version}.%{libdnf_minor_version}.%{libdnf_micro_version}
Release: 15%{?dist} Release: 16%{?dist}
Summary: Library providing simplified C and Python API to libsolv Summary: Library providing simplified C and Python API to libsolv
License: LGPLv2+ License: LGPLv2+
URL: https://github.com/rpm-software-management/libdnf URL: https://github.com/rpm-software-management/libdnf
@ -105,6 +105,7 @@ Patch41: 0041-Fix-listing-a-repository-without-cpeid-RhBug-2066334.patch
Patch42: 0042-Allow-change-of-arch-during-security-updates-with-no.patch Patch42: 0042-Allow-change-of-arch-during-security-updates-with-no.patch
Patch43: 0043-Update-translations.patch Patch43: 0043-Update-translations.patch
Patch44: 0044-Add_repoid_to_solver_error_messagase.patch Patch44: 0044-Add_repoid_to_solver_error_messagase.patch
Patch45: 0045-conf-Support-proxy-_none_-in-main-config-RhBug-21557.patch
BuildRequires: cmake BuildRequires: cmake
@ -350,6 +351,9 @@ popd
%endif %endif
%changelog %changelog
* Wed May 31 2023 Nicola Sella <nsella@redhat.com> - 0.63-0-16
- Support "proxy=_none_" in main config (RhBug:2155713)
* Wed May 17 2023 Jaroslav Rohel <jrohel@redhat.com> - 0.63.0-15 * Wed May 17 2023 Jaroslav Rohel <jrohel@redhat.com> - 0.63.0-15
- Add repoid to solver error messages (RhBug:2179409,2179413) - Add repoid to solver error messages (RhBug:2179409,2179413)