Article View: borland.public.cppbuilder.internet.web
Article #449Re: downloading with wininet
From: Remy Lebeau (TeamB)
Date: Tue, 02 Jan 2007 09:27
Date: Tue, 02 Jan 2007 09:27
35 lines
2154 bytes
2154 bytes
"Boba" <Boba@somewhere.world> wrote in message
news:4599f9c5@newsgroups.borland.com...
> LPCSTR szAcceptTypes[] = { "*.*", NULL };
That is wrong. HttpOpenRequest() expects a media ContentType mask,
not a filename mask. At the verly least, you need to change *.*" to
"*/*", ie:
LPCSTR szAcceptTypes[] = { "*/*", NULL };
> hHttpRequest = HttpOpenRequest( hHttpSession, "GET",
szFileName,
> "HTTP/1.1", NULL,
szAcceptTypes,
> INTERNET_FLAG_RELOAD, 0 );
What exactly are you passing as the szFileName? It needs to be a URL
relative to the root of the server, not a local file path. Why are
you passing the server name separately from the filename in the first
place? You should use InternetCraskUrl() to convert a single full URL
string into the individual parts that InternetOpen(),
InternetConnect(), and HttpOpenRequest() are all expecting.
> do{
> if( InternetQueryDataAvailable( hHttpRequest,
&dwDataSize, 0, 0 ) ){
I suggest you use HttpQueryInfo() to retreive the size of the data
before then entering the loop. That way you know when to stop looping
properly.
Gambit
Technical Details
Message-ID:
<459a2c13$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<4599f9c5@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: feeec,66a46201c905b896 X-Google-Attributes: gidfeeec,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> Newsgroups: borland.public.cppbuilder.internet.web References: <4599f9c5@newsgroups.borland.com> Subject: Re: downloading with wininet Date: Tue, 2 Jan 2007 01:27:42 -0800 Lines: 37 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 NNTP-Posting-Host: 75.83.34.171 Message-ID: <459a2c13$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1167731731 75.83.34.171 (2 Jan 2007 01:55:31 -0800) Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail