So ginge es, auch wenns nicht ganz so ideal ist:
Delphi-Quellcode:
// ....
public
LastURL: String;
end;
// ....
uses
IdException;
// ....
procedure TForm1.IdHTTP1Redirect(Sender: TObject; var dest: string;
var NumRedirect: Integer; var Handled: Boolean; var VMethod: TIdHTTPMethod);
begin
LastURL := dest;
Handled := false;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
CurURL : String;
SomeError : boolean;
begin
Button1.Enabled := false;
LastURL := 'http://feeds.feedburner.com/foxsports/RSS/headlines?m=2749';
SomeError := false;
repeat
Try
CurURL := LastURL;
IdHTTP1.Head(CurURL);
Except
On E: EIdConnClosedGracefully do
begin
SomeError := false;
end;
On E: EIdHTTPProtocolException do
begin
SomeError := E.ReplyErrorCode <> 302;
end;
On E: EIdException do
begin
SomeError := true;
end;
else
raise;
End;
until SomeError or (LastURL = CurURL);
Button1.Enabled := true;
end;