I made a program which allows me to connect to a remote website via socket/bind/connect. It establishes a socket connection and downloads the requested webpage.
Now I would love to actually go thru a proxy server first and have it download the webpage and return it back to me. So normally I have this happening:
And now I want this:
Y SERVER-->REMOTE SITE
This way the remote site sees the proxy server rather than me directly. How do I go about making a proxy server connection and then to the remote site from my Perl script. I have the ground work, as I said but I just can't figure out how the proxy server address fits into it.
Maybe I establish a connection not with the remote site but with the proxy server at port 8080. Then where I normally request for a certain webpage:
GET /index.html HTTP/1.0
I should place:
GET http://www.mysite.com HTTP/1.0
Now the proxy server will understand this GET statement and connect to the remote site. Is this correct thinking?
And another question. Does the Referer field always get passed by all Proxy servers or only some? It is an important header field that needs to get passed. And also, the remote site that is receiving the call, does it get the usual ENVironment variables like a normal call or does the Proxy Server insert additional fields (passing info like who I am and it is a proxy server that is calling). If it is passing additional fields can I somehow turn them off?
Thanks so much.