quiclog / qvis

QUIC and HTTP/3 visualization tools
https://qvis.edm.uhasselt.be
MIT License
173 stars 25 forks source link

Support gzip/brotli compressed assets #14

Open rmarx opened 4 years ago

rmarx commented 4 years ago

This is something the browser can do without issue. However, when downloading qlog from an external endpoint, we currently go through qvis-server to prevent CORS issues... and the qvis-server introspects the qlog etc. and not sure how the nodejs request library handles gzip/brotli.

Plan:

  1. see if we can detect CORS error in the browser and bypass the qvis server if its not needed
  2. treat .qlog.zip, .qlog.gz and .qlog.br as normal .qlog in both qvis and qvis-server
  3. if it's a .qlog or .qlog.gz or .qlog.br file, simply pass it back to the frontend from qvis-server without processing
  4. see how all that works when we -do- want to combine qlog files in qvis-server
  5. don't forget to update the qvis landing page + upload messages to make clearer what happens
marten-seemann commented 4 years ago

treat .qlog.zip, .qlog.gz and .qlog.br as normal .qlog in both qvis and qvis-server

Don’t you have to gunzip it first?

rmarx commented 4 years ago

I'm hoping that I can download them at the server and then just set the correct content_encoding when sending it back to the frontend, allowing the browser to do the decompression... hoping being the keyword there ;)

rmarx commented 4 years ago

Update: 1: This cannot be done directly in the browser. So now we just look for an error. If we get that, we try again via the server (if it was a genuine 4xx the first time we wasted another request, but too bad)

2 - 4: https://github.com/quiclog/qvis/commit/29d3aaa3a858d64aa70518d113ff8bf42d33fbee, https://github.com/quiclog/qvis/commit/bab59db7c6d0263228ced809e146ee7dc10e1fae and https://github.com/quiclog/qvis-server/commit/3759662f822557bcf478c1049c42a2a844a9a85f. Our hope was valid: qvis-server can just proxy the files and set the correct Content-Encoding and it works (or at least it seems to ;))

As a side-effect, we now also try to fetch files inside the browser first. If CORS is setup properly, no more backend interaction is necessary!

5: TODO

Some testfiles one can use: