Skip to content

mbap/basicHTTPproxy

Repository files navigation

Code Authors: Michael Baptist 
Lab Section : Monday 12 - 2 

Compile: .c -> .o -> binexec

1.	generate .o file : gcc -g -O0 -Wall -Wextra -std=gnu99 -c [.c file]
2.	generate bin exec: gcc -g -O0 -Wall -Wextra -std=gnu99 -o [exec] [.o file]

Alternativly use my Makefile.
1. make all 
      -- compiles the source.

2. make clean
      -- remove all .o files

3. make wipe
      -- remove all .o and binexec

Runtime: Run on any linux or mac osx machine. 

1. proxy_server.c
NAME
     proxy_server -- creates a communication path between a client
                     and a server using TCP.

SYNOPSIS
     proxy_server [Port]

DESCRIPTION  
     This program accepts the port number as it's arguments,
     and while running, if contacted by a client, it contacts 
     the server by forwarding the clients http request. It then
     attempts to recieve the request data from the server and 
     relay it back to the clients browser.

OPERANDS
     The only operand is a valid unused port number. If no port 
     number is input to the program, the program will exit with
     an error.

EXIT STATUS

     0    No errors were detected.
     1    One or more errors were detected and error messages were
          printed.
 errno    If a man page call detects an error, perror prints a sys
          message and exits with return value of errno.


2. utils.c and utils.h
  -- basic library for printing debug statements
  -- error handling for read and write system calls.
  -- writes chunks of files and returns file size
  -- searches for files in a directory.

3. Makefile
   all:
       - compiles all included code.
       - gives a binexec for server and client

   clean:
       - removes all .o files

   wipe:
       - removes all .o files as well as all binexec files

4. http_parser.c/h
  -- basic lib for parsing http headers.
  -- can parse header into lines, and those lines into tokens.

5. http_response.c/h
  -- basic lib for generating http responses.
  -- currently only supports 403 and 501 and 500.

6. log.c/h
  -- basic lib for logging http requests to a file
  -- currently comment out in my code due to poor implmentation
  -- has some segfaults

7. siteblock.c/h
  -- utility that checks if a webpage is allowed by the proxy based on the file
     parental_controls.log

8. parental_controls.log
  -- log file to store the allowed web pages.

9. proxy-app_protocol-mbaptist.pdf
    -- short document describing my app layer protocol and how the client
       and server talk.

10. proxyCodeDocs.pdf
  -- pdf with detailed description of code functions and variables 
     generated by doxygen. includes file list of program.
  -- The docs currently only contain the .h file or public methods.
   

11. Github.
 -- All versions of code and interations of builds can be found at:
    https://github.com/mbaptist23/basicHTTPproxy


About

Basic HTTP proxy written in C.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published