diff options
author | Sam Truzjan <pxqr.sta@gmail.com> | 2014-02-04 23:06:49 +0400 |
---|---|---|
committer | Sam Truzjan <pxqr.sta@gmail.com> | 2014-02-04 23:06:49 +0400 |
commit | c7b28220230773fc00122e0aec8fb1a402aff8da (patch) | |
tree | fd7f2116516479519480a65dc45d5f77c41a0636 /src/Network/BitTorrent/Core/Fingerprint.hs | |
parent | 24df88dd3e63024155d86ac3231ca2abbba3fc86 (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.hs | 7 |
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 | ||
30 | import Data.Default | 31 | import Data.Default |
31 | import Data.List as L | 32 | import Data.List as L |
32 | import Data.List.Split as L | 33 | import Data.List.Split as L |
34 | import Data.Monoid | ||
33 | import Data.String | 35 | import Data.String |
34 | import Data.Version | 36 | import Data.Version |
35 | import Text.PrettyPrint hiding ((<>)) | 37 | import Text.PrettyPrint hiding ((<>)) |
@@ -190,6 +192,11 @@ instance Pretty Fingerprint where | |||
190 | libFingerprint :: Fingerprint | 192 | libFingerprint :: Fingerprint |
191 | libFingerprint = Fingerprint IlibHSbittorrent version | 193 | libFingerprint = Fingerprint IlibHSbittorrent version |
192 | 194 | ||
195 | -- | HTTP user agent of this (the bittorrent library) package. Can be | ||
196 | -- used in HTTP tracker requests. | ||
197 | libUserAgent :: String | ||
198 | libUserAgent = render (pretty IlibHSbittorrent <> "/" <> pretty version) | ||
199 | |||
193 | {----------------------------------------------------------------------- | 200 | {----------------------------------------------------------------------- |
194 | -- For torrent file | 201 | -- For torrent file |
195 | -----------------------------------------------------------------------} | 202 | -----------------------------------------------------------------------} |