[MacRuby-devel] [MacRuby] #831: Received request header with Webrick HTTPD is broken after GC is executed.
MacRuby
ruby-noreply at macosforge.org
Thu Aug 5 10:10:03 PDT 2010
#831: Received request header with Webrick HTTPD is broken after GC is executed.
----------------------------------+-----------------------------------------
Reporter: watson1978@… | Owner: lsansonetti@…
Type: defect | Status: new
Priority: blocker | Milestone:
Component: MacRuby | Keywords:
----------------------------------+-----------------------------------------
Test Script:
{{{
#!ruby
$ cat test.rb
require 'open-uri'
require 'webrick'
NullLog = Object.new
def NullLog.<<(arg)
end
def with_http
Dir.mktmpdir {|dr|
srv = WEBrick::HTTPServer.new({
:DocumentRoot => dr,
:ServerType => Thread,
:Logger => WEBrick::Log.new(NullLog),
:AccessLog => [[NullLog, ""]],
:BindAddress => '127.0.0.1',
:Port => 8080})
_, port, _, host = srv.listeners[0].addr
begin
th = srv.start
yield srv, dr, "http://#{host}:#{port}"
ensure
srv.shutdown
end
}
end
myheader1 = 'hello world'
myheader2 = nil
with_http {|srv, dr, url|
srv.mount_proc("/h/") {|req, res|
myheader2 = req['myheader'];
p "recv [1] : before GC : #{myheader2}"
GC.start
p "recv [2] : after GC : #{myheader2}"
res.body = "foo"
}
open("#{url}/h/", 'MyHeader'=>myheader1) {|f|
}
}
}}}
GC Eabled:
{{{
$ macruby test.rb
"recv [1] : before GC : hello world"
"recv [2] : after GC : \xA1i\x00\x00\x00\x00\x00\x00\xE0n)"
}}}
GC Disabled:
{{{
$ GC_DISABLE=true macruby test.rb
"recv [1] : before GC : hello world"
"recv [2] : after GC : hello world"
}}}
--
Ticket URL: <http://www.macruby.org/trac/ticket/831>
MacRuby <http://macruby.org/>
More information about the MacRuby-devel
mailing list