Skip to content

A simple caching HTTP-only webproxy supporting HTTP/1.1.

License

Notifications You must be signed in to change notification settings

djanderson/toyproxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

A simple caching HTTP-only webproxy supporting HTTP/1.1.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published