@@ -125,6 +125,7 @@ import qualified Data.ByteString.Base16 as Base16
125125import qualified Data.ByteString.Char8 as BS8
126126import qualified Data.ByteString.Lazy as LBS
127127import qualified Data.ByteString.Lazy.Char8 as LBS8
128+ import qualified Data.Char as Char
128129import qualified Distribution.Compat.CharParsing as P
129130
130131------------------------------------------------------------------------------
@@ -626,7 +627,8 @@ curlTransport prog =
626627 listToMaybe $
627628 reverse
628629 [ etag
629- | [" ETag:" , etag] <- map words (lines headers)
630+ | [name, etag] <- map words (lines headers)
631+ , isETag name
630632 ]
631633 in case codeerr of
632634 Just (i, err) -> return (i, err, mb_etag)
@@ -776,7 +778,8 @@ wgetTransport prog =
776778 mb_etag =
777779 listToMaybe
778780 [ etag
779- | [" ETag:" , etag] <- map words (reverse (lines resp))
781+ | [name, etag] <- map words (reverse (lines resp))
782+ , isETag name
780783 ]
781784 in case parsedCode of
782785 Just i -> return (i, mb_etag)
@@ -1146,3 +1149,6 @@ genBoundary :: IO String
11461149genBoundary = do
11471150 i <- randomRIO (0x10000000000000 , 0xFFFFFFFFFFFFFF ) :: IO Integer
11481151 return $ showHex i " "
1152+
1153+ isETag :: String -> Bool
1154+ isETag name = fmap Char. toLower name == " etag:"
0 commit comments