[commit: Cabal] master: Set the useragent string to be "cabal-install/$version" (e3cf3c7)
Ian Lynagh
igloo at earth.li
Fri Jun 24 01:49:34 CEST 2011
Repository : ssh://darcs.haskell.org//srv/darcs/packages/Cabal
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/e3cf3c7c9ae749eab9d2b5e1cecb3d02ab771aed
>---------------------------------------------------------------
commit e3cf3c7c9ae749eab9d2b5e1cecb3d02ab771aed
Author: Duncan Coutts <duncan at haskell.org>
Date: Tue Jan 15 16:03:47 2008 +0000
Set the useragent string to be "cabal-install/$version"
eg, currently it is "cabal-install/0.4.2"
>---------------------------------------------------------------
cabal-install/Hackage/HttpUtils.hs | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/cabal-install/Hackage/HttpUtils.hs b/cabal-install/Hackage/HttpUtils.hs
index 00dedc6..a81877f 100644
--- a/cabal-install/Hackage/HttpUtils.hs
+++ b/cabal-install/Hackage/HttpUtils.hs
@@ -16,6 +16,8 @@ import Control.Exception (try, bracket)
#endif
import System.Environment (getEnvironment)
+import Distribution.Version (showVersion)
+import qualified Paths_cabal_install (version)
import Distribution.Verbosity (Verbosity)
import Distribution.Simple.Utils (warn, debug)
@@ -74,8 +76,9 @@ uri2proxy _ = Nothing
mkRequest :: URI -> Request
mkRequest uri = Request{ rqURI = uri
, rqMethod = GET
- , rqHeaders = [Header HdrUserAgent "Cabal"]
+ , rqHeaders = [Header HdrUserAgent userAgent]
, rqBody = "" }
+ where userAgent = "cabal-install/" ++ showVersion Paths_cabal_install.version
-- |Carry out a GET request, using the local proxy settings
getHTTP :: Verbosity -> URI -> IO (Result Response)
More information about the Cvs-libraries
mailing list