Git Product home page Git Product logo

proxy-server's Introduction

Proxy Server

Description

Implementation Details

proxy.c contains:

  • The main function which:

    1. Opens a listening desctiotor for requesting clients requests.
    2. Initializes the cache.
    3. Accepts a connection with each client.
    4. Creates a peer thread for each client.
  • The thread function which:

    1. Detaches itself from the main thread.
    2. Reads client request and headers.
    3. If it's a valid request, it searches in the cache for the request, if present it sends it directly to the client
    4. If not present, then it parses the request.
    5. and opens a connection with the server the client requested.
    6. and serves the client, then forwards it content to it.
    7. lastly, it caches this request if it comes in the future.

How to test it?

  1. Compile and run
git clone https://github.com/Alighorab/Proxy-Server/
cd Proxy-Server/
make
./proxy <port> (e.g., 4000)
  1. Connect to proxy
  • Using TELNET:
telnet localhost <port>
  • Or adjust your browser to content to proxy and content to http sites.
  • NOTE: use these sites and what is similar to them only:
http://www.example.com/
http://go.com/
http://www.washington.edu/
http://www.internic.com/
http://eu.httpbin.org/
http://neverssl.com/
http://info.cern.ch/
http://www.softwareqatest.com/
http://www.vulnweb.com/
  1. Use driver.sh
    • driver.sh tests proxy using tiny
pushd .. &> /dev/null
git clone https://github.com/Alighorab/Tiny-Web-Server/
mv Tiny-Web-Server/ Proxy-Server/tiny/
popd &> /dev/null
./driver.sh
  1. Use sdriver.sh
    • sdriver.sh tests proxy using the above sites
./sdriver.sh

Poject Files

├── cache
│  ├── cache.{c,h}: cache implementation.
│  ├── mm.{c,h}: dynaminc memory allocator to manage proxy cache.
│  └── memlib.{c,h}: a library for the allocator.
├── rio
│  └── rio.{c,h}: robust I/O package.
├── sock_interface
│  └── sock_interface.{c,h}: socket interface package.
├── proxy.c: proxy implementation.
├── Makefile
├── proxylab.pdf: proxy writeup.
├── driver.sh: The autograder for Basic, Concurrency, and Cache using tiny
├── nop-server.py: helper for the autograder.         
└── sdriver.sh: The autograder for Basic, Concurrency, and Cache using http sites

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.