You are seeing a DEBUGGER message. The debugger sees all exceptions before your app's code does. TIdHTTP should catch that exception internally, it should not be escaping into your normal code at runtime. If you don't want to see the exception in the debugger, you can configure the debugger to ignore it.
Right, but how do I get the HTML from the IdHTTP into memo1?
Why would there be any "connection closed gracefully" in the first place if my code was written correctly?
Your issue is a bit vague. Most simply answer would be: ignore the exception, and it probably should appear in Memo1.Lines .
Right, but how do I get the HTML from the IdHTTP into memo1?
What you already have is fine for that. However, TIdHTTP.Get() has overloads which return a String, you don't need the Response stream, eg:
Memo1.Text := IdHTTP.Get(URL);
Because HTTP allows for that. EIdConnClosedGracefully happens when Indy tries to read more data from the socket after the peer has closed the connection. For HTTP, that means the server has either closed the connection prematurely before it has sent the end of the response, or the server is using a socket closure as the end-of-response indicator rather than using the Content-Length or Transfer-Encoding response headers. You would have to analyze the traffic to see what is really happening.
Well, I ignored the exception & still nothing comes back while trying to tunnel through a private proxy.
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?
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..
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.
I still keep getting the "connection closed gracefully" while trying to use the private proxy.
I turn it off & then nothing comes back at all.
How would I "analyze the traffic to see what is really happening"? You mean using a program like wireshark or fiddler?
If so, what exactly am I looking for?
Even when I find it, what changes would most likely need to be made to the code I'm using above?
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.
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.- Gambit
The private proxy I ordered is in IPV4 format which requires username & password authentication. It supports both SOCKS5 and HTTP protocols depending on the port at which I try to access it. I've tried both ports to no avail.
Here's what I've come up with from WireShark as far as the TCP Stream goes while trying to connect through the private proxy:
Here's what I've come up with from WireShark as far as the TCP Stream goes while trying to connect through the private proxy:
That does not look right. After the 407 reply, TIdHTTP should have send another CONNECT request with the Proxy-Authorization header added to it. It should not be sending the GET request (without the Proxy-Authorization header) until after CONNECT has returned a 200 reply first. I will have to dig into the code to see what's happening.