finished static files hosting. Added mime type definition and file sending functions. Finished send_response and changed header compose function. Some small fixes
This commit is contained in:
10
src/server.c
10
src/server.c
@ -12,6 +12,11 @@
|
||||
#include "../include/utils.h"
|
||||
#include "../include/request.h"
|
||||
|
||||
/**
|
||||
* @brief Handle client connection
|
||||
*
|
||||
* @param fd
|
||||
*/
|
||||
void handle_connection(int fd)
|
||||
{
|
||||
const size_t request_buffer_size = 512;
|
||||
@ -89,9 +94,6 @@ int main(int argc, char *argv[])
|
||||
inet_ntop(cli_addr.ss_family, get_in_addr((struct sockaddr *)&cli_addr), s, sizeof s);
|
||||
printf("\nGot connection from %s\n", s);
|
||||
|
||||
// | Doesn't work properly yet
|
||||
// v
|
||||
|
||||
int pid = fork();
|
||||
|
||||
if (pid < 0)
|
||||
@ -100,7 +102,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
close(listenfd);
|
||||
|
||||
handle_connection(client_fd); // Implement
|
||||
handle_connection(client_fd);
|
||||
exit(0);
|
||||
}
|
||||
else
|
||||
|
Reference in New Issue
Block a user