The SSL Proxy

You will make a proxy web server. It will take an https request from the browswer and decode it. Then it will make an https request to the server, and forward the answer to the client. If your proxy is working correctly, it will print a list of every https request to stdout. You do not need to handle http requests. That's not your concern. Also, be careful to only set your browser to a https proxy, and don't mess with http proxying (unless you want to). It is unavoidable to get certificate warnings on the browser. Oh well. You can use my cert if you want.
Rewrite endpoint (use gethostbyname() or something else).
Get rid of all global variables.
Parse the hostname and URL of the request
Fetch the data
Send the data to the browser
Rewrite the header to include your Via information.
  1/2 if you just insert a 'via' line.
  1.0 if you insert or rewrite a via as needed.
Do all this for multiple requests.
Get your own certificate.
(3 points) Convert the SSL code to an object with methods like
  sslRead
  sslWrite
  sslInit
  sslConnect
  sslAccept
Init the ssl library
Load the certificate
Make a socket!!!
Wait for a connection
Connect to the right server
Due: Thursday Nov 6th at 4pm.
You get one point for each item above. This is out of 16 points.
Hints:
You can see if your server is connecting to the web server by looking at the web logs from the server. On Euclid, that would be
tail -f /var/log/apache2/access.log
tail -f /var/log/apache2/error.log

You cannot read() or write() to an SSL connection. Instead you must use SSL_read() and SSL_write().

When compiling, you must use the -lssl flag.
g++ fred.cc -lssl -o fred