Fixes #5691 - HttpInput may skip setting fill interest.

Updates after review.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
Simone Bordet 2020-11-21 16:40:12 +01:00
parent a2c0818811
commit 1ac0af4a76

View File

@ -219,20 +219,24 @@ class AsyncContentProducer implements ContentProducer
public boolean isReady() public boolean isReady()
{ {
HttpInput.Content content = nextTransformedContent(); HttpInput.Content content = nextTransformedContent();
if (content == null) if (content != null)
{ {
if (LOG.isDebugEnabled())
LOG.debug("isReady(), got transformed content {} {}", content, this);
_httpChannel.getState().onContentAdded();
return true;
}
_httpChannel.getState().onReadUnready(); _httpChannel.getState().onReadUnready();
while (true) while (_httpChannel.needContent())
{
if (_httpChannel.needContent())
{ {
content = nextTransformedContent(); content = nextTransformedContent();
if (LOG.isDebugEnabled()) if (LOG.isDebugEnabled())
LOG.debug("isReady got transformed content after needContent retry {} {}", content, this); LOG.debug("isReady(), got transformed content after needContent retry {} {}", content, this);
if (content != null) if (content != null)
{ {
_httpChannel.getState().onContentAdded(); _httpChannel.getState().onContentAdded();
break; return true;
} }
else else
{ {
@ -240,27 +244,12 @@ class AsyncContentProducer implements ContentProducer
// transformed content, so we need to call needContent() again // transformed content, so we need to call needContent() again
// to tell the channel that more content is needed. // to tell the channel that more content is needed.
if (LOG.isDebugEnabled()) if (LOG.isDebugEnabled())
LOG.debug("isReady could not transform content after needContent retry {}", this); LOG.debug("isReady(), could not transform content after needContent retry {}", this);
} }
} }
else
{
if (LOG.isDebugEnabled()) if (LOG.isDebugEnabled())
LOG.debug("isReady false needContent retry {}", this); LOG.debug("isReady(), no content for needContent retry {}", this);
break; return false;
}
}
}
else
{
if (LOG.isDebugEnabled())
LOG.debug("isReady got transformed content {} {}", content, this);
_httpChannel.getState().onContentAdded();
}
boolean ready = content != null;
if (LOG.isDebugEnabled())
LOG.debug("isReady = {}", ready);
return ready;
} }
private HttpInput.Content nextTransformedContent() private HttpInput.Content nextTransformedContent()