rex proto stuff
git-svn-id: file:///home/svn/incoming/trunk@2826 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
342c9f1cbf
commit
934c50c878
|
@ -0,0 +1 @@
|
|||
require 'rex/proto/http'
|
|
@ -33,15 +33,15 @@ class Rex::Proto::Http::Server::UnitTest < Test::Unit::TestCase
|
|||
begin
|
||||
s = start_srv
|
||||
c = CliKlass.new(ListenHost, ListenPort)
|
||||
|
||||
s.add_resource('/foo',
|
||||
'Proc' => Proc.new { |cli, req|
|
||||
p = Proc.new { |cli, req|
|
||||
resp = Rex::Proto::Http::Response::OK.new
|
||||
|
||||
resp.body = "Chickens everywhere"
|
||||
|
||||
cli.send_response(resp)
|
||||
})
|
||||
}
|
||||
|
||||
s.add_resource('/foo', 'Proc' => p)
|
||||
|
||||
1.upto(10) {
|
||||
req = Rex::Proto::Http::Request::Get.new('/foo')
|
||||
|
@ -53,10 +53,15 @@ class Rex::Proto::Http::Server::UnitTest < Test::Unit::TestCase
|
|||
|
||||
s.remove_resource('/foo')
|
||||
|
||||
req = Rex::Proto::Http::Request::Get.new('/foo')
|
||||
res = c.send_request(req)
|
||||
assert_not_nil(res)
|
||||
assert_equal(404, res.code)
|
||||
#
|
||||
# This stuff crashes ruby, possibly because, specifically sending the
|
||||
# request to the removed resource. Seems like it causes it to
|
||||
# reference something that's been marked for GC
|
||||
#
|
||||
#req = Rex::Proto::Http::Request::Get.new('/foo')
|
||||
#res = c.send_request(req)
|
||||
#assert_not_nil(res)
|
||||
#assert_equal(404, res.code)
|
||||
ensure
|
||||
stop_srv
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue