summaryrefslogtreecommitdiff
path: root/htmlua-apache-cgi/src
diff options
context:
space:
mode:
authorgyoder <70408179+gyoder@users.noreply.github.com>2025-07-05 16:13:17 -0600
committergyoder <70408179+gyoder@users.noreply.github.com>2025-07-05 16:16:51 -0600
commit7e896c1397a6d2ccbac31a63852b6ed0fbd32a8d (patch)
treed3a1592241654265be123f1ee32999eda30e2e06 /htmlua-apache-cgi/src
parent93cee588074981d33bd0da54aaa2e9c0311c3d87 (diff)
added apache2 cgi script
Diffstat (limited to 'htmlua-apache-cgi/src')
-rw-r--r--htmlua-apache-cgi/src/main.rs32
1 files changed, 32 insertions, 0 deletions
diff --git a/htmlua-apache-cgi/src/main.rs b/htmlua-apache-cgi/src/main.rs
new file mode 100644
index 0000000..ce86dc6
--- /dev/null
+++ b/htmlua-apache-cgi/src/main.rs
@@ -0,0 +1,32 @@
+use std::env;
+use std::fs;
+use std::fs::read_to_string;
+use std::path::{Path, PathBuf};
+use std::str::FromStr;
+use htmlua_parser::serve::serve_content;
+use kuchikiki::{
+ NodeRef,
+ traits::TendrilSink,
+};
+
+fn main() {
+ println!("Content-Type: text/html\n");
+
+ let request_uri = env::var("PATH_INFO").unwrap_or_else(|_| "".to_string());
+
+ let page = serve_content(request_uri.as_str()).unwrap();
+
+
+ // Output the final expanded HTML
+ println!("{page}");
+}
+
+// Simple HTML escape function
+fn html_escape(input: &str) -> String {
+ input
+ .replace('&', "&amp;")
+ .replace('<', "&lt;")
+ .replace('>', "&gt;")
+ .replace('"', "&quot;")
+ .replace('\'', "&#x27;")
+}