diff --git a/docs/html/_r_e_a_d_m_e_8md.html b/docs/html/_r_e_a_d_m_e_8md.html index 76a5c3d..db1297d 100644 --- a/docs/html/_r_e_a_d_m_e_8md.html +++ b/docs/html/_r_e_a_d_m_e_8md.html @@ -68,7 +68,7 @@ onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Files Functions Variables Pages + All Files Functions Variables Macros Pages
@@ -86,7 +86,7 @@
diff --git a/docs/html/bonsai_8c.html b/docs/html/bonsai_8c.html index 4d8b423..b2c0ae0 100644 --- a/docs/html/bonsai_8c.html +++ b/docs/html/bonsai_8c.html @@ -68,7 +68,7 @@ onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Files Functions Variables Pages + All Files Functions Variables Macros Pages
@@ -166,7 +166,7 @@

Variable Documentation

diff --git a/docs/html/files.html b/docs/html/files.html index 6ec4b1b..93f23d3 100644 --- a/docs/html/files.html +++ b/docs/html/files.html @@ -69,7 +69,7 @@ onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Files Functions Variables Pages + All Files Functions Variables Macros Pages
@@ -86,16 +86,18 @@
Here is a list of all files with brief descriptions:
- - - - + + + + + +
o*bonsai.c
o*misc.c
o*misc.h
o*process.c
\*process.h
o*mime.c
o*mime.h
o*misc.c
o*misc.h
o*process.c
\*process.h
diff --git a/docs/html/globals.html b/docs/html/globals.html index 7583a6b..496490f 100644 --- a/docs/html/globals.html +++ b/docs/html/globals.html @@ -68,6 +68,7 @@
  • All
  • Functions
  • Variables
  • +
  • Macros
  • @@ -76,7 +77,7 @@ onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Files Functions Variables Pages + All Files Functions Variables Macros Pages
    @@ -87,23 +88,33 @@
    Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:
    diff --git a/docs/html/globals_func.html b/docs/html/globals_func.html index 97ada5c..a34e294 100644 --- a/docs/html/globals_func.html +++ b/docs/html/globals_func.html @@ -68,6 +68,7 @@
  • All
  • Functions
  • Variables
  • +
  • Macros
  • @@ -76,7 +77,7 @@ onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Files Functions Variables Pages + All Files Functions Variables Macros Pages
    @@ -87,14 +88,18 @@
     
    diff --git a/docs/html/globals_vars.html b/docs/html/globals_vars.html index 241b264..955aafc 100644 --- a/docs/html/globals_vars.html +++ b/docs/html/globals_vars.html @@ -68,6 +68,7 @@
  • All
  • Functions
  • Variables
  • +
  • Macros
  • @@ -76,7 +77,7 @@ onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Files Functions Variables Pages + All Files Functions Variables Macros Pages
    @@ -100,7 +101,7 @@
    diff --git a/docs/html/index.html b/docs/html/index.html index d8553f7..ad9a1a1 100644 --- a/docs/html/index.html +++ b/docs/html/index.html @@ -63,7 +63,7 @@ onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Files Functions Variables Pages + All Files Functions Variables Macros Pages
    @@ -80,7 +80,7 @@
    diff --git a/docs/html/md__r_e_a_d_m_e.html b/docs/html/md__r_e_a_d_m_e.html index ebaab8f..917ca49 100644 --- a/docs/html/md__r_e_a_d_m_e.html +++ b/docs/html/md__r_e_a_d_m_e.html @@ -62,7 +62,7 @@ onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Files Functions Variables Pages + All Files Functions Variables Macros Pages
    @@ -81,7 +81,7 @@
    diff --git a/docs/html/misc_8c.html b/docs/html/misc_8c.html index 805fa22..2fe13fe 100644 --- a/docs/html/misc_8c.html +++ b/docs/html/misc_8c.html @@ -68,7 +68,7 @@ onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Files Functions Variables Pages + All Files Functions Variables Macros Pages
    @@ -123,7 +123,7 @@

    Function Documentation

    diff --git a/docs/html/misc_8h.html b/docs/html/misc_8h.html index 7a98825..81ad665 100644 --- a/docs/html/misc_8h.html +++ b/docs/html/misc_8h.html @@ -68,7 +68,7 @@ onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Files Functions Variables Pages + All Files Functions Variables Macros Pages
    @@ -124,7 +124,7 @@

    Function Documentation

    diff --git a/docs/html/misc_8h_source.html b/docs/html/misc_8h_source.html index 2fb2a93..ceefbc6 100644 --- a/docs/html/misc_8h_source.html +++ b/docs/html/misc_8h_source.html @@ -69,7 +69,7 @@ onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Files Functions Variables Pages + All Files Functions Variables Macros Pages
    @@ -88,7 +88,7 @@
    diff --git a/docs/html/pages.html b/docs/html/pages.html index 7207f12..1845c29 100644 --- a/docs/html/pages.html +++ b/docs/html/pages.html @@ -63,7 +63,7 @@ onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Files Functions Variables Pages + All Files Functions Variables Macros Pages
    @@ -85,7 +85,7 @@
    diff --git a/docs/html/process_8c.html b/docs/html/process_8c.html index b8d8d3c..5521360 100644 --- a/docs/html/process_8c.html +++ b/docs/html/process_8c.html @@ -68,7 +68,7 @@ onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Files Functions Variables Pages + All Files Functions Variables Macros Pages
    @@ -80,6 +80,7 @@
    +Macros | Functions | Variables
    @@ -90,16 +91,29 @@ #include <stdlib.h>
    #include <unistd.h>
    #include <string.h>
    +#include <limits.h>
    #include "misc.h"
    +#include "mime.h"
    + + + + + +

    +Macros

    #define MAX_HEADERS   25
     
    #define HEADER_SIZE   1025
     
    - - - - - - + + + + + + + + + +

    Functions

    void parse_request_headers (char headers[25][1024], FILE *request)
     
    void send_headers (int connection, char *headers[], int count)
     
    void print_request_headers (char headers[25][1024])
     
    void parse_request_headers (char headers[MAX_HEADERS][HEADER_SIZE], FILE *request)
     
    void request_type_and_file (char request_type[8], char *requested_file, char *first_header)
     
    void send_headers (int connection, char headers[3][HEADER_SIZE], int count)
     
    void send_file (int connection, char file_name[501])
     
    void print_request_headers (char headers[MAX_HEADERS][HEADER_SIZE])
     
    void process_request (int connection, FILE *request)
     
    @@ -108,8 +122,35 @@
    char output [1025]
     
    +

    Macro Definition Documentation

    + +
    +
    + + + + +
    #define HEADER_SIZE   1025
    +
    + +
    +
    + +
    +
    + + + + +
    #define MAX_HEADERS   25
    +
    +

    process.c Process the request and respond.

    +
    Author
    Nathan Campos
    + +
    +

    Function Documentation

    - +
    @@ -117,7 +158,7 @@

    Function Documentation

    - + @@ -143,7 +184,7 @@

    Function Documentation

    - +
    void parse_request_headers ( char headers[25][1024], headers[MAX_HEADERS][HEADER_SIZE],
    @@ -151,16 +192,16 @@

    Function Documentation

    - +
    void print_request_headers ( char headers[25][1024])headers[MAX_HEADERS][HEADER_SIZE])

    Print the request headers (for debugging)

    -
    See Also
    parse_request_headers()
    +
    See Also
    parse_request_headers()
    Parameters
    - +
    headersHeader array obtained from parse_request_headers()
    headersHeader array obtained from parse_request_headers()
    @@ -201,7 +242,84 @@

    Function Documentation

    - + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    void request_type_and_file (char request_type[8],
    char * requested_file,
    char * first_header 
    )
    +
    +

    Parse the Request Type and Requested File into the respective strings.

    +
    See Also
    parse_request_headers()
    +
    Parameters
    + + + + +
    request_typeString where the Request Type will be stored.
    requested_fileString where the Requested File will be stored.
    first_headerFirst request header string.
    +
    +
    + +
    +
    + +
    +
    + + + + + + + + + + + + + + + + + + +
    void send_file (int connection,
    char file_name[501] 
    )
    +
    +

    Parse the requested file location and send back the file contents.

    +
    See Also
    request_type_and_file()
    +
    Parameters
    + + + +
    connectionConnection descriptor.
    file_nameRequested file name acquired from request_type_and_file()
    +
    +
    + +
    +
    +
    @@ -214,8 +332,8 @@

    Function Documentation

    - - + + @@ -252,15 +370,13 @@

    Variable Documentation

    char * headers[], char headers[3][HEADER_SIZE],
    -

    process.c Process the request and respond.

    -
    Author
    Nathan Campos
    diff --git a/docs/html/process_8h.html b/docs/html/process_8h.html index 54cebc3..7bb1810 100644 --- a/docs/html/process_8h.html +++ b/docs/html/process_8h.html @@ -68,7 +68,7 @@ onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Files Functions Variables Pages + All Files Functions Variables Macros Pages
    @@ -133,7 +133,7 @@

    Function Documentation

    diff --git a/docs/html/process_8h_source.html b/docs/html/process_8h_source.html index d2f63c3..917deb2 100644 --- a/docs/html/process_8h_source.html +++ b/docs/html/process_8h_source.html @@ -69,7 +69,7 @@ onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> - All Files Functions Variables Pages + All Files Functions Variables Macros Pages
    @@ -88,7 +88,7 @@
    diff --git a/docs/html/search/all_6d.js b/docs/html/search/all_6d.js index 69079ff..ee05a67 100644 --- a/docs/html/search/all_6d.js +++ b/docs/html/search/all_6d.js @@ -2,6 +2,9 @@ var searchData= [ ['main',['main',['../bonsai_8c.html#a0ddf1224851353fc92bfbff6f499fa97',1,'bonsai.c']]], ['max_5fconnections',['MAX_CONNECTIONS',['../bonsai_8c.html#afbec5bc0e230dafdca37e3c2eab11982',1,'bonsai.c']]], + ['max_5fheaders',['MAX_HEADERS',['../process_8c.html#ab8949645fa8d90e1722d233c6bdfc815',1,'process.c']]], + ['mime_2ec',['mime.c',['../mime_8c.html',1,'']]], + ['mime_2eh',['mime.h',['../mime_8h.html',1,'']]], ['misc_2ec',['misc.c',['../misc_8c.html',1,'']]], ['misc_2eh',['misc.h',['../misc_8h.html',1,'']]] ]; diff --git a/docs/html/search/all_70.js b/docs/html/search/all_70.js index 82cfb2d..cae3d79 100644 --- a/docs/html/search/all_70.js +++ b/docs/html/search/all_70.js @@ -1,8 +1,8 @@ var searchData= [ - ['parse_5frequest_5fheaders',['parse_request_headers',['../process_8c.html#a11d5f846bbce945bb9e16217562b7ae1',1,'process.c']]], + ['parse_5frequest_5fheaders',['parse_request_headers',['../process_8c.html#a558849ee895bb109213ead0c4b4913fa',1,'process.c']]], ['port',['PORT',['../bonsai_8c.html#a78dc8eaa9905715367e9beb76bf4b5f7',1,'bonsai.c']]], - ['print_5frequest_5fheaders',['print_request_headers',['../process_8c.html#a867b52a63f0badb64771b4406801849e',1,'process.c']]], + ['print_5frequest_5fheaders',['print_request_headers',['../process_8c.html#a14306b901ebaa2b9b83f7b0e43fd6bb7',1,'process.c']]], ['process_2ec',['process.c',['../process_8c.html',1,'']]], ['process_2eh',['process.h',['../process_8h.html',1,'']]], ['process_5frequest',['process_request',['../process_8c.html#a2de6a564e073d4c4d7d50d37814765e4',1,'process_request(int connection, FILE *request): process.c'],['../process_8h.html#a2de6a564e073d4c4d7d50d37814765e4',1,'process_request(int connection, FILE *request): process.c']]] diff --git a/docs/html/search/all_72.js b/docs/html/search/all_72.js index 1ca75de..b163d6f 100644 --- a/docs/html/search/all_72.js +++ b/docs/html/search/all_72.js @@ -1,5 +1,6 @@ var searchData= [ ['readme_2emd',['README.md',['../_r_e_a_d_m_e_8md.html',1,'']]], - ['remove_5fnewline',['remove_newline',['../misc_8c.html#a13492161f13dec20e31a2bab7f5a5f08',1,'remove_newline(char *string): misc.c'],['../misc_8h.html#a13492161f13dec20e31a2bab7f5a5f08',1,'remove_newline(char *string): misc.c']]] + ['remove_5fnewline',['remove_newline',['../misc_8c.html#a13492161f13dec20e31a2bab7f5a5f08',1,'remove_newline(char *string): misc.c'],['../misc_8h.html#a13492161f13dec20e31a2bab7f5a5f08',1,'remove_newline(char *string): misc.c']]], + ['request_5ftype_5fand_5ffile',['request_type_and_file',['../process_8c.html#a77ab76838caf713b3a306062589a5fff',1,'process.c']]] ]; diff --git a/docs/html/search/all_73.js b/docs/html/search/all_73.js index 6176bd4..7d18412 100644 --- a/docs/html/search/all_73.js +++ b/docs/html/search/all_73.js @@ -1,4 +1,5 @@ var searchData= [ - ['send_5fheaders',['send_headers',['../process_8c.html#aa39a7e6bef8074f6b3a74d07aad0c167',1,'process.c']]] + ['send_5ffile',['send_file',['../process_8c.html#a9b2a5a3d5b5b94d03e6165fdff90ed43',1,'process.c']]], + ['send_5fheaders',['send_headers',['../process_8c.html#ad856c01448ccc88465a4468569243252',1,'process.c']]] ]; diff --git a/docs/html/search/files_6d.js b/docs/html/search/files_6d.js index 3dc9ed3..cc30c42 100644 --- a/docs/html/search/files_6d.js +++ b/docs/html/search/files_6d.js @@ -1,5 +1,7 @@ var searchData= [ + ['mime_2ec',['mime.c',['../mime_8c.html',1,'']]], + ['mime_2eh',['mime.h',['../mime_8h.html',1,'']]], ['misc_2ec',['misc.c',['../misc_8c.html',1,'']]], ['misc_2eh',['misc.h',['../misc_8h.html',1,'']]] ]; diff --git a/docs/html/search/functions_70.js b/docs/html/search/functions_70.js index 40b735c..c87ec05 100644 --- a/docs/html/search/functions_70.js +++ b/docs/html/search/functions_70.js @@ -1,6 +1,6 @@ var searchData= [ - ['parse_5frequest_5fheaders',['parse_request_headers',['../process_8c.html#a11d5f846bbce945bb9e16217562b7ae1',1,'process.c']]], - ['print_5frequest_5fheaders',['print_request_headers',['../process_8c.html#a867b52a63f0badb64771b4406801849e',1,'process.c']]], + ['parse_5frequest_5fheaders',['parse_request_headers',['../process_8c.html#a558849ee895bb109213ead0c4b4913fa',1,'process.c']]], + ['print_5frequest_5fheaders',['print_request_headers',['../process_8c.html#a14306b901ebaa2b9b83f7b0e43fd6bb7',1,'process.c']]], ['process_5frequest',['process_request',['../process_8c.html#a2de6a564e073d4c4d7d50d37814765e4',1,'process_request(int connection, FILE *request): process.c'],['../process_8h.html#a2de6a564e073d4c4d7d50d37814765e4',1,'process_request(int connection, FILE *request): process.c']]] ]; diff --git a/docs/html/search/functions_72.js b/docs/html/search/functions_72.js index 574f19e..1785607 100644 --- a/docs/html/search/functions_72.js +++ b/docs/html/search/functions_72.js @@ -1,4 +1,5 @@ var searchData= [ - ['remove_5fnewline',['remove_newline',['../misc_8c.html#a13492161f13dec20e31a2bab7f5a5f08',1,'remove_newline(char *string): misc.c'],['../misc_8h.html#a13492161f13dec20e31a2bab7f5a5f08',1,'remove_newline(char *string): misc.c']]] + ['remove_5fnewline',['remove_newline',['../misc_8c.html#a13492161f13dec20e31a2bab7f5a5f08',1,'remove_newline(char *string): misc.c'],['../misc_8h.html#a13492161f13dec20e31a2bab7f5a5f08',1,'remove_newline(char *string): misc.c']]], + ['request_5ftype_5fand_5ffile',['request_type_and_file',['../process_8c.html#a77ab76838caf713b3a306062589a5fff',1,'process.c']]] ]; diff --git a/docs/html/search/functions_73.js b/docs/html/search/functions_73.js index 6176bd4..7d18412 100644 --- a/docs/html/search/functions_73.js +++ b/docs/html/search/functions_73.js @@ -1,4 +1,5 @@ var searchData= [ - ['send_5fheaders',['send_headers',['../process_8c.html#aa39a7e6bef8074f6b3a74d07aad0c167',1,'process.c']]] + ['send_5ffile',['send_file',['../process_8c.html#a9b2a5a3d5b5b94d03e6165fdff90ed43',1,'process.c']]], + ['send_5fheaders',['send_headers',['../process_8c.html#ad856c01448ccc88465a4468569243252',1,'process.c']]] ]; diff --git a/docs/html/search/search.js b/docs/html/search/search.js index 7094cc0..c6211af 100644 --- a/docs/html/search/search.js +++ b/docs/html/search/search.js @@ -7,11 +7,12 @@ var indexSectionsWithContent = { - 0: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000101101100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + 0: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000110000101101100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 1: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000100101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - 2: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100101100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + 2: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000100101100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 3: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000101100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - 4: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + 4: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + 5: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" }; var indexSectionNames = @@ -20,7 +21,8 @@ var indexSectionNames = 1: "files", 2: "functions", 3: "variables", - 4: "pages" + 4: "defines", + 5: "pages" }; function convertToId(search) diff --git a/process.c b/process.c index 3e57bbf..b8cc2a5 100644 --- a/process.c +++ b/process.c @@ -138,11 +138,13 @@ void send_file(int connection, char file_name[501]) { * @param headers Header array obtained from parse_request_headers() */ void print_request_headers(char headers[MAX_HEADERS][HEADER_SIZE]) { - for (int i = 0; i < sizeof(headers) / sizeof(*headers); i++) { + for (int i = 0; i < MAX_HEADERS; i++) { if (strcmp(headers[i], "") != 0) { printf("%s\n", headers[i]); } } + + printf("\n"); } /** @@ -159,6 +161,7 @@ void process_request(int connection, FILE *request) { char file_requested[501]; request_type_and_file(request_type, file_requested, request_headers[0]); printf("%s %s\n", request_type, file_requested); + print_request_headers(request_headers); memset(output, 0, sizeof(output));