Giter Site home page Giter Site logo

toyproxy's Introduction

Toyproxy - Simple HTTP Web Proxy Travis CI Build Status

A simple caching HTTP-only webproxy supporting HTTP/1.1. This project was written for ECEN 5273 - Network Systems at the University of Colorado - Boulder. This is a toy project and shouldn't be used for anything serious, but was the first C project I ever wrote that got big enough to where I needed unit tests to keep from getting overwhelmed.

Quickstart

$ mkdir build
$ cd build
$ cmake ../
$ make && make test
$ ./src/toyproxy 10000  # start on port 10000

Use --debug flag to enable debug output.

Implementation and file layout

Toyproxy is a multithreaded HTTP proxy that implements a subset of HTTP/1.1. It includes a custom written url parser and hashmap caching implementation with unit tests. Request and response parsing is also unit tested. It implements multiple simultaneous requests, user-definable cache timeout, page and hostname caching, and URL and IP blacklisting.

Directories:

  • src - The toyproxy source files
  • vendor - Files for Unity, a small C unit testing framework
  • tests - Unit tests for several of the fundamental data structures and parsing routines

Implementation Files:

  • toyproxy.c - "Configuration" defines (CACHE_ROOT, BLACKLIST_FILE, KEEPALIVE_TIMEOUT, ...), main function, proxy main loop, socket connection handling, etc
  • url.h - Url struct and related functions header
  • url.c - Url struct and related functions implementation
  • hashmap.h - Hashmap struct and related functions header
  • hashmap.c - Hashmap struct and related functions implementation
  • request.h - Request struct and related functions header
  • request.c - Request struct and related functions implementation
  • response.h - Response struct and related functions header
  • response.c - Response struct and related functions implementation
  • printl.h - Printk-like logging function header
  • printl.c - Printk-like logging function implementation
  • queue.h - Thread-safe FIFO queue header (not currently used)
  • queue.c - Thread-safe FIFO queue implementation (not currently used)

Licence

Copyright 2018 Douglas Anderson [email protected]. Released under GPL 3.

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.