jgoerzen / ftphs Goto Github PK
View Code? Open in Web Editor NEWFTP client and server library [Haskell]
Home Page: http://wiki.github.com/jgoerzen/ftphs/
License: GNU Lesser General Public License v2.1
FTP client and server library [Haskell]
Home Page: http://wiki.github.com/jgoerzen/ftphs/
License: GNU Lesser General Public License v2.1
Hi; thanks for the great package!
I was wondering if there were any plans to bring this package onto the stackage index?
(If you wanted to, it's as simple as editing this file)
Repeatedly using getbinary
on a nonexistent file leads to a file leads to a filedescriptor leak.
This seems to be due to forceioresp 100 r
in ntransfercmd
throwing an IOError
, that is thrown from the function without closing a previously opened socket first.
GHC has changed how exceptions work:
[3 of 4] Compiling Network.FTP.Server ( src/Network/FTP/Server.hs, dist-ghc/build/Network/FTP/Server.o )
src/Network/FTP/Server.hs:169:18: Not in scope: `try'
src/Network/FTP/Server.hs:217:33: Not in scope: `catch'
make: *** [build-ghc-stamp] Error 1
connectFTP
doesn't close sockets on connection failure, only throwing an exception. I'm not sure whether it would be more appropriate to fix in connectFTP
itself or in MissingH's connectTCP
/connectTCPAddr
(since it's not clear what is the intended behaviour of connectTCP
), but in programs using connectFTP
there's no socket to close, so apparently should be fixed in one of those.
Since we are dealing with binary data, why is it not returning a ByteString
?
Hi!
I have a problem, I think this package doesnt work with new ghc.
my code:
import Network.FTP.Client
main = do
ftpConn <- easyConnectFTP "..."
ftpRes <- login ftpConn "..." (Just "...") Nothing
putStrLn $ show ftpRes
nlst ftpConn Nothing >>= putStrLn . unlines
quit ftpConn
and my result:
*Main> :main
(230,["Login successful."])
Segmentation fault/access violation in generated code
ghc 8.0.1
ftphs 1.0.9.1
win-7
BR,
Zoltán Kelemen
When I use getlines
or getbinary
I get the following exception.
*** Exception: user error (Not a 227 response: (200,["Using ASCII mode to transfer data."]))
(when I use getbinary
the word ASCII
is BINARY
instead)
Looking at the code, it seems this error has been thrown by respToSockAddr
in line 238 of the client parser. The function throws this error when the input FTPResult
code is not 227. It looks like I am receiving a 200 but I don't know what to do.
Any help appreciated. Thank you.
I am not entirely sure whether this issue is with the library or the Windows 7 64bit system I am using. I am new to Haskell and was trying to write a rudimentary ftp app for my own use. The test case is:
module FtpTest
where
import Network.FTP.Client
import Network.FTP.Client.Parser
display :: Maybe String -> IO ()
display (Just path) = putStrLn path
display Nothing = putStrLn "No path!"
ftpTest :: String -> String -> String -> IO Network.FTP.Client.Parser.FTPResult
ftpTest host usr pass = do
enableFTPDebugging
h <- easyConnectFTP host
login h usr (Just pass) Nothing
(pwd, _) <- pwd h
display pwd
putStrLn "Going to list dir"
fs <- dir h Nothing
putStrLn "Done"
quit h
When running the ftpTest function, I get the current directory and "Going to list dir" printed. But then the program exits silently. I have also tried nlst function but the behaviour is same.
The log below shows output with enableFTPDebugging.
*FtpTest> ftpTest "" "" "" Loading package array-0.5.0.0 ... linking ... done. Loading package deepseq-1.3.0.2 ... linking ... done. Loading package bytestring-0.10.4.0 ... linking ... done. Loading package Win32-2.3.0.2 ... linking ... done. Loading package transformers-0.3.0.0 ... linking ... done. Loading package old-locale-1.0.0.6 ... linking ... done. Loading package time-1.4.2 ... linking ... done. Loading package containers-0.5.5.1 ... linking ... done. Loading package mtl-2.1.3.1 ... linking ... done. Loading package regex-base-0.93.2 ... linking ... done. Loading package regex-posix-0.95.2 ... linking ... : warning: isal um from msvcrt is linked instead of __imp_isalnum : warning: isalnum from msvcrt is linked instead of __imp_isalnum : warning: isalnum from msvcrt is linked instead of __imp_isalnum : warning: isalnum from msvcrt is linked instead of __imp_isalnum : warning: isalnum from msvcrt is linked instead of __imp_isalnum : warning: isalnum from msvcrt is linked instead of __imp_isalnum : warning: isalnum from msvcrt is linked instead of __imp_isalnum : warning: isalnum from msvcrt is linked instead of __imp_isalnum : warning: isalnum from msvcrt is linked instead of __imp_isalnum : warning: isalnum from msvcrt is linked instead of __imp_isalnum : warning: isalnum from msvcrt is linked instead of __imp_isalnum : warning: isalnum from msvcrt is linked instead of __imp_isalnum : warning: isupper from msvcrt is linked instead of __imp_isupper : warning: toupper from msvcrt is linked instead of __imp_toupper : warning: tolower from msvcrt is linked instead of __imp_tolower : warning: isalpha from msvcrt is linked instead of __imp_isalpha : warning: isalpha from msvcrt is linked instead of __imp_isalpha : warning: isalpha from msvcrt is linked instead of __imp_isalpha : warning: iscntrl from msvcrt is linked instead of __imp_iscntrl : warning: isupper from msvcrt is linked instead of __imp_isupper : warning: isgraph from msvcrt is linked instead of __imp_isgraph : warning: isprint from msvcrt is linked instead of __imp_isprint : warning: ispunct from msvcrt is linked instead of __imp_ispunct : warning: isalnum from msvcrt is linked instead of __imp_isalnum : warning: isalpha from msvcrt is linked instead of __imp_isalpha done. Loading package regex-compat-0.95.1 ... linking ... done. Loading package text-1.1.0.0 ... linking ... done. Loading package parsec-3.1.5 ... linking ... done. Loading package old-time-1.1.0.2 ... linking ... done. Loading package network-2.4.2.3 ... linking ... : warning: inet_nt a from ws2_32 is linked instead of __imp_inet_ntoa : warning: getnameinfo from ws2_32 is linked instead of __imp_getn meinfo : warning: getaddrinfo from ws2_32 is linked instead of __imp_geta drinfo : warning: freeaddrinfo from ws2_32 is linked instead of __imp_fre addrinfo : warning: accept from ws2_32 is linked instead of __imp_accept : warning: WSACleanup from ws2_32 is linked instead of __imp_WSACl anup : warning: WSAStartup from ws2_32 is linked instead of __imp_WSASt rtup : warning: WSACleanup from ws2_32 is linked instead of __imp_WSACl anup done. Loading package filepath-1.3.0.2 ... linking ... done. Loading package directory-1.2.1.0 ... linking ... done. Loading package HUnit-1.2.5.2 ... linking ... done. Loading package process-1.2.0.0 ... linking ... done. Loading package hslogger-1.2.8 ... linking ... done. Loading package random-1.0.1.1 ... linking ... done. Loading package MissingH-1.3.0.1 ... linking ... done. Loading package ftphs-1.0.9.1 ... linking ... done. FTP received: 220 (vsFTPd 2.0.5) FTP sent: USER FTP received: 331 Please specify the password. FTP sent: PASS FTP received: 230 Login successful. FTP sent: PWD FTP received: 257 "/home/uname" /home/uname Going to list dir FTP sent: TYPE A FTP received: 200 Switching to ASCII mode. FTP sent: PASV FTP received: 227 Entering Passive Mode (10,240,106,18,41,229) <-- exits hereSystem information:
OS - Windows 7 64 bit
Haskell - Fresh installation of Haskell platform downloaded from the distribution site.
ftphs - installed using Cabal.
This program:
import Data.List
import Network.FTP.Client
desiredFile x = ".xz.sig" `isSuffixOf` x
main = do
enableFTPDebugging
h1 <- easyConnectFTP "prep.ai.mit.edu"
let h = setPassive h1 True
loginAnon h
cwd h "/gnu/hello"
files <- nlst h Nothing
let file = head $ filter desiredFile files
downloadbinary h file
quit h
produces this result:
FTP received: 220 GNU FTP server ready.
FTP sent: USER anonymous
FTP received: 230-Due to U.S. Export Regulations, all cryptographic software on this
FTP received: 230-site is subject to the following legal notice:
FTP received: 230-
FTP received: 230- This site includes publicly available encryption source code
FTP received: 230- which, together with object code resulting from the compiling of
FTP received: 230- publicly available source code, may be exported from the United
FTP received: 230- States under License Exception "TSU" pursuant to 15 C.F.R. Section
FTP received: 230- 740.13(e).
FTP received: 230-
FTP received: 230-This legal notice applies to cryptographic software only. Please see
FTP received: 230-the Bureau of Industry and Security (www.bxa.doc.gov) for more
FTP received: 230-information about current U.S. regulations.
FTP received: 230 Login successful.
FTP sent: CWD /gnu/hello
FTP received: 250 Directory successfully changed.
FTP sent: TYPE A
FTP received: 200 Switching to ASCII mode.
FTP sent: PASV
FTP received: 227 Entering Passive Mode (208,118,235,20,92,41).
FTP sent: NLST
FTP received: 150 Here comes the directory listing.
FTP sent: TYPE I
FTP received: 226 Directory send OK.
FTP sent: PASV
FTP received: 200 Switching to Binary mode.
ftp-example: user error (Not a 227 response: (200,["Switching to Binary mode."]))
setting passive to False gets past the nlst, but fails on the downloadbinary:
FTP received: 220 GNU FTP server ready.
FTP sent: USER anonymous
FTP received: 230-Due to U.S. Export Regulations, all cryptographic software on this
FTP received: 230-site is subject to the following legal notice:
FTP received: 230-
FTP received: 230- This site includes publicly available encryption source code
FTP received: 230- which, together with object code resulting from the compiling of
FTP received: 230- publicly available source code, may be exported from the United
FTP received: 230- States under License Exception "TSU" pursuant to 15 C.F.R. Section
FTP received: 230- 740.13(e).
FTP received: 230-
FTP received: 230-This legal notice applies to cryptographic software only. Please see
FTP received: 230-the Bureau of Industry and Security (www.bxa.doc.gov) for more
FTP received: 230-information about current U.S. regulations.
FTP received: 230 Login successful.
FTP sent: CWD /gnu/hello
FTP received: 250 Directory successfully changed.
FTP sent: TYPE A
FTP received: 200 Switching to ASCII mode.
FTP sent: PORT 192,168,1,172,254,41
FTP received: 200 PORT command successful. Consider using PASV.
FTP sent: NLST
FTP received: 150 Here comes the directory listing.
FTP sent: TYPE I
FTP received: 226 Directory send OK.
FTP sent: PORT 192,168,1,172,254,42
FTP received: 200 Switching to Binary mode.
FTP sent: RETR hello-2.6.tar.xz.sig
FTP received: 200 PORT command successful. Consider using PASV.
ftp-example: user error (FTP: Expected 100, got (200,["PORT command successful. Consider using PASV."]))
This is with ftphs 1.0.9.1 and ghc 7.8.3, on Mac OS X 10.9.5.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.