Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not fail when compressing empty HttpContent #13655

Merged
merged 2 commits into from
Oct 10, 2023

Commits on Oct 9, 2023

  1. Do not fail when compressing empty HttpContent

    Motivation:
    
    HttpContentCompressor fails with an exception when trying to write an empty HttpContent:
    
    ```
    io.netty.handler.codec.EncoderException: MessageToMessageCodec$1 must produce at least one message.
    	at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:99)
    	at io.netty.handler.codec.MessageToMessageCodec.write(MessageToMessageCodec.java:116)
    	at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:879)
    	at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:863)
    	at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:968)
    	at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:856)
    	at io.netty.channel.ChannelDuplexHandler.write(ChannelDuplexHandler.java:115)
    ```
    
    Modification:
    
    If the compression has no output, write an empty dummy HttpContent. This is not an ideal solution, but this should not happen often anyway.
    
    Result:
    
    HttpContentCompressor does not fail anymore.
    yawkat committed Oct 9, 2023
    Configuration menu
    Copy the full SHA
    f6c1483 View commit details
    Browse the repository at this point in the history
  2. Update codec-http/src/test/java/io/netty/handler/codec/http/HttpConte…

    …ntCompressorTest.java
    
    Co-authored-by: Norman Maurer <norman_maurer@apple.com>
    yawkat and normanmaurer committed Oct 9, 2023
    Configuration menu
    Copy the full SHA
    7cd3610 View commit details
    Browse the repository at this point in the history