Webサーバーに追加された最新ファイルの名前を検出しようとする正しい方法は何ですか? Indy HTTPSを使用してファイルをダウンロードしようとしています。ファイル名が動的に生成されるので、まずサーバー上に存在する最新のファイルの名前を判別する必要があります。Delphi Indy HTTPSは、Webサーバーから最新のファイルを検出します。
私は、ウェブサーバからファイルをダウンロードするには、次のコードを使用します。
function getIndyFile_from_https(const fileURL, FileName: String): boolean;
var http:TIdHttp;
s:TFileStream;
i:integer;
FProgress: Integer;
FBytesToTransfer: Int64;
FOnChange: TNotifyEvent;
IOHndl: TIdSSLIOHandlerSocketOpenSSL;
protocol_url,fullurl,url_fara_protocol,host:string;
begin
http:=TIdHTTP.Create(nil);
IOHndl := TIdSSLIOHandlerSocketOpenSSL.Create(nil);
http.Request.BasicAuthentication := True;
//Request.Accept:='text/html,*/*';
//Request.AcceptEncoding:='utf-8';
http.HandleRedirects := True;
http.IOHandler := IOHndl;
http.ReadTimeout := 30000;
//http.OnWork := HTTPWork;
//http.OnWorkBegin := HTTPWorkBegin;
//http.OnWorkEnd := HTTPWorkEnd;
try
s:=TFileStream.Create(filename, fmcreate);
try
http.Get(fileUrl,s);
result:=true;
finally
s.free;
end;
finally
http.Free;
end;
end;
私の前提を確認していただきありがとうございます。 – user2858981