diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/ContinueProtocolHandler.java b/jetty-client/src/main/java/org/eclipse/jetty/client/ContinueProtocolHandler.java index f390115b155..4e545c243a8 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/ContinueProtocolHandler.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/ContinueProtocolHandler.java @@ -24,6 +24,8 @@ import org.eclipse.jetty.client.api.Request; import org.eclipse.jetty.client.api.Response; import org.eclipse.jetty.client.api.Result; import org.eclipse.jetty.client.util.BufferingResponseListener; +import org.eclipse.jetty.http.HttpHeader; +import org.eclipse.jetty.http.HttpHeaderValue; import org.eclipse.jetty.http.HttpStatus; /** @@ -50,12 +52,11 @@ public class ContinueProtocolHandler implements ProtocolHandler @Override public boolean accept(Request request, Response response) { - if (response.getStatus() == HttpStatus.CONTINUE_100) - { - HttpConversation conversation = ((HttpRequest)request).getConversation(); - return conversation.getAttribute(ATTRIBUTE) == null; - } - return false; + boolean is100 = response.getStatus() == HttpStatus.CONTINUE_100; + boolean expect100 = request.getHeaders().contains(HttpHeader.EXPECT, HttpHeaderValue.CONTINUE.asString()); + HttpConversation conversation = ((HttpRequest)request).getConversation(); + boolean handled100 = conversation.getAttribute(ATTRIBUTE) != null; + return (is100 || expect100) && !handled100; } @Override