about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock4
-rw-r--r--Cargo.toml2
-rw-r--r--corgi/src/caller.rs3
-rw-r--r--corgi/src/main.rs3
-rw-r--r--corgi/src/stats.rs6
-rw-r--r--parrot_module/Cargo.toml10
-rw-r--r--parrot_module/src/lib.rs67
7 files changed, 4 insertions, 91 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 6795892..fe3f346 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -384,10 +384,6 @@ name = "parrot"
 version = "0.1.0"
 
 [[package]]
-name = "parrot_module"
-version = "0.1.0"
-
-[[package]]
 name = "pin-project-lite"
 version = "0.2.16"
 source = "registry+https://github.com/rust-lang/crates.io-index"
diff --git a/Cargo.toml b/Cargo.toml
index 47bbc10..a6381ad 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,5 +1,5 @@
 [workspace]
-members = ["corgi", "parrot", "parrot_module", "smalldog", "stats_module"]
+members = ["corgi", "parrot", "smalldog", "stats_module"]
 resolver = "3"
 
 # use this profile like this:
diff --git a/corgi/src/caller.rs b/corgi/src/caller.rs
index a8b04c0..4f75d32 100644
--- a/corgi/src/caller.rs
+++ b/corgi/src/caller.rs
@@ -1,6 +1,5 @@
 use std::{
 	ffi::{self, CString},
-	io::Write,
 	net::IpAddr,
 	process::Stdio,
 	ptr,
@@ -10,7 +9,7 @@ use std::{
 use tokio::{
 	io::AsyncWriteExt,
 	process::Command,
-	sync::oneshot::{self, Receiver, Sender},
+	sync::oneshot::{self, Sender},
 };
 
 use crate::{Script, ScriptKind};
diff --git a/corgi/src/main.rs b/corgi/src/main.rs
index 6a3c528..9581f9f 100644
--- a/corgi/src/main.rs
+++ b/corgi/src/main.rs
@@ -2,7 +2,6 @@ use std::{
 	net::{IpAddr, SocketAddr},
 	path::PathBuf,
 	pin::Pin,
-	process::Stdio,
 	sync::Arc,
 	time::Instant,
 };
@@ -20,7 +19,7 @@ use hyper::{
 use hyper_util::rt::TokioIo;
 use regex_lite::Regex;
 use stats::Stats;
-use tokio::{io::AsyncWriteExt, net::TcpListener, process::Command, runtime::Runtime};
+use tokio::{net::TcpListener, runtime::Runtime};
 
 mod caller;
 mod stats;
diff --git a/corgi/src/stats.rs b/corgi/src/stats.rs
index 0e3b99a..e475820 100644
--- a/corgi/src/stats.rs
+++ b/corgi/src/stats.rs
@@ -1,8 +1,4 @@
-use std::{
-	net::{IpAddr, SocketAddr},
-	path::PathBuf,
-	sync::Mutex,
-};
+use std::{net::IpAddr, path::PathBuf, sync::Mutex};
 
 use base64::{Engine, prelude::BASE64_STANDARD_NO_PAD};
 use rusqlite::{Connection, OptionalExtension, params};
diff --git a/parrot_module/Cargo.toml b/parrot_module/Cargo.toml
deleted file mode 100644
index f4ced8e..0000000
--- a/parrot_module/Cargo.toml
+++ /dev/null
@@ -1,10 +0,0 @@
-[package]
-name = "parrot_module"
-version = "0.1.0"
-edition = "2024"
-
-[lib]
-name = "parrot"
-crate-type = ["cdylib"]
-
-[dependencies]
diff --git a/parrot_module/src/lib.rs b/parrot_module/src/lib.rs
deleted file mode 100644
index 38148ae..0000000
--- a/parrot_module/src/lib.rs
+++ /dev/null
@@ -1,67 +0,0 @@
-use std::ffi::{self, CStr, CString};
-
-#[repr(C)]
-struct ModuleRequest<'req> {
-	headers_len: ffi::c_ulong,
-	headers: &'req [[*const ffi::c_char; 2]],
-	body_len: ffi::c_ulong,
-	body: *const u8,
-}
-
-#[repr(C)]
-struct ModuleResponse {
-	status: ffi::c_ushort,
-	headers_len: ffi::c_ulong,
-	headers: &'static [[*const ffi::c_char; 2]],
-	body_len: ffi::c_ulong,
-	body: *const u8,
-}
-
-const HEADERS: &'static [[*const ffi::c_char; 2]] =
-	&[[c"Content-Type".as_ptr(), c"text/plain".as_ptr()]];
-
-#[unsafe(no_mangle)]
-extern "C" fn cgi_handle(req: *const ModuleRequest) -> *const ModuleResponse {
-	let mut ret = String::new();
-
-	// unwrap is bad here
-	let reqref = unsafe { req.as_ref() }.unwrap();
-
-	for idx in 0..reqref.headers_len {
-		let kvarr = reqref.headers[idx as usize];
-		let k = unsafe { CStr::from_ptr(kvarr[0]) }.to_string_lossy();
-		let v = unsafe { CStr::from_ptr(kvarr[1]) }.to_string_lossy();
-
-		// While debugging I removed the format!() because it was SIGSEGVing
-		// as the String it allocated freed, and now that this is here it can stay
-		ret.push_str(&k);
-		ret.push(':');
-		ret.push(' ');
-		ret.push_str(&v);
-		ret.push('\n')
-	}
-
-	let body = CString::new(ret).unwrap();
-
-	let resp = ModuleResponse {
-		status: 200,
-		headers_len: 1,
-		headers: HEADERS,
-		body_len: body.as_bytes().len() as u64,
-		body: body.into_raw() as *const u8,
-	};
-
-	let boxed = Box::new(resp);
-	Box::<ModuleResponse>::into_raw(boxed)
-}
-
-#[unsafe(no_mangle)]
-extern "C" fn cgi_cleanup(req: *const ModuleResponse) {
-	// from_raw what we need to here so that these get dropped
-	let boxed = unsafe { Box::from_raw(req as *mut ModuleResponse) };
-	let body = unsafe { CString::from_raw(boxed.body as *mut i8) };
-
-	// Explicitly calling drop here to feel good about myself
-	drop(body);
-	drop(boxed);
-}