InternetOpenUrl and retrieving protocol FTP data-size

  • Follow


Hello All,

  I'm currently diving into the InternetOpenUrl command and was wondering if
I could

1) ask it the protocol (HTTP, FTP, GOPHER) it has just accepted (so I can
use the apropriate commands to each protocol (for instance : not trying to
retrieve HTTP headers on a non-HTTP connection)

2) Retrieve the file-size when the protocol is not HTTP (I tried FTP, but
would like to be able to do the same for the other protocols).   I've tried
the HTTP_QUERY_CONTENT_LENGTH method as well as FtpGetFileSize, but both
return an error.

Regards,
  Rudy Wieser



0
Reply address7 (52) 12/20/2009 7:58:13 PM

On 20/12/2009 19:58, R.Wieser wrote:
> Hello All,
>
>    I'm currently diving into the InternetOpenUrl command and was wondering if
> I could
>
> 1) ask it the protocol (HTTP, FTP, GOPHER) it has just accepted (so I can
> use the apropriate commands to each protocol (for instance : not trying to
> retrieve HTTP headers on a non-HTTP connection)

You can use InternetCrackURL to get the scheme of the URL you just 
passed in.

-- 
Dee Earley (dee.earley@icode.co.uk)
i-Catcher Development Team

iCode Systems
0
Reply Dee 12/21/2009 10:17:00 AM


Hello Dee,

> You can use InternetCrackURL to get the scheme of the
> URL you just passed in.

I know, its what I have done previously.  I can even simplify that by doing
just text-compare with "HTTP://", "FTP://" or  "GOPHER://".

But that means I would be attempting to mimic a test in another command,
something that is quite hard to when you have no information about how that
other test actually works (which input it accepts : are those three the
*only* things I have to check for ?).

Thats why I was looking for a way to let the command itself tell me its
test-result/accepted protocol.   I can assume that when a HTTP-headers
related command fails the returned data is non-HTTP, but that is than not
even certain either ...

Regards,
  Rudy Wieser


-- Origional message:
Dee Earley <dee.earley@icode.co.uk> schreef in berichtnieuws
4b2f452e$0$348$7b0f0fd3@reader.news.newnet.co.uk...
> On 20/12/2009 19:58, R.Wieser wrote:
> > Hello All,
> >
> >    I'm currently diving into the InternetOpenUrl command and was
wondering if
> > I could
> >
> > 1) ask it the protocol (HTTP, FTP, GOPHER) it has just accepted (so I
can
> > use the apropriate commands to each protocol (for instance : not trying
to
> > retrieve HTTP headers on a non-HTTP connection)
>
> You can use InternetCrackURL to get the scheme of the URL you just
> passed in.
>
> --
> Dee Earley (dee.earley@icode.co.uk)
> i-Catcher Development Team
>
> iCode Systems


0
Reply R 12/21/2009 12:33:11 PM

Hello All,

  I recently asked the question if I could find out which protocol the the
InternetOpenUrl command just did accept so I could the apropriate actions
belonging to that protocol (mainly retrieving file-size upfront so I can
create progress-bar).

This has become even more important as the info from MS itself
 http://msdn.microsoft.com/en-us/library/aa385098(VS.85).aspx ) is
unreliable : it specifies at the top that only the HTTP, HTTPS and FTP
protocols are accepted, but somewhere down it allso mentions the GOPHER
protocol.

It allso mentions Windows 2000 Professional and Windows 2000 Server as the
minimal requirements for the client and server respectivily, when the
function has-and-stilll works allright on a Win98se OS.

Apart from that I discovered from simply trying that apart from the
above-mentioned protocols it allso accepts the FILE protocol, and who knows
which other ones.

So, I would be gratefull for any info about how to retrieve such
information.

Regards,
  Rudy Wieser

P.s.
Any info about retrieving the file-sizes for any of the accepted protocols
would be welcome too (except for HTTP, that seems to work) .


-- Origional question:
R.Wieser <address@not.available> schreef in berichtnieuws
4b2e811a$0$4492$e4fe514c@dreader19.news.xs4all.nl...
> Hello All,
>
>   I'm currently diving into the InternetOpenUrl command and was
> wondering if I could
>
> 1) ask it the protocol (HTTP, FTP, GOPHER) it has just accepted
> (so I can use the apropriate commands to each protocol (for instance :
> not trying to retrieve HTTP headers on a non-HTTP connection)
>
> 2) Retrieve the file-size when the protocol is not HTTP (I tried FTP,
> but would like to be able to do the same for the other protocols).
> I've tried the HTTP_QUERY_CONTENT_LENGTH method as
> well as FtpGetFileSize, but both return an error.
>
> Regards,
>   Rudy Wieser



0
Reply R 12/22/2009 7:55:12 PM

Hi,

