From 64001975145ed85b6f911d53a62363b5cc40394a Mon Sep 17 00:00:00 2001 From: Emii Tatsuo Date: Tue, 1 Dec 2020 17:38:52 -0500 Subject: [PATCH] Treat zero-length input as no input at all Fixes running with molly brown --- src/types/request.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/types/request.rs b/src/types/request.rs index ae8b844..85fabd4 100644 --- a/src/types/request.rs +++ b/src/types/request.rs @@ -62,7 +62,7 @@ impl Request { uri.normalize(); - let input = match uri.query() { + let input = match uri.query().filter(|q| !q.is_empty()) { None => None, Some(query) => { let input = percent_decode_str(query.as_str()) @@ -126,6 +126,11 @@ impl Request { .collect::>() } + /// View any input sent by the user in the query string + /// + /// Any zero-length input is treated as no input at all, and will be reported as + /// [`None`]. This is done in order to provide compatibility with the SCGI header + /// common practice of reporting no query string as a blank input. pub fn input(&self) -> Option<&str> { self.input.as_deref() }