aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 9b87edf..88752fb 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -32,3 +32,27 @@ where F: Fn(Request<()>) -> Response<T> + Send + Sync + 'static
.unwrap_or(());
});
}
+
+trait From<T>: Sized {
+ fn from(_: T) -> Self;
+}
+
+impl From<fastcgi::Request> for http::request::Builder {
+ fn from(request: fastcgi::Request) -> Self {
+ let method = request.param("REQUEST_METHOD")
+ .unwrap_or("".to_owned());
+
+ let uri = format!(
+ "{}://{}{}",
+ request.param("REQUEST_SCHEME").unwrap_or("".to_owned()),
+ request.param("HTTP_HOST").unwrap_or("".to_owned()),
+ request.param("REQUEST_URI").unwrap_or("".to_owned()),
+ );
+
+ return http::request::Builder::new()
+ .method(&*method)
+ .uri(&uri)
+
+ // HTTP_* params become headers
+ }
+}