[Pkg-haskell-commits] [SCM] haskell-testpack branch, master, updated. debian/1.0.2-1-4-gb0d6b36
John Goerzen
jgoerzen at complete.org
Fri Apr 23 14:45:40 UTC 2010
The following commit has been merged in the master branch:
commit 8a63c81b9a4baddf1afcd8484c7bf4969ba6ff9d
Author: John Goerzen <jgoerzen at complete.org>
Date: Sun Oct 24 04:18:24 2004 +0100
retrlines is working
Keywords:
(jgoerzen at complete.org--projects/missingh--head--1.0--patch-110)
diff --git a/ChangeLog b/ChangeLog
index c0f7b7e..6073c87 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,19 @@
# arch-tag: automatic-ChangeLog--jgoerzen at complete.org--projects/missingh--head--1.0
#
+2004-10-23 22:18:24 GMT John Goerzen <jgoerzen at complete.org> patch-110
+
+ Summary:
+ retrlines is working
+ Revision:
+ missingh--head--1.0--patch-110
+
+
+ modified files:
+ ChangeLog libsrc/MissingH/Network/FTP/Client.hs
+ libsrc/MissingH/Network/FTP/Parser.hs
+
+
2004-10-23 21:03:06 GMT John Goerzen <jgoerzen at complete.org> patch-109
Summary:
diff --git a/libsrc/MissingH/Network/FTP/Client.hs b/libsrc/MissingH/Network/FTP/Client.hs
index 04ab1ee..7ef0748 100644
--- a/libsrc/MissingH/Network/FTP/Client.hs
+++ b/libsrc/MissingH/Network/FTP/Client.hs
@@ -158,7 +158,7 @@ makepasv h =
do
r <- sendcmd h "PASV"
putStrLn "makepasv returning "
- return (respToSockAddr r)
+ respToSockAddr r
{- | Establishes a connection to the remote.
diff --git a/libsrc/MissingH/Network/FTP/Parser.hs b/libsrc/MissingH/Network/FTP/Parser.hs
index 681bb42..f134079 100644
--- a/libsrc/MissingH/Network/FTP/Parser.hs
+++ b/libsrc/MissingH/Network/FTP/Parser.hs
@@ -51,7 +51,7 @@ import MissingH.List
import MissingH.Bits
import MissingH.Str
import MissingH.Logging.Logger
-import Network.Socket(SockAddr(..), PortNumber(..))
+import Network.Socket(SockAddr(..), PortNumber(..), inet_addr)
import System.IO(Handle, hGetContents)
import System.IO.Unsafe
import Text.Regex
@@ -219,24 +219,26 @@ toPortString _ =
error "toPortString only works on AF_INET addresses"
-- | Converts a port string to a socket address. This is the inverse calculation of 'toPortString'.
-fromPortString :: String -> SockAddr
+fromPortString :: String -> IO SockAddr
fromPortString instr =
let inbytes = split "," instr
- hostbytes = map read (take 4 inbytes)
+ hostname = join "." (take 4 inbytes)
portbytes = map read (drop 4 inbytes)
in
- SockAddrInet (fromInteger $ fromBytes portbytes) (fromBytes hostbytes)
+ do
+ addr <- inet_addr hostname
+ return $ SockAddrInet (fromInteger $ fromBytes portbytes) addr
respToSockAddrRe = mkRegex("([0-9]+,){5}[0-9]+")
-- | Converts a response code to a socket address
-respToSockAddr :: FTPResult -> SockAddr
+respToSockAddr :: FTPResult -> IO SockAddr
respToSockAddr f =
- let r = forcexresp 200 f
- in
- if (fst r) /= 227 then
- error ("Not a 227 response: " ++ show r)
- else case matchRegexAll respToSockAddrRe (head (snd r)) of
- Nothing -> error ("Could not find remote endpoint in " ++ (show r))
- Just (_, x, _, _) -> fromPortString x
+ do
+ forceioresp 200 f
+ if (fst f) /= 227 then
+ fail ("Not a 227 response: " ++ show f)
+ else case matchRegexAll respToSockAddrRe (head (snd f)) of
+ Nothing -> fail ("Could not find remote endpoint in " ++ (show f))
+ Just (_, x, _, _) -> fromPortString x
\ No newline at end of file
--
haskell-testpack
More information about the Pkg-haskell-commits
mailing list