Skip to content

Commit

Permalink
Ajustado Provider ElasticSearch
Browse files Browse the repository at this point in the history
  • Loading branch information
dliocode committed Aug 9, 2022
1 parent 69b76c6 commit ef267c2
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 13 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ static/
src/*.~*
*.res
*.exe
*.dll
*.bpl
*.bpi
*.dcp
Expand Down
Binary file added Samples/ElasticSearch/DLL/libeay32.dll
Binary file not shown.
Binary file added Samples/ElasticSearch/DLL/ssleay32.dll
Binary file not shown.
8 changes: 8 additions & 0 deletions Samples/ElasticSearch/ProviderElasticSearch.dproj
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@
<UWP_DelphiLogo44>$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png</UWP_DelphiLogo44>
<UWP_DelphiLogo150>$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png</UWP_DelphiLogo150>
<SanitizedProjectName>ProviderElasticSearch</SanitizedProjectName>
<DCC_Define>DATALOGGER_ELASTICSEARCH_USE_INDY;$(DCC_Define)</DCC_Define>
<VerInfo_Locale>1046</VerInfo_Locale>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Win32)'!=''">
<DCC_UsePackage>vclwinx;DataSnapServer;fmx;emshosting;vclie;DbxCommonDriver;bindengine;IndyIPCommon;VCLRESTComponents;DBXMSSQLDriver;FireDACCommonODBC;emsclient;FireDACCommonDriver;appanalytics;IndyProtocols;vclx;IndyIPClient;dbxcds;vcledge;bindcompvclwinx;FmxTeeUI;emsedge;bindcompfmx;DBXFirebirdDriver;inetdb;ibmonitor;FireDACSqliteDriver;DbxClientDriver;FireDACASADriver;Tee;soapmidas;vclactnband;TeeUI;fmxFireDAC;dbexpress;FireDACInfxDriver;DBXMySQLDriver;VclSmp;inet;DataSnapCommon;vcltouch;fmxase;DBXOdbcDriver;dbrtl;FireDACDBXDriver;FireDACOracleDriver;fmxdae;TeeDB;FireDACMSAccDriver;CustomIPTransport;FireDACMSSQLDriver;DataSnapIndy10ServerTransport;DataSnapConnectors;vcldsnap;DBXInterBaseDriver;FireDACMongoDBDriver;IndySystem;FireDACTDataDriver;vcldb;ibxbindings;vclFireDAC;bindcomp;FireDACCommon;DataSnapServerMidas;FireDACODBCDriver;emsserverresource;IndyCore;RESTBackendComponents;bindcompdbx;rtl;FireDACMySQLDriver;FireDACADSDriver;RESTComponents;DBXSqliteDriver;vcl;IndyIPServer;dsnapxml;dsnapcon;DataSnapClient;DataSnapProviderClient;adortl;DBXSybaseASEDriver;DBXDb2Driver;vclimg;DataSnapFireDAC;emsclientfiredac;FireDACPgDriver;FireDAC;FireDACDSDriver;inetdbxpress;xmlrtl;tethering;ibxpress;bindcompvcl;dsnap;CloudService;DBXSybaseASADriver;DBXOracleDriver;FireDACDb2Driver;DBXInformixDriver;vclib;fmxobj;bindcompvclsmp;DataSnapNativeClient;FMXTee;DatasnapConnectorsFreePascal;soaprtl;soapserver;FireDACIBDriver;$(DCC_UsePackage)</DCC_UsePackage>
Expand Down Expand Up @@ -133,6 +135,12 @@
<Source>
<Source Name="MainSource">ProviderElasticSearch.dpr</Source>
</Source>
<Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\bcboffice2k280.bpl">Embarcadero C++Builder Office 2000 Servers Package</Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\bcbofficexp280.bpl">Embarcadero C++Builder Office XP Servers Package</Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dcloffice2k280.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dclofficexp280.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
</Excluded_Packages>
</Delphi.Personality>
<Deployment Version="3">
<DeployFile LocalName="Win32\Debug\ProviderElasticSearch.exe" Configuration="Debug" Class="ProjectOutput">
Expand Down
1 change: 0 additions & 1 deletion src/Providers/DataLogger.Provider.ElasticSearch.pas
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ constructor TProviderElasticSearch.Create;

URL('https://localhost:9200');
ContentType('application/json');
BasicAuth('elastic', '');
Index('logger');
end;

Expand Down
14 changes: 6 additions & 8 deletions src/Providers/DataLogger.Provider.REST.Indy.pas
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ interface

uses
DataLogger.Provider, DataLogger.Types,
IdHTTP, IdSSLOpenSSL, IdMultipartFormData,
IdHTTP, IdSSLOpenSSL, IdSSLOpenSSLHeaders, IdMultipartFormData,
System.SysUtils, System.Classes, System.Threading, System.JSON, System.TypInfo, System.NetEncoding;

type
Expand Down Expand Up @@ -320,12 +320,13 @@ procedure TProviderRESTIndy.HTTP(const AMethod: TRESTMethod; const AItemREST: TL
try
LHTTP.ConnectTimeout := 60000;
LHTTP.ReadTimeout := 60000;

LHTTP.HandleRedirects := True;
LHTTP.Request.AcceptCharSet := 'utf-8';
LHTTP.Request.AcceptEncoding := 'utf-8';
LHTTP.Request.UserAgent := 'DataLogger.Provider.REST.Indy';
LHTTP.Request.ContentType := FContentType;
LHTTP.Request.Accept := FContentType;
LHTTP.Request.AcceptCharSet := 'utf-8';
LHTTP.Request.AcceptEncoding := 'gzip, deflate, br';
LHTTP.Request.Accept := '*/*';
LHTTP.Request.Connection := 'Keep-Alive';

