[commit: Cabal] master: Improve the HTTP error message slightly and note some TODOs (4d200cc)
Ian Lynagh
igloo at earth.li
Fri Jun 24 01:58:54 CEST 2011
Repository : ssh://darcs.haskell.org//srv/darcs/packages/Cabal
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/4d200cc00d569a38bfe34369d757059c55f32635
>---------------------------------------------------------------
commit 4d200cc00d569a38bfe34369d757059c55f32635
Author: Duncan Coutts <duncan at haskell.org>
Date: Fri Aug 22 23:17:39 2008 +0000
Improve the HTTP error message slightly and note some TODOs
>---------------------------------------------------------------
cabal-install/Distribution/Client/Fetch.hs | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/cabal-install/Distribution/Client/Fetch.hs b/cabal-install/Distribution/Client/Fetch.hs
index 1145e95..4fd37f6 100644
--- a/cabal-install/Distribution/Client/Fetch.hs
+++ b/cabal-install/Distribution/Client/Fetch.hs
@@ -81,10 +81,14 @@ downloadURI verbosity path uri = do
Right rsp
| rspCode rsp == (2,0,0)
-> writeFileAtomic path (rspBody rsp)
+ --FIXME: check the content-length header matches the body length.
+ --TODO: stream the download into the file rather than buffering the whole
+ -- thing in memory.
+ -- remember the ETag so we can not re-download if nothing changed.
>> return Nothing
| otherwise
- -> return (Just (ErrorMisc ("Invalid HTTP code: " ++ show (rspCode rsp))))
+ -> return (Just (ErrorMisc ("Unsucessful HTTP code: " ++ show (rspCode rsp))))
-- Downloads a package to [config-dir/packages/package-id] and returns the path to the package.
downloadPackage :: Verbosity -> Repo -> PackageIdentifier -> IO String
More information about the Cvs-libraries
mailing list