Giter Site home page Giter Site logo

nds-lab1's Introduction

################################################################################
# README                                                                       #
#                                                                              #
# Description: This file serves as a README and documentation for Lab1         #
#                                                                              #
# Authors: Max Shatkhin <[email protected]>,                                  #
#          Joe Abi Sleiman <[email protected]>                                 #
#                                                                              #
################################################################################




[TOC-1] Table of Contents
--------------------------------------------------------------------------------

        [TOC-1] Table of Contents
        [DES-2] Description of Files
        [RUN-3] How to Run
        [FUN-4] Explanation of Functions
        [LIM-5] Limitation of Server




[DES-2] Description of Files
--------------------------------------------------------------------------------

Here is a listing of all files associated with Recitation 1 and what their'
purpose is:

                    .../README                  - Current document 
                    .../project-1/echo_client.c       - Simple echo network client
                    .../project-1/echo_server.c       - Simple echo network server
                    .../project-1/Makefile            - Contains rules for make
                    .../project-1/cp1_checker.py      - Python test script for CP1
                    .../project-1/parse.c             - State machine for reading in; HTTP parser main
                    .../project-1/parser.y            - yacc grammar for http parser
                    .../project-1/lexer.l             - lex grammar for extracting tokens for http parse
                    .../project-1/www/*               - endpoints used for testing http requests
                    .../project-1/test.txt            - overview of testing methods for server





[RUN-3] How to Run
--------------------------------------------------------------------------------

Building and executing the echo code should be very simple:

                    cd project-1
                    make
                    ./echo_server 9999 _ log.txt www
                    ./lisod 9999 _ log.txt www




[FUN-4] Explanation of Functions
--------------------------------------------------------------------------------
***
int close_socket(int sock);
Description: closes connection with a client socket
***
void handleDate(char *date);
Description: gets the current date and time and formats the input character buffer

***
void handlePOST(int fd);
Description: Implements the POST functionality and sends response to client.
             Side-effect is to append string to a file.

***
int handleGET(int fd, Request *request);
Description: Implements GET functionality and sends response to client

***
int handleHEAD(int fd, Request *request);
Description: Implements HEAD functionality and sends response to client

***
void writeLog(char *file_name, char *message);
Description: writes message to log file with appended timestamp

***
void getMimeType(char *http_uri, char *mimeType);
Description: gets the mime type passed in bby the http request

***
int sendError(int fd, int error_code, Request *request);
Description: sends error to client

***
parse(buf,readret,i);
Description: This function implements the HTTP parser. It leverages lex and yacc grammar
for parsing http requests.




[LIM-5] Limitations of Server
--------------------------------------------------------------------------------
- Our server only implements 3 kinds of HTTP requests at the moment: GET, HEAD, POST
- Error handling is also limited at the moment (404, 501, 505,...)
- The server should be able to echo to up to 1024 clients, however managing HTTP requests on this number
  of clients has not been tested.
- Pipelined requests should, in theory, be handled properly however there has not been extensive testing on this.
- The POST method has a very vanilla implementation currently, with no checks on the content of the body
  that gets passed in. The current side-effect is to simply append a string to a POSTlog file.

nds-lab1's People

Watchers

Max Shatkhin avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.