Mam pewien problem ze sprawdzeniem czy połączenie zostało nawiązane. Wygląda to u mnie tak:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, IdBaseComponent, IdComponent, IdTCPConnection,
IdTCPClient, IdHTTP, IdIOHandler, IdIOHandlerSocket, IdIOHandlerStack,
IdSSL, IdSSLOpenSSL;
type
TForm1 = class(TForm)
IdHTTP1: TIdHTTP;
Edit1: TEdit;
Edit2: TEdit;
Label1: TLabel;
Button1: TButton;
Memo1: TMemo;
IdSSLIOHandlerSocketOpenSSL1: TIdSSLIOHandlerSocketOpenSSL;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
post: TStringList;
result: string;
begin
post := TStringList.Create;
IdHTTP1.HandleRedirects := True;
try
post.Add('username=User');
post.Add('password=Password123');
result := IdHTTP1.Post('https://id.atlassian.com/login', post);
if () then
Label1.Caption := 'Connect'
else
Label1.Caption := 'Disconnect';
except
post.Free;
end;
end;
end.
I nie wiem co mam dać w warunku if, żeby sprawdzić czy połączenie zostało nawiązane.
Edit
Próbowałem użyć procedury ResponseCode, ale za każdym razem dostaję wiadomość "Connected", nawet gdy jest złe hasło.