AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Netzwerke Delphi indy idHttp + file download
Thema durchsuchen
Ansicht
Themen-Optionen

indy idHttp + file download

Ein Thema von sdean · begonnen am 28. Nov 2010 · letzter Beitrag vom 28. Nov 2010
Antwort Antwort
sdean

Registriert seit: 5. Dez 2009
64 Beiträge
 
#1

indy idHttp + file download

  Alt 28. Nov 2010, 18:49
Hi i've a list of Files to be downloaded :

1: http_://www.myweb.com/myfile.zip
2: http_://www.mywebcom.com/get.php?id=02906
3: http_://www.mywebcom.com/file.php?e=02906


the 1st link is easy to download / handle , But the problem is with Links #2 and #3 .
my idhttp handleRedirects property is True and RedirectMaximum is 15 But still no Chance to handle Them ( #2 and #3 Links ) .


so please how could i handle them ?
  Mit Zitat antworten Zitat
Klaus01

Registriert seit: 30. Nov 2005
Ort: München
5.755 Beiträge
 
Delphi 10.4 Sydney
 
#2

AW: indy idHttp + file download

  Alt 28. Nov 2010, 20:14
Hello,

is it possible to access link #2 and #3 with a common webbrowser?
Do you have the chance to trace the access attempts (i.e. with wireshark)?

Best regards
Klaus
Klaus
  Mit Zitat antworten Zitat
sdean

Registriert seit: 5. Dez 2009
64 Beiträge
 
#3

AW: indy idHttp + file download

  Alt 28. Nov 2010, 20:30
Thank you Klaus01 .
Zitat:
is it possible to access link #2 and #3 with a common webbrowser?
Yes .
and other question :
Is it possible to ignore the Downloading process in case of URL Redirect and continue with others ; that means :
Ignore URL Redirection for link #2 and #3 and continue downloading the other links ?
  Mit Zitat antworten Zitat
Benutzerbild von Luckie
Luckie

Registriert seit: 29. Mai 2002
37.621 Beiträge
 
Delphi 2006 Professional
 
#4

AW: indy idHttp + file download

  Alt 28. Nov 2010, 20:55
Sure. Just handle the error.
Michael
Ein Teil meines Codes würde euch verunsichern.
  Mit Zitat antworten Zitat
sdean

Registriert seit: 5. Dez 2009
64 Beiträge
 
#5

AW: indy idHttp + file download

  Alt 28. Nov 2010, 21:12
Sure. Just handle the error.
Thank you , But just how .
cause if i put handleRedirects property to False and idhttp faces an URL redirectios it will raise an exception with the Famous error http//1.1 302 found .
  Mit Zitat antworten Zitat
Benutzerbild von Luckie
Luckie

Registriert seit: 29. Mai 2002
37.621 Beiträge
 
Delphi 2006 Professional
 
#6

AW: indy idHttp + file download

  Alt 28. Nov 2010, 21:19
Code:
try
 
excpet
  on NotFound
    jumpt to next download in queue
end;
Michael
Ein Teil meines Codes würde euch verunsichern.
  Mit Zitat antworten Zitat
sdean

Registriert seit: 5. Dez 2009
64 Beiträge
 
#7

AW: indy idHttp + file download

  Alt 28. Nov 2010, 21:42
thank you Luckie
Here is my Thread Code :
Could you Fix it for me please . many thanks
Delphi-Quellcode:
procedure TFileDownThread.Execute;
var
  FStream: TFileStream;
  i:Integer;

begin

For i:=0 to FUrl.Count-1 do
  begin

  IdHTTP := TIdHTTP.Create(nil);
  try
    IdHTTP.Request.UserAgent := 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)';
    IdHTTP.OnWorkBegin := FWorkBeginEvent;
    IdHTTP.OnWork := FWorkEvent;
    IdHTTP.OnWorkEnd := FWorkEndevent;
    IdHTTP.HandleRedirects:=False;
   // IdHTTP.RedirectMaximum := 15;
   // Idhttp.OnRedirect:=OnRedirect;
    IdHTTP.Head(URL[i]);
    BytesInsgesamt := IdHTTP.Response.ContentLength;

    FStream:= TFileStream.Create(ExtractUrlFileName(URL[i]), fmCreate);
    IdHTTP.Get(URL[i], FStream);

  finally
    IdHTTP.Free;
    FStream.Free;
  
  end;
// Synchronize(ShowCode);
  end;
end;

Geändert von sdean (28. Nov 2010 um 21:44 Uhr)
  Mit Zitat antworten Zitat
Benutzerbild von Luckie
Luckie

Registriert seit: 29. Mai 2002
37.621 Beiträge
 
Delphi 2006 Professional
 
#8

AW: indy idHttp + file download

  Alt 28. Nov 2010, 22:10
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var
  i: Integer;
begin
  FileList := TStringList.Create;
  try
    FileList.Add('http://www.michael-puff.de/Programmierung/Delphi/Programme/AdressDB.zip');
    FileList.Add('http://www.michael-puff.de/Programmierung/Delphi/Programme/AdressDB_nonVCL.zip');
    FileList.Add('kdvndk');
    FileList.Add('http://www.michael-puff.de/Programmierung/Delphi/Programme/AudioPlayer.zip');
    for i := 0 to FileList.Count - 1 do
    begin
      try
        Download(i);
      except
        on E: EIdReadTimeOut do
        begin
          Memo1.Lines.Add(E.Message);
          Continue;
        end;
      end;
    end;
  finally
    FileList.Free
  end;
end;

procedure TForm1.Download(index: Integer);
begin
  IdHTTP1.Head(FileList[index]);
  Memo1.Lines.Add(IntToStr(IdHTTP1.Response.ContentLength));
end;
Just to show you the main principle.
Michael
Ein Teil meines Codes würde euch verunsichern.
  Mit Zitat antworten Zitat
sdean

Registriert seit: 5. Dez 2009
64 Beiträge
 
#9

AW: indy idHttp + file download

  Alt 28. Nov 2010, 22:20
Thank you Luckie i will apply your Idea .
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 03:27 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz