Skip to content

Remove deflate compression from ContentEncoding#6628

Merged
westnordost merged 2 commits into
streetcomplete:masterfrom
Firefishy:patch-1
Nov 21, 2025
Merged

Remove deflate compression from ContentEncoding#6628
westnordost merged 2 commits into
streetcomplete:masterfrom
Firefishy:patch-1

Conversation

@Firefishy

@Firefishy Firefishy commented Nov 19, 2025

Copy link
Copy Markdown
Contributor

Removed deflate compression as server can respond with zlib-wrapped DEFLATE format (RFC 1950) which is not supported by the io.ktor.client which I believe only supports raw DEFLATE.

Fixes: #6626

Removed deflate compression as server can reply as server can respond with zlib-wrapped DEFLATE format (RFC 1950) which is not supported by the io.ktor.client which I believe only supports raw DEFLATE.
@matkoniecz

Copy link
Copy Markdown
Member

Thanks!

Have you tested the new app version?

Sadly I am not able to test it right now - and not sure how to test it to avoid triggering rewrite rule, maybe change also user agent?
Is that rewrite rule applied also to dev server?

@Firefishy

Copy link
Copy Markdown
Contributor Author

No, I've not tested it.

The dev server does not have the workarounds applied.

@riQQ riQQ added the bug label Nov 19, 2025
@westnordost

westnordost commented Nov 20, 2025

Copy link
Copy Markdown
Member

No need to test, this will work. Thank you @Firefishy !

I wonder if this should be reported upstream (and that issue report be mentioned in a comment at that point in the code). I have to admit that I don't quite understand the cause of the issue yet. Just scanned the wikipedia article, which just has this to say:

deflate – compression based on the deflate algorithm (described in RFC 1951), a combination of the LZ77 algorithm and Huffman coding, wrapped inside the zlib data format (RFC 1950);

So, deflate doesn't work at all, or deflate doesn't work under certain circumstances?
There's a sample application for using content encoding with ktor here, which uses deflate. I seems kind of hard to believe that a general bug in deflate would have slipped under their radar.
When reporting an issue, ktor-people would probably want a reproduction, e.g. an API endpoint that offers this version of deflate that is incompatible with whatever implementation they have. Any OSM API call will do?

@westnordost

Copy link
Copy Markdown
Member

@westnordost

Copy link
Copy Markdown
Member

Turns out there is already an issue report. I added my reproduction. https://youtrack.jetbrains.com/issue/KTOR-6999/Deflate-ContentEncoder-incorrectly-uses-raw-DEFLATE

@westnordost westnordost merged commit e7e494c into streetcomplete:master Nov 21, 2025
@Firefishy Firefishy deleted the patch-1 branch November 21, 2025 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ApiClientException - Answer not uploaded

4 participants