Skip to content

Commit

Permalink
repology: add user agent
Browse files Browse the repository at this point in the history
  • Loading branch information
zowoq committed Oct 14, 2024
1 parent b52cefd commit 2063b5e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Repology.hs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import qualified Data.Text as T
import qualified Data.Text.IO
import qualified Data.Vector as V
import GHC.Generics
import Network.HTTP.Client.TLS (newTlsManager)
import Network.HTTP.Client (managerModifyRequest, newManager, requestHeaders)
import Network.HTTP.Client.TLS (tlsManagerSettings)
import OurPrelude
import Servant.API
import Servant.Client (BaseUrl (..), ClientM, Scheme (..), client, mkClientEnv, runClientM)
Expand Down Expand Up @@ -172,7 +173,8 @@ fetch = do
hSetBuffering stdout LineBuffering
hSetBuffering stderr LineBuffering
liftIO $ hPutStrLn stderr "starting"
manager' <- newTlsManager
let addUserAgent req = pure $ req {requestHeaders = ("User-Agent", "https://github.com/nix-community/nixpkgs-update") : requestHeaders req}
manager' <- newManager tlsManagerSettings {managerModifyRequest = addUserAgent}
e <- runClientM allNixUpdateInfo (mkClientEnv manager' baseUrl)
case e of
Left ce -> liftIO $ hPutStrLn stderr $ show ce
Expand Down

0 comments on commit 2063b5e

Please sign in to comment.