Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/pr/1077'
Browse files Browse the repository at this point in the history
  • Loading branch information
hasufell committed Jul 7, 2024
2 parents af0f713 + 620cf76 commit 921ecab
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/GHCup/Download/IOStreams.hs
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,16 @@ downloadInternal = go (5 :: Int)

downloadStream r i' = do
void setup
let size = case getHeader r "Content-Length" of
Just x' -> case decimal $ decUTF8Safe x' of
-- We can only do content length checks & progress bar when the stream is not encoded
let notEncoded = case mk <$> getHeader r "Content-Encoding" of
Nothing -> True
Just "identity" -> True
Just _ -> False
size = case (notEncoded, getHeader r "Content-Length") of
(True, Just x') -> case decimal $ decUTF8Safe x' of
Left _ -> Nothing
Right (r', _) -> Just r'
Nothing -> Nothing
_ -> Nothing

forM_ size $ \s -> forM_ eCSize $ \es -> when (es /= s) $ throwIO (ContentLengthError Nothing (Just s) es)
let size' = eCSize <|> size
Expand Down

0 comments on commit 921ecab

Please sign in to comment.