This is an automated email from the ASF dual-hosted git repository.

jensg pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/thrift.git


The following commit(s) were added to refs/heads/master by this push:
     new 6762cad  THRIFT-5304 TWinHTTPClientImpl may incorrectly report that 
the message size is reached Client: Delphi Patch: Jens Geyer
6762cad is described below

commit 6762cad25cad7997d09931ba942212d2d0ef61f1
Author: Jens Geyer <[email protected]>
AuthorDate: Fri Oct 30 17:15:18 2020 +0100

    THRIFT-5304 TWinHTTPClientImpl may incorrectly report that the message size 
is reached
    Client: Delphi
    Patch: Jens Geyer
---
 lib/delphi/src/Thrift.Transport.WinHTTP.pas | 2 ++
 lib/delphi/src/Thrift.Transport.pas         | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/delphi/src/Thrift.Transport.WinHTTP.pas 
b/lib/delphi/src/Thrift.Transport.WinHTTP.pas
index 5794b1c..b0f32ef 100644
--- a/lib/delphi/src/Thrift.Transport.WinHTTP.pas
+++ b/lib/delphi/src/Thrift.Transport.WinHTTP.pas
@@ -333,6 +333,8 @@ begin
     else raise TTransportExceptionInterrupted.Create( sMsg);
   end;
 
+  // we're about to receive a new message, so reset everyting
+  ResetConsumedMessageSize(-1);
   FInputStream := THTTPResponseStream.Create( http);
   if http.QueryTotalResponseSize( dwSize)  // FALSE indicates "no info 
available"
   then UpdateKnownMessageSize( dwSize);
diff --git a/lib/delphi/src/Thrift.Transport.pas 
b/lib/delphi/src/Thrift.Transport.pas
index 1b8300c..6a69d93 100644
--- a/lib/delphi/src/Thrift.Transport.pas
+++ b/lib/delphi/src/Thrift.Transport.pas
@@ -110,7 +110,7 @@ type
     function  MaxMessageSize : Integer;
     property  RemainingMessageSize : Int64 read FRemainingMessageSize;
     property  KnownMessageSize : Int64 read FKnownMessageSize;
-    procedure ResetConsumedMessageSize( const newSize : Int64 = -1); inline;
+    procedure ResetConsumedMessageSize( const newSize : Int64 = -1);
     procedure UpdateKnownMessageSize(const size : Int64); override;
     procedure CheckReadBytesAvailable(const numBytes : Int64); inline;
     procedure CountConsumedMessageBytes(const numBytes : Int64); inline;

Reply via email to