14 #include <curl/curl.h> 16 #include <zypp/base/Gettext.h> 17 #include <zypp/base/String.h> 56 str <<
"[<no-url>]" << endl;
58 <<
"password: " << (
_password.empty() ?
"<empty>" :
"<non-empty>");
82 , _auth_type(CURLAUTH_NONE)
88 , _auth_type(CURLAUTH_NONE)
110 curl_version_info_data *curl_info = curl_version_info(CURLVERSION_NOW);
112 std::vector<std::string> list;
113 std::vector<std::string>::const_iterator it;
114 long auth_type = CURLAUTH_NONE;
118 for(it = list.begin(); it != list.end(); ++it)
122 auth_type |= CURLAUTH_BASIC;
127 auth_type |= CURLAUTH_DIGEST;
130 if((curl_info && (curl_info->features & CURL_VERSION_NTLM)) &&
133 auth_type |= CURLAUTH_NTLM;
136 if((curl_info && (curl_info->features & CURL_VERSION_SPNEGO)) &&
137 (*it ==
"spnego" || *it ==
"negotiate"))
140 auth_type |= CURLAUTH_GSSNEGOTIATE;
143 if((curl_info && (curl_info->features & CURL_VERSION_GSSNEGOTIATE)) &&
144 (*it ==
"gssnego" || *it ==
"negotiate"))
146 auth_type |= CURLAUTH_GSSNEGOTIATE;
159 std::list<std::string> auth_list;
161 if(auth_type & CURLAUTH_GSSNEGOTIATE)
162 auth_list.push_back(
"negotiate");
164 if(auth_type & CURLAUTH_NTLM)
165 auth_list.push_back(
"ntlm");
167 if(auth_type & CURLAUTH_DIGEST)
168 auth_list.push_back(
"digest");
170 if(auth_type & CURLAUTH_BASIC)
171 auth_list.push_back(
"basic");
static const ViewOption WITH_USERNAME
Option to include username in the URL string.
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.
std::string join(TIterator begin, TIterator end, const C_Str &sep_r=" ")
Join strings using separator sep_r (defaults to BLANK).
String related utilities and Regular expression matching.
Url::asString() view options.
unsigned split(const C_Str &line_r, TOutputIterator result_r, const C_Str &sepchars_r=" \, const Trim trim_r=NO_TRIM)
Split line_r into words.
std::string asString() const
Returns a default string representation of the Url object.
bool isValid() const
Verifies the Url.
static const ViewOption WITH_PASSWORD
Option to include password in the URL string.
Easy-to use interface to the ZYPP dependency resolver.
std::string getPassword(EEncoding eflag=zypp::url::E_DECODED) const
Returns the password from the URL authority.
std::string getUsername(EEncoding eflag=zypp::url::E_DECODED) const
Returns the username from the URL authority.