14 #include <curl/curl.h>
47 str <<
"[<no-url>]" << endl;
48 str <<
"username: '" <<
_username <<
"'" << std::endl
49 <<
"password: " << (
_password.empty() ?
"<empty>" :
"<non-empty>");
73 , _auth_type(CURLAUTH_NONE)
79 , _auth_type(CURLAUTH_NONE)
96 curl_version_info_data *curl_info = curl_version_info(CURLVERSION_NOW);
98 std::vector<std::string> list;
99 std::vector<std::string>::const_iterator it;
100 long auth_type = CURLAUTH_NONE;
104 for(it = list.begin(); it != list.end(); ++it)
108 auth_type |= CURLAUTH_BASIC;
113 auth_type |= CURLAUTH_DIGEST;
116 if((curl_info && (curl_info->features & CURL_VERSION_NTLM)) &&
119 auth_type |= CURLAUTH_NTLM;
122 if((curl_info && (curl_info->features & CURL_VERSION_SPNEGO)) &&
123 (*it ==
"spnego" || *it ==
"negotiate"))
126 auth_type |= CURLAUTH_GSSNEGOTIATE;
129 if((curl_info && (curl_info->features & CURL_VERSION_GSSNEGOTIATE)) &&
130 (*it ==
"gssnego" || *it ==
"negotiate"))
132 auth_type |= CURLAUTH_GSSNEGOTIATE;
145 std::list<std::string> auth_list;
147 if(auth_type & CURLAUTH_GSSNEGOTIATE)
148 auth_list.push_back(
"negotiate");
150 if(auth_type & CURLAUTH_NTLM)
151 auth_list.push_back(
"ntlm");
153 if(auth_type & CURLAUTH_DIGEST)
154 auth_list.push_back(
"digest");
156 if(auth_type & CURLAUTH_BASIC)
157 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).
std::string getUsername(EEncoding eflag=zypp::url::E_DECODED) const
Returns the username from the URL authority.
bool isValid() const
Verifies the Url.
Url::asString() view options.
std::string asString() const
Returns a default string representation of the Url object.
unsigned split(const C_Str &line_r, TOutputIterator result_r, const C_Str &sepchars_r=" \t")
Split line_r into words.
static const ViewOption WITH_PASSWORD
Option to include password in the URL string.
std::string getPassword(EEncoding eflag=zypp::url::E_DECODED) const
Returns the password from the URL authority.