ref->config("path_encode_slash2", "y"); // always encode 2. slash
addUrlByScheme("ftp", ref);
addUrlByScheme("sftp", ref);
+ addUrlByScheme("tftp", ref);
}
bool
bool Url::schemeIsRemote( const std::string & scheme_r )
{
- static const char * val[] = { "http", "https", "nfs", "nfs4", "smb", "cifs", "ftp", "sftp" };
+ static const char * val[] = { "http", "https", "nfs", "nfs4", "smb", "cifs", "ftp", "sftp", "tftp" };
return isInList( arrayBegin(val), arrayEnd(val), scheme_r );
}
bool Url::schemeIsDownloading( const std::string & scheme_r )
{
- static const char * val[] = { "http", "https", "ftp", "sftp" };
+ static const char * val[] = { "http", "https", "ftp", "sftp", "tftp" };
return isInList( arrayBegin(val), arrayEnd(val), scheme_r );
}
///////////////////////////////////////////////////////////////////
/** \overload nonstatic version */
bool schemeIsLocal() const { return schemeIsLocal( getScheme() ); }
- /** nfs nfs4 smb cifs http https ftp sftp */
+ /** nfs nfs4 smb cifs http https ftp sftp tftp */
static bool schemeIsRemote( const std::string & scheme_r );
/** \overload nonstatic version */
bool schemeIsRemote() const { return schemeIsRemote( getScheme() ); }
/** \overload nonstatic version */
bool schemeIsVolatile() const { return schemeIsVolatile( getScheme() ); }
- /** http https ftp sftp */
+ /** http https ftp sftp tftp */
static bool schemeIsDownloading( const std::string & scheme_r );
/** \overload nonstatic version */
bool schemeIsDownloading() const { return schemeIsDownloading( getScheme() ); }
_handler = new MediaDISK (url,preferred_attach_point);
else if (scheme == "cifs" || scheme == "smb")
_handler = new MediaCIFS (url,preferred_attach_point);
- else if (scheme == "ftp" || scheme == "http" || scheme == "https")
+ else if (scheme == "ftp" || scheme == "tftp" || scheme == "http" || scheme == "https")
{
// Another good idea would be activate MediaAria2c handler via external var
bool use_aria = false;
else if ( !use_aria && ariaenv && ( strcmp(ariaenv, "1" ) == 0 ) )
{
// no aria for ftp - no advantage in that over curl
- if ( url.getScheme() == "ftp" )
+ if ( url.getScheme() == "ftp" || url.getScheme() == "tftp" )
WAR << "no aria2c for FTP, despite ZYPP_ARIA2C=1" << endl;
else
{
else
{
// if there is no username, set anonymous auth
- if ( url.getScheme() == "ftp" && s.username().empty() )
+ if ( ( url.getScheme() == "ftp" || url.getScheme() == "tftp" ) && s.username().empty() )
s.setAnonymousAuth();
}
{
DBG << "HTTP response: " + str::numstring(httpReturnCode);
if ( httpReturnCode == 304
- || ( httpReturnCode == 213 && _url.getScheme() == "ftp" ) ) // not modified
+ || ( httpReturnCode == 213 && (_url.getScheme() == "ftp" || _url.getScheme() == "tftp") ) ) // not modified
{
DBG << " Not modified.";
modified = false;
* Mandatory URL component, that specifies the share name with
* optional subdirectory, where the desired files are located.
*
- * \subsection MediaCurl_Url MediaCurl - FTP/HTTP directory tree (ftp, http, https)
+ * \subsection MediaCurl_Url MediaCurl - FTP/HTTP directory tree (ftp, tftp, http, https)
* The access handler to media directory tree on a ftp/http server.
* - Scheme:
* - <b>ftp</b>
+ * - <b>tftp</b>
* - <b>http</b>
* - <b>https</b>
* - Examples:
try
{
string scheme = urliter->getScheme();
- if (scheme == "http" || scheme == "https" || scheme == "ftp")
+ if (scheme == "http" || scheme == "https" || scheme == "ftp" || scheme == "tftp")
{
checkProtocol(*urliter);
myurllist.push_back(*urliter);
/**
* 4: local: file,dir,hd
* 3: remote: nfs,cifs,smb
- * ?: download: http,https,ftp,sftp
+ * ?: download: http,https,ftp,sftp, tftp
* ?: volatile: cd,dvd
* 0: the rest
*/
RETURN_IF( "file", 4 );
RETURN_IF( "ftp", ZConfig::instance().download_media_prefer_download() ? 2 : 1);
break;
+
+ case 't':
+ RETURN_IF( "tftp", ZConfig::instance().download_media_prefer_download() ? 2 : 1);
+ break;
case 'h':
RETURN_IF( "http", ZConfig::instance().download_media_prefer_download() ? 2 : 1 );
(void)sscanf(buf + 14, "%d,%d,%d", &sql, &rsl, &csl);
else if (!strncmp(buf, "Blocksize: ", 11))
blksize = atoi(buf + 11);
- else if (!strncmp(buf, "URL: http://", 12) || !strncmp(buf, "URL: https://", 13) || !strncmp(buf, "URL: ftp://", 11))
+ else if (!strncmp(buf, "URL: http://", 12) || !strncmp(buf, "URL: https://", 13) || !strncmp(buf, "URL: ftp://", 11) || !strncmp(buf, "URL: tftp://", 12) )
urls.push_back(buf + 5);
else if (!strncmp(buf, "SHA-1: ", 7))
{