comparison seobeo/seobeo_internal.h @ 185:dfdd66825396

Merged in keep alive changes and mrjunejune changes.
author MrJuneJune <me@mrjunejune.com>
date Fri, 23 Jan 2026 22:22:30 -0800
parents a8976a008a9d
children 8cf4ec5e2191
comparison
equal deleted inserted replaced
182:d6ab5921fedc 185:dfdd66825396
22 SEOBEO_STREAM_TYPE_SERVER, 22 SEOBEO_STREAM_TYPE_SERVER,
23 SEOBEO_STREAM_TYPE_CLIENT, 23 SEOBEO_STREAM_TYPE_CLIENT,
24 } Seobeo_SocketType; 24 } Seobeo_SocketType;
25 25
26 typedef struct { 26 typedef struct {
27 int32 socket; 27 int32 socket;
28 Seobeo_SocketType type; 28 Seobeo_SocketType type;
29 boolean connected; 29 boolean connected;
30 30
31 char *host; 31 char *host;
32 char *port; 32 char *port;
33 33
34 SSL_CTX_TYPE *ssl_ctx; 34 SSL_CTX_TYPE *ssl_ctx;
35 SSL_TYPE *ssl; 35 SSL_TYPE *ssl;
36 36
37 uint8 *read_buffer; 37 uint8 *read_buffer;
38 uint32 read_buffer_capacity; 38 uint32 read_buffer_capacity;
39 uint32 read_buffer_len; // current size 39 uint32 read_buffer_len; // current size
40 uint32 read_buffer_used; // TODO: Implement this for client 40 uint32 read_buffer_used; // TODO: Implement this for client
41 41
42 uint8 *write_buffer; 42 uint8 *write_buffer;
43 uint32 write_buffer_capacity; 43 uint32 write_buffer_capacity;
44 uint32 write_buffer_len; // current size 44 uint32 write_buffer_len; // current size
45 45
46 void *file; 46 void *file;
47 void *text_copy; 47 void *text_copy;
48 char *file_name; 48 char *file_name;
49 49
50 atomic_bool destroyed; 50 atomic_bool destroyed;
51
52 // Keep-alive support
53 time_t last_activity; // Timestamp of last request/response
54 boolean keep_alive; // Whether this connection should be kept alive
51 } Seobeo_Handle; 55 } Seobeo_Handle;
52 56
53 // Cached file entry with content and size (for binary file support) 57 // Cached file entry with content and size (for binary file support)
54 typedef struct { 58 typedef struct {
55 char *content; 59 char *content;
85 89
86 // --- Parse Header into Dowa Map ---// 90 // --- Parse Header into Dowa Map ---//
87 extern int Seobeo_Web_Header_Parse(Seobeo_Handle *p_handle, Seobeo_Request_Entry **pp_map, Dowa_Arena *p_arena); 91 extern int Seobeo_Web_Header_Parse(Seobeo_Handle *p_handle, Seobeo_Request_Entry **pp_map, Dowa_Arena *p_arena);
88 92
89 // --- Handle Request --- // 93 // --- Handle Request --- //
90 extern void Seobeo_Web_HandleClientRequest(Seobeo_Handle *cli, Seobeo_Cache_Entry *p_html_cache); 94 /* Handle a client request. Returns TRUE if connection should be kept alive. */
95 extern boolean Seobeo_Web_ClientHandle_Request(Seobeo_Handle *p_cli_handle, Seobeo_Cache_Entry *p_html_cache, boolean use_keep_alive);
91 96
92 // --- SSL --- // 97 // --- SSL --- //
93 extern void Seobeo_Web_SSL_Init(); 98 extern void Seobeo_Web_SSL_Init();
94 extern void Seobeo_Web_SSL_Cleanup(); // Not used 99 extern void Seobeo_Web_SSL_Cleanup(); // Not used
95 extern int Seobeo_SSL_Setup_Client(Seobeo_Handle *p_handle, const char *host, int socket_fd); 100 extern int Seobeo_SSL_Setup_Client(Seobeo_Handle *p_handle, const char *host, int socket_fd);