if (nettyResponse.getDecoderResult().isFailure()) { emitResponseError(new BadHttpResponseException(origin, nettyResponse.getDecoderResult().cause())); return;
if (nettyResponse.getDecoderResult().isFailure()) { emitResponseError(new BadHttpResponseException(origin, nettyResponse.getDecoderResult().cause())); return;
return; } else if (response.getStatus().code() != HttpResponseStatus.OK.code()) { LOG.error(response.getStatus().reasonPhrase(), response.getDecoderResult().cause()); endFetch(FetcherState.FETCH_FAILED); return;
eventsSubject.onEvent(HttpClientMetricsEvent.RESPONSE_HEADER_RECEIVED); HttpResponse response = (HttpResponse) msg; DecoderResult decoderResult = response.getDecoderResult(); if (decoderResult.isFailure()) { ctx.channel().attr(DISCARD_CONNECTION).set(true); // Netty rejects all data after decode failure.
@Override protected ConnectionState readHTTPInitial(HttpResponse httpResponse) { LOG.debug("Received raw response: {}", httpResponse); if (httpResponse.getDecoderResult().isFailure()) { LOG.debug("Could not parse response from server. Decoder result: {}", httpResponse.getDecoderResult().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"); HttpHeaders.setKeepAlive(substituteResponse, false); httpResponse = substituteResponse; } currentFilters.serverToProxyResponseReceiving(); rememberCurrentResponse(httpResponse); respondWith(httpResponse); if (ProxyUtils.isChunked(httpResponse)) { return AWAITING_CHUNK; } else { currentFilters.serverToProxyResponseReceived(); return AWAITING_INITIAL; } }
@Override protected ConnectionState readHTTPInitial(HttpResponse httpResponse) { LOG.debug("Received raw response: {}", httpResponse); if (httpResponse.getDecoderResult().isFailure()) { LOG.debug("Could not parse response from server. Decoder result: {}", httpResponse.getDecoderResult().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"); HttpHeaders.setKeepAlive(substituteResponse, false); httpResponse = substituteResponse; } currentFilters.serverToProxyResponseReceiving(); rememberCurrentResponse(httpResponse); respondWith(httpResponse); if (ProxyUtils.isChunked(httpResponse)) { return AWAITING_CHUNK; } else { currentFilters.serverToProxyResponseReceived(); return AWAITING_INITIAL; } }