From 3137c81b3653f2348bbcedb97aae937ba9469299 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 23 Jul 2020 04:17:34 +0000 Subject: test_server: test_early_hints: fix test reliability IO#sysread may only capture the 103 response and return before the server can send the 200. Since we don't support persistent connections, we can just use IO#read to rely on the server giving us an EOF after the 200 is sent. Cc: Jean Boussier --- test/unit/test_server.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/unit/test_server.rb') diff --git a/test/unit/test_server.rb b/test/unit/test_server.rb index d706243..384fa6b 100644 --- a/test/unit/test_server.rb +++ b/test/unit/test_server.rb @@ -106,7 +106,7 @@ class WebServerTest < Test::Unit::TestCase sock = TCPSocket.new('127.0.0.1', @port) sock.syswrite("GET / HTTP/1.0\r\n\r\n") - responses = sock.sysread(4096) + responses = sock.read(4096) assert_match %r{\AHTTP/1.[01] 103\b}, responses assert_match %r{^Link: }, responses assert_match %r{^Link: }, responses -- cgit v1.2.3-24-ge0c7