Very, very basic server responses

This commit is contained in:
2025-09-13 19:50:41 +03:00
parent eb5e420d41
commit 172665ed4d
6 changed files with 298 additions and 21 deletions

View File

@@ -16,6 +16,7 @@
#include <sys/socket.h>
#include <sys/types.h>
#include "utils/hashmap.h"
#include "utils/string_builder.h"
typedef struct http_version
{
@@ -65,7 +66,7 @@ typedef struct http_request
typedef struct http_response
{
http_version_t http_version;
u_short http_status_code;
unsigned short http_status_code;
char* http_status_message;
size_t http_status_message_len;
hashmap_t* http_headers;
@@ -79,7 +80,8 @@ typedef struct http_server
} http_server_t;
void start_http_server(http_server_t* http_server, const char *addr, short port);
void process_conn(http_server_t* http_server, int server_fd, struct sockaddr* address, socklen_t* addr_len);
void process_conn(const http_server_t* http_server, int server_fd, struct sockaddr* address, socklen_t* addr_len);
enum http_method parse_method_str(const char* str, size_t len);
const char* http_method_to_string(enum http_method m);
#endif //SIMPLEHTTPSERVER_H