if not FToken.Trim.IsEmpty then
Expand All @@ -347,7 +348,7 @@ procedure TProviderRESTIndy.HTTP(const AMethod: TRESTMethod; const AItemREST: TL
if LURL.ToLower.Contains('https://') then
begin
if not LoadOpenSSLLibrary then
raise EDataLoggerException.Create('DLL''s not compatible or not found (ssleay32 e libeay32)');
raise EDataLoggerException.Create(Self.ClassName + ' > ' + WhichFailedToLoad);

LSSL := TIdSSLIOHandlerSocketOpenSSL.Create(LHTTP);
LSSL.SSLOptions.Method := sslvTLSv1_2;
Expand Down Expand Up @@ -407,9 +408,6 @@ procedure TProviderRESTIndy.HTTP(const AMethod: TRESTMethod; const AItemREST: TL
finally
LHTTP.Free;

if Assigned(LSSL) then
UnLoadOpenSSLLibrary;

if Assigned(AItemREST.Stream) then
AItemREST.Stream.Free;

Expand Down
6 changes: 3 additions & 3 deletions src/Providers/DataLogger.Provider.REST.NetHTTPClient.pas
Original file line number Diff line number Diff line change
Expand Up @@ -321,11 +321,11 @@ procedure TProviderRESTNetHTTPClient.HTTP(const AMethod: TRESTMethod; const AIte
LHTTP.SendTimeout := 60000;
{$ENDIF}
LHTTP.HandleRedirects := True;
LHTTP.AcceptCharSet := 'utf-8';
LHTTP.AcceptEncoding := 'utf-8';
LHTTP.UserAgent := 'DataLogger.Provider.REST.NetHTTPClient';
LHTTP.ContentType := FContentType;
LHTTP.Accept := FContentType;
LHTTP.AcceptCharSet := 'utf-8';
LHTTP.AcceptEncoding := 'gzip, deflate, br';
LHTTP.Accept := '*/*';

if not FToken.Trim.IsEmpty then
LHTTP.CustomHeaders['Authorization'] := FToken;
Expand Down

0 comments on commit ef267c2

Please sign in to comment.