}
}
}
info.handle.event(new State.HeadersReceived(state.resp));
} else if (msg instanceof HttpContent) {
HttpContent c = (HttpContent) msg;
info.handle.event(new State.ContentReceived(c));
c.content().resetReaderIndex();
if (c.content().readableBytes() > 0) {
state.content.writeBytes(c.content());
}
state.content.resetReaderIndex();
boolean last = c instanceof LastHttpContent;
if (!last && state.resp.headers().get(HttpHeaders.Names.CONTENT_LENGTH) != null) {
long len = Headers.CONTENT_LENGTH.toValue(state.resp.headers().get(HttpHeaders.Names.CONTENT_LENGTH));
last = state.content.readableBytes() >= len;
}
if (last) {
c.content().resetReaderIndex();
sendFullResponse(ctx);
}
}
// if (!info.listenerAdded) {
// info.listenerAdded = true;