diff options
Diffstat (limited to 'src/Network/BitTorrent/Tracker/RPC/HTTP.hs')
-rw-r--r-- | src/Network/BitTorrent/Tracker/RPC/HTTP.hs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/Network/BitTorrent/Tracker/RPC/HTTP.hs b/src/Network/BitTorrent/Tracker/RPC/HTTP.hs index 7d69df1a..0a7e9a08 100644 --- a/src/Network/BitTorrent/Tracker/RPC/HTTP.hs +++ b/src/Network/BitTorrent/Tracker/RPC/HTTP.hs | |||
@@ -106,10 +106,10 @@ fillRequest Options {..} q r = r | |||
106 | | BS.null a = b | 106 | | BS.null a = b |
107 | | otherwise = a <> "&" <> b | 107 | | otherwise = a <> "&" <> b |
108 | 108 | ||
109 | httpTracker :: BEncode a => Manager -> URI -> SimpleQuery -> ResourceT IO a | 109 | httpTracker :: BEncode a => Manager -> URI -> SimpleQuery -> IO a |
110 | httpTracker Manager {..} uri q = do | 110 | httpTracker Manager {..} uri q = do |
111 | request <- fillRequest options q <$> setUri def uri | 111 | request <- fillRequest options q <$> setUri def uri |
112 | response <- httpLbs request httpMgr | 112 | response <- runResourceT $ httpLbs request httpMgr |
113 | case BE.decode $ BL.toStrict $ responseBody response of | 113 | case BE.decode $ BL.toStrict $ responseBody response of |
114 | Left msg -> error $ "httpTracker: " ++ msg | 114 | Left msg -> error $ "httpTracker: " ++ msg |
115 | Right info -> return info | 115 | Right info -> return info |
@@ -121,7 +121,7 @@ httpTracker Manager {..} uri q = do | |||
121 | -- | Send request and receive response from the tracker specified in | 121 | -- | Send request and receive response from the tracker specified in |
122 | -- announce list. | 122 | -- announce list. |
123 | -- | 123 | -- |
124 | announce :: Manager -> URI -> AnnounceQuery -> ResourceT IO AnnounceInfo | 124 | announce :: Manager -> URI -> AnnounceQuery -> IO AnnounceInfo |
125 | announce mgr uri q = httpTracker mgr uri (renderAnnounceRequest uriQ) | 125 | announce mgr uri q = httpTracker mgr uri (renderAnnounceRequest uriQ) |
126 | where | 126 | where |
127 | uriQ = AnnounceRequest | 127 | uriQ = AnnounceRequest |
@@ -148,7 +148,7 @@ scrapeURL uri = do | |||
148 | -- However if the info hash list is 'null', the tracker should list | 148 | -- However if the info hash list is 'null', the tracker should list |
149 | -- all available torrents. | 149 | -- all available torrents. |
150 | -- | 150 | -- |
151 | scrape :: Manager -> URI -> ScrapeQuery -> ResourceT IO ScrapeInfo | 151 | scrape :: Manager -> URI -> ScrapeQuery -> IO ScrapeInfo |
152 | scrape m u q = do | 152 | scrape m u q = do |
153 | case scrapeURL u of | 153 | case scrapeURL u of |
154 | Nothing -> error "Tracker do not support scraping" | 154 | Nothing -> error "Tracker do not support scraping" |
@@ -156,7 +156,7 @@ scrape m u q = do | |||
156 | 156 | ||
157 | -- | More particular version of 'scrape', just for one torrent. | 157 | -- | More particular version of 'scrape', just for one torrent. |
158 | -- | 158 | -- |
159 | scrapeOne :: Manager -> URI -> InfoHash -> ResourceT IO ScrapeEntry | 159 | scrapeOne :: Manager -> URI -> InfoHash -> IO ScrapeEntry |
160 | scrapeOne m uri ih = do | 160 | scrapeOne m uri ih = do |
161 | xs <- scrape m uri [ih] | 161 | xs <- scrape m uri [ih] |
162 | case L.lookup ih xs of | 162 | case L.lookup ih xs of |