こんにちは。

また出てしまいました…。
よくわかりません。

--- そーす ----
require 'socket'
require 'thread'

def proxy(sv,cl)
  x = Thread.current
  y = Thread.start do
    begin
      while svdat = sv.sysread(1024)
        cl.syswrite(svdat)
      end
    rescue
      x.raise "disconnect"
    end
  end

  begin
    while cldat = cl.sysread(1024)
      sv.syswrite(cldat)
    end
  rescue
    y.raise "disconnect"
  end
end

# main
$0 = "??????????"

ls = TCPserver.open(1080)
while true
  cl = ls.accept
  peerhost = cl.peeraddr[2]
  if peerhost != '?????' && peerhost != '???????????'
    cl.close
    redo
  end
  Thread.start do
    cl2 = cl
    sv = TCPsocket.open('??????',????)
    proxy(sv,cl2)
    sv.close
    cl2.close
  end
end
----------------------------------------------
#trace ./throw.rb

sigcleanup () = 0
select (120, 0xefffd5e8, 0xefffd5c8, 0xefffd5a8, 0) = 1
read (119, "HTTP/1.0 304 Not Modified\r\nDate:".., 1024) = 247
select (118, 0xefffcb58, 0xefffcb38, 0xefffcb18, 0xefffcb10) = 0
select (120, 0xefffca98, 0xefffca78, 0xefffca58, 0) = 1
write (118, "HTTP/1.0 304 Not Modified\r\nDate:".., 247) = 247
select (120, 0xefffc878, 0xefffc858, 0xefffc838, 0) = 1
read (117, "", 1024) = 0
sigsetmask (0) = 0
sigsetmask (0) = 0
sigsetmask (0) = 0
select (4, 0xefffea68, 0xefffea48, 0xefffea28, 0xefffea20) = 1
- SIGVTALRM (26)
sigcleanup () = 0
accept (3, 0xefffe978, 0xefffe974) = 122
dup (122) = 123
getpeername (122, 0xefffe758, 0xefffe754) = 0
gettimeofday (0xefffd9a0, 0xefffd998) = 0
gettimeofday (0xefffd960, 0xefffd958) = 0
socket (2, 1, 6) = 124
fcntl (124, 03, 0) = 2
fcntl (124, 04, 0x6) = 0
connect (124, "".., 16) = -1 EINPROGRESS (Operation now in progress)
select (126, 0xefffd980, 0xefffd960, 0xefffd940, 0xefffd938) = 0
select (126, 0xefffd5e8, 0xefffd5c8, 0xefffd5a8, 0xefffd5a0) = 0
select (126, 0xefffe818, 0xefffe7f8, 0xefffe7d8, 0) = 1
accept (3, 0xefffe978, 0xefffe974) = 125
dup (125) = 126
getpeername (125, 0xefffe758, 0xefffe754) = 0
gettimeofday (0xefffd9a0, 0xefffd998) = 0
gettimeofday (0xefffd960, 0xefffd958) = 0
socket (2, 1, 6) = 127
fcntl (127, 03, 0) = 2
fcntl (127, 04, 0x6) = 0
connect (127, "".., 16) = -1 EINPROGRESS (Operation now in progress)
select (129, 0xefffd980, 0xefffd960, 0xefffd940, 0xefffd938) = 1
connect (124, "".., 16) = -1 EISCONN (Socket is already connected)
fcntl (124, 04, 0x2) = 0
dup (124) = 128
brk (0x227ca0) = 0
select (129, 0xefffc878, 0xefffc858, 0xefffc838, 0xefffc830) = 0
select (129, 0xefffe818, 0xefffe7f8, 0xefffe7d8, 0xefffe7d0) = 0
select (129, 0xefffd640, 0xefffd620, 0xefffd600, 0) = 1
read (122, "???????????????????????????????", 1024) = 17
- SIGSEGV (11)
write (2, "./throw.rb:20: [BUG] Segmentatio".., 39) = ./throw.rb:20: [BUG] Segme
ntation fault39
write (2, "\n", 1) = 1
write (2, "ruby 1.6.5 (2001-09-19) [sparc-s".., 46) = ruby 1.6.5 (2001-09-19) [s
parc-sunos4.1.4_JL]
46
-----------------------------------------------------
一部???で隠してます。

-- 
横山 隆志(Takashi Yokoyama)
E-Mail: yoko / tenchi.ne.jp