Treat zero-length input as no input at all

Fixes running with molly brown
This commit is contained in:
Emii Tatsuo 2020-12-01 17:38:52 -05:00
parent de060363f1
commit 6400197514
Signed by: Emi
GPG Key ID: 68FAB2E2E6DFC98B
1 changed files with 6 additions and 1 deletions

View File

@ -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::<Vec<String>>()
}
/// 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()
}