packages feed

download-curl 0.1 → 0.1.1

raw patch · 3 files changed

+34/−12 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Network.Curl.Download: openURIWithOpts :: [CurlOption] -> String -> IO (Either String ByteString)
+ Network.Curl.Download.Lazy: openLazyURIWithOpts :: [CurlOption] -> String -> IO (Either String ByteString)

Files

Network/Curl/Download.hs view
@@ -30,6 +30,8 @@         , openAsXML         , openAsFeed +        -- * A lower level interface+        , openURIWithOpts     ) where  import Network.Curl@@ -64,13 +66,7 @@ -- > openURI "http://haskell.org" -- openURI :: String -> IO (Either String S.ByteString)-openURI s = case parseURL s of-     Nothing  -> return $ Left $ "Malformed url: "++ s-     Just url -> do-        e <- getFile url []-        return $ case e of-             Left err   -> Left $ "Failed to connect: " ++ err-             Right src  -> Right src+openURI s = openURIWithOpts [] s  -- | Like openURI, but returns the result as a 'String' --@@ -80,6 +76,22 @@ -- openURIString :: String -> IO (Either String String) openURIString s = (fmap Char8.unpack) `fmap` openURI s+++-- | Like openURI, but takes curl options.+--+-- Examples:+--+-- > openURIWithOpts [CurlPost True] "http://haskell.org"+--+openURIWithOpts :: [CurlOption] -> String -> IO (Either String S.ByteString)+openURIWithOpts opts s = case parseURL s of+     Nothing  -> return $ Left $ "Malformed url: "++ s+     Just url -> do+        e <- getFile url opts+        return $ case e of+             Left err   -> Left $ "Failed to connect: " ++ err+             Right src  -> Right src  ------------------------------------------------------------------------ -- Parser interface:
Network/Curl/Download/Lazy.hs view
@@ -22,6 +22,7 @@          -- * The basic lazy interface to network content           openLazyURI+        , openLazyURIWithOpts      ) where @@ -46,13 +47,22 @@ -- -- Examples: ----- > openURI "http://haskell.org"+-- > openLazyURI "http://haskell.org" -- openLazyURI :: String -> IO (Either String L.ByteString)-openLazyURI s = case parseURL s of+openLazyURI s = openLazyURIWithOpts [] s++-- | Like openURI, but takes curl options.+--+-- Examples:+--+-- > openLazyURIWithOpts [CurlPost True] "http://haskell.org"+--+openLazyURIWithOpts :: [CurlOption] -> String -> IO (Either String L.ByteString)+openLazyURIWithOpts opts s = case parseURL s of      Nothing  -> return $ Left $ "Malformed url: "++ s      Just url -> do-        e <- getFile url []+        e <- getFile url opts         return $ case e of              Left err   -> Left $ "Failed to connect: " ++ err              Right src  -> Right src
download-curl.cabal view
@@ -1,5 +1,5 @@ name:            download-curl-version:         0.1+version:         0.1.1 homepage:        http://code.haskell.org/~dons/code/download-curl synopsis:        High-level file download based on URLs description:     High-level file download based on URLs@@ -8,7 +8,7 @@  tags, XML, RSS or Atom feeds or JSON, using the curl network library.  .  Importing the library:- .                 + .  > import Network.Curl.Download  .  Loading a webpage as a "ByteString":