diff options
author | Joey Hess <joey@kitenet.net> | 2012-02-10 19:17:41 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-02-10 19:23:41 -0400 |
commit | 9030f684521ce8db3e9cd6a4e2a10f4edce7bfee (patch) | |
tree | 010f0a533899f6c24b24b1840cd9e8ce162f2d1d /Remote/Web.hs | |
parent | fa77d9486dab1348d759722d2f7cbb5232797af7 (diff) |
When checking that an url has a key, verify that the Content-Length, if available, matches the size of the key.
If there's no Content-Length, or the key has no size, this check is not
done, but it should happen most of the time, and protect against web
content that has changed.
Diffstat (limited to 'Remote/Web.hs')
-rw-r--r-- | Remote/Web.hs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Remote/Web.hs b/Remote/Web.hs index 49c3f43f3..6bd04d4b1 100644 --- a/Remote/Web.hs +++ b/Remote/Web.hs @@ -15,6 +15,7 @@ import Annex.Content import Config import Logs.Web import qualified Utility.Url as Url +import Types.Key remote :: RemoteType remote = RemoteType { @@ -77,8 +78,8 @@ checkKey key = do us <- getUrls key if null us then return $ Right False - else return . Right =<< checkKey' us -checkKey' :: [URLString] -> Annex Bool -checkKey' us = untilTrue us $ \u -> do + else return . Right =<< checkKey' key us +checkKey' :: Key -> [URLString] -> Annex Bool +checkKey' key us = untilTrue us $ \u -> do showAction $ "checking " ++ u - liftIO $ Url.exists u + liftIO $ Url.check u (keySize key) |