net-sftp 4.1.1 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/CHANGES.txt +9 -1
- data/README.rdoc +0 -7
- data/lib/net/sftp/errors.rb +8 -0
- data/lib/net/sftp/operations/upload.rb +1 -1
- data/lib/net/sftp/request.rb +11 -1
- data/lib/net/sftp/session.rb +17 -3
- data/lib/net/sftp/version.rb +2 -2
- data.tar.gz.sig +1 -2
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 267343b1e93d06405cabf970bb50cc03e75bd31c148577e1b6fd2d54fca6feff
|
|
4
|
+
data.tar.gz: 7cd1d4abc40f4e5a72ea76c3ebbd472d2d7a0739f83332eea2aefacb9a4eb2a3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d8a13027eb28176434bac9f4f000d8f0bc95cfb1954f3fe417042d86e3fb324f65e207b4798d47adda285d3d4f42e4512f4cedadc5194e122819eaeeb5b2c3c2
|
|
7
|
+
data.tar.gz: 5bfeb015b1b513c2bace3cac110506c0b31a7649af86baa191d27e67fef211fc8b03f211e27d24e1589594361451451f3646b73327fe7da6ff0c8fb8964e1ba7
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/CHANGES.txt
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
=== 4.2.0
|
|
2
|
+
|
|
3
|
+
* BREAKING: Raise `Net::SFTP::SessionClosedError` when the server closes the SFTP channel: pending requests, `download!`/`upload!` and the event loop now fail instead of hanging, sending afterwards no longer raises `NoMethodError`, and `connect!`/`Net::SFTP.start` raise if the channel closes before the version handshake. Code that relied on the previous silent return now gets an exception. Reported by @kapso (#94) and @rngtng (#115) [#201, #94, #115]
|
|
4
|
+
* A write that fails after the local file reached EOF now raises `Net::SFTP::StatusException` and closes the remote file, instead of raising `NoMethodError`. Reported by @yxhuvud [#214, #213]
|
|
5
|
+
* Removed the `setup.rb` installer, which has not worked since Ruby 2.2 and was LGPL-licensed, and the stale `Manifest` from the gem. [#197]
|
|
6
|
+
|
|
1
7
|
=== 4.1.1
|
|
2
8
|
|
|
3
9
|
* A read error during a single-file download is raised once, after the outstanding reads complete and the handle is closed, instead of once per in-flight read [#212]
|
|
@@ -47,8 +53,10 @@
|
|
|
47
53
|
|
|
48
54
|
=== 4.0.0
|
|
49
55
|
|
|
56
|
+
* No breaking API changes in net-sftp itself; the major version marks allowing net-ssh 7, whose interface net-sftp exposes. net-ssh 5 and 6 are still supported (`>= 5.0.0, < 8.0.0`). Upgrading to net-ssh 7 drops Ruby 2.5, see net-ssh's 7.0.0 changes. [#142]
|
|
50
57
|
* Allow net-ssh 7
|
|
51
|
-
* Fix multibyte string write [#110]
|
|
58
|
+
* Fix multibyte string write: `File#write` advances the position by bytes, not characters, and returns the byte count [#110]
|
|
59
|
+
* The gem is signed with a new certificate; see README.rdoc for the current `net-sftp-public_cert.pem`
|
|
52
60
|
|
|
53
61
|
=== 3.0.0
|
|
54
62
|
|
data/README.rdoc
CHANGED
|
@@ -88,13 +88,6 @@ Then, when install the gem, do so with high security:
|
|
|
88
88
|
|
|
89
89
|
If you don't add the public key, you'll see an error like "Couldn't verify data signature". If you're still having trouble let me know and I'll give you a hand.
|
|
90
90
|
|
|
91
|
-
Or, if you prefer to do it the hard way (sans Rubygems):
|
|
92
|
-
|
|
93
|
-
* tar xzf net-ssh-*.tgz
|
|
94
|
-
* cd net-ssh-*
|
|
95
|
-
* ruby setup.rb config
|
|
96
|
-
* ruby setup.rb install (might need sudo privileges)
|
|
97
|
-
|
|
98
91
|
== LICENSE:
|
|
99
92
|
|
|
100
93
|
(The MIT License)
|
data/lib/net/sftp/errors.rb
CHANGED
|
@@ -3,6 +3,14 @@ module Net; module SFTP
|
|
|
3
3
|
# The base exception class for the SFTP system.
|
|
4
4
|
class Exception < RuntimeError; end
|
|
5
5
|
|
|
6
|
+
# Raised when the SFTP channel closes while requests are pending or before
|
|
7
|
+
# the session is open, and when sending on a closed session.
|
|
8
|
+
class SessionClosedError < Net::SFTP::Exception
|
|
9
|
+
def initialize(message = "SFTP session closed")
|
|
10
|
+
super
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
6
14
|
# A exception class for reporting a non-success result of an operation.
|
|
7
15
|
class StatusException < Net::SFTP::Exception
|
|
8
16
|
|
|
@@ -385,7 +385,7 @@ module Net; module SFTP; module Operations
|
|
|
385
385
|
|
|
386
386
|
if !response.ok? && !file.error
|
|
387
387
|
file.error = StatusException.new(response, "write #{file.remote}")
|
|
388
|
-
stop_reading(file)
|
|
388
|
+
stop_reading(file) if file.io
|
|
389
389
|
end
|
|
390
390
|
|
|
391
391
|
if file.io.nil? && file.pending.zero?
|
data/lib/net/sftp/request.rb
CHANGED
|
@@ -42,6 +42,7 @@ module Net; module SFTP
|
|
|
42
42
|
def initialize(session, type, id, &callback) #:nodoc:
|
|
43
43
|
@session, @id, @type, @callback = session, id, type, callback
|
|
44
44
|
@response = nil
|
|
45
|
+
@error = nil
|
|
45
46
|
@properties = {}
|
|
46
47
|
end
|
|
47
48
|
|
|
@@ -67,9 +68,12 @@ module Net; module SFTP
|
|
|
67
68
|
# Waits (blocks) until the server responds to this packet. If prior
|
|
68
69
|
# SFTP packets were also pending, they will be processed as well (since
|
|
69
70
|
# SFTP packets are processed in the order in which they are received by
|
|
70
|
-
# the server). Returns the request object itself.
|
|
71
|
+
# the server). Returns the request object itself. Raises
|
|
72
|
+
# Net::SFTP::SessionClosedError if the channel closed before the server
|
|
73
|
+
# responded.
|
|
71
74
|
def wait
|
|
72
75
|
session.loop { pending? }
|
|
76
|
+
raise @error if @error
|
|
73
77
|
self
|
|
74
78
|
end
|
|
75
79
|
|
|
@@ -86,6 +90,12 @@ module Net; module SFTP
|
|
|
86
90
|
|
|
87
91
|
callback.call(@response) if callback
|
|
88
92
|
end
|
|
93
|
+
|
|
94
|
+
# Marks this request as failed without a response; #wait will raise
|
|
95
|
+
# +error+.
|
|
96
|
+
def fail!(error) #:nodoc:
|
|
97
|
+
@error = error
|
|
98
|
+
end
|
|
89
99
|
end
|
|
90
100
|
|
|
91
101
|
end; end
|
data/lib/net/sftp/session.rb
CHANGED
|
@@ -823,6 +823,7 @@ module Net; module SFTP
|
|
|
823
823
|
def send_packet(type, *args)
|
|
824
824
|
data = Net::SSH::Buffer.from(*args)
|
|
825
825
|
msg = Net::SSH::Buffer.from(:long, data.length+1, :byte, type, :raw, data)
|
|
826
|
+
raise SessionClosedError unless channel
|
|
826
827
|
channel.send_data(msg.to_s)
|
|
827
828
|
end
|
|
828
829
|
|
|
@@ -869,6 +870,7 @@ module Net; module SFTP
|
|
|
869
870
|
def when_channel_confirmed(channel)
|
|
870
871
|
debug { "requesting sftp subsystem" }
|
|
871
872
|
@state = :subsystem
|
|
873
|
+
channel.on_close(&method(:when_channel_closed))
|
|
872
874
|
channel.subsystem("sftp", &method(:when_subsystem_started))
|
|
873
875
|
end
|
|
874
876
|
|
|
@@ -885,17 +887,29 @@ module Net; module SFTP
|
|
|
885
887
|
channel.on_data { |c,data| input.append(data) }
|
|
886
888
|
channel.on_extended_data { |c,t,data| debug { data } }
|
|
887
889
|
|
|
888
|
-
channel.on_close(&method(:when_channel_closed))
|
|
889
890
|
channel.on_process(&method(:when_channel_polled))
|
|
890
891
|
|
|
891
892
|
send_packet(FXP_INIT, :long, @version || HIGHEST_PROTOCOL_VERSION_SUPPORTED)
|
|
892
893
|
end
|
|
893
894
|
|
|
894
|
-
# Called when the SSH server closes the underlying channel.
|
|
895
|
+
# Called when the SSH server closes the underlying channel. Raises
|
|
896
|
+
# SessionClosedError out of the event loop if requests were still pending
|
|
897
|
+
# or the session had not finished opening; the pending requests are
|
|
898
|
+
# failed with the same error.
|
|
895
899
|
def when_channel_closed(channel)
|
|
896
900
|
debug { "sftp channel closed" }
|
|
901
|
+
was_opening = opening?
|
|
897
902
|
@channel = nil
|
|
898
|
-
|
|
903
|
+
begin
|
|
904
|
+
# Data that arrived in the same read as the close has not been polled yet.
|
|
905
|
+
when_channel_polled(channel)
|
|
906
|
+
ensure
|
|
907
|
+
@state = :closed
|
|
908
|
+
failed, @pending_requests = @pending_requests, {}
|
|
909
|
+
error = SessionClosedError.new
|
|
910
|
+
failed.each_value { |request| request.fail!(error) }
|
|
911
|
+
end
|
|
912
|
+
raise error if was_opening || failed.any?
|
|
899
913
|
end
|
|
900
914
|
|
|
901
915
|
# Called whenever Net::SSH polls the SFTP channel for pending activity.
|
data/lib/net/sftp/version.rb
CHANGED
|
@@ -49,10 +49,10 @@ module Net
|
|
|
49
49
|
MAJOR = 4
|
|
50
50
|
|
|
51
51
|
# The minor component of this version of the Net::SFTP library
|
|
52
|
-
MINOR =
|
|
52
|
+
MINOR = 2
|
|
53
53
|
|
|
54
54
|
# The tiny component of this version of the Net::SFTP library
|
|
55
|
-
TINY =
|
|
55
|
+
TINY = 0
|
|
56
56
|
|
|
57
57
|
# The prerelease component of this version of the Net::SFTP library
|
|
58
58
|
# nil allowed
|
data.tar.gz.sig
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
�
|
|
2
|
-
���G�3�B�E[e��g����_�L���cJ��� M������)�ׅ�����~��uY2�pI����G���8*�k,�up��~��,t�K9q��(6���W��
|
|
1
|
+
�Z-��3��a*x�s�4}) /h�䒎�N��7�rɱSb�X�7g�V8��d�ÏX1д�26?K��Ā�f��-�@EIG���P����PX��s�� +�H����դ�.
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: net-sftp
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.
|
|
4
|
+
version: 4.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jamis Buck
|
|
@@ -32,7 +32,7 @@ cert_chain:
|
|
|
32
32
|
mMdUtmMoVbjbik3hqkY/18G03c3PoFNpL38VLKuyyROYz1DaCqOaRju3sbOoirD+
|
|
33
33
|
piQTZDCWxeKuX0Iuxq02uxkYHfoGB6In0y3OOQ==
|
|
34
34
|
-----END CERTIFICATE-----
|
|
35
|
-
date: 2026-
|
|
35
|
+
date: 2026-11-14 00:00:00.000000000 Z
|
|
36
36
|
dependencies:
|
|
37
37
|
- !ruby/object:Gem::Dependency
|
|
38
38
|
name: net-ssh
|
metadata.gz.sig
CHANGED
|
Binary file
|