test invalid redirect location.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
a5971a1282
commit
33d5c13775
@ -240,6 +240,32 @@ class TestOpenURI < Test::Unit::TestCase
|
|||||||
assert_equal("ab\r\n", content)
|
assert_equal("ab\r\n", content)
|
||||||
ensure
|
ensure
|
||||||
Thread.kill(th)
|
Thread.kill(th)
|
||||||
|
th.join
|
||||||
|
end
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_redirect_invalid
|
||||||
|
TCPServer.open("127.0.0.1", 0) {|serv|
|
||||||
|
port = serv.addr[1]
|
||||||
|
th = Thread.new {
|
||||||
|
sock = serv.accept
|
||||||
|
begin
|
||||||
|
req = sock.gets("\r\n\r\n")
|
||||||
|
assert_match(%r{\AGET /foo/bar }, req)
|
||||||
|
sock.print "HTTP/1.0 302 Found\r\n"
|
||||||
|
sock.print "Location: ::\r\n\r\n"
|
||||||
|
ensure
|
||||||
|
sock.close
|
||||||
|
end
|
||||||
|
}
|
||||||
|
begin
|
||||||
|
assert_raise(OpenURI::HTTPError) {
|
||||||
|
URI("http://127.0.0.1:#{port}/foo/bar").read
|
||||||
|
}
|
||||||
|
ensure
|
||||||
|
Thread.kill(th)
|
||||||
|
th.join
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
@ -456,6 +482,7 @@ class TestOpenURI < Test::Unit::TestCase
|
|||||||
assert_equal("content", content)
|
assert_equal("content", content)
|
||||||
ensure
|
ensure
|
||||||
Thread.kill(th)
|
Thread.kill(th)
|
||||||
|
th.join
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
@ -482,6 +509,7 @@ class TestOpenURI < Test::Unit::TestCase
|
|||||||
}
|
}
|
||||||
ensure
|
ensure
|
||||||
Thread.kill(th)
|
Thread.kill(th)
|
||||||
|
th.join
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
@ -508,6 +536,7 @@ class TestOpenURI < Test::Unit::TestCase
|
|||||||
assert_equal("ab\r\n", content)
|
assert_equal("ab\r\n", content)
|
||||||
ensure
|
ensure
|
||||||
Thread.kill(th)
|
Thread.kill(th)
|
||||||
|
th.join
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user