ftp-client-conduit 0.4.0.1 → 0.5.0.0
raw patch · 2 files changed
+40/−25 lines, 2 filesdep ~ftp-clientPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: ftp-client
API changes (from Hackage documentation)
- Network.FTP.Client.Conduit: mlsd :: MonadResource m => Handle -> String -> Producer m MlsdResponse
+ Network.FTP.Client.Conduit: mlsd :: MonadResource m => Handle -> String -> Producer m MlsxResponse
Files
ftp-client-conduit.cabal view
@@ -1,5 +1,5 @@ name: ftp-client-conduit-version: 0.4.0.1+version: 0.5.0.0 cabal-version: >=1.10 build-type: Simple license: PublicDomain@@ -23,7 +23,7 @@ Network.FTP.Client.Conduit build-depends: base >=4.7 && <5,- ftp-client ==0.4.*,+ ftp-client ==0.5.*, conduit-combinators ==1.1.*, bytestring >=0.10.8.1 && <0.11, resourcet ==1.1.*,
src/Network/FTP/Client/Conduit.hs view
@@ -20,18 +20,21 @@ import System.IO import Network.FTP.Client ( sendCommand- , sendCommands+ , sendCommandS+ , sendAll+ , sendAllS , FTPCommand(..) , RTypeCode(..) , getLineResp , createSendDataCommand , createTLSSendDataCommand , PortActivity(..)- , getMultiLineResp+ , getResponse+ , getResponseS , sIOHandleImpl , tlsHandleImpl , Security(..)- , parseMlsdLine+ , parseMlsxLine ) import qualified Network.FTP.Client as FTP@@ -52,6 +55,9 @@ debugPrint' _ False = return () debugPrint' s True = liftIO $ print s +debugResponse :: (Show a, MonadIO m) => a -> m ()+debugResponse s = debugPrint $ "Recieved: " <> (show s)+ getAllLineRespC :: MonadIO m => FTP.Handle -> Producer m ByteString getAllLineRespC h = loop where@@ -79,7 +85,8 @@ :: MonadResource m => FTP.Handle -> PortActivity- -> [FTPCommand]+ -> RTypeCode+ -> FTPCommand -> (FTP.Handle -> ConduitM i o m r) -> ConduitM i o m r sourceDataCommandSecurity h =@@ -91,32 +98,36 @@ :: MonadResource m => FTP.Handle -> PortActivity- -> [FTPCommand]+ -> RTypeCode+ -> FTPCommand -> (FTP.Handle -> ConduitM i o m r) -> ConduitM i o m r-sourceDataCommand ch pa cmds f = do+sourceDataCommand ch pa code cmd f = do+ sendCommandS ch $ RType code x <- bracketP- (createSendDataCommand ch pa cmds)+ (createSendDataCommand ch pa cmd) (liftIO . hClose) (f . sIOHandleImpl)- resp <- liftIO $ getMultiLineResp ch- debugPrint $ "Recieved: " <> (show resp)+ resp <- getResponse ch+ debugResponse resp return x sourceTLSDataCommand :: MonadResource m => FTP.Handle -> PortActivity- -> [FTPCommand]+ -> RTypeCode+ -> FTPCommand -> (FTP.Handle -> ConduitM i o m r) -> ConduitM i o m r-sourceTLSDataCommand ch pa cmds f = do+sourceTLSDataCommand ch pa code cmd f = do+ sendCommandS ch $ RType code x <- bracketP- (createTLSSendDataCommand ch pa cmds)+ (createTLSSendDataCommand ch pa cmd) (liftIO . connectionClose) (f . tlsHandleImpl)- resp <- liftIO $ getMultiLineResp ch- debugPrint $ "Recieved: " <> (show resp)+ resp <- getResponse ch+ debugResponse resp return x sourceFTPHandle :: MonadIO m => FTP.Handle -> Producer m ByteString@@ -152,26 +163,30 @@ nlst :: MonadResource m => FTP.Handle -> [String] -> Producer m ByteString nlst ch args =- sourceDataCommandSecurity ch Passive [RType TA, Nlst args] getAllLineRespC+ sourceDataCommandSecurity ch Passive TA (Nlst args) getAllLineRespC retr :: MonadResource m => FTP.Handle -> String -> Producer m ByteString retr ch path =- sourceDataCommandSecurity ch Passive [RType TI, Retr path] sourceFTPHandle+ sourceDataCommandSecurity ch Passive TI (Retr path) sourceFTPHandle list :: MonadResource m => FTP.Handle -> [String] -> Producer m ByteString list ch args =- sourceDataCommandSecurity ch Passive [RType TA, List args] getAllLineRespC+ sourceDataCommandSecurity ch Passive TA (List args) getAllLineRespC -stor :: MonadResource m => FTP.Handle -> String -> RTypeCode -> Consumer ByteString m ()+stor+ :: MonadResource m+ => FTP.Handle+ -> String+ -> RTypeCode+ -> Consumer ByteString m () stor ch loc rtype =- sourceDataCommandSecurity ch Passive [RType rtype, Stor loc]- $ sendType rtype+ sourceDataCommandSecurity ch Passive rtype (Stor loc) $ sendType rtype mlsd :: MonadResource m => FTP.Handle -> String- -> Producer m FTP.MlsdResponse+ -> Producer m FTP.MlsxResponse mlsd ch dir =- sourceDataCommandSecurity ch Passive [RType TA, Mlsd dir] getAllLineRespC- .| mapC parseMlsdLine+ sourceDataCommandSecurity ch Passive TA (Mlsd dir) getAllLineRespC+ .| mapC parseMlsxLine