if (msg instanceof HttpResponse) { final HttpResponse nettyRes = (HttpResponse) msg; final DecoderResult decoderResult = nettyRes.decoderResult(); if (!decoderResult.isSuccess()) { fail(ctx, new ProtocolViolationException(decoderResult.cause()));
@Override public void channelRead(final ChannelHandlerContext ctx, Object msg) throws Exception { if (msg instanceof io.netty.handler.codec.http.HttpResponse) { io.netty.handler.codec.http.HttpResponse response = (io.netty.handler.codec.http.HttpResponse) msg; if (response.decoderResult().isFailure()) { exceptionCaught(ctx, response.decoderResult().cause()); return; } responseEmitter.onSuccess(new NettyResponse(response, contentEmitter)); } else if (msg instanceof HttpContent) { HttpContent content = (HttpContent) msg; contentEmitter.onReceivedContent(content); if (msg instanceof LastHttpContent) { acquisitionListener.contentDone(false); } } else { exceptionCaught(ctx, new IllegalStateException("Unexpected message type: " + msg.getClass().getName())); } }
@Override public void readInboundResponseHeaders(TargetHandler targetHandler, HttpResponse httpInboundResponse) { this.targetHandler = targetHandler; OutboundMsgHolder msgHolder = targetHandler.getHttp2TargetHandler() .getHttp2ClientChannel().getInFlightMessage(Http2CodecUtil.HTTP_UPGRADE_STREAM_ID); if (msgHolder != null) { // Response received over HTTP/1.x connection, so mark no push promises available in the channel msgHolder.markNoPromisesReceived(); } if (targetHandler.getHttpResponseFuture() != null) { HttpCarbonMessage inboundResponseMsg = targetHandler.getInboundResponseMsg(); inboundResponseMsg.setTargetContext(targetHandler.getContext()); targetHandler.getHttpResponseFuture().notifyHttpListener(inboundResponseMsg); } else { LOG.error("Cannot notify the response to client as there is no associated responseFuture"); } if (httpInboundResponse.decoderResult().isFailure()) { LOG.warn(httpInboundResponse.decoderResult().cause().getMessage()); } }
String loggingMsg = msg.toString(); if (msg instanceof HttpResponse) { DecoderResult decoderResult = ((HttpResponse) msg).decoderResult(); if (decoderResult.isFailure()) { log.debug(format(ctx.channel(), "Decoding failed: " + msg + " : "),
if (!m.decoderResult().isSuccess()) ctx.fireExceptionCaught(m.decoderResult().cause()); return;
@Override protected ConnectionState readHTTPInitial(HttpResponse httpResponse) { LOG.debug("Received raw response: {}", httpResponse); if (httpResponse.decoderResult().isFailure()) { LOG.debug("Could not parse response from server. Decoder result: {}", httpResponse.decoderResult().toString()); // create a "substitute" Bad Gateway response from the server, since we couldn't understand what the actual // response from the server was. set the keep-alive on the substitute response to false so the proxy closes // the connection to the server, since we don't know what state the server thinks the connection is in. FullHttpResponse substituteResponse = ProxyUtils.createFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.BAD_GATEWAY, "Unable to parse response from server"); HttpUtil.setKeepAlive(substituteResponse, false); httpResponse = substituteResponse; } currentFilters.serverToProxyResponseReceiving(); rememberCurrentResponse(httpResponse); respondWith(httpResponse); if (ProxyUtils.isChunked(httpResponse)) { return AWAITING_CHUNK; } else { currentFilters.serverToProxyResponseReceived(); return AWAITING_INITIAL; } }
if (msg instanceof HttpResponse) { HttpResponse response = (HttpResponse) msg; if (response.decoderResult() .isFailure()) { onInboundError(response.decoderResult() .cause()); ReferenceCountUtil.release(msg);
if (msg instanceof HttpResponse) { HttpResponse response = (HttpResponse) msg; if (response.decoderResult() .isFailure()) { onInboundError(response.decoderResult() .cause()); ReferenceCountUtil.release(msg);
if (msg instanceof HttpResponse) { HttpResponse response = (HttpResponse) msg; if (response.decoderResult() .isFailure()) { onInboundError(response.decoderResult() .cause()); ReferenceCountUtil.release(msg);