Git Product home page Git Product logo

http-proxy's Introduction

HTTP Proxy Server

Written in Python using the Socket API
The proxy will receive a GET request and communicate with the server. The proxy is able to receive files from the server, cache it, and forward it to the client. It handles 404 and 301 errors.

How to run

  1. Clone this repo

  2. Run the server with python3 server.py

  3. Establish a connection with a client with python3 proxy.py <Listen-Port>

  • Replace Listen-Port with for example 8080.
  1. Make a get request such as: http://​localhost:8080​/​www.columbia.edu/~ge2211/4119/test2/www.hats.com/

Implementation details

The IP address for my proxy is localhost and the port number I used was 8080.

To implement caching, I used the OS file system to store the received files. Each time I get a 200 or 301 response for the first time, I would retrieve this data before sending it back to the client and store it in the specified directory + file. In the case of a 301, I first requested the new location to get a 200 and stored this file in the cache. (For 404 I did not cache anything) When the client requests, I first check if the directory and file exists in my local file system and if it exists, without connecting to the server, I directly sent back this cached file.

http-proxy's People

Contributors

eureyuri avatar

Watchers

 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.