1
0
Fork 0
mirror of https://code.sup39.dev/repos/Wqawg synced 2024-12-31 06:34:51 +09:00

When doing httpJSON to GET keyId, use appHttpManager, not the silly global one

This commit is contained in:
fr33domlover 2019-01-19 02:33:20 +00:00
parent 61a82f52d8
commit 93def0dfc8

View file

@ -40,7 +40,7 @@ import Data.Time.Clock (UTCTime, getCurrentTime)
import Data.Time.Interval (TimeInterval, toTimeUnit) import Data.Time.Interval (TimeInterval, toTimeUnit)
import Data.Time.Units (Second) import Data.Time.Units (Second)
import Network.HTTP.Client (Manager, HttpException, requestFromURI) import Network.HTTP.Client (Manager, HttpException, requestFromURI)
import Network.HTTP.Simple (httpJSONEither, getResponseBody) import Network.HTTP.Simple (httpJSONEither, getResponseBody, setRequestManager)
import Network.URI (URI (uriFragment), parseURI) import Network.URI (URI (uriFragment), parseURI)
import Text.Blaze.Html (Html) import Text.Blaze.Html (Html)
import UnliftIO.Exception (try) import UnliftIO.Exception (try)
@ -155,7 +155,8 @@ postInboxR = do
u <- liftE $ case parseURI $ BC.unpack keyid of u <- liftE $ case parseURI $ BC.unpack keyid of
Nothing -> Left "keyId in Sig header isn't a valid absolute URI" Nothing -> Left "keyId in Sig header isn't a valid absolute URI"
Just uri -> Right uri Just uri -> Right uri
response <- ExceptT $ first (displayException :: HttpException -> String) <$> (try $ httpJSONEither =<< requestFromURI u) manager <- getsYesod appHttpManager
response <- ExceptT $ first (displayException :: HttpException -> String) <$> (try $ httpJSONEither . setRequestManager manager =<< requestFromURI u)
liftE $ do liftE $ do
actor <- first displayException $ getResponseBody response actor <- first displayException $ getResponseBody response
let uActor = u { uriFragment = "" } let uActor = u { uriFragment = "" }