[commit: packages/Cabal] ghc-head: Document etag parameter for mkRequest & mkRequest. (4e872b0)

git at git.haskell.org git at git.haskell.org
Mon Aug 26 23:25:46 CEST 2013


Repository : ssh://git@git.haskell.org/Cabal

On branch  : ghc-head
Link       : http://git.haskell.org/?p=packages/Cabal.git;a=commit;h=4e872b078e2b418e14180d6d0ecffb946461a4b7

>---------------------------------------------------------------

commit 4e872b078e2b418e14180d6d0ecffb946461a4b7
Author: Thomas Dziedzic <gostrc at gmail.com>
Date:   Wed May 22 01:28:08 2013 +0000

    Document etag parameter for mkRequest & mkRequest.


>---------------------------------------------------------------

4e872b078e2b418e14180d6d0ecffb946461a4b7
 cabal-install/Distribution/Client/HttpUtils.hs |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/cabal-install/Distribution/Client/HttpUtils.hs b/cabal-install/Distribution/Client/HttpUtils.hs
index e4e0180..d410c95 100644
--- a/cabal-install/Distribution/Client/HttpUtils.hs
+++ b/cabal-install/Distribution/Client/HttpUtils.hs
@@ -57,7 +57,9 @@ proxy _verbosity = do
       if uri' == "" then NoProxy else Proxy uri' auth
     _ -> p
 
-mkRequest :: URI -> Maybe String -> Request ByteString
+mkRequest :: URI
+          -> Maybe String -- ^ optional etag to be set in the If-None-Match HTTP header
+          -> Request ByteString
 mkRequest uri etag = Request{ rqURI     = uri
                             , rqMethod  = GET
                             , rqHeaders = Header HdrUserAgent userAgent : ifNoneMatchHdr
@@ -66,7 +68,10 @@ mkRequest uri etag = Request{ rqURI     = uri
         ifNoneMatchHdr = maybe [] (\t -> [Header HdrIfNoneMatch t]) etag
 
 -- |Carry out a GET request, using the local proxy settings
-getHTTP :: Verbosity -> URI -> Maybe String -> IO (Result (Response ByteString))
+getHTTP :: Verbosity
+        -> URI
+        -> Maybe String -- ^ optional etag to check if we already have the latest file
+        -> IO (Result (Response ByteString))
 getHTTP verbosity uri etag = liftM (\(_, resp) -> Right resp) $
                                    cabalBrowse verbosity (return ()) (request (mkRequest uri etag))
 





More information about the ghc-commits mailing list