Skip to content

Commit a3f833c

Browse files
committed
Merged revision(s) 3093 from SourceForge:
Ajustes no AcceptEncoding, ContentEncoding e ContentType dos componentes SocketIndy.
1 parent c151823 commit a3f833c

3 files changed

Lines changed: 17 additions & 11 deletions

File tree

CORE/Source/Consts/uRESTDWConsts.pas

Lines changed: 4 additions & 1 deletion
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.3-';
74-
RESTDWRelease = '3091';
74+
RESTDWRelease = '3093';
7575
RESTDWCodeProject = 'Savage Reign - GitHub';
7676
RESTDWVersao = RESTDWVersionINFO + RESTDWRelease + '(' + RESTDWCodeProject + ')';
7777
GOffsetFromUTC : TDateTime = 0{$IFDEF HAS_DEPRECATED}deprecated{$ENDIF};
@@ -143,6 +143,9 @@
143143
rsLazarusDWPackage = 'REST Dataware - Tools';
144144
rsDwRequestDBGName = 'REST Dataware - Request Debbuger';
145145
cDefaultContentType = 'application/json';
146+
cContentTypeFormUrl = 'application/x-www-form-urlencoded';
147+
cContentTypeMultiPart = 'multipart/form-data';
148+
cDefaultContentEncoding = 'gzip, identity';
146149
cValueKey = '{"serverinforequest":"%s", "inforequest":"%s", "lifecycle":"%s"}';
147150
cValueKeyToken = '{"secrets":"%s", "md5":"%s"}';
148151
cValueToken = '{%s"exp":"%s", "iat":"%s", "secrets":"%s"}';

CORE/Source/ShellTools/uRESTDWShellServicesDelphi.pas

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,9 @@ interface
123123
vResponseString := '';
124124
vStream := Nil;
125125
vRedirect := Redirect;
126-
ARequest.ReadTotalContent;
126+
{$IF CompilerVersion > 21}
127+
ARequest.ReadTotalContent;
128+
{$IFEND}
127129
Try
128130
If CORS Then
129131
Begin

CORE/Source/Sockets/Indy/uRESTDWIdBase.pas

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -396,9 +396,6 @@ TIdHTTPAccess = class(TIdHTTP)
396396
HttpRequest.ProxyParams.ProxyPassword := ProxyOptions.ProxyPassword;
397397
HttpRequest.ProxyParams.ProxyPort := ProxyOptions.ProxyPort;
398398
HttpRequest.ReadTimeout := RequestTimeout;
399-
HttpRequest.Request.ContentType := ContentType;
400-
HttpRequest.Request.Accept := Accept;
401-
HttpRequest.Request.AcceptEncoding := AcceptEncoding;
402399
HttpRequest.AllowCookies := AllowCookies;
403400
HttpRequest.HandleRedirects := HandleRedirects;
404401
HttpRequest.RedirectMaximum := RedirectMaximum;
@@ -418,10 +415,10 @@ TIdHTTPAccess = class(TIdHTTP)
418415
HttpRequest.Request.Charset := 'ansi';
419416
HttpRequest.Request.AcceptCharSet := HttpRequest.Request.Charset;
420417
End;
421-
HttpRequest.Request.ContentType := ContentType;
422418
HttpRequest.Request.Accept := Accept;
423-
HttpRequest.Request.ContentEncoding := ContentEncoding;
424419
HttpRequest.Request.AcceptEncoding := AcceptEncoding;
420+
HttpRequest.Request.ContentType := ContentType;
421+
HttpRequest.Request.ContentEncoding := ContentEncoding;
425422
HttpRequest.Request.UserAgent := UserAgent;
426423
HttpRequest.MaxAuthRetries := MaxAuthRetries;
427424
End;
@@ -2610,10 +2607,10 @@ TIdHTTPAccess = class(TIdHTTP)
26102607
Constructor TRESTDWIdClientREST.Create(AOwner: TComponent);
26112608
Begin
26122609
Inherited;
2613-
ContentType := 'application/json';
2614-
ContentEncoding := 'application/x-www-form-urlencoded'; //'multipart/form-data';
2610+
//application/json
2611+
ContentType := cContentTypeFormUrl;
2612+
ContentEncoding := cDefaultContentEncoding;
26152613
Accept := 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8';
2616-
// AcceptEncoding := 'gzip, deflate, br';
26172614
AcceptEncoding := '';
26182615
MaxAuthRetries := 0;
26192616
UserAgent := cUserAgent;
@@ -2770,7 +2767,6 @@ TIdHTTPAccess = class(TIdHTTP)
27702767
Var
27712768
I : Integer;
27722769
Begin
2773-
HttpRequest.Request.AcceptEncoding := AcceptEncoding;
27742770
HttpRequest.Request.RawHeaders.Clear;
27752771
// HttpRequest.Request.CustomHeaders.Clear;
27762772
If AccessControlAllowOrigin <> '' Then
@@ -2786,6 +2782,7 @@ TIdHTTPAccess = class(TIdHTTP)
27862782
{$ELSE}
27872783
SendParams.AddFormField('Access-Control-Allow-Origin', AccessControlAllowOrigin);
27882784
{$ENDIF}
2785+
HttpRequest.Request.ContentEncoding := cContentTypeMultiPart;
27892786
End;
27902787
End;
27912788
If Assigned(AHeaders) Then
@@ -3502,6 +3499,8 @@ TIdHTTPAccess = class(TIdHTTP)
35023499
Inherited;
35033500
HttpRequest := Nil;
35043501
vCipherList := '';
3502+
ContentType := cContentTypeFormUrl;
3503+
ContentEncoding := cDefaultContentEncoding;
35053504
End;
35063505

35073506
Destructor TRESTDWIdClientPooler.Destroy;
@@ -4596,6 +4595,8 @@ TIdHTTPAccess = class(TIdHTTP)
45964595
HttpRequest := Nil;
45974596
vCipherList := '';
45984597
RESTClientPooler := TRESTDWIdClientPooler.Create(Self);
4598+
ContentType := cContentTypeFormUrl;
4599+
ContentEncoding := cDefaultContentEncoding;
45994600
End;
46004601

46014602
Destructor TRESTDWIdDatabase.Destroy;

0 commit comments

Comments
 (0)