%3 ::ftpd::Session ::ftpd::Session AUTH CDUP CWD EPRT EPSV FEAT LIST MDTM MLSD NLST OPTS PASS PASV PWD QUIT RETR SIZE SYST TYPE USER close_data destroy file dir file exists file format date file format list file format mlst file format name file format permissions file glob file lastmodified file open file size init listen_data read_handler reply require_data write_data ::ftpd::Infrastructure ::ftpd::Infrastructure log ::ftpd::Session->::ftpd::Infrastructure ::ftpd::Server ::ftpd::Server destroy listen listen_handler ::ftpd::Server->::ftpd::Infrastructure ::nx::Object ::nx::Object __default_accessor __default_method_call_protection __object_configureparameter __resolve_method_path contains copy delete object method delete object property delete object variable destroy_on_cleanup info info info lookup parameters info lookup slots info lookup syntax info lookup variables info object method args info object method body info object method callprotection info object method debug info object method definition info object method definitionhandle info object method deprecated info object method exists info object method handle info object method origin info object method parameters info object method registrationhandle info object method returns info object method submethods info object method syntax info object method type info object slots info object variables info variable definition info variable name info variable parameter move object alias object forward object method object property object variable private protected public qn require namespace require object method require private object method require protected object method require public object method serialize ::ftpd::Infrastructure->::nx::Object

Class ::ftpd::Session

::ftpd::Session[i] create ... \
           [ -channel channel ] \
           [ -currentdir:substdefault (default "[file normalize [ns_server pagedir]/]") ] \
           [ -data data ] \
           [ -host host ] \
           [ -listen listen ] \
           [ -permission_bits (default "0 --- 1 --x 2 -w- 3 -wx 4 r-- 5 r-x 6 rw- 7 rwx") ] \
           [ -rootdir rootdir ] \
           [ -type (default "L8") ]

Defined in

Class Relations

  • class: ::nx::Class[i]
  • superclass: ::ftpd::Infrastructure[i]
::nx::Class create ::ftpd::Session \
     -superclass ::ftpd::Infrastructure

Methods (to be applied on instances)

  • close_data (scripted, public)

     <instance of ftpd::Session[i]> close_data

    Testcases:
    No testcase defined.
    if {[info exists :data]} {
        :log debug "closing data channel ${:data}"
        ns_connchan close ${:data}
        unset :data
    }
  • listen_data (scripted, public)

     <instance of ftpd::Session[i]> listen_data channel
    Parameters:
    channel (required)

    Testcases:
    No testcase defined.
    ns_connchan close ${:listen}
    unset :listen
    :log debug "listen_data sets :data <$channel>"
    set :data $channel
    :log debug "have delayed cmds [info exists :delayed_cmds]"
    if {[info exists :delayed_cmds]} {
        foreach {lambda arg} ${:delayed_cmds} {
            apply $lambda $arg
        }
        unset :delayed_cmds
    }
  • read_handler (scripted, public)

     <instance of ftpd::Session[i]> read_handler condition
    Parameters:
    condition (required)

    Testcases:
    No testcase defined.
    set bytes [encoding convertfrom utf-8 [ns_connchan read ${:channel}]]
    set rlen [string length $bytes]
    #:log debug "read_handler: ${:channel} $rlen <[string trim $bytes]>"
    set result 0
    if {0 && $rlen == 0} {
        :log debug "client has closed connection"
    } else {
        #
        # Some clients send multiple lines/commands in one transmission
        #
        foreach line [split [string trim $bytes] \n] {
            set line [string trim $line]
            :log debug "${:channel} <<< $line"
            if {$line eq ""} continue
            if {[regexp {^([A-Za-z]+)\s?(.*)$} $line . cmd arg]} {
                set cmd [string toupper $cmd]
                if {[:info lookup method $cmd] ne ""} {
                    :$cmd $arg
                    set result 1
                } else {
                    :log warning "502 Requested action <$cmd> not taken"
                    :reply "502 Requested action <$cmd> not taken"
                }
            } else {
                :log warning "line <$line> does not look like a valid command"
            }
        }
    }
    return $result