websever.c
/*
 * This function looks at method used and calls the appropriate handler function.
 * Since we only implement GET and POST methods, it calls handle_unimplemented_method()
 * in case both these don't match. This sends an error to the client.
 * */
This function looks at method used and calls the appropriate handler function.
Since we only implement GET and POST methods, it calls handle_unimplemented_method()
in case both these don't match. This sends an error to the client.
This function looks at method used and calls the appropriate handler function . Since we only implement GET and POST methods it calls handle_unimplemented_method () in case both these don ' t match . This sends an error to the client .
void handle_http_method(char *method_buffer, int client_socket, int epoll_fd) {
    char *method, *path, *saveptr;
    method = strtok_r(method_buffer, " ", &saveptr);
    strtolower(method);
    path = strtok_r(NULL, " ", &saveptr);
    if (strcmp(method, "get") == 0) {
        handle_get_method(path, client_socket, epoll_fd);
    } else {
        handle_unimplemented_method(client_socket, epoll_fd);
    }
}
void handle_http_method ( char * method_buffer , int client_socket , int epoll_fd ) { char * method , * path , * saveptr ; method = strtok_r ( method_buffer , " " , & saveptr ) ; strtolower ( method ) ; path = strtok_r ( NULL , " " , & saveptr ) ; if ( strcmp ( method , " " ) == 0 ) { handle_get_method ( path , client_socket , epoll_fd ) ; } else { handle_unimplemented_method ( client_socket , epoll_fd ) ; } }
This function looks at method used and calls the appropriate handler function.
This function looks at method used and calls the appropriate handler function .