about summary refs log tree commit diff
path: root/corgi/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'corgi/src/main.rs')
-rw-r--r--corgi/src/main.rs43
1 files changed, 2 insertions, 41 deletions
diff --git a/corgi/src/main.rs b/corgi/src/main.rs
index fb6b75a..b8b23de 100644
--- a/corgi/src/main.rs
+++ b/corgi/src/main.rs
@@ -2,9 +2,7 @@ use std::{
 	net::{IpAddr, SocketAddr},
 	path::PathBuf,
 	pin::Pin,
-	sync::{Arc, Mutex},
-	thread::JoinHandle,
-	time::Instant,
+	sync::Arc,
 };
 
 use caller::HttpRequest;
@@ -32,25 +30,8 @@ pub struct Settings {
 }
 
 #[derive(Clone, Debug)]
-pub enum ScriptKind {
-	Executable,
-	Module { thread: Arc<Option<JoinHandle<()>>> },
-}
-
-impl ScriptKind {
-	pub fn is_executable(&self) -> bool {
-		if let ScriptKind::Executable = self {
-			true
-		} else {
-			false
-		}
-	}
-}
-
-#[derive(Clone, Debug)]
 pub struct Script {
 	name: String,
-	kind: ScriptKind,
 	regex: Option<Regex>,
 	filename: String,
 	env: Vec<(String, String)>,
@@ -105,21 +86,8 @@ fn parse_script_conf(conf: &Value) -> Script {
 		},
 	};
 
-	let kind = match conf.get("Type") {
-		None => ScriptKind::Executable,
-		Some("executable") => ScriptKind::Executable,
-		Some("object") => ScriptKind::Module {
-			thread: Arc::new(None),
-		},
-		Some(kind) => {
-			eprintln!("'{kind}' is not a valid script type");
-			std::process::exit(1)
-		}
-	};
-
 	Script {
 		name,
-		kind,
 		regex,
 		filename,
 		env: env.unwrap_or_default(),
@@ -176,8 +144,6 @@ impl Svc {
 		caddr: SocketAddr,
 		req: Request<Incoming>,
 	) -> Response<Full<Bytes>> {
-		let start = Instant::now();
-
 		// Collect things we need from the request before we eat it's body
 		let method = req.method().as_str().to_ascii_uppercase();
 		let version = req.version();
@@ -251,12 +217,7 @@ impl Svc {
 			body: if content_length > 0 { Some(body) } else { None },
 		};
 
-		let cgi_response = match script.kind {
-			ScriptKind::Executable => {
-				caller::call_and_parse_cgi(script.clone(), http_request).await
-			}
-			ScriptKind::Object => caller::call_and_parse_module(script.clone(), http_request).await,
-		};
+		let cgi_response = caller::call_and_parse_cgi(script.clone(), http_request).await;
 
 		let status = StatusCode::from_u16(cgi_response.status).unwrap();
 		let mut response = Response::builder().status(status);