Skip to content

GZipResponseStream should not buffer whole request #638

@gkresic

Description

@gkresic

As currently implemented, GZipResponseStream buffers whole response and compresses it only upon closing:

https://github.com/pippo-java/pippo/blob/master/pippo-core/src/main/java/ro/pippo/core/gzip/GZipResponseStream.java

This may result in HUGE heap usage when streaming BIG responses, which is primary use case for using compression in responses.

Instead, it should wrap response.getOutputStream() and simply pump content to it. Even better, use some threshold and buffer responses under it, compressing only if response size end up to be over that threshold.

Idea for better implementation:

https://github.com/oblac/jodd/blob/master/jodd-servlet/src/main/java/jodd/servlet/filter/GzipResponseStream.java

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions