What does “WARN Could not determine content-length of response body.” mean and how to I get rid of it?

前端 未结 9 2661
离开以前
离开以前 2020-11-27 09:35

Since upgrading to Rails 3.1 I\'m seeing this warning message in my development log:

WARN Could not determine content-length of response body. Set co

相关标签:
9条回答
  • 2020-11-27 10:07

    Asked the same question to one of Rails-Core's members:

    https://twitter.com/luislavena/status/108998968859566080

    And the answer:

    https://twitter.com/tenderlove/status/108999110136303617

    ya, it's fine. Need to clean it up, but nothing is being hurt.

    0 讨论(0)
  • 2020-11-27 10:08

    The following patch solved the problem in my case; no more warnings for me.

    204_304_keep_alive.patch

    Just edit the file httpresponse.rb at line 205 as shown at the link above; in fact the link shows a correction made to a future release of Ruby.

    I'm using rails 3.2.0 on ruby 1.9.3-p0 installed through RVM as a single user. So the location in my case is:

    ~/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/webrick/httpresponse.rb
    

    The location of the file to be altered differs depending on the type of installation, RVM or not, or even multi-user or single user, so I'm just giving the last part of it:

    .../ruby-1.9.3-p0/lib/ruby/1.9.1/webrick/httpresponse.rb
    

    I hope this can be helpful to someone.

    EDIT: This is the link to the commit that altered the line in question in the trunk branch of ruby project.

    0 讨论(0)
  • 2020-11-27 10:08

    You can also use Thin instead of the default Webrick. Add this to Gemfile gem 'thin'

    then rails s thin will use thin, and the warning will disappear.

    0 讨论(0)
提交回复
热议问题