@Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { if (ctx.channel().attr(ATTR_CH_THROTTLED).get() != null) { // Discard this msg as channel is in process of being closed. } else { super.channelRead(ctx, msg); } }
@Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { if (msg instanceof HttpRequest) { // Fire start event, and if that succeeded, then allow processing to // continue to next handler in pipeline. if (fireStartEvent(ctx, (HttpRequest) msg)) { super.channelRead(ctx, msg); } } else { super.channelRead(ctx, msg); } }
@Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { try { if (msg instanceof Http2Frame) { incrementCounter(registry, frameCounterName, metricId, (Http2Frame) msg); } } finally { super.channelRead(ctx, msg); } }
@Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { try { String clientIP = ctx.channel().attr(SourceAddressChannelHandler.ATTR_SOURCE_ADDRESS).get(); if (IPS.get().contains(clientIP)) { ctx.channel().attr(DynamicHttp2FrameLogger.ATTR_ENABLE).set(Boolean.TRUE); ctx.pipeline().remove(this); } } finally { super.channelRead(ctx, msg); } } }
@Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { if (msg instanceof HttpResponse) { ctx.channel().attr(ATTR_HTTP_RESP).set((HttpResponse) msg); } try { super.channelRead(ctx, msg); } finally { if (msg instanceof LastHttpContent) { fireCompleteEventIfNotAlready(ctx, CompleteReason.SESSION_COMPLETE); } } }
@Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { State state = null; // Reset the state as each new request comes in. if (msg instanceof HttpRequest) { state = createNewState(ctx.channel()); } // Update the request body size with this chunk. if (msg instanceof HttpContent) { if (state == null) { state = getOrCreateCurrentState(ctx.channel()); } state.requestBodySize += ((HttpContent) msg).content().readableBytes(); } super.channelRead(ctx, msg); }
@Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { if (msg instanceof HttpRequest) { HttpRequest req = (HttpRequest) msg; for (String name : req.headers().names()) { if (name.startsWith("x-http2-")) { req.headers().remove(name); } } } super.channelRead(ctx, msg); } }
@Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { if (msg instanceof HttpRequest) { RequestState state = new RequestState(); state.request = (HttpRequest) msg; state.startTimeNs = System.nanoTime(); state.requestBodySize = 0; ctx.channel().attr(ATTR_REQ_STATE).set(state); } if (msg instanceof HttpContent) { RequestState state = ctx.channel().attr(ATTR_REQ_STATE).get(); if (state != null) { state.requestBodySize += ((HttpContent) msg).content().readableBytes(); } } super.channelRead(ctx, msg); }
@Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { if (msg instanceof Http2ResetFrame) { // Inform zuul to cancel the request. ctx.fireUserEventTriggered(new RequestCancelledEvent()); } else { super.channelRead(ctx, msg); } } }
@Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { if (msg instanceof HttpRequest) { // Fire start event, and if that succeeded, then allow processing to // continue to next handler in pipeline. if (fireStartEvent(ctx, (HttpRequest) msg)) { super.channelRead(ctx, msg); } } else { super.channelRead(ctx, msg); } }
@Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { if (ctx.channel().attr(ATTR_CH_THROTTLED).get() != null) { // Discard this msg as channel is in process of being closed. } else { super.channelRead(ctx, msg); } }
@Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { if (msg instanceof LastHttpContent) { removeInternalHandler(ctx); } else if (msg instanceof HttpRequest) { // Start timeout handler. InternalReadTimeoutHandler handler = new InternalReadTimeoutHandler(timeout, unit); ctx.pipeline().addBefore(HANDLER_NAME, INTERNAL_HANDLER_NAME, handler); } super.channelRead(ctx, msg); }
@Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { try { if (msg instanceof Http2Frame) { incrementCounter(registry, frameCounterName, metricId, (Http2Frame) msg); } } finally { super.channelRead(ctx, msg); } }
@Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { if (msg instanceof HttpResponse) { ctx.channel().attr(ATTR_HTTP_RESP).set((HttpResponse) msg); } try { super.channelRead(ctx, msg); } finally { if (msg instanceof LastHttpContent) { fireCompleteEventIfNotAlready(ctx, CompleteReason.SESSION_COMPLETE); } } }
@Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { try { String clientIP = ctx.channel().attr(SourceAddressChannelHandler.ATTR_SOURCE_ADDRESS).get(); if (IPS.get().contains(clientIP)) { ctx.channel().attr(DynamicHttp2FrameLogger.ATTR_ENABLE).set(Boolean.TRUE); ctx.pipeline().remove(this); } } finally { super.channelRead(ctx, msg); } } }
@Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { State state = null; // Reset the state as each new request comes in. if (msg instanceof HttpRequest) { state = createNewState(ctx.channel()); } // Update the request body size with this chunk. if (msg instanceof HttpContent) { if (state == null) { state = getOrCreateCurrentState(ctx.channel()); } state.requestBodySize += ((HttpContent) msg).content().readableBytes(); } super.channelRead(ctx, msg); }
@Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { if (msg instanceof HttpRequest) { HttpRequest req = (HttpRequest) msg; for (String name : req.headers().names()) { if (name.startsWith("x-http2-")) { req.headers().remove(name); } } } super.channelRead(ctx, msg); } }
@Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { if (msg instanceof HttpRequest) { RequestState state = new RequestState(); state.request = (HttpRequest) msg; state.startTimeNs = System.nanoTime(); state.requestBodySize = 0; ctx.channel().attr(ATTR_REQ_STATE).set(state); } if (msg instanceof HttpContent) { RequestState state = ctx.channel().attr(ATTR_REQ_STATE).get(); if (state != null) { state.requestBodySize += ((HttpContent) msg).content().readableBytes(); } } super.channelRead(ctx, msg); }
@Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { if (msg instanceof Http2ResetFrame) { // Inform zuul to cancel the request. ctx.fireUserEventTriggered(new RequestCancelledEvent()); } else { super.channelRead(ctx, msg); } } }
@Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { if (msg instanceof LastHttpContent) { removeInternalHandler(ctx); } else if (msg instanceof HttpRequest) { // Start timeout handler. InternalReadTimeoutHandler handler = new InternalReadTimeoutHandler(timeout, unit); ctx.pipeline().addBefore(HANDLER_NAME, INTERNAL_HANDLER_NAME, handler); } super.channelRead(ctx, msg); }