14 #include <curl/curl.h>
16 #include <boost/format.hpp>
49 str <<
"[<no-url>]" << endl;
50 str <<
"username: '" <<
_username <<
"'" << std::endl
51 <<
"password: " << (
_password.empty() ?
"<empty>" :
"<non-empty>");
75 , _auth_type(CURLAUTH_NONE)
81 , _auth_type(CURLAUTH_NONE)
98 curl_version_info_data *curl_info = curl_version_info(CURLVERSION_NOW);
100 std::vector<std::string> list;
101 std::vector<std::string>::const_iterator it;
102 long auth_type = CURLAUTH_NONE;
106 for(it = list.begin(); it != list.end(); ++it)
110 auth_type |= CURLAUTH_BASIC;
115 auth_type |= CURLAUTH_DIGEST;
118 if((curl_info && (curl_info->features & CURL_VERSION_NTLM)) &&
121 auth_type |= CURLAUTH_NTLM;
124 if((curl_info && (curl_info->features & CURL_VERSION_SPNEGO)) &&
125 (*it ==
"spnego" || *it ==
"negotiate"))
128 auth_type |= CURLAUTH_GSSNEGOTIATE;
131 if((curl_info && (curl_info->features & CURL_VERSION_GSSNEGOTIATE)) &&
132 (*it ==
"gssnego" || *it ==
"negotiate"))
134 auth_type |= CURLAUTH_GSSNEGOTIATE;
138 std::string msg = boost::str(
139 boost::format (
_(
"Unsupported HTTP authentication method '%s'")) % *it);
150 std::list<std::string> auth_list;
152 if(auth_type & CURLAUTH_GSSNEGOTIATE)
153 auth_list.push_back(
"negotiate");
155 if(auth_type & CURLAUTH_NTLM)
156 auth_list.push_back(
"ntlm");
158 if(auth_type & CURLAUTH_DIGEST)
159 auth_list.push_back(
"digest");
161 if(auth_type & CURLAUTH_BASIC)
162 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.
unsigned split(const C_Str &line_r, _OutputIterator result_r, const C_Str &sepchars_r=" \t")
Split line_r into words.
String related utilities and Regular expression matching.
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.
std::string join(_Iterator begin, _Iterator end, const C_Str &sep_r=" ")
Join strings using separator sep_r (defaults to BLANK).
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.