gpt4 book ai didi

delphi - TIdHTTPServer 是否与 Microsoft BITS 兼容

转载 作者:可可西里 更新时间:2023-11-01 15:10:23 26 4
gpt4 key购买 nike

我们正在尝试使用 TIdHTTPServer 组件为我们的软件编写一个更新服务器。目前我们正在提供一个 XML 文件,其中列出了可用更新及其文件版本等。当客户端程序找到更新版本时,它应该开始使用 BITS 下载它。

现在这是我们遇到问题的地方,我们的程序正在请求 XML 文件并看到有可用的更新。然后它创建一个 BITS 作业来下载它,但是 BITS 一直报告下载失败。我们可以使用相同的 URL 和 IE/Firefox/Chrome 下载文件。

所以我的问题:

TIdHTTPServer 是否与 BITS 兼容?

我问这个是因为我发现有这些下载要求才能工作。
HTTP Requirements for BITS Downloads

BITS supports HTTP and HTTPS downloads and uploads and requires that the server supports the HTTP/1.1 protocol. For downloads, the HTTP server's Head method must return the file size and its Get method must support the Content-Range and Content-Length headers. As a result, BITS only transfers static file content and generates an error if you try to transfer dynamic content, unless the ASP, ISAPI, or CGI script supports the Content-Range and Content-Length headers.

BITS can use an HTTP/1.0 server as long as it meets the Head and Get method requirements.

To support downloading ranges of a file, the server must support the following requirements:

Allow MIME headers to include the standard Content-Range and Content-Type headers, plus a maximum of 180 bytes of other headers.Allow a maximum of two CR/LFs between the HTTP headers and the first boundary string.

最佳答案

刚刚在 indy 中发现一个错误,该错误在使用范围请求时会阻止传输超过 2.1GB 的文件。

这里是

IdHTTPHeaderInfo.pas 大约第 770 行

procedure TIdEntityRange.SetText(const AValue: String);
var
LValue, S: String;
begin
LValue := Trim(AValue);
if LValue <> '' then
begin
S := Fetch(LValue, '-'); {do not localize}
if S <> '' then begin
FStartPos := StrToIntDef(S, -1);
FEndPos := StrToIntDef(Fetch(LValue), -1);
FSuffixLength := -1;
end else begin
FStartPos := -1;
FEndPos := -1;
FSuffixLength := StrToIntDef(Fetch(LValue), -1);
end;
end else begin
FStartPos := -1;
FEndPos := -1;
FSuffixLength := -1;
end;
end;

应该是

procedure TIdEntityRange.SetText(const AValue: String);
var
LValue, S: String;
begin
LValue := Trim(AValue);
if LValue <> '' then
begin
S := Fetch(LValue, '-'); {do not localize}
if S <> '' then begin
FStartPos := StrToInt64Def(S, -1);
FEndPos := StrToInt64Def(Fetch(LValue), -1);
FSuffixLength := -1;
end else begin
FStartPos := -1;
FEndPos := -1;
FSuffixLength := StrToInt64Def(Fetch(LValue), -1);
end;
end else begin
FStartPos := -1;
FEndPos := -1;
FSuffixLength := -1;
end;
end;

一个让 Remy 修复

关于delphi - TIdHTTPServer 是否与 Microsoft BITS 兼容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4408000/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com