Page MenuHomePhabricator

[keyserver] Compress HTTP responses
ClosedPublic

Authored by ashoat on Sep 27 2023, 11:12 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Nov 30, 2:19 AM
Unknown Object (File)
Tue, Nov 26, 2:47 AM
Unknown Object (File)
Tue, Nov 26, 12:39 AM
Unknown Object (File)
Sat, Nov 16, 9:28 PM
Unknown Object (File)
Sat, Nov 16, 9:28 PM
Unknown Object (File)
Sat, Nov 16, 9:28 PM
Unknown Object (File)
Sat, Nov 16, 9:25 PM
Unknown Object (File)
Fri, Nov 8, 3:48 PM
Subscribers

Details

Summary

This change enables the use of gzip and deflate compression "transparently" for all HTTP requests. It does so using Express's official compression library. Linear task: ENG-5018

  • iOS: iOS supports deflate but not Brotli, so this is the best thing we can do outside of the application layer.
  • Android: Android only supports gzip, so this is the best thing we can do outside of the application layer.
  • Web: Pretty much all modern browsers support Brotli now. I explored alternatives to compression that support Brotli here, but didn't find any that I felt great about.

I also considered implementing this on the application layer like I did for the socket. I ended up deciding against this given how much easier this approach was. More details here.

Test Plan

I tested iOS, Android, and Chrome using this patch. I also enabled debug output for compression by running the keyserver via DEBUG=compression yarn dev. I confirmed that all three were getting compressed responses when the response was sufficiently large. Android was a bit tricky because it was stripping the Content-Encoding header, but I was able to confirm it here.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable