Skip to content

Commit

Permalink
[CI] test_puma_server.rb - fix test_chunked_keep_alive_twenty_back_to…
Browse files Browse the repository at this point in the history
…_back
  • Loading branch information
MSP-Greg committed Oct 15, 2024
1 parent 7cf7a3b commit e556a46
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions test/test_puma_server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1257,12 +1257,12 @@ def test_chunked_keep_alive_two_back_to_back
end

def test_chunked_keep_alive_twenty_back_to_back
skip if :windows
req_count = 20
requests = 0
body = nil
content_length = nil

server_run { |env|
server_run(max_fast_inline: 21) { |env|
requests += 1
body = env['rack.input'].read
content_length = env['CONTENT_LENGTH']
Expand All @@ -1271,11 +1271,20 @@ def test_chunked_keep_alive_twenty_back_to_back

req = "GET / HTTP/1.1\r\nX-Forwarded-For: 127.0.0.1\r\nConnection: Keep-Alive\r\nTransfer-Encoding: chunked\r\n\r\n1\r\nh\r\n4\r\nello\r\n0\r\n\r\n"

socket = send_http(req * 20)

20.times do |i|
assert_equal "Request_#{i+1}", socket.read_body
expected = String.new # rubocop: disable Performance/UnfreezeString
req_count.times do |i|
expected << "HTTP/1.1 200 OK\r\nContent-Length: #{(i+1).to_s.length + 8}\r\n\r\nRequest_#{i+1}"
end

socket = send_http(req * req_count)
Thread.pass
sleep 0.2

sent = socket.read

assert_equal req_count, sent.scan('Request_').length

assert_equal expected, sent
end

def test_chunked_keep_alive_two_back_to_back_with_set_remote_address
Expand Down

0 comments on commit e556a46

Please sign in to comment.