-
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
Improved handling of 100 Continue #12113
Improved handling of 100 Continue #12113
Conversation
* Changed ContentSender demand from iterate()+IDLE to succeeded()+SCHEDULED. This ensures that there is no re-iteration in case a 100 Continue response arrives. This, in turn, avoids that the demand is performed multiple times, causing ISE to be thrown. * Changed the 100 Continue action of the proxy Servlet/Handler, that provides the request content, to be executed by the HttpSender, rather than by the HttpReceiver. Signed-off-by: Simone Bordet <[email protected]>
* Now `HttpClient` removed the `Expect` header if there is no request content. * Changed AbstractProxyServlet and ProxyHandler check for request content: now the Content-Type header is not taken into consideration. * Now the server avoids sending the 100 Continue response if there is no request content. Signed-off-by: Simone Bordet <[email protected]>
jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/internal/HttpChannelState.java
Show resolved
Hide resolved
Is the work here going to help the old 100-Continue issue with AsyncMiddleManServlet? |
Now the request body is not defaulted if missing, but just kept null. Signed-off-by: Simone Bordet <[email protected]>
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.
OK, but a couple of niggles.
jetty-core/jetty-client/src/main/java/org/eclipse/jetty/client/transport/HttpConnection.java
Outdated
Show resolved
Hide resolved
@@ -215,6 +207,9 @@ protected void normalizeRequest(HttpRequest request) | |||
request.addHeader(new HttpField.LongValueHttpField(HttpHeader.CONTENT_LENGTH, contentLength)); | |||
} | |||
} | |||
// RFC 9110, section 10.1.1. | |||
if (content == null || content.getLength() == 0) | |||
request.headers(h -> h.remove(HttpHeader.EXPECT)); |
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.
technically you should just remove the 100-continue value from the Expect header, but as there are currently no other defined values, this is probably OK.
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.
Correct. And we don't have an easy API in HttpFields
to remove a single value.
jetty-ee9/jetty-ee9-proxy/src/main/java/org/eclipse/jetty/ee9/proxy/AbstractProxyServlet.java
Outdated
Show resolved
Hide resolved
…continue-fixes'. Signed-off-by: Simone Bordet <[email protected]>
Hi All, Would you please set expectations as to next steps? Are we waiting on a review from @gregw ? TY! |
Signed-off-by: Simone Bordet <[email protected]>
jetty-ee10/jetty-ee10-proxy/src/test/java/org/eclipse/jetty/ee10/proxy/ProxyServletTest.java
Outdated
Show resolved
Hide resolved
@garydgregory this PR is almost ready to be merged in, we won't wait for @gregw (currently in vacation). It will be in the next Jetty 12 release, due end of month. |
Signed-off-by: Simone Bordet <[email protected]>
HttpClient
removed theExpect
header if there is no request content.