Skip to content
Snippets Groups Projects
Select Git revision
2 results Searching

get.h

Blame
  • get.h 742 B
    /* Include guards */
    #ifndef GET_H_INCLUDED
    #define GET_H_INCLUDED
    
    /* Hash defines */
    #define FOUND_RESPONSE "HTTP/1.0 200 OK\r\n" /* add \n*/
    #define NOT_FOUND_RESPONSE "HTTP/1.0 404\r\n\r\n"
    #define FOUND 1
    #define NOT_FOUND 0
    #define BUF 100000
    #define INFINITE_LOOP 1
    
    /* Libraries used */
    #include "server.h"
    
    
    /* Prototypes for the functions */
    void parse_request_and_send_response(char* root, char* buffer, int newsockfd);
    int file_found(char* path_to_file);
    void respond_OK_and_send_file(char* full_path, int newsockfd);
    void respond_NOTFOUND(int newsockfd);
    void get_mime_type(char* path, char* mime);
    void make_response_header(char* response, char* full_path, size_t size);
    size_t get_size(int fd);
    
    #endif