大网数据广告活动
网络与域名解析

File Transfer Consistency

· 52CE 我爱测

BITS guarantees that the version of the file it transfers is consistent based on the file size and time stamp, not content (BITS does not protect against man-in-the-middle attacks).

BITS guarantees that the version of the file it transfers is consistent based on the file size and time stamp, not content (BITS does not protect against man-in-the-middle attacks). To verify the contents yourself, you can use the IBackgroundCopyFile3::GetTemporaryName method to get the name of the file that contains the downloaded content, verify the contents using your own mechanism, and then call the IBackgroundCopyFile3::SetValidationState method to indicate to BITS if the contents of the file is valid. If you set the validation state to FALSE and the content is from the origin server, the job goes into the error state. If the content is from a peer, BITS downloads the file from the origin server.

For downloads, if the file size or time stamp changes while BITS is transferring the file, BITS restarts the transfer of that file only. For example, if the download job contains two files and the files are updated on the server while BITS is transferring the second file, BITS restarts the transfer of the second file only. The first file, which already transferred successfully, is not updated to reflect the new changes.

Note that if you own the file being downloaded from the server, you should create a new URL for each new version of the file. If you use the same URL for new versions of the file, some proxy servers may serve stale data from their cache because they do not verify with the original server if the file is stale.

For uploads, if the file size or time stamp changes during the file transfer, BITS generates an error and the job is placed in the BG_JOB_STATE_ERROR state.

BITS does not synchronize transfer requests when one or more users request that the same file be transferred to the same location. BITS transfers the file for each request separately.

Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Win32 documentation
适用范围
Windows Win32 API · Source date 05/31/2018
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。