-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Issue #5605 unconsumed input on sendError #5637
Conversation
Add Connection:close if content can't be consumed during a sendError. Processed after the request has returned to the container. Signed-off-by: Greg Wilkins <[email protected]>
…05-unconsumed-send-error
+ Add close on all uncommitted requests when content cannot be consumed.
@sbordet I'm now trying to consumeAll during the completion of any request without a committed response (ie when we can still add the Connection: close). |
jetty-server/src/main/java/org/eclipse/jetty/server/HttpChannel.java
Outdated
Show resolved
Hide resolved
jetty-server/src/main/java/org/eclipse/jetty/server/HttpChannel.java
Outdated
Show resolved
Hide resolved
jetty-server/src/main/java/org/eclipse/jetty/server/HttpChannel.java
Outdated
Show resolved
Hide resolved
jetty-server/src/main/java/org/eclipse/jetty/server/HttpChannel.java
Outdated
Show resolved
Hide resolved
jetty-server/src/main/java/org/eclipse/jetty/server/HttpChannelState.java
Show resolved
Hide resolved
jetty-server/src/test/java/org/eclipse/jetty/server/AsyncRequestReadTest.java
Show resolved
Hide resolved
+ fixed comment + space comma
jetty-server/src/main/java/org/eclipse/jetty/server/HttpChannel.java
Outdated
Show resolved
Hide resolved
jetty-server/src/main/java/org/eclipse/jetty/server/HttpChannel.java
Outdated
Show resolved
Hide resolved
@sbordet I had to update to only try to consume the input if the response is >= 200, otherwise it was trying to consume input for 101 upgrades etc. |
I do not think it was valid to always consumeAll in COMPLETE as this could break upgrades with both 101s and 200s Instead I have reverted to having this consumeAll logic only: + in sendError once control has passed back to the container and we are about to generate an error page. + in front of all the sendRedirection that we do without calling the application first. Extra tests also added
@sbordet @lorban I know you have approved, but can you re-review. I've decided to go for a less general solution as I lost confidence that |
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.
You've got 1 broken test (AsyncRequestReadTest.testPartialReadThenClose
) but it should be easy to fix, so this LGTM if fixing the test does not require non-test code changes (which I think is the case).
reverted test
Signed-off-by: Joakim Erdfelt <[email protected]>
Signed-off-by: Simone Bordet <[email protected]>
Signed-off-by: Joakim Erdfelt <[email protected]>
@sbordet can you check the latest commit that always calls consumeAll |
…05-unconsumed-send-error
Fixed test
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 think the handling of redirects must be reviewed, as we don't want to duplicate all the calls to ensureContentConsumedOrConnectionClose()
.
jetty-jaspi/src/main/java/org/eclipse/jetty/security/jaspi/modules/FormAuthModule.java
Outdated
Show resolved
Hide resolved
jetty-server/src/main/java/org/eclipse/jetty/server/HttpChannel.java
Outdated
Show resolved
Hide resolved
jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnection.java
Outdated
Show resolved
Hide resolved
+ added redirect methods that consumeAll + ensureContentConsumedOrConnectionClose renamed to ensureConsumeAllOrNotPersistent + ensureConsumeAllOrNotPersistent now handles HTTP/1.0 and HTTP/1.1 differently
jetty-server/src/main/java/org/eclipse/jetty/server/Response.java
Outdated
Show resolved
Hide resolved
jetty-server/src/main/java/org/eclipse/jetty/server/HttpChannel.java
Outdated
Show resolved
Hide resolved
jetty-server/src/main/java/org/eclipse/jetty/server/handler/ContextHandler.java
Show resolved
Hide resolved
jetty-server/src/test/java/org/eclipse/jetty/server/ErrorHandlerTest.java
Show resolved
Hide resolved
+ better javadoc + filter out keep-alive + added more tests
+ better javadoc
+ fixed form redirection test for http 1.0 and 1.1
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.
A couple of improvements to do.
jetty-server/src/main/java/org/eclipse/jetty/server/Response.java
Outdated
Show resolved
Hide resolved
+ HttpGenerator removes keep-alive if close present + Use isRedirection
…-9.4.x-5605-unconsumed-send-error
Add Connection:close if content can't be consumed during a sendError. Processed after the request has returned to the container.
Signed-off-by: Greg Wilkins [email protected]