Giter Club home page Giter Club logo

cl-ftp's Introduction

Overview

CL-FTP is a library which provides FTP client functionality to a Common Lisp program. CL-FTP uses the USOCKET package for network sockets and the SPLIT-SEQUENCE package for some parsing needs.

Examples

(with-ftp-connection (conn :hostname "foo")
  (retrieve-file conn "bar" "baz"))

Further examples should be included with your copy of this software. See simple-client.lisp for a simple FTP client written with CL-FTP.

#’RETRIEVE-FILE / #’STORE-FILE hang or don’t work

Short answer
Use passive FTP.
Long answer
FTP is something of a weird protocol, and this tends to trip people up—FTP opens up two connections, one for commands, and one for data (file transfers). The data channel can be opened in two different ways: in “active” mode (the default), the client tells the server “hey, connect to me on port X”, and then the server actually opens the connection to the client; in “passive” mode, the client connects to the server.

As you might imagine, active mode does not play well with NAT or firewalls, and this is usually the problem when commands work, but files fail to download. Most likely, including :passive-ftp-p t in your WITH-FTP-CONNECTION or (make-instance 'ftp-connection) form will get you going.

License

This software, and documentation, is copyright various authors. Redistribution and modification is permitted under a MIT-style license. See the LICENSE file for more details.

cl-ftp's People

Contributors

darabi avatar ralcantaraperez avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cl-ftp's Issues

(ql:quickload "ftp") problem for clisp at windows

have this error:

[9]>  (ql:quickload "ftp")
To load "ftp":
  Load 1 ASDF system:
    asdf
  Install 3 Quicklisp releases:
    cl-ftp split-sequence usocket
; Fetching #<URL "http://beta.quicklisp.org/archive/usocket/2019-12-27/usocket-0.8.3.tgz">
; 83.84KB
==================================================
85,851 bytes in 2.18 seconds (38.41KB/sec)
; Fetching #<URL "http://beta.quicklisp.org/archive/split-sequence/2019-05-21/split-sequence-v2.0.0.tgz">
; 10.09KB
==================================================
10,329 bytes in 0.01 seconds (1680.68KB/sec)
; Fetching #<URL "http://beta.quicklisp.org/archive/cl-ftp/2015-06-08/cl-ftp-20150608-http.tgz">
; 9.15KB
==================================================
9,367 bytes in 0.01 seconds (1144.05KB/sec)
; Loading "ftp"

*** - Error while trying to load definition for system split-sequence from pathname C:\Users\konovv\quicklisp\dists\quicklisp\software\split-sequence-v2.0.0\split-sequence.asd:
      MAKE-INSTANCE: некорректная пара ключевое слово/значение :IF-FEATURE, (:OR :SBCL :ABCL) в списке аргументов.
      Разрешенные ключевые слова: (:NAME :VERSION :DESCRIPTION :LONG-DESCRIPTION :IN-ORDER-TO :DO-FIRST
      :PARENT :PATHNAME :AROUND-COMPILE :ENCODING :PROPERTIES :TYPE)
Имеются следующие варианты продолжения:
SKIP           :R1      пропустить (DEFSYSTEM SPLIT-SEQUENCE AUTHOR ...)
RETRY          :R2      retry (DEFSYSTEM SPLIT-SEQUENCE AUTHOR ...)
STOP           :R3      бросить загрузку файла C:\Users\konovv\quicklisp\dists\quicklisp\software\split-sequence-v2.0.0\split-sequence.asd
REINITIALIZE-SOURCE-REGISTRY-AND-RETRY :R4 Retry finding system split-sequence after reinitializing the source-registry.
ABORT          :R5      Give up on "ftp"
ABORT          :R6      Прервать главный цикл
Break 1 ASDF0[10]>```
thanks in advance! :)

CL-FTP dies if server does not require a password

Subject line says it all. Here's a fix:

(defmethod connect-to-server ((conn ftp-connection))
  (with-ftp-connection-slots (conn)
    (unless (and hostname port (integerp port) (stringp hostname))
      (error "You must specify a hostname string and an integer port"))
    (when (and (slot-boundp conn 'socket) (streamp (socket-stream socket)))
      (close (socket-stream socket)))
    (setf socket (socket-connect hostname port))
    (unless socket
      (error "Error connecting to ~A:~A" hostname port))
    (when (and username password (stringp username) (stringp password))
      (expect-code-or-lose conn 220)
      (send-raw-line conn (format nil "USER ~A" username))
      (multiple-value-bind (data code) (receive-response conn :block t)
        (case code
          (331 (send-raw-line conn (format nil "PASS ~A" password)))
          (230)
          (otherwise (raise-ftp-error code (data-to-string data))))))
    (values)))

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.