Архив | Сентябрь 2012

Проблема WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true

На RoR 3.2  есть некоторая проблема с Webrick, при которой он постоянно в лог выдаёт что-то типа:

[2012-03-07 19:46:14] WARN  Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true
[2012-03-07 19:46:14] WARN  Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true

При этом, как мне показалось, хромает производительность.

Решается проблема патчем от Amiel Martin —

https://bugs.ruby-lang.org/attachments/2300/204_304_keep_alive.patch

Либо в ручную. Достаточно в файле httpresponse.rb заменить строку

if chunked? || @header['content-length']

на

if chunked? || @header['content-length'] || @status == 304 || @status == 204