about summary refs log tree commit homepage
path: root/test/test_auto_chunk.rb
DateCommit message (Collapse)
2016-12-14response: do not set chunked header on bodyless responses
Setting "Transfer-Encoding: chunked" on responses will confuse clients which see a 204 response and do not expect a body. This follows Rack::Chunked behavior, as yahns should function without Rack::Chunked middleware. This regression appeared in yahns v1.13.0 (2016-08-05)
2016-08-03response: support auto-chunking for HTTP/1.1
We might as well do it since puma and thin both do(*), and we can still do writev for now to get some speedups by avoiding Rack::Chunked overhead. timing runs of "curl --no-buffer http://127.0.0.1:9292/ >/dev/null" results in a best case drop from ~260ms to ~205ms on one VM by disabling Rack::Chunked in the below config.ru $ ruby -I lib bin/yahns-rackup -E none config.ru ==> config.ru <== class Body STR = ' ' * 1024 * 16 def each 10000.times { yield STR } end end use Rack::Chunked if ENV['RACK_CHUNKED'] run(lambda do |env| [ 200, [ %w(Content-Type text/plain) ], Body.new ] end) (*) they can do Content-Length, but I don't think it's worth the effort at the server level.