ftpd::Session method read_handler (public)

 <instance of ftpd::Session[i]> read_handler condition

Defined in

Parameters:
condition (required)

Testcases:
No testcase defined.
Source code:
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
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: