加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

delphi – TIdHTTPServer是否兼容Microsoft BITS

发布时间:2020-12-15 04:26:18 所属栏目:大数据 来源:网络整理
导读:我们正在尝试使用TIdHTTPServer组件为我们的软件编写更新服务器.目前,我们正在提供一个列出可用更新及其文件版本等的 XML文件.当客户端程序找到更新版本时,应使用BITS开始下载. 现在这是我们遇到的问题,我们的程序正在请求XML文件,并且看到有可用的更新.然后
我们正在尝试使用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.

解决方法

刚刚发现一个错误,在使用范围请求时,阻止传输2.1GB以上的文件.

这里是

IdHTTPHeaderInfo.pas aprox行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,'-'); {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修复

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读