* Added BasicAuth support

This commit is contained in:
Andreas Schneider 2015-09-17 15:19:23 +02:00
parent 974c5ef298
commit 5689b89d90
1 changed files with 22 additions and 0 deletions

View File

@ -151,6 +151,20 @@ begin
{$endif} {$endif}
end; end;
procedure CmdBasicAuth(AData: String);
var
separator: Char;
i: Integer;
begin
separator := AData[1];
i := 2;
while (i < Length(AData)) and (AData[i] <> separator) do
Inc(i);
http.UserName := Copy(AData, 2, i - 2);
http.Password := Copy(AData, i + 1, Length(AData));
end;
function ProcessCommand(ALine: String): Boolean; function ProcessCommand(ALine: String): Boolean;
begin begin
Result := False; Result := False;
@ -169,6 +183,14 @@ begin
Result := True; Result := True;
method := Copy(ALine, 8, Length(ALine)); method := Copy(ALine, 8, Length(ALine));
end else end else
// We don't include the space here, since we also interpret this following
// char as separator for username and password! (In case the username itself
// contains a space.)
if AnsiStartsStr('BasicAuth', ALine) then
begin
Result := True;
CmdBasicAuth(Copy(ALine, 10, Length(ALine)));
end else
if AnsiStartsStr('Call ', ALine) then if AnsiStartsStr('Call ', ALine) then
begin begin
Result := True; Result := True;