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.
This commit is contained in:
parent
fa77d9486d
commit
9030f68452
5 changed files with 30 additions and 11 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue