Develop and Download Open Source Software

Browse Subversion Repository

Contents of /branches/ttcomtester/tests/#39614-portforward.rb

Parent Directory Parent Directory | Revision Log Revision Log


Revision 10521 - (show annotations) (download)
Fri Jan 20 16:03:38 2023 UTC (13 months, 2 weeks ago) by zmatsuo
File size: 905 byte(s)
add communication test tool
1 #!/usr/bin/ruby
2 # coding: UTF-8
3 #
4 # Ticket: #39614 のテストスクリプト
5 #
6 # Tera Term で /ssh-L8000:ttssh2.osdn.jp:80 を指定してサーバに接続後、
7 # このスクリプトを実行する。
8 # 再現しない場合は sleep の時間を適宜調整する
9 #
10
11 require 'socket'
12
13 s = TCPSocket.open("localhost", 8000)
14
15 puts "Send request."
16 s.write "GET /tmp/ticket-39614-test.txt HTTP/1.0\r\nHost: ttssh2.osdn.jp\r\n\r\n"
17
18 puts "Wait 5 seconds."
19 sleep 5
20
21 puts "Skip HTTP header"
22
23 while s.gets
24 break if /^\r\n$/ =~ $_
25 end
26
27 count = 0
28
29 puts "Reading body part..."
30 while data = s.read(4096)
31 count += data.size
32 if ((count / 4096) % 64) == 0
33 puts "#{count} bytes read"
34 sleep 1
35 end
36 end
37
38 s.close
39
40 result = ""
41 if count == 13229000
42 result = "data OK."
43 elsif count < 13229000
44 result = "data corrupted."
45 else
46 result = "unknown data."
47 end
48
49 puts "END: #{count} bytes read. #{result}"

Properties

Name Value
svn:executable *

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26