45 std::map<std::string, boost::any> extraInfo;
47 if ( nativeCode != 0 ) {
49 const char *nativeErr = curl_easy_strerror(
static_cast<CURLcode
>(nativeCode) );
50 if ( nativeErr !=
nullptr )
53 if ( !nativeError.empty() )
56 extraInfo.insert( {
"requestUrl", url } );
57 extraInfo.insert( {
"curlCode", nativeCode } );
58 extraInfo.insert( {
"filepath", req.
targetFilePath().asString() } );
63 case CURLE_UNSUPPORTED_PROTOCOL:
68 err +=
" or redirect (";
73 case CURLE_URL_MALFORMAT:
case CURLE_URL_MALFORMAT_USER:
76 case CURLE_LOGIN_DENIED:
79 case CURLE_HTTP_RETURNED_ERROR: {
80 long httpReturnCode = 0;
81 CURLcode infoRet = curl_easy_getinfo( req.
nativeHandle(),
82 CURLINFO_RESPONSE_CODE,
85 if ( infoRet == CURLE_OK ) {
86 extraInfo.insert( {
"responseCode", httpReturnCode } );
89 switch ( httpReturnCode )
92 std::string auth_hint;
94 long auth_info = CURLAUTH_NONE;
97 curl_easy_getinfo(req.
nativeHandle(), CURLINFO_HTTPAUTH_AVAIL, &auth_info);
99 if(infoRet == CURLE_OK) {
118 err =
zypp::str::form(
_(
"Location '%s' is temporarily unaccessible."), url.asString().c_str() );
122 err =
zypp::str::form(
_(
"Timeout exceeded when accessing '%s'."), url.asString().c_str() );
126 if ( url.getHost().find(
".suse.com") != std::string::npos )
127 msg403 =
_(
"Visit the SUSE Customer Center to check whether your registration is valid and has not expired.");
128 else if (url.asString().find(
"novell.com") != std::string::npos)
129 msg403 =
_(
"Visit the Novell Customer Center to check whether your registration is valid and has not expired.");
150 "Unable to retrieve HTTP response\n"), url.asString().c_str() ) ;
154 case CURLE_FTP_COULDNT_RETR_FILE:
155#if CURLVERSION_AT_LEAST(7,16,0)
156 case CURLE_REMOTE_FILE_NOT_FOUND:
158 case CURLE_FTP_ACCESS_DENIED:
159 case CURLE_TFTP_NOTFOUND:
162 case CURLE_BAD_PASSWORD_ENTERED:
163 case CURLE_FTP_USER_PASSWORD_INCORRECT:
166 case CURLE_COULDNT_RESOLVE_PROXY:
167 case CURLE_COULDNT_RESOLVE_HOST:
168 case CURLE_COULDNT_CONNECT:
169 case CURLE_FTP_CANT_GET_HOST:
172 case CURLE_WRITE_ERROR: {
177 case CURLE_PARTIAL_FILE:
180 case CURLE_OPERATION_TIMEDOUT:
183 case CURLE_ABORTED_BY_CALLBACK:
186 case CURLE_PEER_FAILED_VERIFICATION:
192 case CURLE_HTTP2_STREAM:
305 if ( it != d->_extraInfo.end() ) {
307 return boost::any_cast<std::string>( it->second );
308 }
catch (
const boost::bad_any_cast &) { }
312 if ( it != d->_extraInfo.end() ) {
314 return boost::any_cast<std::string>( it->second );
315 }
catch (
const boost::bad_any_cast &) { }
318 return std::string();