net-ftp 0.2.0 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +1 -1
- data/lib/net/ftp.rb +11 -14
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97ccaa6df703f39961e8a7274b19cc9468f04ed72dc5fc7d6152c0509ff7c989
|
4
|
+
data.tar.gz: aacca7dfd79d87e581fa01f13a1dabec628185bf1ba7bff43c28463f077cc290
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ebf50723f5c16057db6dc1b98fc313259a48436b894126754290e5c9d236f7e89e27a67584dba5c4205563e98569c8a65218bf71d4f9d3caf7b0d26340a33b5
|
7
|
+
data.tar.gz: a2ea30881abbfa4e75903c1daaa12913267c1cd221ed4c1efa3aecc84f5100b03572056766c677358323766866fbd64c547b878b372a72143098978bfd860a49
|
data/.github/workflows/test.yml
CHANGED
data/lib/net/ftp.rb
CHANGED
@@ -85,7 +85,7 @@ module Net
|
|
85
85
|
end
|
86
86
|
|
87
87
|
# :stopdoc:
|
88
|
-
VERSION = "0.
|
88
|
+
VERSION = "0.3.3"
|
89
89
|
FTP_PORT = 21
|
90
90
|
CRLF = "\r\n"
|
91
91
|
DEFAULT_BLOCKSIZE = BufferedIO::BUFSIZE
|
@@ -356,19 +356,14 @@ module Net
|
|
356
356
|
# SOCKS_SERVER, then a SOCKSSocket is returned, else a Socket is
|
357
357
|
# returned.
|
358
358
|
def open_socket(host, port) # :nodoc:
|
359
|
-
|
360
|
-
|
361
|
-
|
359
|
+
return Timeout.timeout(@open_timeout, OpenTimeout) {
|
360
|
+
if defined? SOCKSSocket and ENV["SOCKS_SERVER"]
|
361
|
+
@passive = true
|
362
362
|
SOCKSSocket.open(host, port)
|
363
|
+
else
|
364
|
+
Socket.tcp(host, port)
|
363
365
|
end
|
364
|
-
|
365
|
-
begin
|
366
|
-
Socket.tcp host, port, nil, nil, connect_timeout: @open_timeout
|
367
|
-
rescue Errno::ETIMEDOUT #raise Net:OpenTimeout instead for compatibility with previous versions
|
368
|
-
raise Net::OpenTimeout, "Timeout to open TCP connection to "\
|
369
|
-
"#{host}:#{port} (exceeds #{@open_timeout} seconds)"
|
370
|
-
end
|
371
|
-
end
|
366
|
+
}
|
372
367
|
end
|
373
368
|
private :open_socket
|
374
369
|
|
@@ -568,6 +563,7 @@ module Net
|
|
568
563
|
def transfercmd(cmd, rest_offset = nil) # :nodoc:
|
569
564
|
if @passive
|
570
565
|
host, port = makepasv
|
566
|
+
succeeded = false
|
571
567
|
begin
|
572
568
|
conn = open_socket(host, port)
|
573
569
|
if @resume and rest_offset
|
@@ -582,8 +578,9 @@ module Net
|
|
582
578
|
if !resp.start_with?("1")
|
583
579
|
raise FTPReplyError, resp
|
584
580
|
end
|
581
|
+
succeeded = true
|
585
582
|
ensure
|
586
|
-
conn
|
583
|
+
conn&.close if !succeeded
|
587
584
|
end
|
588
585
|
else
|
589
586
|
sock = makeport
|
@@ -1401,7 +1398,7 @@ module Net
|
|
1401
1398
|
if !resp.start_with?("227")
|
1402
1399
|
raise FTPReplyError, resp
|
1403
1400
|
end
|
1404
|
-
if m =
|
1401
|
+
if m = /(?<host>\d+(?:,\d+){3}),(?<port>\d+,\d+)/.match(resp)
|
1405
1402
|
if @use_pasv_ip
|
1406
1403
|
host = parse_pasv_ipv4_host(m["host"])
|
1407
1404
|
else
|
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.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shugo Maeda
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-12-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-protocol
|
@@ -61,7 +61,7 @@ licenses:
|
|
61
61
|
metadata:
|
62
62
|
homepage_uri: https://github.com/ruby/net-ftp
|
63
63
|
source_code_uri: https://github.com/ruby/net-ftp
|
64
|
-
post_install_message:
|
64
|
+
post_install_message:
|
65
65
|
rdoc_options: []
|
66
66
|
require_paths:
|
67
67
|
- lib
|
@@ -76,8 +76,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
76
76
|
- !ruby/object:Gem::Version
|
77
77
|
version: '0'
|
78
78
|
requirements: []
|
79
|
-
rubygems_version: 3.4.
|
80
|
-
signing_key:
|
79
|
+
rubygems_version: 3.4.12
|
80
|
+
signing_key:
|
81
81
|
specification_version: 4
|
82
82
|
summary: Support for the File Transfer Protocol.
|
83
83
|
test_files: []
|