Issue #3038 SSL Connection Leak
Don't call handleContentMessage after content call if the content call returns true. This is a slight bending of the parser contract to work around the current client interpretation that a true return will prevent other events from being delivered. Signed-off-by: Greg Wilkins <gregw@webtide.com>
This commit is contained in:
parent
b191d69bb0
commit
041e8fd9cf
|
@ -20,7 +20,6 @@ package org.eclipse.jetty.client.http;
|
|||
|
||||
import java.io.EOFException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import org.eclipse.jetty.client.HttpClient;
|
||||
import org.eclipse.jetty.client.HttpExchange;
|
||||
|
@ -40,7 +39,6 @@ import org.eclipse.jetty.util.CompletableCallback;
|
|||
|
||||
public class HttpReceiverOverHTTP extends HttpReceiver implements HttpParser.ResponseHandler
|
||||
{
|
||||
private final AtomicReference<ContentState> handlingContent = new AtomicReference<>(ContentState.IDLE);
|
||||
private final HttpParser parser;
|
||||
private ByteBuffer buffer;
|
||||
private boolean shutdown;
|
||||
|
@ -265,18 +263,8 @@ public class HttpReceiverOverHTTP extends HttpReceiver implements HttpParser.Res
|
|||
if (exchange == null)
|
||||
return false;
|
||||
|
||||
handlingContent.set(ContentState.CONTENT);
|
||||
CompletableCallback callback = new CompletableCallback()
|
||||
{
|
||||
@Override
|
||||
public void succeeded()
|
||||
{
|
||||
boolean messageComplete = !handlingContent.compareAndSet(ContentState.CONTENT, ContentState.IDLE);
|
||||
super.succeeded();
|
||||
if (messageComplete)
|
||||
messageComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resume()
|
||||
{
|
||||
|
@ -316,9 +304,6 @@ public class HttpReceiverOverHTTP extends HttpReceiver implements HttpParser.Res
|
|||
@Override
|
||||
public boolean messageComplete()
|
||||
{
|
||||
if (handlingContent.compareAndSet(ContentState.CONTENT, ContentState.COMPLETE))
|
||||
return false;
|
||||
|
||||
HttpExchange exchange = getHttpExchange();
|
||||
if (exchange == null)
|
||||
return false;
|
||||
|
@ -390,6 +375,4 @@ public class HttpReceiverOverHTTP extends HttpReceiver implements HttpParser.Res
|
|||
{
|
||||
return String.format("%s[%s]", super.toString(), parser);
|
||||
}
|
||||
|
||||
private enum ContentState { IDLE, CONTENT, COMPLETE }
|
||||
}
|
||||
|
|
|
@ -1660,16 +1660,14 @@ public class HttpParser
|
|||
_contentPosition += _contentChunk.remaining();
|
||||
buffer.position(buffer.position()+_contentChunk.remaining());
|
||||
|
||||
boolean handle = _handler.content(_contentChunk);
|
||||
if (_handler.content(_contentChunk))
|
||||
return true;
|
||||
|
||||
if(_contentPosition == _contentLength)
|
||||
{
|
||||
setState(State.END);
|
||||
boolean handleContent = handleContentMessage();
|
||||
return handle || handleContent;
|
||||
return handleContentMessage();
|
||||
}
|
||||
else if (handle)
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue