14 #include <curl/curl.h>
16 #include <boost/format.hpp>
46 str <<
"username: '" <<
_username <<
"'" << std::endl
47 <<
"password: " << (
_password.empty() ?
"<empty>" :
"<non-empty>")
72 , _auth_type(CURLAUTH_NONE)
78 , _auth_type(CURLAUTH_NONE)
95 curl_version_info_data *curl_info = curl_version_info(CURLVERSION_NOW);
97 std::vector<std::string> list;
98 std::vector<std::string>::const_iterator it;
99 long auth_type = CURLAUTH_NONE;
103 for(it = list.begin(); it != list.end(); ++it)
107 auth_type |= CURLAUTH_BASIC;
112 auth_type |= CURLAUTH_DIGEST;
115 if((curl_info && (curl_info->features & CURL_VERSION_NTLM)) &&
118 auth_type |= CURLAUTH_NTLM;
121 if((curl_info && (curl_info->features & CURL_VERSION_SPNEGO)) &&
122 (*it ==
"spnego" || *it ==
"negotiate"))
125 auth_type |= CURLAUTH_GSSNEGOTIATE;
128 if((curl_info && (curl_info->features & CURL_VERSION_GSSNEGOTIATE)) &&
129 (*it ==
"gssnego" || *it ==
"negotiate"))
131 auth_type |= CURLAUTH_GSSNEGOTIATE;
135 std::string msg = boost::str(
136 boost::format (
_(
"Unsupported HTTP authentication method '%s'")) % *it);
147 std::list<std::string> auth_list;
149 if(auth_type & CURLAUTH_GSSNEGOTIATE)
150 auth_list.push_back(
"negotiate");
152 if(auth_type & CURLAUTH_NTLM)
153 auth_list.push_back(
"ntlm");
155 if(auth_type & CURLAUTH_DIGEST)
156 auth_list.push_back(
"digest");
158 if(auth_type & CURLAUTH_BASIC)
159 auth_list.push_back(
"basic");