Skip to content

Commit 17355f8

Browse files
committed
Merged revision(s) 3051-3053 from SourceForge:
Correção para Lazarus de AV. Correção no pacote DriverZEOS. Ajuste de AV no ServerContext Ajuste de path no include na uRESTDWJSON Adição da função GetMIMEType para o ServerContext
1 parent c925b31 commit 17355f8

8 files changed

Lines changed: 49 additions & 15 deletions

File tree

CORE/Packages/Lazarus/Connectors/Indy/RestDatawareIndySockets.lpk

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@
1919
</Optimizations>
2020
<SmallerCode Value="True"/>
2121
</CodeGeneration>
22+
<Linking>
23+
<Debugging>
24+
<DebugInfoType Value="dsDwarf2"/>
25+
</Debugging>
26+
</Linking>
2227
<Other>
2328
<CustomOptions Value="-dNOGUI
2429
-dUseCThreads"/>

CORE/Packages/Lazarus/Drivers/zeos/restdwdriverzeos.lpk

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
<Version Value="11"/>
1010
<PathDelim Value="\"/>
1111
<SearchPaths>
12-
<IncludeFiles Value="..\..\..\..;..\..\..\..\Includes;..\..\..\..\Source\Includes"/>
12+
<IncludeFiles Value="..\..\..\..;..\..\..\..\Includes"/>
1313
<Libraries Value="..\..\..\..\static\$(TargetCPU)-$(TargetOS)"/>
1414
<OtherUnitFiles Value="..\..\libs;..\..;..\..\libs\JSON;..\..\..\..\Source\Database_Drivers"/>
15-
<UnitOutputDirectory Value="..\..\..\..\Source\compiledlaz"/>
15+
<UnitOutputDirectory Value="..\..\..\..\compiledlaz"/>
1616
</SearchPaths>
1717
<CodeGeneration>
1818
<Optimizations>
@@ -26,12 +26,13 @@
2626
<Version Major="2"/>
2727
<Files Count="3">
2828
<Item1>
29-
<Filename Value="restdwdriverzeos.lrs"/>
30-
<Type Value="LRS"/>
29+
<Filename Value="uRESTDWDriverZEOSReg.pas"/>
30+
<HasRegisterProc Value="True"/>
31+
<UnitName Value="uRESTDWDriverZEOSReg"/>
3132
</Item1>
3233
<Item2>
33-
<Filename Value="..\..\..\..\Source\Includes\uRESTDWPlataform.inc"/>
34-
<Type Value="Include"/>
34+
<Filename Value="restdwdriverzeos.lrs"/>
35+
<Type Value="LRS"/>
3536
</Item2>
3637
<Item3>
3738
<Filename Value="..\..\..\..\Source\Database_Drivers\uRESTDWDriverZEOS.pas"/>
@@ -40,16 +41,19 @@
4041
</Item3>
4142
</Files>
4243
<CompatibilityMode Value="True"/>
43-
<RequiredPkgs Count="3">
44+
<RequiredPkgs Count="4">
4445
<Item1>
4546
<PackageName Value="restdatawarecomponents"/>
4647
</Item1>
4748
<Item2>
4849
<PackageName Value="LR_ZeosDB"/>
4950
</Item2>
5051
<Item3>
51-
<PackageName Value="FCL"/>
52+
<PackageName Value="indylaz"/>
5253
</Item3>
54+
<Item4>
55+
<PackageName Value="FCL"/>
56+
</Item4>
5357
</RequiredPkgs>
5458
<UsageOptions>
5559
<UnitPath Value="$(PkgOutDir)"/>

CORE/Packages/Lazarus/Drivers/zeos/restdwdriverzeos.pas

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@
88
interface
99

1010
uses
11-
uRESTDWDriverZEOS, LazarusPackageIntf;
11+
uRESTDWDriverZEOSReg, uRESTDWDriverZEOS, LazarusPackageIntf;
1212

1313
implementation
1414

1515
procedure Register;
1616
begin
17+
RegisterUnit('uRESTDWDriverZEOSReg', @uRESTDWDriverZEOSReg.Register);
1718
RegisterUnit('uRESTDWDriverZEOS', @uRESTDWDriverZEOS.Register);
1819
end;
1920

