No content response (204); content length/Transfer-Encoding headers; passenger with apache

Hello.
I am not sure, it’s right place for question.
We use passenger with apache. Api responds with 204 via “head
:no_content”
– ActionController/Head.html
http://api.rubyonrails.org/classes/ActionController/Head.html

response (tcpdump output):

HTTP/1.1 204 No Content^M

but according (RFC 7230 https://tools.ietf.org/html/rfc7230):

A sender MUST NOT send a Content-Length header field in any message
that contains a Transfer-Encoding header field.

plus

A server MUST NOT send a Transfer-Encoding header field in any

response with a status code of 1xx (Informational) or 204 (No
Content). A server MUST NOT send a Transfer-Encoding header field in
any 2xx (Successful) response to a CONNECT request (Section 4.3.6 of
[RFC7231] https://tools.ietf.org/html/rfc7231#section-4.3.6).

As the result we got this error on ios:

Error Domain=NSURLErrorDomain Code=-1017 “cannot parse response”
UserInfo=0x1740eb880 {NSUnderlyingError=0x174051be0 “cannot parse
response”, NSErrorFailingURLStringKey=api-url

http://qubeidea.net:6633/api/v1/users/958948062/orders/1042746869/cbottles/1044979373?,

NSErrorFailingURLKey=api-url, kCFStreamErrorDomainKey=4, kCFStreamErrorCodeKey=-1,
NSLocalizedDescription=cannot parse response}

I make a dirty workaround

headers[‘Content-Length’] = 0

after “head :no_content”. It’s remove “Transfer-Encoding: chunked”

according rfc7230#section-3.3.2
http://tools.ietf.org/html/rfc7230#section-3.3.2

A server MUST NOT send a Content-Length header field in any response
with a status code of 1xx (Informational) or 204 (No Content).

I think there is passenger mod or apache bug (maybe documentation lack
or
config settings). What should I do?

// and sorry for my poor English

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs