From: Eugene Crosser Date: Thu, 27 Mar 2014 09:14:36 +0000 (+0400) Subject: wip make http request X-Git-Tag: 0.9.0.0~120 X-Git-Url: http://average.org/gitweb/?a=commitdiff_plain;h=e76cfb2c55808966d70deb1d6fe73a5102590c68;p=pdns-pipe-nmc.git wip make http request --- diff --git a/pdns-pipe-nmc.hs b/pdns-pipe-nmc.hs index aea5c0a..3d1e46d 100644 --- a/pdns-pipe-nmc.hs +++ b/pdns-pipe-nmc.hs @@ -11,7 +11,7 @@ import Data.Either.Utils import Data.List.Split import Data.Aeson (encode, decode, Value(..)) import Network.HTTP.Types --- does not exist -- import Network.HTTP.Client +import Data.Conduit import Network.HTTP.Conduit import Data.JsonRpcClient import NmcJson @@ -146,7 +146,9 @@ pdnsOut uri (Right rq) = case rq of -- Main entry main = do + cfg <- readConfig confFile + ver <- do let loopErr e = forever $ do @@ -161,10 +163,12 @@ main = do ["HELO", x ] -> loopErr $ "unsupported ABI version " ++ (show x) _ -> loopErr $ "bad HELO " ++ (show s) --- mgr <- newManager conduitManagerSettings - putStrLn $ "OK\tDnsNmc ready to serve, protocol v." ++ (show ver) - print $ qReq cfg "samplequery" + mgr <- newManager def + + print $ qReq cfg "d/dot-bit" + rsp <- runResourceT $ httpLbs (qReq cfg "d/dot-bit") mgr + print rsp --forever $ getLine >>= (pdnsOut uri) . (pdnsParse ver)