Article ID: 232194 - Last Review: August 7, 2007 - Revision: 1.2 FIX: ITC OpenUrl Method Does Not Return Complete FilesThis article was previously published under Q232194 SYMPTOMS
When you use the OpenUrl method of Microsoft Internet Transfer Control (ITC) to download files from Web servers, the resulting files may not be complete if the
server uses "chunked" transfer-encoding to send the HTTP response data. The chunked method is used by Internet Information Server (IIS) to optimize the sending of dynamically generated content, such as that sent by Active Server Pages (ASP).
CAUSE
ITC allocates a buffer of 64K bytes and calls InternetReadFile in a loop. Whenever the buffer containing the read data is not full after the API returns, ITC will exit the loop. However, InternetReadFile can return when less than the total number of bytes requested were read into the buffer, which causes the problem. This is the case if the transfer-encoding is chunked.
RESOLUTION
A way to work around this problem is to call the WinInet APIs directly in Visual Basic, as described in the following two steps:
STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article. This bug was corrected in the next service pack for Visual Studio 6.0. For additional information about Visual Studio service packs, click the following article numbers to view the articles in the Microsoft Knowledge Base: 194022
(http://support.microsoft.com/kb/194022/EN-US/
)
INFO: Visual Studio 6.0 Service Packs, What, Where, Why To download the latest Visual Studio service pack, visit the following Microsoft Web site:194295 (http://support.microsoft.com/kb/194295/EN-US/ ) HOWTO: Tell That a Visual Studio Service Pack Is Installed http://msdn2.microsoft.com/en-us/vstudio/Aa718353.aspx
(http://msdn2.microsoft.com/en-us/vstudio/Aa718353.aspx)
REFERENCES
For an example of how to call the WinInet APIs directly from Visual Basic, please see the following article in the Microsoft Knowledge Base:
175179
(http://support.microsoft.com/kb/175179/EN-US/
)
FILE: VBFTP.EXE: Implementing FTP Using WinInet API from VB
| Article Translations
|

Back to the top
