Safe Haskell | None |
---|---|
Language | Haskell2010 |
Network.HTTP.Download.Verified
Synopsis
- verifiedDownload :: HasRunner env => DownloadRequest -> Path Abs File -> (Maybe Integer -> ConduitM ByteString Void (RIO env) ()) -> RIO env Bool
- recoveringHttp :: forall env a. HasRunner env => RetryPolicy -> RIO env a -> RIO env a
- data DownloadRequest = DownloadRequest {}
- drRetryPolicyDefault :: RetryPolicy
- data HashCheck = (Show a, HashAlgorithm a) => HashCheck {}
- data CheckHexDigest
- type LengthCheck = Int
- data VerifiedDownloadException
Documentation
Arguments
:: HasRunner env | |
=> DownloadRequest | |
-> Path Abs File | destination |
-> (Maybe Integer -> ConduitM ByteString Void (RIO env) ()) | custom hook to observe progress |
-> RIO env Bool | Whether a download was performed |
Copied and extended version of Network.HTTP.Download.download.
Has the following additional features: * Verifies that response content-length header (if present) matches expected length * Limits the download to (close to) the expected # of bytes * Verifies that the expected # bytes were downloaded (not too few) * Verifies md5 if response includes content-md5 header * Verifies the expected hashes
Throws VerifiedDownloadException. Throws IOExceptions related to file system operations. Throws HttpException.
recoveringHttp :: forall env a. HasRunner env => RetryPolicy -> RIO env a -> RIO env a #
data DownloadRequest #
A request together with some checks to perform.
Constructors
DownloadRequest | |
Fields |
drRetryPolicyDefault :: RetryPolicy #
Default to retrying thrice with a short constant delay.
Constructors
(Show a, HashAlgorithm a) => HashCheck | |
Fields |
data CheckHexDigest #
Constructors
CheckHexDigestString String | |
CheckHexDigestByteString ByteString | |
CheckHexDigestHeader ByteString |
Instances
Show CheckHexDigest # | |
Defined in Network.HTTP.Download.Verified Methods showsPrec :: Int -> CheckHexDigest -> ShowS # show :: CheckHexDigest -> String # showList :: [CheckHexDigest] -> ShowS # | |
IsString CheckHexDigest # | |
Defined in Network.HTTP.Download.Verified Methods fromString :: String -> CheckHexDigest # |
type LengthCheck = Int #
data VerifiedDownloadException #
An exception regarding verification of a download.
Constructors
WrongContentLength Request Int ByteString | |
WrongStreamLength Request Int Int | |
WrongDigest Request String CheckHexDigest String |
Instances
Show VerifiedDownloadException # | |
Defined in Network.HTTP.Download.Verified Methods showsPrec :: Int -> VerifiedDownloadException -> ShowS # show :: VerifiedDownloadException -> String # showList :: [VerifiedDownloadException] -> ShowS # | |
Exception VerifiedDownloadException # | |
Defined in Network.HTTP.Download.Verified |