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
> Date: Wed, 15 Jul 2015 13:05:41 GMT^M
> Server: Apache/2.4.7 (Ubuntu)^M
> Cache-Control: no-cache^M
> X-Runtime: 0.025314^M
> X-Request-Id: 28bdd133-29c6-4176-a9a5-edcb628d9a19^M
> X-Powered-By: Phusion Passenger 5.0.14^M
> Transfer-Encoding: chunked^M
> Status: 204 No Content^M
> Content-Length: 0^M
> Connection: close
>

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, <i raw_pre="_" 
> raw_post="_">kCFStreamErrorDomainKey=4, </i>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 

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/2c65f996-591b-430f-9b93-4ab1835d2372%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to