Skip to content

Instantly share code, notes, and snippets.

@carlosantoniodasilva
Created November 12, 2012 15:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carlosantoniodasilva/4059980 to your computer and use it in GitHub Desktop.
Save carlosantoniodasilva/4059980 to your computer and use it in GitHub Desktop.
Fix Webrick HTTPResponse warnings.
# WEBrick doesn't support keep alive connections for 204 and 304 responses. If a 204 or 304 response is made along with a keepalive, a warning is issued and webrick closes the connection.
# WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true
# https://github.com/rails/rails/issues/3164
# https://bugs.ruby-lang.org/issues/5737
# ~/.rbenv/versions/1.9.3-pXXX/lib/ruby/1.9.1/webrick/httpresponse.rb
# Change line 205 to:
if chunked? || @header['content-length'] || @status == 304 || @status == 204
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment