simplify external special remote implementation

This commit is contained in:
Joey Hess 2014-12-11 17:44:27 -04:00
parent f41ce65ef4
commit 8a17bcb0be

View file

@ -435,6 +435,10 @@ checkurl external url =
handleRequest external (CHECKURL url) Nothing $ \req -> case req of
CHECKURL_CONTENTS sz f -> Just $ return $ UrlContents sz
(if null f then Nothing else Just f)
-- Treat a single item multi response specially to
-- simplify the external remote implementation.
CHECKURL_MULTI ((_, sz, f):[]) ->
Just $ return $ UrlContents sz (Just f)
CHECKURL_MULTI l -> Just $ return $ UrlMulti l
CHECKURL_FAILURE errmsg -> Just $ error errmsg
UNSUPPORTED_REQUEST -> error "CHECKURL not implemented by external special remote"