Skip to content

Add support for gzip compression in API calls - #198

Merged
dylex merged 3 commits into
dylex:mainfrom
EionRobb:gzip_compression
Jul 26, 2025
Merged

Add support for gzip compression in API calls#198
dylex merged 3 commits into
dylex:mainfrom
EionRobb:gzip_compression

Conversation

@EionRobb

Copy link
Copy Markdown
Collaborator

There's currently a 4MiB limit on all API responses (4096*1024 in the purple_util_fetch_url_request_len_with_account() call of slack-api.c) so potentially could cause errors when making API requests with a >4MiB response - eg see issue #81 which had a workaround for large responses by paginating by 500 users at a time.

Adding gzip compression can help with large responses from the server and preventing the buffer from overflowing and corrupting. Fortunately, json gzip compresses really well, eg a /api/users.list API response I had which was 497KiB, compressed down to a 42KiB gzipped response.

This PR adds gzip content-encoding support to help reduce network bandwidth and allow for larger responses before there's json parser corruption.

@dylex
dylex merged commit 1115ec1 into dylex:main Jul 26, 2025
4 checks passed
@dylex

dylex commented Jul 26, 2025

Copy link
Copy Markdown
Owner

Good idea. This seems generic enough, any plan to integrate it into libpurple util_fetch calls?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants