#74 ✓resolved
Dan Kubb (dkubb)

Content-Length should be added when possible

Reported by Dan Kubb (dkubb) | July 18th, 2008 @ 03:39 PM | in Future

Right now, if the Content-Length isn't provided to Thin, it will pass the request through to the client as-is.

In my case Merb does not automatically add the Content-Length when using HAML (although this could affect ERB and other templating systems, I haven't checked).

If the body were a String or an Array, it would be relatively inexpensive to calculate the Content-Length and include it in the response. This would help in situations where the client has requested keep-alive, but the framework doesn't set Content-Length.

In certain cases, the Content-Length should not be automatically added:

  • When the Status code is 1xx, 204 or 304
  • When the Transfer-Encoding header is set to chunked
  • When the body is neither a String or an Array

Also, I'm not entirely sure about this, but perhaps the Rack guys should be asked to include a test in Rack::Lint to ensure the Content-Length is set by the framework unless one of the above conditions is met.

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

People watching this ticket