From: Ramakrishnan Muthukrishnan Date: Sun, 3 May 2015 09:14:58 +0000 (+0530) Subject: Remove the redundant withSocketsDo call wrapping simpleHTTP X-Git-Url: https://git.rkrishnan.org/pf/content/en/seg/priv/frontends/index.php?a=commitdiff_plain;h=cfd4492b3eaaa60332ea25af64317d4d39fb511a;p=functorrent.git Remove the redundant withSocketsDo call wrapping simpleHTTP simpleHTTP calls withSocketsDo deep inside, so no need to wrap it outside. --- diff --git a/src/FuncTorrent/Network.hs b/src/FuncTorrent/Network.hs index 001fe0e..eac69c9 100644 --- a/src/FuncTorrent/Network.hs +++ b/src/FuncTorrent/Network.hs @@ -11,7 +11,6 @@ import Data.ByteString (ByteString) import Data.ByteString.Char8 as BC (pack, unpack, concat, intercalate) import Network.HTTP (simpleHTTP, defaultGETRequest_, getResponseBody) import Network.URI (parseURI) -import Network.Socket (withSocketsDo) -- | Make a query string from a alist of k, v -- TODO: Url encode each argument @@ -19,7 +18,7 @@ mkParams :: [(String, ByteString)] -> ByteString mkParams params = BC.intercalate "&" [concat [pack f, "=", s] | (f,s) <- params] get :: String -> [(String, ByteString)] -> IO ByteString -get url args = withSocketsDo $ simpleHTTP (defaultGETRequest_ url') >>= getResponseBody +get url args = simpleHTTP (defaultGETRequest_ url') >>= getResponseBody where url' = case parseURI $ unpack $ concat [pack url, "?", qstr] of Just x -> x _ -> error "Bad tracker URL"