diff seobeo/s_web.c @ 184:8c74204fd362

[MD to HTML] Updated so it can be used through readme to html
author MrJuneJune <me@mrjunejune.com>
date Fri, 23 Jan 2026 22:20:35 -0800
parents a8976a008a9d
children 8cf4ec5e2191
line wrap: on
line diff
--- a/seobeo/s_web.c	Fri Jan 23 21:19:08 2026 -0800
+++ b/seobeo/s_web.c	Fri Jan 23 22:20:35 2026 -0800
@@ -1,6 +1,6 @@
 #include "seobeo/seobeo.h"
-#include <strings.h>  // for strcasecmp
-#include <time.h>     // for time_t
+#include <strings.h>
+#include <time.h>
 
 static char g_folder_path[512] = ".";
 
@@ -151,20 +151,17 @@
   void *p_conn_kv = Dowa_HashMap_Get_Ptr(p_req_map, "Connection");
   const char *conn_header = p_conn_kv ? ((Seobeo_Request_Entry*)p_conn_kv)->value : NULL;
 
-  if (conn_header) {
-    // Explicit Connection header - check for keep-alive or close
-    if (connection_header_contains(conn_header, "close")) {
+  if (conn_header)
+  {
+    if (connection_header_contains(conn_header, "close"))
       should_keep_alive = FALSE;
-    } else if (connection_header_contains(conn_header, "keep-alive")) {
+    else if (connection_header_contains(conn_header, "keep-alive"))
       should_keep_alive = use_keep_alive;
-    } else {
-      // Unknown value, use version default
-      should_keep_alive = is_http11 && use_keep_alive;
-    }
-  } else {
-    // No Connection header - use HTTP version defaults
+    else
+      should_keep_alive = is_http11 && use_keep_alive;  // Unknown value, use version default
+  }
+  else
     should_keep_alive = is_http11 && use_keep_alive;
-  }
 
   void *p_method_kv = Dowa_HashMap_Get_Ptr(p_req_map, "HTTP_Method");
   const char *method = p_method_kv ? ((Seobeo_Request_Entry*)p_method_kv)->value : NULL;
@@ -269,7 +266,25 @@
     else if (strstr(file_path, ".js")) mime = "application/javascript";
     else if (strstr(file_path, ".png")) mime = "image/png";
     else if (strstr(file_path, ".jpg") || strstr(file_path, ".jpeg")) mime = "image/jpeg";
+    else if (strstr(file_path, ".gif")) mime = "image/gif";
+    else if (strstr(file_path, ".svg")) mime = "image/svg+xml";
+    else if (strstr(file_path, ".ico")) mime = "image/x-icon";
+    else if (strstr(file_path, ".webp")) mime = "image/webp";
     else if (strstr(file_path, ".json")) mime = "application/json";
+    else if (strstr(file_path, ".wasm")) mime = "application/wasm";
+    else if (strstr(file_path, ".xml")) mime = "application/xml";
+    else if (strstr(file_path, ".pdf")) mime = "application/pdf";
+    else if (strstr(file_path, ".txt")) mime = "text/plain";
+    else if (strstr(file_path, ".mp4")) mime = "video/mp4";
+    else if (strstr(file_path, ".webm")) mime = "video/webm";
+    else if (strstr(file_path, ".mp3")) mime = "audio/mpeg";
+    else if (strstr(file_path, ".woff2")) mime = "font/woff2";
+    else if (strstr(file_path, ".woff")) mime = "font/woff";
+    else if (strstr(file_path, ".ttf")) mime = "font/ttf";
+    else if (strstr(file_path, ".webp")) mime = "image/webp";
+    else if (strstr(file_path, ".glb")) mime = "model/gltf-binary";
+    else if (strstr(file_path, ".gltf")) mime = "model/gltf+json";
+
 
     Seobeo_Web_Header_Generate_KeepAlive(p_response_header,
                                HTTP_OK,
@@ -789,6 +804,3 @@
   Dowa_Array_Free(g_routes);
   g_routes = NULL;
 }
-
-// Logging functions moved to s_logging.c
-