1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
| unit Censored_HTTPSConnector;
interface
uses Classes,
IdHTTP, IdSSLOpenSSL,
Censored_Common;
type
ECensoredHTTPSConnectorError = class(ECensoredError);
TCensoredHTTPSConnector = class(TObject)
public
procedure Get(AURL: string; const AResponseContent: TStream);
end;
implementation
{ TCensoredHTTPSConnector }
procedure TCensoredHTTPSConnector.Get(AURL: string; const AResponseContent: TStream);
var
IdHTTPCensored: TIdHTTP;
begin
if Assigned(AResponseContent) then
begin
IdHTTPCensored := TIdHTTP.Create(nil);
try
IdHTTPCensored.IOHandler := TIdSSLIOHandlerSocket.Create(nil);
try
IdHTTPCensored.Get(AURL, AResponseContent);
AResponseContent.Seek(0, soBeginning);
finally
IdHTTPCensored.IOHandler.Free();
end;
finally
IdHTTPCensored.IOHandler.Free();
end;
end
else
raise ECensoredHTTPSConnectorError.Create('AResponseContent not initialize');
end;
end. |
Partager