Merged branch 'jetty-9.4.x' into 'master'.

This commit is contained in:
Simone Bordet 2017-10-09 16:00:04 +02:00
commit 14f7b03060
1 changed files with 7 additions and 6 deletions

View File

@ -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