Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

InternetConnect() using proxy

635 views
Skip to first unread message

Ruggero Rossi

unread,
Dec 20, 1999, 3:00:00 AM12/20/99
to
Hallo,
excuse my poor english, I'm italian.
I've been trying to use winiet api using a proxy connection to Internet
(Microsoft Proxy Server 2.0).
For HTTP session there is no problem, it all works fine, but for FTP
session the return value of InternetConnect is 12007: "The server name
could not be resolved".
I suppose the problem lies in the parameters i give to the function
InternetConnect.

The code follows:
hInternet=InternetOpen("MyWebBrowser", INTERNET_OPEN_TYPE_PRECONFIG,
NULL, NULL, 0);
hConnect=InternetConnect(hInternet,"ftp.someFtpSite.it",
INTERNET_INVALID_PORT_NUMBER, "userName",
"password",INTERNET_SERVICE_FTP,0,0);

I also tried to give the two functions other parameters, not using
Wininet proxy autodetection:
hInternet=InternetOpen("MyWebBrowser",INTERNET_OPEN_TYPE_PROXY,"sistedit:80",NULL,0);

hConnect=InternetConnect(hInternet,"ftp.SomeFtpSite.it",INTERNET_DEFAULT_FTP_PORT,"userName","password",INTERNET_SERVICE_FTP,0,0);

I also use the suggested syntax for the proxy server name, like this:
ftp=ftp://sistedit:80.

Any suggestions?

Ruggero Rossi


Nicholas Paldino

unread,
Dec 22, 1999, 3:00:00 AM12/22/99
to
Ruggero,

Is your proxy set up to allow FTP connections? From your code, it looks
like you are using an HTTP proxy, which will only intercept HTTP
connections, and not FTP connections (I base this on the fact that your
proxy is running on port 80).

--
- Nicholas Paldino
- nicholas...@exisconsulting.com
- casp...@caspershouse.com

tdh...@my-deja.com

unread,
Dec 23, 1999, 3:00:00 AM12/23/99
to
Hi Ruggero,

As far as I know, wininet FTP functions do not work properly behind
a proxy connection. I discovered a way to handle FTP requests behind a
proxy, but I was using MFC CInternetSession, CHttpConnection classes,
which are simply a wrapper over the wininet functions. But the idea is
to make a dummy HTTP request to the internet behind a proxy before
making a FTP request.

1. Make a CInternetSession (ie. InternetConnect() in wininet)
2. Make a CHttpConnection and CHttpFile (ie HttpOpenRequest() in
wininet)
3. Now do a CHttpFile::SendRequest (ie HttpSendRequest() in wininet)
4. Get the status code using CHttpFile::QueryInfoStatusCode (ie
HttpQueryInfo() in wininet)
5. Handle all the proxy username and password requests.
6. Now do a CInternetSession::OpenUrl() (ie. InternetOpenUrl() in
wininet).
7. Alse specify the passive tag in the InternetOpenUrl function.

This should get u there.

tdh_13
(Tom_Dickn_Harry)


In article <385E4E48...@libero.it>,


Sent via Deja.com http://www.deja.com/
Before you buy.

Brad Bruce

unread,
Dec 23, 1999, 3:00:00 AM12/23/99
to
The work-arounds suggested by Microsoft enable you to GET data only.
This is either by FTP or HTTP. They DO NOT make a firewall friendly FTP.
I ended up writing my own FTP client (special purpose requirements, No UI)
to get around the few firewall types my customers ran into.

Look on www.codeguru.com for some examples

Brad

tdh...@my-deja.com wrote in message <83s7e3$on9$1...@nnrp1.deja.com>...

0 new messages