37 #include <zypp/zyppng/media/MediaNetwork> 97 bool exactIdMatch)
const 108 MIL <<
"Url is not valid" << endl;
118 MIL <<
"Trying scheme '" << scheme <<
"'" << endl;
124 if (scheme ==
"cd" || scheme ==
"dvd")
126 else if (scheme ==
"nfs" || scheme ==
"nfs4")
128 else if (scheme ==
"iso")
130 else if (scheme ==
"file" || scheme ==
"dir")
132 else if (scheme ==
"hd")
134 else if (scheme ==
"cifs" || scheme ==
"smb")
136 else if (scheme ==
"ftp" || scheme ==
"tftp" || scheme ==
"http" || scheme ==
"https")
138 const char *networkenv = getenv(
"ZYPPNG_MEDIANETWORK" );
139 bool use_network = ( networkenv && strcmp(networkenv,
"1" ) == 0 );
141 WAR <<
"network backend manually enabled." << endl;
142 zyppng::MediaHandlerNetwork *hdl =
new zyppng::MediaHandlerNetwork (
url,preferred_attach_point);
144 UrlResolverPlugin::HeaderList::const_iterator it;
145 for (
const auto & el : custom_headers ) {
146 std::string header { el.first };
149 MIL <<
"Added custom header -> " << header << endl;
150 hdl->settings().addHeader( std::move(header) );
156 bool use_multicurl =
true;
158 if ( urlmediahandler ==
"multicurl" )
160 use_multicurl =
true;
162 else if ( urlmediahandler ==
"curl" )
164 use_multicurl =
false;
168 if ( ! urlmediahandler.empty() )
170 WAR <<
"unknown mediahandler set: " << urlmediahandler << endl;
172 const char *multicurlenv = getenv(
"ZYPP_MULTICURL" );
174 if ( use_multicurl && multicurlenv && ( strcmp(multicurlenv,
"0" ) == 0 ) )
176 WAR <<
"multicurl manually disabled." << endl;
177 use_multicurl =
false;
179 else if ( !use_multicurl && multicurlenv && ( strcmp(multicurlenv,
"1" ) == 0 ) )
181 WAR <<
"multicurl manually enabled." << endl;
182 use_multicurl =
true;
193 for (
const auto & el : custom_headers ) {
194 std::string header { el.first };
197 MIL <<
"Added custom header -> " << header << endl;
203 else if (scheme ==
"plugin" )
212 ERR <<
"Failed to create media handler" << endl;
216 MIL <<
"Opened: " << *
this << endl;
264 WAR <<
"Close: " << *
this <<
" (" << excpt_r <<
")" << endl;
267 MIL <<
"Close: " << *
this <<
" (OK)" << endl;
299 unsigned int & index)
const 307 if (!devices.empty())
479 return str <<
"MediaAccess( closed )";
487 DBG <<
"From: " << from << endl <<
"To: " << to << endl;
std::string getScheme() const
Returns the scheme name of the URL.
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.
Store and operate with byte count.
String related utilities and Regular expression matching.
std::string basename() const
Return the last component of this path.
#define ZYPP_RETHROW(EXCPT)
Drops a logline and rethrows, updating the CodeLocation.
std::string getPathData() const
Returns the encoded path component of the URL.
std::string getQueryParam(const std::string ¶m, EEncoding eflag=zypp::url::E_DECODED) const
Return the value for the specified query parameter.
const std::string & asString() const
String representation.
Pathname dirname() const
Return all but the last component od this path.
void setPathData(const std::string &pathdata)
Set the path data component in the URL.
std::list< DirEntry > DirContent
Returned by readdir.
bool isValid() const
Verifies the Url.
#define ZYPP_CAUGHT(EXCPT)
Drops a logline telling the Exception was caught (in order to handle it).
Easy-to use interface to the ZYPP dependency resolver.