net-ssh 2.0.22 → 2.0.23
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +9 -0
- data/lib/net/ssh/connection/channel.rb +7 -2
- data/lib/net/ssh/version.rb +1 -1
- data/net-ssh.gemspec +1 -1
- data/test/connection/test_channel.rb +15 -0
- metadata +2 -2
data/CHANGELOG.rdoc
CHANGED
@@ -1,4 +1,13 @@
|
|
1
1
|
|
2
|
+
=== 2.0.23 / 03 Jun 2010
|
3
|
+
|
4
|
+
* delay CHANNEL_EOF packet until output buffer is empty [Rich Lane]
|
5
|
+
|
6
|
+
Previously, calling #eof! after #send_data would result in the CHANNEL_EOF
|
7
|
+
packet being sent immediately, ahead of the data in the output buffer. Now
|
8
|
+
buffer becomes empty.
|
9
|
+
|
10
|
+
|
2
11
|
=== 2.0.22 / 20 Apr 2010
|
3
12
|
|
4
13
|
* Fix for: "Parsing the config errors out because it coerces the "1" into an integer and then tries to split it on spaces for multiple host checking." (http://net-ssh.lighthouseapp.com/projects/36253/tickets/10) [Lee Marlow]
|
@@ -126,7 +126,7 @@ module Net; module SSH; module Connection
|
|
126
126
|
@pending_requests = []
|
127
127
|
@on_open_failed = @on_data = @on_extended_data = @on_process = @on_close = @on_eof = nil
|
128
128
|
@on_request = {}
|
129
|
-
@closing = @eof = false
|
129
|
+
@closing = @eof = @sent_eof = false
|
130
130
|
end
|
131
131
|
|
132
132
|
# A shortcut for accessing properties of the channel (see #properties).
|
@@ -298,10 +298,10 @@ module Net; module SSH; module Connection
|
|
298
298
|
|
299
299
|
# Tells the remote end of the channel that no more data is forthcoming
|
300
300
|
# from this end of the channel. The remote end may still send data.
|
301
|
+
# The CHANNEL_EOF packet will be sent once the output buffer is empty.
|
301
302
|
def eof!
|
302
303
|
return if eof?
|
303
304
|
@eof = true
|
304
|
-
connection.send_message(Buffer.from(:byte, CHANNEL_EOF, :long, remote_id))
|
305
305
|
end
|
306
306
|
|
307
307
|
# If an #on_process handler has been set up, this will cause it to be
|
@@ -310,6 +310,11 @@ module Net; module SSH; module Connection
|
|
310
310
|
def process
|
311
311
|
@on_process.call(self) if @on_process
|
312
312
|
enqueue_pending_output
|
313
|
+
|
314
|
+
if @eof and not @sent_eof and output.empty?
|
315
|
+
connection.send_message(Buffer.from(:byte, CHANNEL_EOF, :long, remote_id))
|
316
|
+
@sent_eof = true
|
317
|
+
end
|
313
318
|
end
|
314
319
|
|
315
320
|
# Registers a callback to be invoked when data packets are received by the
|
data/lib/net/ssh/version.rb
CHANGED
data/net-ssh.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
@spec = Gem::Specification.new do |s|
|
2
2
|
s.name = "net-ssh"
|
3
3
|
s.rubyforge_project = 'net-ssh'
|
4
|
-
s.version = "2.0.
|
4
|
+
s.version = "2.0.23"
|
5
5
|
s.summary = "Net::SSH: a pure-Ruby implementation of the SSH2 client protocol."
|
6
6
|
s.description = s.summary
|
7
7
|
s.authors = ["Jamis Buck", "Delano Mandelbaum"]
|
@@ -378,6 +378,7 @@ module Connection
|
|
378
378
|
channel.do_open_confirmation(0, 1000, 1000)
|
379
379
|
connection.expect { |t,p| assert_equal CHANNEL_EOF, p.type }
|
380
380
|
channel.eof!
|
381
|
+
channel.process
|
381
382
|
end
|
382
383
|
|
383
384
|
def test_eof_bang_should_not_send_eof_if_eof_was_already_declared
|
@@ -385,6 +386,7 @@ module Connection
|
|
385
386
|
connection.expect { |t,p| assert_equal CHANNEL_EOF, p.type }
|
386
387
|
channel.eof!
|
387
388
|
assert_nothing_raised { channel.eof! }
|
389
|
+
channel.process
|
388
390
|
end
|
389
391
|
|
390
392
|
def test_eof_q_should_return_true_if_eof_declared
|
@@ -394,15 +396,28 @@ module Connection
|
|
394
396
|
assert !channel.eof?
|
395
397
|
channel.eof!
|
396
398
|
assert channel.eof?
|
399
|
+
channel.process
|
397
400
|
end
|
398
401
|
|
399
402
|
def test_send_data_should_raise_exception_if_eof_declared
|
400
403
|
channel.do_open_confirmation(0, 1000, 1000)
|
401
404
|
connection.expect { |t,p| assert_equal CHANNEL_EOF, p.type }
|
402
405
|
channel.eof!
|
406
|
+
channel.process
|
403
407
|
assert_raises(EOFError) { channel.send_data("die! die! die!") }
|
404
408
|
end
|
405
409
|
|
410
|
+
def test_data_should_precede_eof
|
411
|
+
channel.do_open_confirmation(0, 1000, 1000)
|
412
|
+
connection.expect do |t,p|
|
413
|
+
assert_equal CHANNEL_DATA, p.type
|
414
|
+
connection.expect { |t,p| assert_equal CHANNEL_EOF, p.type }
|
415
|
+
end
|
416
|
+
channel.send_data "foo"
|
417
|
+
channel.eof!
|
418
|
+
channel.process
|
419
|
+
end
|
420
|
+
|
406
421
|
private
|
407
422
|
|
408
423
|
class MockConnection
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: net-ssh
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.23
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jamis Buck
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2010-
|
13
|
+
date: 2010-06-03 00:00:00 -04:00
|
14
14
|
default_executable:
|
15
15
|
dependencies: []
|
16
16
|
|