summaryrefslogtreecommitdiff
path: root/src/Network/BitTorrent/Tracker/RPC
diff options
context:
space:
mode:
authorSam Truzjan <pxqr.sta@gmail.com>2014-02-27 15:56:57 +0400
committerSam Truzjan <pxqr.sta@gmail.com>2014-02-27 15:56:57 +0400
commit51068952db8fa263f576e49ee7d2ce1dcc89898a (patch)
tree69da0c13194eac465950c48ab95cf83d988571dc /src/Network/BitTorrent/Tracker/RPC
parent8b067e765c249beff379d4d416cd7dff702b51fb (diff)
Check uri scheme before making RPC
Diffstat (limited to 'src/Network/BitTorrent/Tracker/RPC')
-rw-r--r--src/Network/BitTorrent/Tracker/RPC/UDP.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/Network/BitTorrent/Tracker/RPC/UDP.hs b/src/Network/BitTorrent/Tracker/RPC/UDP.hs
index 160397dd..0cb8e95e 100644
--- a/src/Network/BitTorrent/Tracker/RPC/UDP.hs
+++ b/src/Network/BitTorrent/Tracker/RPC/UDP.hs
@@ -212,6 +212,9 @@ data RpcException
212 -- | Unable to lookup hostname; 212 -- | Unable to lookup hostname;
213 | HostLookupFailed 213 | HostLookupFailed
214 214
215 -- | Expecting 'udp:', but some other scheme provided.
216 | UnrecognizedScheme String
217
215 -- | Tracker exists but not responding for specific number of seconds. 218 -- | Tracker exists but not responding for specific number of seconds.
216 | TimeoutExpired Int 219 | TimeoutExpired Int
217 220
@@ -250,7 +253,9 @@ resolveURI _ = throwIO HostUnknown
250 253
251-- TODO caching? 254-- TODO caching?
252getTrackerAddr :: Manager -> URI -> IO SockAddr 255getTrackerAddr :: Manager -> URI -> IO SockAddr
253getTrackerAddr _ = resolveURI 256getTrackerAddr _ uri
257 | uriScheme uri == "udp:" = resolveURI uri
258 | otherwise = throwIO (UnrecognizedScheme (uriScheme uri))
254 259
255{----------------------------------------------------------------------- 260{-----------------------------------------------------------------------
256 Tokens 261 Tokens