> ...
> This has become even more important as the info from MS itself
>  http://msdn.microsoft.com/en-us/library/aa385098(VS.85).aspx ) is
> unreliable : it specifies at the top that only the HTTP, HTTPS and FTP
> protocols are accepted, but somewhere down it allso mentions the GOPHER
> protocol.
> 
> It allso mentions Windows 2000 Professional and Windows 2000 Server as the
> minimal requirements for the client and server respectivily, when the
> function has-and-stilll works allright on a Win98se OS.

In the requirements section table of this link is a row "Version: IE 3.0 or
later". Afaik wininet.dll is updated with the IE.

> Apart from that I discovered from simply trying that apart from the
> above-mentioned protocols it allso accepts the FILE protocol, and who knows
> which other ones.

Interesting.

> P.s.
> Any info about retrieving the file-sizes for any of the accepted protocols
> would be welcome too (except for HTTP, that seems to work) .
> 

I can help with FTP only:
FtpGetFileSize (min. IE 5.0)
http://msdn.microsoft.com/en-us/library/aa384159(VS.85).aspx
MS does not say what is returned on error; perhaps it is like GetFileSize?

Regards,
 Friedel
0
Reply Friedel 12/23/2009 8:41:46 AM

Hello Friedel,

> In the requirements section table of this link is a row
> "Version: IE 3.0 or later". Afaik wininet.dll is updated
> with the IE.

I overlooked that, but for me that makes it even worse : what am I to
believe ?  The "minimum supported client/server" or the IE version.  Due to
my experience (it works in Win98se) I must assume the latter, but what is
that "minimum supported" than doing there ?

> I can help with FTP only:
> FtpGetFileSize (min. IE 5.0)
> MS does not say what is returned on error; perhaps it is
> like GetFileSize?

I must apologize, I did try that (on ftp://ftp.FreeBSD.org ) and got an
error back. And yes, now you mention it its the same one as with the
"GetDFileSize" function.  I did not check the "GetLastError" result, as I
was quite convinced I should have gotten a size and I assumed I used the
function wrong.  I'll have to retry.

Thanks for the reply

Regards,
  Rudy Wieser

-- Origional message :
Friedel Jantzen <nospam_plz@freenet.de> schreef in berichtnieuws
14ldhjxv2v500$.v6ppagy95x9g$.dlg@40tude.net...
> Hi,
>
> > ...
> > This has become even more important as the info from MS itself
> >  http://msdn.microsoft.com/en-us/library/aa385098(VS.85).aspx ) is
> > unreliable : it specifies at the top that only the HTTP, HTTPS and FTP
> > protocols are accepted, but somewhere down it allso mentions the GOPHER
> > protocol.
> >
> > It allso mentions Windows 2000 Professional and Windows 2000 Server as
the
> > minimal requirements for the client and server respectivily, when the
> > function has-and-stilll works allright on a Win98se OS.
>
> In the requirements section table of this link is a row "Version: IE 3.0
or
> later". Afaik wininet.dll is updated with the IE.
>
> > Apart from that I discovered from simply trying that apart from the
> > above-mentioned protocols it allso accepts the FILE protocol, and who
knows
> > which other ones.
>
> Interesting.
>
> > P.s.
> > Any info about retrieving the file-sizes for any of the accepted
protocols
> > would be welcome too (except for HTTP, that seems to work) .
> >
>
> I can help with FTP only:
> FtpGetFileSize (min. IE 5.0)
> http://msdn.microsoft.com/en-us/library/aa384159(VS.85).aspx
> MS does not say what is returned on error; perhaps it is like GetFileSize?
>
> Regards,
>  Friedel


0
Reply R 12/23/2009 10:05:01 AM

Hi Rudy,

> 
>> In the requirements section table of this link is a row
>> "Version: IE 3.0 or later". Afaik wininet.dll is updated
>> with the IE.
> 
> I overlooked that, but for me that makes it even worse : what am I to
> believe ?  The "minimum supported client/server" or the IE version.  Due to
> my experience (it works in Win98se) I must assume the latter, but what is
> that "minimum supported" than doing there ?

I guess, since "min. supported" it is shipped as a part of the OS, too.

>> I can help with FTP only:
>> FtpGetFileSize (min. IE 5.0)
>> MS does not say what is returned on error; perhaps it is
>> like GetFileSize?
> 
> I must apologize, I did try that (on ftp://ftp.FreeBSD.org ) and got an
> error back. And yes, now you mention it its the same one as with the
> "GetDFileSize" function.  I did not check the "GetLastError" result, as I
> was quite convinced I should have gotten a size and I assumed I used the
> function wrong.  I'll have to retry.
 
Yes, the cause of the failure is important. As the doc is insufficient, we
only can try & error.

Another way to get the FTP filesize is
FtpFindFirstFile (min. IE 3.0)
http://msdn.microsoft.com/en-us/library/aa384146(VS.85).aspx

Regards,
 Friedel
0
Reply Friedel 12/24/2009 7:22:51 AM

6 Replies
255 Views

(page loaded in 0.078 seconds)

Similiar Articles:












7/12/2012 1:20:51 PM


Reply: