diff options
| author | Teddy Wing | 2020-06-27 21:17:14 +0200 | 
|---|---|---|
| committer | Teddy Wing | 2020-06-27 21:17:14 +0200 | 
| commit | 0be4106a600b2e038170d4c49136f50ad54af6b7 (patch) | |
| tree | 128e87ea9c727af89e9133321abaf262094f1052 | |
| parent | cb1ffca05c679f41490a09fc9e107da707858068 (diff) | |
| download | fastcgi-conduit-0be4106a600b2e038170d4c49136f50ad54af6b7.tar.bz2 | |
FastCgiRequest: Add query string
| -rw-r--r-- | src/lib.rs | 12 | 
1 files changed, 11 insertions, 1 deletions
| @@ -34,6 +34,7 @@ struct FastCgiRequest<'a> {      method: conduit::Method,      headers: conduit::HeaderMap,      path: String, +    query: Option<String>,  }  impl<'a> FastCgiRequest<'a> { @@ -50,6 +51,7 @@ impl<'a> FastCgiRequest<'a> {              method: method,              headers: headers,              path: Self::path(&request), +            query: Self::query(&request),          };          Ok(r) @@ -128,6 +130,10 @@ impl<'a> FastCgiRequest<'a> {              None => "/".to_owned(),          }      } + +    fn query(request: &'a fastcgi::Request) -> Option<String> { +        request.param("QUERY_STRING") +    }  }  impl<'a> conduit::RequestExt for FastCgiRequest<'a> { @@ -155,7 +161,11 @@ impl<'a> conduit::RequestExt for FastCgiRequest<'a> {         &self.path     } -   fn query_string(&self) -> std::option::Option<&str> { todo!() } +   fn query_string(&self) -> std::option::Option<&str> { +       self.query.as_ref() +           .map(|p| p.as_str()) +   } +     fn remote_addr(&self) -> std::net::SocketAddr { todo!() }     fn content_length(&self) -> std::option::Option<u64> { todo!() }     fn headers(&self) -> &conduit::HeaderMap { todo!() } | 
