From 6fd3351272ba949dc80d160c18f0e403757a0c0d Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Mon, 9 Oct 2017 13:38:17 +0200 Subject: [PATCH] Fixes #1878 - Handle 100 Continue response without Expect header. Fixed accept() to test for the response code being indeed 100. --- .../eclipse/jetty/client/ContinueProtocolHandler.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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 6a7bbfae359..f390115b155 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,7 @@ 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.HttpStatus; /** *

A protocol handler that handles the 100 response code.

@@ -49,8 +50,12 @@ public class ContinueProtocolHandler implements ProtocolHandler @Override public boolean accept(Request request, Response response) { - HttpConversation conversation = ((HttpRequest)request).getConversation(); - return conversation.getAttribute(ATTRIBUTE) == null; + if (response.getStatus() == HttpStatus.CONTINUE_100) + { + HttpConversation conversation = ((HttpRequest)request).getConversation(); + return conversation.getAttribute(ATTRIBUTE) == null; + } + return false; } @Override