lib/http/protocol/http1/connection.rb in http-protocol-0.15.0 vs lib/http/protocol/http1/connection.rb in http-protocol-0.16.0
- old
+ new
@@ -256,18 +256,19 @@
@stream.write(chunk)
@stream.flush
end
end
- @stream.io.close_write
+ @stream.close_write
end
def write_body(body, chunked = true, head = false)
if body.nil? or body.empty?
write_empty_body(body)
elsif length = body.length
write_fixed_length_body(body, length, head)
- elsif chunked
+ elsif @persistent and chunked
+ # We specifically ensure that non-persistent connections do not use chunked response, so that hijacking works as expected.
write_chunked_body(body, head)
else
write_body_and_close(body, head)
end