49 const Pathname MediaAccess::_noPath;
53 MediaAccess::MediaAccess ()
96 bool exactIdMatch)
const
107 MIL <<
"Url is not valid" << endl;
117 MIL <<
"Trying scheme '" << scheme <<
"'" << endl;
123 if (scheme ==
"cd" || scheme ==
"dvd")
125 else if (scheme ==
"nfs" || scheme ==
"nfs4")
127 else if (scheme ==
"iso")
129 else if (scheme ==
"file" || scheme ==
"dir")
131 else if (scheme ==
"hd")
133 else if (scheme ==
"cifs" || scheme ==
"smb")
135 else if (scheme ==
"ftp" || scheme ==
"tftp" || scheme ==
"http" || scheme ==
"https")
137 bool use_multicurl =
true;
138 string urlmediahandler ( url.
getQueryParam(
"mediahandler") );
139 if ( urlmediahandler ==
"multicurl" )
141 use_multicurl =
true;
143 else if ( urlmediahandler ==
"curl" )
145 use_multicurl =
false;
149 if ( ! urlmediahandler.empty() )
151 WAR <<
"unknown mediahandler set: " << urlmediahandler << endl;
153 const char *multicurlenv = getenv(
"ZYPP_MULTICURL" );
155 if ( use_multicurl && multicurlenv && ( strcmp(multicurlenv,
"0" ) == 0 ) )
157 WAR <<
"multicurl manually disabled." << endl;
158 use_multicurl =
false;
160 else if ( !use_multicurl && multicurlenv && ( strcmp(multicurlenv,
"1" ) == 0 ) )
162 WAR <<
"multicurl manually enabled." << endl;
163 use_multicurl =
true;
172 curl =
new MediaCurl (url,preferred_attach_point);
174 UrlResolverPlugin::HeaderList::const_iterator it;
175 for (it = custom_headers.begin();
176 it != custom_headers.end();
178 std::string header = it->first +
": " + it->second;
179 MIL <<
"Added custom header -> " << header << endl;
184 else if (scheme ==
"plugin" )
193 ERR <<
"Failed to create media handler" << endl;
197 MIL <<
"Opened: " << *
this << endl;
245 WAR <<
"Close: " << *
this <<
" (" << excpt_r <<
")" << endl;
248 MIL <<
"Close: " << *
this <<
" (OK)" << endl;
280 unsigned int & index)
const
288 if (!devices.empty())
451 return str <<
"MediaAccess( closed )";
459 DBG <<
"From: " << from << endl <<
"To: " << to << endl;
462 Pathname dir = path.dirname();
463 string base = path.basename();
483 {
return obj.
dumpOn( str ); }
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.
std::string getPathData() const
Returns the encoded path component of the URL.
bool isValid() const
Verifies the Url.
#define ZYPP_RETHROW(EXCPT)
Drops a logline and rethrows, updating the CodeLocation.
void setPathData(const std::string &pathdata)
Set the path data component in the URL.
std::list< DirEntry > DirContent
Returned by readdir.
std::string getQueryParam(const std::string ¶m, EEncoding eflag=zypp::url::E_DECODED) const
Return the value for the specified query parameter.
#define ZYPP_CAUGHT(EXCPT)
Drops a logline telling the Exception was caught (in order to handle it).
std::string getScheme() const
Returns the scheme name of the URL.