Our PPC (WinCE) MFC app is using CHHTPConnection and CHTTPFile to download a
file via HTTP. The problem is that if the file is larger than the device's
cache supports, MFC throws an error: Error: 12158:
ERROR_INTERNET_UNABLE_TO_CACHE_FILE.
Is there a way we can determine the file size of the file BEFORE we receive
this error?
Here is our current code.
NOTE: dwFlags=0. We can NOT use INTERNET_FLAG_DONT_CACHE as a flag since
WinCE does NOT allow this flag.
---------------------------------------------------------------------------------------------------------
file = connection->OpenRequest(1, strFile, NULL, 1, ppszAcceptTypes, NULL,
dwFlags);
file->AddRequestHeaders("");
file->SendRequest(); <============ This is where MFC throws the
exception
// Get file length & last modified date of file.
file->QueryInfo( HTTP_QUERY_CONTENT_LENGTH, dwLen, NULL ); <==== this is
where we would normally get the file size
---------------------------------------------------------------------------------------------------------
So my question is: What possible call(s) can we make to retrieve the file
size of the file so as to avoid the ERROR_INTERNET_UNABLE_TO_CACHE_FILE
error?
Remember:
1) This is WinCE using eVC++ 3.0
2) We can NOT use the INTERNET_FLAG_DONT_CACHE or the
INTERNET_FLAG_PRAGMA_NOCACHE flag.
My guess would be that we need to formulate some sort of request header
string, but I don't know what that would look like.
Can anyone provide any guidance?
Many thanks experts!