Class: HrrRbSftp::Protocol::Version1::Packet::SSH_FXP_OPENDIR
- Inherits:
-
Object
- Object
- HrrRbSftp::Protocol::Version1::Packet::SSH_FXP_OPENDIR
- Includes:
- Common::Packetable
- Defined in:
- lib/hrr_rb_sftp/protocol/version1/packet/011_ssh_fxp_opendir.rb
Constant Summary collapse
- TYPE =
11
- FORMAT =
[ [DataType::Byte, :"type" ], [DataType::Uint32, :"request-id"], [DataType::String, :"path" ], ]
Instance Attribute Summary
Attributes included from Loggable
Instance Method Summary collapse
Methods included from Common::Packetable
Methods included from Loggable
#log_debug, #log_error, #log_fatal, #log_info, #log_warn
Instance Method Details
#respond_to(request) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/hrr_rb_sftp/protocol/version1/packet/011_ssh_fxp_opendir.rb', line 16 def respond_to request begin dir = ::Dir.open(request[:"path"]) handle = dir.object_id.to_s(16) @handles[handle] = dir { :"type" => SSH_FXP_HANDLE::TYPE, :"request-id" => request[:"request-id"], :"handle" => handle, } rescue Errno::ENOENT { :"type" => SSH_FXP_STATUS::TYPE, :"request-id" => request[:"request-id"], :"code" => SSH_FXP_STATUS::SSH_FX_NO_SUCH_FILE, :"error message" => "No such file or directory", :"language tag" => "", } rescue Errno::EACCES { :"type" => SSH_FXP_STATUS::TYPE, :"request-id" => request[:"request-id"], :"code" => SSH_FXP_STATUS::SSH_FX_PERMISSION_DENIED, :"error message" => "Permission denied", :"language tag" => "", } rescue Errno::ENOTDIR { :"type" => SSH_FXP_STATUS::TYPE, :"request-id" => request[:"request-id"], :"code" => SSH_FXP_STATUS::SSH_FX_FAILURE, :"error message" => "Not a directory", :"language tag" => "", } rescue => e log_error { [e.backtrace[0], ": ", e., " (", e.class.to_s, ")\n\t", e.backtrace[1..-1].join("\n\t")].join } { :"type" => SSH_FXP_STATUS::TYPE, :"request-id" => request[:"request-id"], :"code" => SSH_FXP_STATUS::SSH_FX_FAILURE, :"error message" => e., :"language tag" => "", } end end |