Support checking ftp urls for file presence.

This commit is contained in:
Joey Hess 2015-05-05 14:05:02 -04:00
parent 0b18228516
commit cf786f42a4
3 changed files with 13 additions and 3 deletions

View file

@ -123,10 +123,14 @@ getUrlInfo url uo = case parseURIRelaxed url of
| Build.SysConfig.curl -> do
output <- catchDefaultIO "" $
readProcess "curl" $ toCommand curlparams
let len = extractlencurl output
let good = found len Nothing
case lastMaybe (lines output) of
Just ('2':_:_) -> found
(extractlencurl output)
Nothing
Just ('2':_:_) -> good
-- don't try to parse ftp status
-- codes; if curl got a length,
-- it's good
_ | "ftp" `isInfixOf` uriScheme u && isJust len -> good
_ -> dne
| otherwise -> dne
Nothing -> dne