Autor Beitrag
Daniel L.
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 140
Erhaltene Danke: 14

W7, W8
TurboD Prof, Delphi Community
BeitragVerfasst: Sa 23.09.17 22:18 
Hallo NG!

In meiner Anwendung nutze ich einen Service von Yahoo,
um Aktienkurse mit IdHTTP (Indy 10) downzuloaden.

Über viele Monate lief die Anwendung fehlerlos,
bis auf einmal eine Exception auftrat, - obwohl ich überhaupt nichts verändert hatte :o

Als Beispiel hier der Abruf einer Autoaktie.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
procedure TForm1.Button1Click(Sender: TObject);
var
  http: TIdHTTP;
  ms: TMemoryStream;
  UrlStr : string;
begin
  UrlStr := 'http://finance.yahoo.com/d/quotes.csv?s=BMW.DE&f=l1';
  http := TIdHTTP.Create (nil);
  http.HandleRedirects := true;
  ms := TMemoryStream.Create;
  http.Get (UrlStr, ms);  --> Exception der Klasse EIdIOHandlerPropInvalid mit Meldung 'IOHandler value is not valid'
end;


Die Position in unit IdHTTP (IdHTTP.pas), wo der Fehler ausgelöst wird, ist:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
...
function TIdCustomHTTP.SetHostAndPort: TIdHTTPConnectionType;
   ...
   if TextIsSame(URL.Protocol, 'HTTPS'then begin  {do not localize}
      // Just check can we do SSL
      if (not Assigned(IOHandler)) or (not (IOHandler is TIdSSLIOHandlerSocketBase)) then begin
        raise EIdIOHandlerPropInvalid.Create(RSIOHandlerPropInvalid);
      end;
   ...  
...



Leider fehlen mir die Neztwerkkentnisse, um weiterzukommen -
wäre toll, wenn jemand helfen könnte.

Gibt man übrigens den UrlString direkt in einen Browser ein,
lässt sich der Kurs ohne Probleme als csv-File downloaden.

Nutze TD Prof mit Indy 10

Daniel L.
Holgerx
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 62
Erhaltene Danke: 27

Win95 - Win11 / MSServer2000 - MSServer2019
Delphi 6pro / XE4
BeitragVerfasst: So 24.09.17 06:24 
Hmm..

Könnte es sein, das Yahoo von HTTP auf HTTPS umgestellt hat?

Durch das

http.HandleRedirects := true;

wird hier durch Indy das Redirect durchgeführt.

Jedoch wird dann bei INDY für das HTTPS ein entsprechender SSL-Handler benötigt, incl. der zwei DLLs.
Da beides anscheined nicht vorhanden, gibt es die Exception.

Ein Browser hat die benötigten Komponenten bereits intrigiert und mach auch das Redirect/Umstellen auf HTTPS automatisch, so dass dort dementsprechend keine Fehlermeldung kommt.

Such mal mit 'INDY10 SSL', da gelangst du dann z.B. hierhin
www.delphipraxis.net...5Bindy10-5-5%5D.html

Für diesen Beitrag haben gedankt: Daniel L.
Frühlingsrolle
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mo 25.09.17 04:23 
- Nachträglich durch die Entwickler-Ecke gelöscht -
t.roller
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 118
Erhaltene Danke: 34



BeitragVerfasst: Mo 25.09.17 07:52 
user profile iconFrühlingsrolle hat folgendes geschrieben Zum zitierten Posting springen:
Es wurde im Code nirgends ein entsprechender IOHandler dem TIdHTTP zugewiesen, daher auch die Fehlermeldung. So sollte es gehen...


Wenn die EXE Zugriff hat auf
(uses
IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient, IdHTTP,
IdIOHandler, IdIOHandlerSocket, IdIOHandlerStack, IdSSL, IdSSLOpenSSL;)
und libeay32.dll und ssleay32.dll,
dann geht es.
Daniel L. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 140
Erhaltene Danke: 14

W7, W8
TurboD Prof, Delphi Community
BeitragVerfasst: Mo 25.09.17 09:44 
Danke an alle!

Nach Holgerxs Hinweis hatte ich schnell rausgefunden, dass ich IdSSLIOHandlerSocketOpenSSL
und die beiden ssl - dll's brauche, allerdings konnte ich auch nach langer Suche keine
finden, die Versionsmäßig zu D 2006 passen (Indy 10.1.5)
Jetzt habe ichs mal mit Delphi 10.1 Starter probiert und es geht.
(Hatte ich ganz vergessen, weil ich es nach Erprobung nie genutzt hatte) :wink:
Werd mal ein höheres Indy in 2006 reininstallieren - falls das geht.

Gruß Daniel
Frühlingsrolle
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mo 25.09.17 12:13 
- Nachträglich durch die Entwickler-Ecke gelöscht -
Daniel L. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 140
Erhaltene Danke: 14

W7, W8
TurboD Prof, Delphi Community
BeitragVerfasst: Mo 25.09.17 15:56 
Also bei mir gehts nur mit IOHandler und DLL's

Daniel
baka0815
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 489
Erhaltene Danke: 14

Win 10, Win 8, Debian GNU/Linux
Delphi 10.1 Berlin, Java, C#
BeitragVerfasst: Fr 06.10.17 12:16 
Für den Indy OpenSSL IOHandler braucht man auch die DLLs.
Die gibt's z.B. unter indy.fulgan.com/SSL/?C=N;O=D.