Issue #6728 - QUIC and HTTP/3

- Fixed trailer frame handling.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
Simone Bordet 2021-11-02 17:27:31 +01:00
parent 6aedfe52f1
commit cb97549fa6
2 changed files with 29 additions and 12 deletions

View File

@ -197,17 +197,26 @@ public abstract class HTTP3StreamConnection extends AbstractConnection
{
case FRAME:
{
DataFrame frame = dataFrame;
dataFrame = null;
if (LOG.isDebugEnabled())
LOG.debug("read data {} on {}", frame, this);
buffer.retain();
// Store in a local variable so that the lambda captures the right buffer.
RetainableByteBuffer current = buffer;
// Release the network buffer here (if empty), since the application may
// not be reading more bytes, to avoid to keep around a consumed buffer.
tryReleaseBuffer(false);
return new Stream.Data(frame, () -> completeReadData(current));
if (parserDataMode)
{
DataFrame frame = dataFrame;
dataFrame = null;
if (LOG.isDebugEnabled())
LOG.debug("read data {} on {}", frame, this);
buffer.retain();
// Store in a local variable so that the lambda captures the right buffer.
RetainableByteBuffer current = buffer;
// Release the network buffer here (if empty), since the application may
// not be reading more bytes, to avoid to keep around a consumed buffer.
tryReleaseBuffer(false);
return new Stream.Data(frame, () -> completeReadData(current));
}
else
{
// Not anymore in data mode, so it's a trailer frame.
tryReleaseBuffer(false);
return null;
}
}
case MODE_SWITCH:
{

View File

@ -368,7 +368,15 @@ public class HttpChannelOverHTTP3 extends HttpChannel
return result;
}
return null;
else
{
// The call to readData() may have parsed the trailer frame which
// triggers the content complete event which sets the content to EOF.
try (AutoLock l = lock.lock())
{
return content;
}
}
}
private HttpInput.Content newContent(Stream.Data data)