Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Http Error on Get UnKnowen Protocol


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 1 - Last Post: Mar 22, 2018 2:19 PM Last Post By: Remy Lebeau (Te...
Donald Bossen

Posts: 81
Registered: 2/3/02
Http Error on Get UnKnowen Protocol  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 22, 2018 1:52 PM
I am getting a Error "Unknown Protocol" when I Preform The Get in my code
procedure TFrmTb2.SetImageView(iPartNo : String;var iImage : TImageEn);//; HideFlag : Boolean);
var
msg : ShortString;
Ok : Boolean;
Tbl : TADODataSet;
bStream : TStream;

Stream : TMemoryStream;
Url : String;
Rez : String;
function GetLocalImage(iPartNo : String) : Boolean;
begin
with FrmTb2 do
begin
Result := False;
if SelectDataWhere(TblImage1,Msg,'Picture','part_no = '''+iPartNo+'''') then
begin
Result := True;
Tbl := TblImage1;
end
else
if SelectDataWhere(TblImage2,Msg,'Picture','part_no = '''+iPartNo+'''') then
begin
Result := True;
Tbl := TblImage2;
end;
if Result then
begin
iImage.Clear;
bstream := Tbl.CreateBlobStream(Tbl.FieldByName('Image'),bmRead);
iImage.IO.LoadFromStream(bStream);
end
else
iImage.Clear
end;
end;
begin
if SelectDataAll(TblConfig,Msg,'Config','sls_no',FrmTb2.ActiveSlsm,'') then
if (TblConfig.FieldByName('Use_Image').AsString = 'Y') and HideFlag then
begin
idHttp.ConnectTimeout := ReadIniInt(IniHdwe,'HTTP','ConnectTimeout',160);
rez := '800';
ok := True;
repeat
try
Stream := TMemoryStream.Create;
try
Url := ReadIniStr(IniHdwe,'Images',rez) + iPartNo + '.jpg'; URL = 1901.jpg
try
idHttp.Get(Url, Stream);
if Stream.Size > 0 then
begin
Stream.Position := 0;
iImage.IO.LoadFromStream(Stream);
Ok := True;
end;
except
GetLocalImage(iPartNo);
end;
finally
Stream.Free;
end;
except
ok := False;
case StrToInt(Rez) of
800 : rez := '400';
400 : rez := '180';
180 : rez := '75';
75 : begin
iImage.Clear;
Ok := True;
end;
end;
end;
until ok;
end
else
begin
GetLocalImage(iPartNo);
end;
end;
The Fun thing is I took this code from an other program the difference is it checks if there is an Internet connection first. I tried in the other program to comment out the code I removed and It did not give me Errors. Where is this this protocol setting what is missing. (Windows 10) (Indy 10.2.5366) (Tokyo 10.2.3)
Thanks In Advance
Donald S. Bossen
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: Http Error on Get UnKnowen Protocol  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 22, 2018 2:19 PM   in response to: Donald Bossen in response to: Donald Bossen
Donald Bossen wrote:

I am getting a Error "Unknown Protocol" when I Preform The Get in
my code

That means you are passing a URL to TIdHTTP.Get() that does not begin
with a URL scheme, like 'http:' or 'https:'.

Make sure that you call to ReadIniStr(IniHdwe,'Images',rez) is
returning a proper URL, and not a blank string, for instance.

Where is this this protocol setting what is missing.

Look at the URLs you are passing to TIdHTTP.Get().

--
Remy Lebeau (TeamB)
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02