I realize that you can use a Socks5 proxy with WebProxy. That being said, what I am trying to do is this:
Open Up TCPListener -> Create request with HttpWebRequest that sends request to TCPListener using HttpWebRequest.Proxy -> Use either the NetworkStream or Socket from TCPListener to then forward the request through socket connected to a remote Socks5 proxy -> Return the response all the way back up the chain.
I am using Socket.Receive(); to read the bytes from the socket I accept with TCPClient then write them to a socket I've connected to the Socks5 proxy server with. This works great when my requests are just plain HTTP requests. I seem to be having problems requesting SSL pages. They aren't returning responses. Is there something I am missing or maybe even an easier way to do this? At this p开发者_运维技巧oint I might even consider a library for sending Http Requests with a socks5 proxy.
You're actually doing a man-in-the-middle-attack. HttpWebRequest fails to verify your SSL certificate check and won't accept the connection (aka it knows something fishy is going on).
You can try this to work around the SSL-checks if you really need this working (and understand the consequences)
精彩评论