Skip to content

Commit

Permalink
Merge pull request #8625 from eclipse/jetty-12.0.x-http2-fix-unsuppor…
Browse files Browse the repository at this point in the history
…ted-retain

Fixes the case where HTTP/2 readData() was returning EOF
  • Loading branch information
sbordet authored Sep 27, 2022
2 parents b5541d9 + 70e4ccd commit eacd73f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -415,18 +415,6 @@ public DataFrame frame()
return frame;
}

@Override
public void retain()
{
throw new UnsupportedOperationException();
}

@Override
public boolean release()
{
return true;
}

@Override
public String toString()
{
Expand All @@ -439,6 +427,18 @@ public EOF(int streamId)
{
super(new DataFrame(streamId, BufferUtil.EMPTY_BUFFER, true));
}

@Override
public void retain()
{
throw new UnsupportedOperationException();
}

@Override
public boolean release()
{
return true;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,12 @@ public Runnable onTrailer(HeadersFrame frame)

private Content.Chunk createChunk(Stream.Data data)
{
// As we are passing the ByteBuffer to the Chunk we need to retain.
data.retain();
DataFrame frame = data.frame();
if (frame.isEndStream() && frame.remaining() == 0)
return Content.Chunk.EOF;

// We need to retain because we are passing the ByteBuffer to the Chunk.
data.retain();
return Content.Chunk.from(frame.getData(), frame.isEndStream(), data);
}

Expand Down

0 comments on commit eacd73f

Please sign in to comment.