Class Http2ContentLengthEnforcingHandler

java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
com.netflix.zuul.netty.server.http2.Http2ContentLengthEnforcingHandler
All Implemented Interfaces:
io.netty.channel.ChannelHandler, io.netty.channel.ChannelInboundHandler

public final class Http2ContentLengthEnforcingHandler extends io.netty.channel.ChannelInboundHandlerAdapter
This class is only suitable for use on HTTP/2 child channels.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler

    io.netty.channel.ChannelHandler.Sharable
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    channelRead(io.netty.channel.ChannelHandlerContext ctx, Object msg)
    This checks that the content length does what it says, preventing a client from causing Zuul to misinterpret the request.

    Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter

    channelActive, channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggered

    Methods inherited from class io.netty.channel.ChannelHandlerAdapter

    ensureNotSharable, handlerAdded, handlerRemoved, isSharable

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface io.netty.channel.ChannelHandler

    handlerAdded, handlerRemoved
  • Constructor Details

    • Http2ContentLengthEnforcingHandler

      public Http2ContentLengthEnforcingHandler()
  • Method Details

    • channelRead

      public void channelRead(io.netty.channel.ChannelHandlerContext ctx, Object msg) throws Exception
      This checks that the content length does what it says, preventing a client from causing Zuul to misinterpret the request. Because this class is meant to work in an HTTP/2 setting, the content length and transfer encoding checks are more semantics. In particular, this checks:
      • No duplicate Content length
      • Content Length (if present) must always be greater than or equal to how much content has been seen
      • Content Length (if present) must always be equal to how much content has been seen by the end
      • Content Length cannot be present along with chunked transfer encoding.
      Specified by:
      channelRead in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      channelRead in class io.netty.channel.ChannelInboundHandlerAdapter
      Throws:
      Exception