views:

590

answers:

3

Hi all,

How can i connect to a server through a http proxy server in delphi? What about SOCKS5 proxy?

Google doesn't have any suggestion!

+2  A: 

If you're using Indy (highly recommended), then try using a TIdConnectThroughHttpProxy object from the IdConnectThroughHttpProxy unit. It's a descendant of TIdIOHandler, so connect an instance of that class to your client object's IOHandler property. To connect through a Socks server instead, use TIdSocksInfo, in IdSocks.

If you're set on doing it manually, without the aid of a protocol library like Indy, then connect your TTcpClient object to the proxy server's address instead of the real destination, and then send your commands there. The proxy server knows where to send the request either because you issue a CONNECT command to it, or because you specify a full URL (instead of just the path portion) in the GET request. (The HTTP spec demonstrates the latter.) The response you'll get should be forwarded from the destination server, unless the proxy server has an error itself.

Rob Kennedy
A: 

Thanks, I see indy components, but i can't convert project to use them, project is already written.

Where can i find documents about proxy commands? Is there any existing project about this?

What you've posted here is not an answer to your question. Please either edit your question to contain new information, or add a comment to the answer you're following up about.
Rob Kennedy
Another option is to ask a completely separate question.
Rob Kennedy
A: 

I think you can do it using Indy. You may find information in the Indy in Depth ebook.

Hope this helps.

eKek0