anchor.diff:            FEncrypted := False;
             Socket.SSLDoShutdown();
             Exit(False);
  -        end;
  -
  -        Reply := ReceiveString();
  -
  -        Log('encrypt reply: ' + Reply);
  -        if ProcessReply(Reply, Msg) then
  -        begin
  -          FEncrypted := True;
           end
           else
  +          FEncrypted := True;
  +
  +        Reply := ReceiveString();
  +
  +        Log('encrypt reply: ' + Reply);
  +        if not ProcessReply(Reply, Msg) then
             FEncrypted := False;
  +
         end
         else
         begin
  
positive.code:   HGD_PROTO_MAJOR: integer = 17;
    HGD_PROTO_MINOR: integer = 0;
    HGD_NUM_TRACK_FIELDS: integer = 14;
    BLOCK_SIZE: Int64 = 512 * 1024;
  
    //The hgd protocol is telnet based, use CRLF as LineEnding
  
negative.code: var
    s: string;
    i: integer;
    p: pointer;
  begin
    if FEncrypted then
    begin
      p := GetMem(HGD_MAX_LINE);
      Socket.RecvBufferEx(p, HGD_MAX_LINE, Timeout);
  
      s := '';
      for i := 0 to HGD_MAX_LINE - 1 do
      begin
        s := s + Char((p + i * SizeOf(Char))^);
        if Copy(s, Length(s)-3, 2) = ProtoLineEnding then
        begin
          s := Copy(s, 1, Length(s) - 4);
          Break;
        end;
      end;
  
      FreeMem(p);
      Result := s;
    end
    else
      Result := Socket.RecvString(Timeout);
  end;
  
  end.
  