deislabs / wagi

Write HTTP handlers in WebAssembly with a minimal amount of work
Apache License 2.0
889 stars 44 forks source link

PATH_TRANSLATED should be different #57

Closed technosophos closed 3 years ago

technosophos commented 3 years ago

According to the CGI spec, the PATH_TRANSLATED env var was a path to a file on the filesystem. We could use PATH_TRANSLATED to hold the path info with the prefix chopped off. E.g. if the route matches is /foo/... and the PATH_INFO is /foo/bar/baz, then the PATH_TRANSLATED would be /bar/baz.

Since this is a frequently needed transformation, it is probably a good idea to do it.

If we are worried about overloading a CGI term, we could use something like X_SUBPATH or something

technosophos commented 3 years ago

Instead of re-purposing PATH_TRANSLATED, I am going to introduce X_RELATIVE_PATH. And its value will be bar/baz, not /bar/baz.