Skip to content

Commit

Permalink
Tweak contentList fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephane Maldini committed May 6, 2019
1 parent 8e80029 commit c6aa625
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/main/java/reactor/netty/http/client/HttpClientOperations.java
Expand Up @@ -355,16 +355,25 @@ && markSentHeaderAndBody()) {
return FutureMono.from(channel().writeAndFlush(newFullBodyMessage(Unpooled.EMPTY_BUFFER)));
}

CompositeByteBuf agg = alloc.compositeBuffer(list.size());
ByteBuf output;
int i = list.size();
if (i == 1) {
output = list.get(0);
}
else {
CompositeByteBuf agg = alloc.compositeBuffer(list.size());

for (ByteBuf component : list) {
agg.addComponent(true, component);
}

for (ByteBuf component : list) {
agg.addComponent(component);
output = agg;
}

if (agg.readableBytes() > 0) {
return FutureMono.from(channel().writeAndFlush(newFullBodyMessage(agg)));
if (output.readableBytes() > 0) {
return FutureMono.from(channel().writeAndFlush(newFullBodyMessage(output)));
}
agg.release();
output.release();
return FutureMono.from(channel().writeAndFlush(newFullBodyMessage(Unpooled.EMPTY_BUFFER)));
}));
}
Expand Down

0 comments on commit c6aa625

Please sign in to comment.