From fd6b47cf1690cb45f2144cd92e0fe1f301c7c37b Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 5 Oct 2010 22:09:20 +0000 Subject: tee_input: use kgio to avoid stack traces on EOF TeeInput methods may be invoked deep in the stack, so avoid giving them more work to do if a client disconnects due to a bad upload. --- test/unit/test_request.rb | 4 ++++ test/unit/test_tee_input.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/unit/test_request.rb b/test/unit/test_request.rb index 8aae344..5ac511f 100644 --- a/test/unit/test_request.rb +++ b/test/unit/test_request.rb @@ -163,6 +163,10 @@ class RequestTest < Test::Unit::TestCase length = bs * count client = Tempfile.new('big_put') def client.kgio_addr; '127.0.0.1'; end + def client.kgio_read(*args) + readpartial(*args) + rescue EOFError + end client.syswrite( "PUT / HTTP/1.1\r\n" \ "Host: foo\r\n" \ diff --git a/test/unit/test_tee_input.rb b/test/unit/test_tee_input.rb index 56b8952..263aa8a 100644 --- a/test/unit/test_tee_input.rb +++ b/test/unit/test_tee_input.rb @@ -10,7 +10,7 @@ class TestTeeInput < Test::Unit::TestCase def setup @rs = $/ @env = {} - @rd, @wr = UNIXSocket.pair + @rd, @wr = Kgio::UNIXSocket.pair @rd.sync = @wr.sync = true @start_pid = $$ end -- cgit v1.2.3-24-ge0c7