summaryrefslogtreecommitdiff
path: root/src/Network/BitTorrent/Core/Fingerprint.hs
diff options
context:
space:
mode:
authorSam Truzjan <pxqr.sta@gmail.com>2014-02-04 23:06:49 +0400
committerSam Truzjan <pxqr.sta@gmail.com>2014-02-04 23:06:49 +0400
commitc7b28220230773fc00122e0aec8fb1a402aff8da (patch)
treefd7f2116516479519480a65dc45d5f77c41a0636 /src/Network/BitTorrent/Core/Fingerprint.hs
parent24df88dd3e63024155d86ac3231ca2abbba3fc86 (diff)
Add user agent to HTTP request headers
Diffstat (limited to 'src/Network/BitTorrent/Core/Fingerprint.hs')
-rw-r--r--src/Network/BitTorrent/Core/Fingerprint.hs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/Network/BitTorrent/Core/Fingerprint.hs b/src/Network/BitTorrent/Core/Fingerprint.hs
index a81edd8b..d743acd0 100644
--- a/src/Network/BitTorrent/Core/Fingerprint.hs
+++ b/src/Network/BitTorrent/Core/Fingerprint.hs
@@ -25,11 +25,13 @@ module Network.BitTorrent.Core.Fingerprint
25 ( ClientImpl (..) 25 ( ClientImpl (..)
26 , Fingerprint (..) 26 , Fingerprint (..)
27 , libFingerprint 27 , libFingerprint
28 , libUserAgent
28 ) where 29 ) where
29 30
30import Data.Default 31import Data.Default
31import Data.List as L 32import Data.List as L
32import Data.List.Split as L 33import Data.List.Split as L
34import Data.Monoid
33import Data.String 35import Data.String
34import Data.Version 36import Data.Version
35import Text.PrettyPrint hiding ((<>)) 37import Text.PrettyPrint hiding ((<>))
@@ -190,6 +192,11 @@ instance Pretty Fingerprint where
190libFingerprint :: Fingerprint 192libFingerprint :: Fingerprint
191libFingerprint = Fingerprint IlibHSbittorrent version 193libFingerprint = Fingerprint IlibHSbittorrent version
192 194
195-- | HTTP user agent of this (the bittorrent library) package. Can be
196-- used in HTTP tracker requests.
197libUserAgent :: String
198libUserAgent = render (pretty IlibHSbittorrent <> "/" <> pretty version)
199
193{----------------------------------------------------------------------- 200{-----------------------------------------------------------------------
194-- For torrent file 201-- For torrent file
195-----------------------------------------------------------------------} 202-----------------------------------------------------------------------}