fake_ftp 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/fake_ftp/server.rb +8 -8
- data/lib/fake_ftp/version.rb +1 -1
- data/spec/models/fake_ftp/server_spec.rb +1 -1
- metadata +4 -4
data/lib/fake_ftp/server.rb
CHANGED
@@ -53,7 +53,7 @@ module FakeFtp
|
|
53
53
|
end
|
54
54
|
|
55
55
|
if passive_port
|
56
|
-
@data_server = ::
|
56
|
+
@data_server = ::TCPServer.new('127.0.0.1', passive_port)
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
@@ -85,7 +85,7 @@ module FakeFtp
|
|
85
85
|
message = contents[1..contents.length]
|
86
86
|
case command
|
87
87
|
when *CMDS
|
88
|
-
__send__ "_#{command}", message
|
88
|
+
__send__ "_#{command}", *message
|
89
89
|
else
|
90
90
|
'500 Unknown command'
|
91
91
|
end
|
@@ -115,8 +115,8 @@ module FakeFtp
|
|
115
115
|
end
|
116
116
|
end
|
117
117
|
|
118
|
-
def _port(remote)
|
119
|
-
remote = remote.
|
118
|
+
def _port(remote = '')
|
119
|
+
remote = remote.split(',')
|
120
120
|
remote_port = remote[4].to_i * 256 + remote[5].to_i
|
121
121
|
unless @active_connection.nil?
|
122
122
|
@active_connection.close
|
@@ -137,7 +137,7 @@ module FakeFtp
|
|
137
137
|
@client = nil
|
138
138
|
end
|
139
139
|
|
140
|
-
def _stor(filename)
|
140
|
+
def _stor(filename = '')
|
141
141
|
respond_with('425 Ain\'t no data port!') && return if active? && @active_connection.nil?
|
142
142
|
|
143
143
|
respond_with('125 Do it!')
|
@@ -152,7 +152,7 @@ module FakeFtp
|
|
152
152
|
'226 Did it!'
|
153
153
|
end
|
154
154
|
|
155
|
-
def _retr(filename)
|
155
|
+
def _retr(filename = '')
|
156
156
|
respond_with('501 No filename given') if filename.empty?
|
157
157
|
|
158
158
|
file = file(::File.basename(filename.to_s))
|
@@ -170,7 +170,7 @@ module FakeFtp
|
|
170
170
|
'226 File transferred'
|
171
171
|
end
|
172
172
|
|
173
|
-
def _list(args)
|
173
|
+
def _list(*args)
|
174
174
|
respond_with('425 Ain\'t no data port!') && return if active? && @active_connection.nil?
|
175
175
|
|
176
176
|
respond_with('150 Listing status ok, about to open data connection')
|
@@ -185,7 +185,7 @@ module FakeFtp
|
|
185
185
|
'226 List information transferred'
|
186
186
|
end
|
187
187
|
|
188
|
-
def _nlst(args)
|
188
|
+
def _nlst(*args)
|
189
189
|
respond_with('425 Ain\'t no data port!') && return if active? && @active_connection.nil?
|
190
190
|
|
191
191
|
respond_with('150 Listing status ok, about to open data connection')
|
data/lib/fake_ftp/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fake_ftp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 6
|
10
|
+
version: 0.0.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Colin Shield
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-
|
19
|
+
date: 2011-06-12 00:00:00 -07:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|