delphi – TIdHTTPServer是否兼容Microsoft BITS

前端之家收集整理的这篇文章主要介绍了delphi – TIdHTTPServer是否兼容Microsoft BITS前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我们正在尝试使用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修复

原文链接:https://www.f2er.com/delphi/101545.html

猜你在找的Delphi相关文章