in zuul-core/src/main/java/com/netflix/zuul/netty/server/OriginResponseReceiver.java [83:108]
protected void channelReadInternal(ChannelHandlerContext ctx, Object msg) throws Exception {
if (msg instanceof HttpResponse) {
if (edgeProxy != null) {
edgeProxy.responseFromOrigin((HttpResponse) msg);
} else if (ReferenceCountUtil.refCnt(msg) > 0) {
// this handles the case of a DefaultFullHttpResponse that could have content that needs to be released
ReferenceCountUtil.safeRelease(msg);
}
ctx.channel().read();
} else if (msg instanceof HttpContent chunk) {
if (edgeProxy != null) {
edgeProxy.invokeNext(chunk);
} else {
ReferenceCountUtil.safeRelease(chunk);
}
ctx.channel().read();
} else {
// should never happen
ReferenceCountUtil.release(msg);
Exception error = new IllegalStateException("Received invalid message from origin");
if (edgeProxy != null) {
edgeProxy.errorFromOrigin(error);
}
ctx.fireExceptionCaught(error);
}
}