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/Git.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/Git.hs')
-rw-r--r-- | Remote/Git.hs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Remote/Git.hs b/Remote/Git.hs index 829ad1ccb..390524775 100644 --- a/Remote/Git.hs +++ b/Remote/Git.hs @@ -28,6 +28,7 @@ import qualified Utility.Url as Url import Utility.TempFile import Config import Init +import Types.Key remote :: RemoteType remote = RemoteType { @@ -143,7 +144,8 @@ inAnnex r key where go e [] = return $ Left e go _ (u:us) = do - res <- catchMsgIO $ Url.exists u + res <- catchMsgIO $ + Url.check u (keySize key) case res of Left e -> go e us v -> return v |