comparison 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
comparison
equal deleted inserted replaced
78:e7bf9e002850 79:5710108c949e
43 #define HTTP_UNAUTHORIZED 401 43 #define HTTP_UNAUTHORIZED 401
44 #define HTTP_FORBIDDEN 403 44 #define HTTP_FORBIDDEN 403
45 #define HTTP_NOT_FOUND 404 45 #define HTTP_NOT_FOUND 404
46 #define HTTP_INTERNAL_ERROR 500 46 #define HTTP_INTERNAL_ERROR 500
47 47
48 #define CREATE_REDIRECT_HANDLER(name, target_url) \
49 Seobeo_Request_Entry* GetRedirect##name(Seobeo_Request_Entry *req, Dowa_Arena *arena) \
50 { \
51 Seobeo_Request_Entry *resp = NULL; \
52 Dowa_HashMap_Push_Arena(resp, "status", "301", arena); \
53 Dowa_HashMap_Push_Arena(resp, "content-type", "text/plain", arena); \
54 Dowa_HashMap_Push_Arena(resp, "Body", "", arena); \
55 Dowa_HashMap_Push_Arena(resp, "Location", target_url, arena); \
56 return resp; \
57 }
58
48 extern volatile sig_atomic_t stop_server; 59 extern volatile sig_atomic_t stop_server;
49 60
50 // --- TCP --- // 61 // --- TCP --- //
51 // --- Generate a Server Handle. ---// 62 // --- Generate a Server Handle. ---//
52 extern Seobeo_Handle *Seobeo_Stream_Handle_Server_Create(const char *host, const char* port); 63 extern Seobeo_Handle *Seobeo_Stream_Handle_Server_Create(const char *host, const char* port);