diff options
author | Teddy Wing | 2018-11-13 20:23:23 +0100 |
---|---|---|
committer | Teddy Wing | 2018-11-13 20:23:23 +0100 |
commit | ad5678584a555bd7b323b9df0b77f97581e57798 (patch) | |
tree | eb8db92b336470a07c86c1e156afbc81b78bc861 | |
parent | 77b26ddcf498c69e593f053aea0650b115c91978 (diff) | |
download | dome-key-web-ad5678584a555bd7b323b9df0b77f97581e57798.tar.bz2 |
license: Get URL path without query string parameters
The `REQUEST_URI` parameter gives us the URL path including the query
string. Unfortunately, there's no param for just the path without the
query string. Well, that's not entirely true. On my production server
I'll be using Apache, and in development I'm using Lighttpd. Apache
provides a `SCRIPT_URL` param that does include just the path, but
Lighttpd doesn't appear to have an equivalent.
I wasn't able to figure out how to add a `SCRIPT_URL` param in Lighttpd
manually, either. Using `bin-environment` in the FastCGI config didn't
work, and using `setenv.add-environment` wouldn't allow me to set it to
both of our routes (I assume).
In light of this, just grab the path from `REQUEST_URI` by getting the
part in front of `?`.
-rw-r--r-- | license-generator/src/bin/license.rs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/license-generator/src/bin/license.rs b/license-generator/src/bin/license.rs index ca29260..5010fff 100644 --- a/license-generator/src/bin/license.rs +++ b/license-generator/src/bin/license.rs @@ -215,6 +215,8 @@ fn main() -> Result<()> { }; if let Some(path) = req.param("REQUEST_URI") { + let path = path.split("?").collect::<Vec<_>>()[0]; + match path.as_ref() { "/license" => { // Get params name, email, secret |