CORE/Packages/Lazarus/restdatawarecomponents.lpk

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@
1919
</Optimizations>
2020
<SmallerCode Value="True"/>
2121
</CodeGeneration>
22+
<Linking>
23+
<Debugging>
24+
<DebugInfoType Value="dsDwarf2"/>
25+
</Debugging>
26+
</Linking>
2227
<Other>
2328
<CustomOptions Value="-dNOGUI
2429
-dUseCThreads"/>

CORE/Source/Basic/uRESTDWBasic.pas

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1946,6 +1946,7 @@ interface
19461946
AuthPassword := AuthenticationString;
19471947
End;
19481948
Begin
1949+
ResultStream := Nil;
19491950
Result := True;
19501951
vRDWAuthOptionParam := Nil;
19511952
decoder := Nil;
@@ -3827,6 +3828,8 @@ interface
38273828
StatusCode := vErrorCode;
38283829
If ServerContextStream <> Nil Then
38293830
Begin
3831+
If Not (Assigned(ResultStream)) Then
3832+
ResultStream := TStringStream.Create(''); //Anderson
38303833
WriteStream(ServerContextStream, ResultStream);
38313834
FreeAndNil(ServerContextStream);
38323835
End

CORE/Source/Consts/uRESTDWConsts.pas

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
monthnames : Array [1 .. 12] Of string = ('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', {do not localize}
7272
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'); {do not localize}
7373
RESTDWVersionINFO = 'v2.0.0-';
74-
RESTDWRelease = '3048';
74+
RESTDWRelease = '3050';
7575
RESTDWCodeProject = 'Savage Reign - GitHub';
7676
RESTDWVersao = RESTDWVersionINFO + RESTDWRelease + '(' + RESTDWCodeProject + ')';
7777
GOffsetFromUTC : TDateTime = 0{$IFDEF HAS_DEPRECATED}deprecated{$ENDIF};
@@ -376,7 +376,7 @@
376376
Function BuildStringFloat (Value : String;
377377
DataModeD : TDataMode = dmDataware;
378378
FloatDecimalFormat : String = '') : String;
379-
// Function GetMIMEType (sFile : TFileName) : string;
379+
Function GetMIMEType (sFile : TFileName) : string;
380380
Function Scripttags (Value : String) : Boolean;
381381
Function RESTDWFileExists (sFile,
382382
BaseFilePath : String) : Boolean;
@@ -643,6 +643,19 @@ implementation
643643
End;
644644
End;
645645

646+
Function GetMIMEType(sFile: TFileName): string;
647+
Var
648+
Mime : TMimeTable;
649+
Begin
650+
Mime := nil;
651+
Mime := TMimeTable.Create();
652+
try
653+
Result := Mime.GetFileMIMEType(sFile);
654+
finally
655+
FreeAndNil(Mime);
656+
end;
657+
End;
658+
646659
Function scripttags(Value: String): Boolean;
647660
var
648661
I : Integer;

CORE/Source/Sockets/Indy/uRESTDWIdBase.pas

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3127,9 +3127,12 @@ TIdHTTPAccess = class(TIdHTTP)
31273127
Else
31283128
ResultStream := TStringStream.Create(ErrorMessage);
31293129
End;
3130-
AResponseInfo.FreeContentStream := True;
3131-
AResponseInfo.ContentStream := ResultStream;
3132-
AResponseInfo.ContentStream.Position := 0;
3130+
if Assigned(ResultStream) then //anderson
3131+
begin
3132+
AResponseInfo.FreeContentStream := True;
3133+
AResponseInfo.ContentStream := ResultStream;
3134+
AResponseInfo.ContentStream.Position := 0;
3135+
end;
31333136
{$IFNDEF FPC}
31343137
AResponseInfo.ContentLength := ResultStream.Size;
31353138
{$ELSE}

CORE/Source/libs/JSON/uRESTDWJSON.pas

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
unit uRESTDWJSON;
22

3-
{$I ..\..\Source\Includes\uRESTDWPlataform.inc}
3+
{$I ..\..\..\Source\Includes\uRESTDWPlataform.inc}
44

55
Interface
66

0 commit comments

Comments
 (0)