Written in Java
How the proxy works:
-
Server starts up either with a specified port, or will default to port 8000.
-
Server listens for incoming connections at that specified port.
-
Server accepts a incoming connection.
-
Server reads the request from the user and extracts the destination URL and modifies the HTTP request.
-
Once the HTTP request has been modified, the request is relayed in byteform to the destination.
-
Once the destination receives the request, the destination opens a connection with the proxy server to transmit back the requested data.
-
Following that, the proxy server relays it back to the client.
Repeat 1-7 for every new connection.
To initialize with a special port, java -jar HttpProxy.jar [PORT NUMBER]