net-ftp 0.1.2 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/net/ftp.rb +15 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 21c0eba7e609e9e211574f9516bcdeecd08cfccd970ad52f098838cddbba2b23
|
4
|
+
data.tar.gz: f5e77d0c5fcf882ac5e9fa521fb29eed475fa5578886f1270c2b9047ba856b9d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a022858433f6ddb623e6cc5a1f7b3ff01c686dbcff371530064b71b0d6fb39eb7e31a107a23d9bacbf9f52ef8bf0aeb09d5a651cd338bc37ecc76591e0a06cf7
|
7
|
+
data.tar.gz: 416f37d820111d80b207ee426aa0007b237591d25662c6bb55de12483f0f8dd2d0f0ff0251d44dff594d5d46847c132b0ef97efa67ef12c4f756c712cb19650b
|
data/lib/net/ftp.rb
CHANGED
@@ -85,7 +85,7 @@ module Net
|
|
85
85
|
end
|
86
86
|
|
87
87
|
# :stopdoc:
|
88
|
-
VERSION = "0.1.
|
88
|
+
VERSION = "0.1.4"
|
89
89
|
FTP_PORT = 21
|
90
90
|
CRLF = "\r\n"
|
91
91
|
DEFAULT_BLOCKSIZE = BufferedIO::BUFSIZE
|
@@ -98,6 +98,10 @@ module Net
|
|
98
98
|
# When +true+, the connection is in passive mode. Default: +true+.
|
99
99
|
attr_accessor :passive
|
100
100
|
|
101
|
+
# When +true+, use the IP address in PASV responses. Otherwise, it uses
|
102
|
+
# the same IP address for the control connection. Default: +false+.
|
103
|
+
attr_accessor :use_pasv_ip
|
104
|
+
|
101
105
|
# When +true+, all traffic to and from the server is written
|
102
106
|
# to +$stdout+. Default: +false+.
|
103
107
|
attr_accessor :debug_mode
|
@@ -206,6 +210,9 @@ module Net
|
|
206
210
|
# handshake.
|
207
211
|
# See Net::FTP#ssl_handshake_timeout for
|
208
212
|
# details. Default: +nil+.
|
213
|
+
# use_pasv_ip:: When +true+, use the IP address in PASV responses.
|
214
|
+
# Otherwise, it uses the same IP address for the control
|
215
|
+
# connection. Default: +false+.
|
209
216
|
# debug_mode:: When +true+, all traffic to and from the server is
|
210
217
|
# written to +$stdout+. Default: +false+.
|
211
218
|
#
|
@@ -266,6 +273,7 @@ module Net
|
|
266
273
|
@open_timeout = options[:open_timeout]
|
267
274
|
@ssl_handshake_timeout = options[:ssl_handshake_timeout]
|
268
275
|
@read_timeout = options[:read_timeout] || 60
|
276
|
+
@use_pasv_ip = options[:use_pasv_ip] || false
|
269
277
|
if host
|
270
278
|
connect(host, options[:port] || FTP_PORT)
|
271
279
|
if options[:username]
|
@@ -1381,7 +1389,12 @@ module Net
|
|
1381
1389
|
raise FTPReplyError, resp
|
1382
1390
|
end
|
1383
1391
|
if m = /\((?<host>\d+(?:,\d+){3}),(?<port>\d+,\d+)\)/.match(resp)
|
1384
|
-
|
1392
|
+
if @use_pasv_ip
|
1393
|
+
host = parse_pasv_ipv4_host(m["host"])
|
1394
|
+
else
|
1395
|
+
host = @bare_sock.remote_address.ip_address
|
1396
|
+
end
|
1397
|
+
return host, parse_pasv_port(m["port"])
|
1385
1398
|
else
|
1386
1399
|
raise FTPProtoError, resp
|
1387
1400
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: net-ftp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shugo Maeda
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-protocol
|
@@ -77,7 +77,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
77
77
|
- !ruby/object:Gem::Version
|
78
78
|
version: '0'
|
79
79
|
requirements: []
|
80
|
-
rubygems_version: 3.3.
|
80
|
+
rubygems_version: 3.3.27
|
81
81
|
signing_key:
|
82
82
|
specification_version: 4
|
83
83
|
summary: Support for the File Transfer Protocol.
|