-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
404 with encodings_provided sets encoding Header but doesn't encode response body #144
Comments
A dirty trick to resolve it would be to unset the Content-Encoding header in https://github.com/seancribbs/webmachine-ruby/blob/master/lib/webmachine/errors.rb#L14 because the length is also for the unencoded response. |
That sounds like the simplest thing to do. We'll know once someone implements it :) |
Close and mark as wont-fix for now until someone else wants it? |
Dunno if I would close it, since it is a bug |
Tis. But you don't have to fix every bug ;) That's why the 'wont-fix' tag exists! It seems like a low impact bug which nobody is enthusiastic about fixing, so I'm not sure if there's much point in leaving it open. But we can leave it if nobody else shares my particular obsession with checking items off lists! |
I wanted to understand this issue better so I first created a resource with a to_html method containing the current 404 not found response body.
The response: Then I added the encodings_provided method.
The response: Here it works because it was a 200 response, not a 404 response. The path it took through the FSM was different. Now I set the resource_exists? to false with no encodings_provided method present.
The response: And lastly I added the encodings_provided method.
The response: The problem is that Content-Length should have been 175. render_error creates a response body when no body is given. A response body can be encoded when you know which encodings are provided by the resource. So I think this can't happen inside render_error because the resource isn't available there. A 404 response can be given because:
I think to fix the issue for 2. the l7 state in the FSM should set up the response body and encode it before the response is passed to the render_error method. (The state diagram for reference.) (I tried to fix it by unsetting the Content-Encoding header in render_error but this didn't had an effect.) |
This is the reply
The text was updated successfully, but these errors were encountered: