about summary refs log tree commit diff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs
index da021a8..396ba51 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -106,6 +106,8 @@ impl Svc {
 			forward.unwrap_or(x_forward.unwrap_or(caddr.ip()))
 		};
 
+		println!("new connection from: [{client_addr}]");
+
 		let server_name = headers
 			.get("Host")
 			.expect("no http host header set")
@@ -138,6 +140,8 @@ impl Svc {
 		}
 
 		let cgi_response = Self::call_and_parse_cgi(cmd).await;
+		println!("called cgi!");
+
 		let status = StatusCode::from_u16(cgi_response.status).unwrap();
 		let mut response = Response::builder().status(status);
 
@@ -145,7 +149,8 @@ impl Svc {
 			response = response.header(key, value);
 		}
 
-		response.body(Full::new(Bytes::from(body.to_vec()))).unwrap()
+		let response_body = cgi_response.body.map(|v| Bytes::from(v)).unwrap_or(Bytes::new());
+		response.body(Full::new(response_body)).unwrap()
 	}
 
 	fn parse_addr_from_header(maybe_hval: Option<&HeaderValue>) -> Option<IpAddr> {