-
Notifications
You must be signed in to change notification settings - Fork 566
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
4.x: Return 500 when 204 with entity is sent from routing. #8357
Conversation
...http-status-count-se/src/test/java/io/helidon/examples/se/httpstatuscount/StatusService.java
Show resolved
Hide resolved
1a41a8f
I have validated the implementation in |
Find here my findings about this: jakartaee/rest#1199 (comment) You would need to read the whole inputstream when you receive 204, 205 or 304 and ignore the entity if exists. This is in the ideal case that the stream is flushed with headers and entity together. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am reviewing this further and I am having questions. Lets try to clarify that.
Is Http1ServerResponse#nonEntityBytes always invoked?. I think it is. When there is 204, 205 or 304 with an entity we should log a warning and don't write the entity rather than failing with 500 error in my opinion.
Also the helidon client will not be able to handle chunked 204, 205 or 304 with entity. This is the comment wrote here: #8357 (comment)
…o#8357) * Return 500 when 204 with entity is sent from routing. * Never send entity with status 204 (from our own code) * Updated to include 205 and 304 statuses
…o#8357) * Return 500 when 204 with entity is sent from routing. * Never send entity with status 204 (from our own code) * Updated to include 205 and 304 statuses
Resolves #8348
Description
Fixed a problem when user returned
204
with an entity in JAX-RS.With the default connector, the next (!) request would fail with Status code
-1
(caused by the client ignoring the entity according to the specification, but then the connection was broken, and the next response started reading the previous entity).The client could handle this more gracefully (i.e. close the connection, report the problem), but it is the default one in Java...
Updated solution:
204
status, the status is changed to500
, and everything else carries out as usual (as entity is allowed with 500). The server logs an error explaining the problem.