Mercurial
diff seobeo/seobeo.h @ 119:c39582f937e5
[Seobeo Client] Added client side logic which will be used for all my other calls instead of curl.
| author | June Park <parkjune1995@gmail.com> |
|---|---|
| date | Wed, 07 Jan 2026 16:05:57 -0800 |
| parents | 70401cf61e97 |
| children | cbbf78b17cfa |
line wrap: on
line diff
--- a/seobeo/seobeo.h Wed Jan 07 13:24:38 2026 -0800 +++ b/seobeo/seobeo.h Wed Jan 07 16:05:57 2026 -0800 @@ -10,10 +10,6 @@ #include "seobeo/seobeo_internal.h" -/* Included in dowa - #include <stdio.h> - #include <stdlib.h> -*/ #include <stdarg.h> #include <unistd.h> #include <errno.h> @@ -70,6 +66,28 @@ extern int Seobeo_Web_Server_Start(const char *folder_path, const char *port, Seobeo_ServerMode mode, int thread_count); /* Generic HTTP GET Rquest to given host and port with path. It will mimic chrome. */ extern int Seobeo_Web_Client_Get(const char *host, const char *port, const char *path); + +// --- HTTP Client (curl-like API) --- // +/* Create a new HTTP client request with the given URL. */ +extern Seobeo_Client_Request *Seobeo_Client_Request_Create(const char *url); +/* Set HTTP method (GET, POST, PUT, DELETE, etc.). Default is GET. */ +extern void Seobeo_Client_Request_Set_Method(Seobeo_Client_Request *p_req, const char *method); +/* Add a header using key-value pairs (stored in HashMap). */ +extern void Seobeo_Client_Request_Add_Header_Map(Seobeo_Client_Request *p_req, const char *key, const char *value); +/* Add a header as a string "Key: Value" (stored in Array). */ +extern void Seobeo_Client_Request_Add_Header_Array(Seobeo_Client_Request *p_req, const char *header); +/* Set request body with given data and length. */ +extern void Seobeo_Client_Request_Set_Body(Seobeo_Client_Request *p_req, const char *body, size_t length); +/* Enable/disable following redirects with max redirect count. Default is FALSE with 10 max. */ +extern void Seobeo_Client_Request_Set_Follow_Redirects(Seobeo_Client_Request *p_req, boolean follow, int32 max_redirects); +/* Set download path to save response body to file instead of memory. */ +extern void Seobeo_Client_Request_Set_Download_Path(Seobeo_Client_Request *p_req, const char *path); +/* Execute the HTTP request and return response. */ +extern Seobeo_Client_Response *Seobeo_Client_Request_Execute(Seobeo_Client_Request *p_req); +/* Destroy request and free all resources. */ +extern void Seobeo_Client_Request_Destroy(Seobeo_Client_Request *p_req); +/* Destroy response and free all resources. */ +extern void Seobeo_Client_Response_Destroy(Seobeo_Client_Response *p_resp); /* Initialize the router system (called automatically by Seobeo_Web_Server_Start) */ extern void Seobeo_Router_Init(); /* Register an API route handler. Call before starting server. */