From ee7810ebe5d06fdf1198435186bcbdfb5b1af82a Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Fri, 4 Mar 2016 19:46:54 +0100 Subject: inital archiv fetcher diff --git a/rhimport/fetcher.go b/rhimport/fetcher.go index cbcbc41..446cebf 100644 --- a/rhimport/fetcher.go +++ b/rhimport/fetcher.go @@ -222,10 +222,18 @@ func fetchFileFake(ctx *Context, res *Result, uri *url.URL) error { return nil } +func fetchFileArchiv(ctx *Context, res *Result, uri *url.URL) error { + rhdl.Printf("archiv fetcher for '%s'", ctx.SourceUri) + + res.ResponseCode = http.StatusNotImplemented + res.ErrorString = "archiv fetcher is not finished yet" + // TODO: implement this + return nil +} + type FetchFunc func(*Context, *Result, *url.URL) (err error) // TODO: implement fetchers for: -// archiv:// // public:// // home:// ????? var ( @@ -240,10 +248,15 @@ var ( ) func fetcherInit() { + archiveEnabled := false info := curl.VersionInfo(curl.VERSION_FIRST) protos := info.Protocols for _, proto := range protos { - if _, ok := curlProtos[proto]; ok { + if proto == "smb" { + rhdl.Printf("curl: enabling protocol %s", proto) + fetchers["archiv"] = fetchFileArchiv + archiveEnabled = true + } else if _, ok := curlProtos[proto]; ok { rhdl.Printf("curl: enabling protocol %s", proto) fetchers[proto] = fetchFileCurl curlProtos[proto] = true @@ -256,6 +269,9 @@ func fetcherInit() { rhl.Printf("curl: protocol %s is disabled because the installed library version doesn't support it!", proto) } } + if !archiveEnabled { + rhl.Printf("archiv: fetcher is disabled because the installed curl library version doesn't support scp!") + } } func checkPassword(ctx *Context, result *Result) (err error) { -- cgit v0.10.2