diff seobeo/seobeo.h @ 79:5710108c949e

[Seobeo] Added Redirect logic.
author June Park <parkjune1995@gmail.com>
date Thu, 01 Jan 2026 05:57:03 -0800
parents e7bf9e002850
children 70401cf61e97
line wrap: on
line diff
--- a/seobeo/seobeo.h	Wed Dec 31 15:07:43 2025 -0800
+++ b/seobeo/seobeo.h	Thu Jan 01 05:57:03 2026 -0800
@@ -45,6 +45,17 @@
 #define HTTP_NOT_FOUND 404
 #define HTTP_INTERNAL_ERROR 500
 
+#define CREATE_REDIRECT_HANDLER(name, target_url) \
+Seobeo_Request_Entry* GetRedirect##name(Seobeo_Request_Entry *req, Dowa_Arena *arena) \
+{ \
+  Seobeo_Request_Entry *resp = NULL; \
+  Dowa_HashMap_Push_Arena(resp, "status", "301", arena); \
+  Dowa_HashMap_Push_Arena(resp, "content-type", "text/plain", arena); \
+  Dowa_HashMap_Push_Arena(resp, "Body", "", arena); \
+  Dowa_HashMap_Push_Arena(resp, "Location", target_url, arena); \
+  return resp; \
+}
+
 extern volatile sig_atomic_t stop_server;
 
 // --- TCP --- //