avoid using curl for file:// urls since it's buggy

This commit is contained in:
Joey Hess 2013-03-10 22:34:44 -04:00
parent 74f723bb50
commit eedd248371
2 changed files with 10 additions and 2 deletions

View file

@ -17,6 +17,7 @@ module Utility.Url (
import Common
import Network.URI
import Utility.CopyFile
type URLString = String
@ -71,11 +72,13 @@ exists url headers = case parseURI url of
- would not be appropriate to test at configure time and build support
- for only one in.
-
- Curl is always used for file:// urls, as wget does not support them.
- For file:// urls, neither program works well, so we just copy.
-}
download :: URLString -> Headers -> [CommandParam] -> FilePath -> IO Bool
download url headers options file
| "file://" `isPrefixOf` url = curl
| "file://" `isPrefixOf` url =
let f = drop (length "file://") url
in copyFileExternal f file
| otherwise = ifM (inPath "wget") (wget , curl)
where
headerparams = map (\h -> Param $ "--header=" ++ h) headers

View file

@ -19,3 +19,8 @@ Debian sid/experimental
default repository version: 3
supported repository versions: 3 4
upgrade supported from repository versions: 0 1 2
> Seems that curl doesn't write the file it was asked to
> output to in this case. Crazy. Does not affect empty
> http urls. Switched to using just cp for file://
> [[done]] --[[Joey]]