开发者

Indy 10 FTP empty list

开发者 https://www.devze.com 2022-12-25 10:53 出处:网络
I have been receiving reports from some of my users that, when using idFTP.List() from some servers (MS FTP) then the listing is received as empty (no files) when in reality there are (non-hidden) fil

I have been receiving reports from some of my users that, when using idFTP.List() from some servers (MS FTP) then the listing is received as empty (no files) when in reality there are (non-hidden) files on the current directory. May this be 开发者_如何学Ca case of a missing parser? The funny think, when I use the program to get the list from MY server (MSFTP on W2003) everything seems OK but on some servers I've been hitting this problem.

Using latest Indy10 on D2010. Any idea?


IdFTPListParseWindowsNT is broken.

The function CheckListing returns false because of a bad parsing:

if sDir = '  <DI' then begin   {do not localize}
    sDir := Copy(SData, 27, 5);
  end else begin
    sDir := Copy(SData, 26,28);  <---------------BAD PASRSING
    Result := TextStartsWith(sDir,'  <DI') or IsNumeric(TrimLeft(sDir));
    if not Result then begin
       Exit;
    end;     

  end;

Commenting this part to make it work like in older versions

    if sDir = '  <DI' then begin   {do not localize}
        sDir := Copy(SData, 27, 5);
      end;

{ else begin
        sDir := Copy(SData, 26,28);  <---------------BAD PASRSING
        Result := TextStartsWith(sDir,'  <DI') or IsNumeric(TrimLeft(sDir));
        if not Result then begin
           Exit;
        end;     

  end;}

Showuld solve your problem. Don't know why this change was introduced, though.


This is usually caused by something unexpected in the directory listing which makes the list parser fail. IIS might support both NT-style and Unix-style directory listings, so make sure that you're including both listing parsers in your application and picking between them using IdFTPLaistParse.pas::CheckListing. If that doesn't help it's probably a goofy date or a something in the filename; the best way to debug it is to add code to save the raw directory listing to a file so the end user can send you a copy.


Are you sure you can actually establish the data connection ? The directly listing command is usually the first occasion such a listing is requested and, if you're in the wrong mode, it's usually the point where the failure occurs (i.e. the data channel connection timesout).

0

精彩评论

暂无评论...
验证码 换一张
取 消