📄 threads.~pas
字号:
unit threads;
interface
uses Classes, IdHTTP, SysUtils;
type
getHttpThread = class(TThread)
private
strName, strBase64: string;
protected
procedure Execute; override;
end;
var
mgetHttpThread: getHttpThread;
implementation
uses Unit1;
procedure getHttpThread.Execute();
var
RtnString: string;
IdHttp1: TIdHTTP;
begin
Form1.Memo1.Lines.Add(strName);
IdHttp1:=TIdHTTP.Create(nil);
idHttp1.Request.CustomHeaders.Clear;
idHttp1.Request.CustomHeaders.Text := 'Host: www.3322.org'+chr(13)+chr(10)+'Connection: Keep-Alive'+chr(13)+chr(10)+'Cookie: username=' + strName + chr(13)+chr(10) + 'Authorization: Basic '+ strBase64;
try
RtnString:=IdHttp1.Get('http://192.168.1.1/');
except
RtnString:='error';
end;
Form1.Memo1.Lines.add('Return: '+RtnString);
if (Copy(RtnString,1,5)='error') then
begin
Form1.Memo1.Lines.add('login failure.');
end
else
begin
Form1.Memo1.Lines.add('login success.');
end;
idHttp1.Disconnect;
Form1.Memo1.Lines.add('Time:'+FormatDatetime('yyyy-mm-dd hh:nn:ss',now));
Form1.Memo1.Lines.add('');
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -