Unknown Protocol Error on idhttp get

Giganews Newsgroups
Subject: Unknown Protocol Error on idhttp get
Posted by:  Mark Williams (mark@{removethis}skwirel.com)
Date: Wed, 7 May 2008

I recompiled a project with Indy today (version 10.1.5).

Everytime I now try and do a Get indy throws up an unknown protocol error.
This comes from the PrepareRequest procedure.

This worked fine prior to the recompiling of the project and I have made no
changes to Indy as far as I am aware. I tried to analyse the code (which is
below), but find it a bit puzzling.

The LUri object is created in preparerequest but I can't see where its
protocol property gets set so don't understand the point of the first 2 text
compares. So I am guessing I am dependent on Length(FURI.Port) > 0. Can't
see how this gets set and don't understand why it was previously getting
set, but has stopped today. Any help would be very much appreciated.

if TextIsSame(LURI.Protocol, 'http') then begin    {do not localize}
        FURI.Port := IntToStr(IdPORT_HTTP);
      end else begin
        if TextIsSame(LURI.Protocol, 'https') then begin  {do not localize}
          FURI.Port := IntToStr(IdPORT_SSL);
        end else begin
          if Length(FURI.Port) > 0 then begin
          {  FURI.Port:=FURI.Port; } // do nothing, as the port is already
filled in.
          end else begin
            raise EIdUnknownProtocol.Create(RSHTTPUnknownProtocol);

Replies