Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

ActionController::Metal head() function should set Content-Length #2315

Closed
OhaiBBQ opened this Issue Jul 28, 2011 · 5 comments

Comments

Projects
None yet
5 participants

OhaiBBQ commented Jul 28, 2011

This function renders an "empty" response (" "), but fails to set Content-Length. This can result in browsers with Connection: keep-alive maintaining connections until they timeout. Response headers from a simple head :created controller method:

X-UA-Compatible: IE=Edge
X-Runtime: 0.032611
Content-Type: text/html; charset=utf-8  
Cache-Control: no-cache
Connection: keep-alive
Transfer-Encoding: chunked

OhaiBBQ commented Aug 23, 2011

I was just told that Rails sends " " due to a bug in older versions of Safari. I still don't see a reason as to why we don't send a content length too.

cc @dhh @tenderlove

johnf commented Jan 10, 2012

Sending " " has implications for json.
If you set head :ok the content-length will be 1 and content will be " ". the json gem baulks at this as a single character string is invalid JSON.

Owner

tenderlove commented Jan 10, 2012

These headers say your transfer encoding is chunked. If you're using chunked encoding, a content length header isn't required. Keep alive connections may still be maintained. See here.

Contributor

isaacsanders commented May 1, 2012

Is this still an issue?

Member

arunagw commented May 13, 2012

Closing this now. please reopen if issue still exists.

thanks

@arunagw arunagw closed this May 13, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment