JuliaPluto / PlutoSliderServer.jl

Web server to run just the `@bind` parts of a Pluto.jl notebook
https://computationalthinking.mit.edu/
The Unlicense
135 stars 18 forks source link

Use base64url instead of base64 to avoid escaping #57

Closed fonsp closed 2 years ago

fonsp commented 2 years ago

PlutoSliderServer uses a lot of base64, for example, in a staterequest:

GET /staterequest/$notebook_hash/$bonds_data

We currently use the following as the Pluto hash:

And for the bonds data, the same, but without hashing.

The hope was that by URI escaping, we would get legal URLs for base64 data, and additionally, in #29 , legal file names for precomputed states.

But! It turns out that some proxies and some file servers perform URI unescaping before it reaches this package. List of problems:

Solution

This PR uses the base64url algorithm instead of base64:

This function implements the base64url algorithm, which is like regular base64 but it produces legal URL/filenames: it uses - instead of +, _ instead of /, and it does not pad (with = originally).

See the wiki or the official spec (RFC 4648 §5).

TODO

TODO: