Created
May 4, 2018 04:15
-
-
Save anacrolix/8fd254a6aa7f4211e44ee3e1664d2661 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bytesRange :: Wai.Request -> FileLength -> (Integer, Integer) | |
bytesRange r l = fromMaybe (0,l) $ | |
(\case | |
ByteRangeFrom f -> (f, l-f) | |
ByteRangeFromTo f t -> (f, t-f+1) | |
ByteRangeSuffix s -> (l-s,s) | |
) <$> (requestHeaderRange r >>= parseByteRanges >>= listToMaybe) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment