14 #include <curl/curl.h>
44 str <<
"username: '" <<
_username <<
"'" << std::endl
45 <<
"password: " << (
_password.empty() ?
"<empty>" :
"<non-empty>")
70 , _auth_type(CURLAUTH_NONE)
76 , _auth_type(CURLAUTH_NONE)
93 curl_version_info_data *curl_info = curl_version_info(CURLVERSION_NOW);
95 std::vector<std::string> list;
96 std::vector<std::string>::const_iterator it;
97 long auth_type = CURLAUTH_NONE;
101 for(it = list.begin(); it != list.end(); ++it)
105 auth_type |= CURLAUTH_BASIC;
110 auth_type |= CURLAUTH_DIGEST;
113 if((curl_info && (curl_info->features & CURL_VERSION_NTLM)) &&
116 auth_type |= CURLAUTH_NTLM;
119 if((curl_info && (curl_info->features & CURL_VERSION_SPNEGO)) &&
120 (*it ==
"spnego" || *it ==
"negotiate"))
123 auth_type |= CURLAUTH_GSSNEGOTIATE;
126 if((curl_info && (curl_info->features & CURL_VERSION_GSSNEGOTIATE)) &&
127 (*it ==
"gssnego" || *it ==
"negotiate"))
129 auth_type |= CURLAUTH_GSSNEGOTIATE;
142 std::list<std::string> auth_list;
144 if(auth_type & CURLAUTH_GSSNEGOTIATE)
145 auth_list.push_back(
"negotiate");
147 if(auth_type & CURLAUTH_NTLM)
148 auth_list.push_back(
"ntlm");
150 if(auth_type & CURLAUTH_DIGEST)
151 auth_list.push_back(
"digest");
153 if(auth_type & CURLAUTH_BASIC)
154 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.