Well, I ignored the exception & still nothing comes back while trying to tunnel through a private proxy.
What kind of proxy are you using, exactly? Is it an HTTP proxy, a SOCKS proxy, something else, etc? The
ProxyParams feature only works with HTTP proxies. If you need to support other kinds of proxies, you have to use the
IOHandler's
TransparentProxy feature instead.
It seems to only work when I turn off the proxy configurations. I'd like to keep this as an option while connecting to any websites. Any idea why I'm not able to connect through this private proxy?
Not without more detailed information. The
ProxyParams feature has been available for a VERY LONG time, so I know it works under normal conditions.
Can you provide a capture of the raw socket traffic and the HTTP traffic?
BTW, I know that this private proxy is working because I've made the configurations on my pc which shows that I am indeed able to connect to Google, YouTube, this forum, etc..
That doesn't negate the possibility that the proxy may be something that is unsupported by the
ProxyParams feature. There are many different kinds of proxies. I need more details to diagnose the issue.
The problem has got to be with Indy or the way that I've written the code, just not sure exactly how it's supposed to be implemented.
The code shown is fine, provided the proxy is a standard HTTP proxy.
I still keep getting the "connection closed gracefully" while trying to use the private proxy.
Without seeing the HTTP/socket traffic, there is no way to diagnose that.
I turn it off & then nothing comes back at all.
Then that is a completely different issue.
How would I "analyze the traffic to see what is really happening"? You mean using a program like wireshark or fiddler?
Yes, if the problem turns out to be at the socket/proxy level. If the problem is at the HTTP level, you can capture the HTTP requests/responses by assigning one of Indy's
TIdLog... components to the
TIdHTTP.Intercept property.
If so, what exactly am I looking for?
At what point exactly the socket closure is actually occurring in relation to the rest of the traffic. For instance, is the socket closure intentional at the HTTP level (ie, there is a
Connection: close response header and no
Connect-Length or
Transfer-Encoding header)? Or, is it happening without any HTTP response being sent at all? etc. Maybe the proxy doesn't like the request and is forcing the connection closed. OR maybe there is a firewall blocking the connection. There is just not enough information yet to know what is really going on.
Even when I find it, what changes would most likely need to be made to the code I'm using above?
I can't answer that without first identifying what the root cause actually is.
I've use plenty of programming languages in the past such as Python, PHP, Visual Basic, Javascript, etc., & have never had such difficulty trying to use any library with proxies. I'm not sure why it's so difficult to do in Pascal. It's usually just plug n play in all other languages & libraries. I'm not trying to be rude, I'm just being honest that I've never had this much difficulty to do something that is usually very easy to accomplish in other languages.
Are you really complaining about Pascal in general, or just about Indy specifically?
Those other languages you mention are more higher-level, whereas Pascal in general is more lower-level. High-level languages are designed for simplicity, so they tend to provide more wrappers and less complexity. Pascal tends to be more flexible, and sometimes that means you need to piece multiple isolated components together to get the same tasks done.