turn server into library + driver code

This commit is contained in:
2025-06-02 00:57:43 +02:00
parent feee7b53cc
commit 2e22186952
4 changed files with 125 additions and 62 deletions

26
http.h Normal file
View File

@ -0,0 +1,26 @@
#ifndef HTTP_H
#define HTTP_H
#include <netinet/in.h>
#include <sys/socket.h>
typedef struct {
int client_sock;
char *method;
char *target;
char *version;
/* Field_Lines (Header) */
char *body;
} HTTP_Request;
typedef struct {
char *version;
unsigned int status;
/* Field_Lines (Header) */
char *body;
} HTTP_Response;
int http_init(int port, int connection_amount);
HTTP_Request* http_accept(int server);
#endif /* HTTP_H */