summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Remote/WebDAV.hs21
-rw-r--r--git-annex.cabal2
2 files changed, 10 insertions, 13 deletions
diff --git a/Remote/WebDAV.hs b/Remote/WebDAV.hs
index de1b721c9..8ac9c2c79 100644
--- a/Remote/WebDAV.hs
+++ b/Remote/WebDAV.hs
@@ -17,7 +17,11 @@ import qualified Data.ByteString.Lazy as L
import Network.URI (normalizePathSegments)
import qualified Control.Exception as E
import qualified Control.Exception.Lifted as EL
+#if MIN_VERSION_DAV(0,6,0)
+import Network.HTTP.Client (HttpException(..))
+#else
import Network.HTTP.Conduit (HttpException(..))
+#endif
import Network.HTTP.Types
import System.IO.Error
@@ -355,8 +359,9 @@ mkdirDAV url user pass =
#endif
existsDAV :: DavUrl -> DavUser -> DavPass -> IO (Either String Bool)
-existsDAV url user pass = either onerr id <$> tryNonAsync check
+existsDAV url user pass = either (Left . show) id <$> tryNonAsync check
where
+ ispresent = return . Right
#if MIN_VERSION_DAV(0,6,0)
check = goDAV url user pass $ do
setDepth Nothing
@@ -374,20 +379,12 @@ existsDAV url user pass = either onerr id <$> tryNonAsync check
#endif
(const $ ispresent False)
#endif
- ispresent = return . Right
- {- This is a horrible hack, it seems that the type of the
- - HttpException gets screwed up with DAV 0.6.x, and so
- - I'm reduced to string matching. :( -}
- onerr e
- | "StatusCodeException" `isInfixOf` show e
- && "statusCode = 404" `isInfixOf` show e = Right False
- | otherwise = Left (show e)
matchStatusCodeException :: Status -> HttpException -> Maybe ()
-#if ! MIN_VERSION_http_conduit(1,9,0)
-matchStatusCodeException want (StatusCodeException s _)
-#else
+#if MIN_VERSION_DAV(0,6,0)
matchStatusCodeException want (StatusCodeException s _ _)
+#else
+matchStatusCodeException want (StatusCodeException s _)
#endif
| s == want = Just ()
| otherwise = Nothing
diff --git a/git-annex.cabal b/git-annex.cabal
index 7ba1c7d78..d7bf6cad6 100644
--- a/git-annex.cabal
+++ b/git-annex.cabal
@@ -134,7 +134,7 @@ Executable git-annex
if flag(WebDAV)
Build-Depends: DAV ((>= 0.3 && < 0.6) || > 0.6),
- http-conduit, xml-conduit, http-types, lifted-base
+ http-client, http-conduit, http-types, lifted-base
CPP-Options: -DWITH_WEBDAV
if flag(Assistant) && ! os(solaris)