Drop the dependency on the haskell curl bindings, use regular haskell HTTP.
This commit is contained in:
parent
71c783bf24
commit
5c69ac14eb
7 changed files with 25 additions and 15 deletions
|
@ -14,10 +14,9 @@ module Remote.Web (
|
||||||
import Control.Monad.State (liftIO)
|
import Control.Monad.State (liftIO)
|
||||||
import Control.Exception
|
import Control.Exception
|
||||||
import System.FilePath
|
import System.FilePath
|
||||||
import Network.Curl.Easy
|
import Network.Browser
|
||||||
import Network.Curl.Opts
|
import Network.HTTP
|
||||||
import Network.Curl.Types
|
import Network.URI
|
||||||
import Network.Curl.Code
|
|
||||||
|
|
||||||
import Types
|
import Types
|
||||||
import Types.Remote
|
import Types.Remote
|
||||||
|
@ -31,6 +30,8 @@ import PresenceLog
|
||||||
import LocationLog
|
import LocationLog
|
||||||
import Locations
|
import Locations
|
||||||
|
|
||||||
|
type URLString = String
|
||||||
|
|
||||||
remote :: RemoteType Annex
|
remote :: RemoteType Annex
|
||||||
remote = RemoteType {
|
remote = RemoteType {
|
||||||
typename = "web",
|
typename = "web",
|
||||||
|
@ -111,13 +112,19 @@ checkKey' (u:us) = do
|
||||||
|
|
||||||
urlexists :: URLString -> IO Bool
|
urlexists :: URLString -> IO Bool
|
||||||
urlexists url = do
|
urlexists url = do
|
||||||
curl <- initialize
|
case parseURI url of
|
||||||
_ <- setopt curl (CurlURL url)
|
Nothing -> return False
|
||||||
_ <- setopt curl (CurlNoBody True)
|
Just u -> do
|
||||||
_ <- setopt curl (CurlFailOnError True)
|
(_, r) <- Network.Browser.browse $ do
|
||||||
_ <- setopt curl (CurlFollowLocation True)
|
setErrHandler ignore
|
||||||
res <- perform curl
|
setOutHandler ignore
|
||||||
return $ res == CurlOK
|
setAllowRedirects True
|
||||||
|
request (mkRequest HEAD u :: Request_String)
|
||||||
|
case rspCode r of
|
||||||
|
(2,_,_) -> return True
|
||||||
|
_ -> return False
|
||||||
|
where
|
||||||
|
ignore = const $ return ()
|
||||||
|
|
||||||
download :: [URLString] -> FilePath -> Annex Bool
|
download :: [URLString] -> FilePath -> Annex Bool
|
||||||
download [] _ = return False
|
download [] _ = return False
|
||||||
|
|
1
debian/changelog
vendored
1
debian/changelog
vendored
|
@ -5,6 +5,7 @@ git-annex (3.20110703) UNRELEASED; urgency=low
|
||||||
hard link made to it.
|
hard link made to it.
|
||||||
* uninit: Use unannex in --fast mode, to support unannexing multiple
|
* uninit: Use unannex in --fast mode, to support unannexing multiple
|
||||||
files that link to the same content.
|
files that link to the same content.
|
||||||
|
* Drop the dependency on the haskell curl bindings, use regular haskell HTTP.
|
||||||
|
|
||||||
-- Joey Hess <joeyh@debian.org> Mon, 04 Jul 2011 15:50:21 -0400
|
-- Joey Hess <joeyh@debian.org> Mon, 04 Jul 2011 15:50:21 -0400
|
||||||
|
|
||||||
|
|
2
debian/control
vendored
2
debian/control
vendored
|
@ -9,8 +9,8 @@ Build-Depends:
|
||||||
libghc-pcre-light-dev,
|
libghc-pcre-light-dev,
|
||||||
libghc-sha-dev,
|
libghc-sha-dev,
|
||||||
libghc-dataenc-dev,
|
libghc-dataenc-dev,
|
||||||
|
libghc-http-dev,
|
||||||
libghc-utf8-string-dev,
|
libghc-utf8-string-dev,
|
||||||
libghc-curl-dev,
|
|
||||||
libghc-hs3-dev (>= 0.5.6),
|
libghc-hs3-dev (>= 0.5.6),
|
||||||
libghc-testpack-dev [any-i386 any-amd64],
|
libghc-testpack-dev [any-i386 any-amd64],
|
||||||
ikiwiki,
|
ikiwiki,
|
||||||
|
|
|
@ -25,7 +25,7 @@ To build and use git-annex, you will need:
|
||||||
* [dataenc](http://hackage.haskell.org/package/dataenc)
|
* [dataenc](http://hackage.haskell.org/package/dataenc)
|
||||||
* [TestPack](http://hackage.haskell.org/cgi-bin/hackage-scripts/package/testpack)
|
* [TestPack](http://hackage.haskell.org/cgi-bin/hackage-scripts/package/testpack)
|
||||||
* [QuickCheck 2](http://hackage.haskell.org/package/QuickCheck)
|
* [QuickCheck 2](http://hackage.haskell.org/package/QuickCheck)
|
||||||
* [curl](http://hackage.haskell.org/package/curl)
|
* [HTTP](http://hackage.haskell.org/package/HTTP)
|
||||||
* [hS3](http://hackage.haskell.org/package/hS3) (optional, but recommended)
|
* [hS3](http://hackage.haskell.org/package/hS3) (optional, but recommended)
|
||||||
* Shell commands
|
* Shell commands
|
||||||
* [git](http://git-scm.com/)
|
* [git](http://git-scm.com/)
|
||||||
|
|
|
@ -9,6 +9,7 @@ sudo cabal install pcre-light
|
||||||
sudo cabal install quickcheck
|
sudo cabal install quickcheck
|
||||||
sudo cabal install SHA
|
sudo cabal install SHA
|
||||||
sudo cabal install dataenc
|
sudo cabal install dataenc
|
||||||
|
sudo cabal install HTTP
|
||||||
sudo cabal install hS3
|
sudo cabal install hS3
|
||||||
|
|
||||||
git clone git://git-annex.branchable.com/
|
git clone git://git-annex.branchable.com/
|
||||||
|
|
|
@ -7,6 +7,7 @@ sudo cabal install pcre-light
|
||||||
sudo cabal install quickcheck
|
sudo cabal install quickcheck
|
||||||
sudo cabal install SHA
|
sudo cabal install SHA
|
||||||
sudo cabal install dataenc
|
sudo cabal install dataenc
|
||||||
|
sudo cabal install HTTP
|
||||||
sudo cabal install hS3 # optional
|
sudo cabal install hS3 # optional
|
||||||
|
|
||||||
# optional: this will enable the gnu tools, (to give sha224sum etc..., it does not override the BSD userland)
|
# optional: this will enable the gnu tools, (to give sha224sum etc..., it does not override the BSD userland)
|
||||||
|
|
|
@ -30,14 +30,14 @@ Executable git-annex
|
||||||
Main-Is: git-annex.hs
|
Main-Is: git-annex.hs
|
||||||
Build-Depends: haskell98, MissingH, hslogger, directory, filepath,
|
Build-Depends: haskell98, MissingH, hslogger, directory, filepath,
|
||||||
unix, containers, utf8-string, network, mtl, bytestring, old-locale, time,
|
unix, containers, utf8-string, network, mtl, bytestring, old-locale, time,
|
||||||
pcre-light, extensible-exceptions, dataenc, SHA, process, hS3, curl,
|
pcre-light, extensible-exceptions, dataenc, SHA, process, hS3, HTTP
|
||||||
base < 5
|
base < 5
|
||||||
|
|
||||||
Executable git-annex-shell
|
Executable git-annex-shell
|
||||||
Main-Is: git-annex-shell.hs
|
Main-Is: git-annex-shell.hs
|
||||||
Build-Depends: haskell98, MissingH, hslogger, directory, filepath,
|
Build-Depends: haskell98, MissingH, hslogger, directory, filepath,
|
||||||
unix, containers, utf8-string, network, mtl, bytestring, old-locale, time,
|
unix, containers, utf8-string, network, mtl, bytestring, old-locale, time,
|
||||||
pcre-light, extensible-exceptions, dataenc, SHA, process, hS3, curl,
|
pcre-light, extensible-exceptions, dataenc, SHA, process, hS3, HTTP
|
||||||
base < 5
|
base < 5
|
||||||
|
|
||||||
Executable git-union-merge
|
Executable git-union-merge
|
||||||
|
|
Loading…
Reference in a new issue