Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 content-length of the response or set Response#chunked = true

What does this mean and how can I remove it? Is it a problem?

like image 572
Nate Bird Avatar asked Aug 16 '11 17:08

Nate Bird


2 Answers

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.

like image 195
Luis Lavena Avatar answered Oct 02 '22 16:10

Luis Lavena


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.

like image 27
jasoares Avatar answered Oct 02 '22 17:10

jasoares