Skip to content

Commit bd0fcd5

Browse files
committed
Add OS and arch to HTTP user-agent string
This makes the HTTP user-agent field look like so: User-Agent: cabal-install/1.21.0.0 (linux; x86_64) This allows us to gather more statistics about our user-base as with the current user-agent string we can only do a rough break-down by cabal-install version numbers.
1 parent 84a7680 commit bd0fcd5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

cabal-install/Distribution/Client/HttpUtils.hs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ import Distribution.Verbosity (Verbosity)
3131
import Distribution.Simple.Utils
3232
( die, info, warn, debug, notice
3333
, copyFileVerbose, writeFileAtomic )
34+
import Distribution.System
35+
( buildOS, buildArch )
3436
import Distribution.Text
3537
( display )
3638
import Data.Char ( isSpace )
@@ -67,7 +69,9 @@ mkRequest uri etag = Request{ rqURI = uri
6769
, rqMethod = GET
6870
, rqHeaders = Header HdrUserAgent userAgent : ifNoneMatchHdr
6971
, rqBody = ByteString.empty }
70-
where userAgent = "cabal-install/" ++ display Paths_cabal_install.version
72+
where userAgent = concat [ "cabal-install/", display Paths_cabal_install.version
73+
, " (", display buildOS, "; ", display buildArch, ")"
74+
]
7175
ifNoneMatchHdr = maybe [] (\t -> [Header HdrIfNoneMatch t]) etag
7276

7377
-- |Carry out a GET request, using the local proxy settings

0 commit comments

Comments
 (0)