THRIFT-5015 WinHTTP QueryDataAvailable cannot be used to retrieve total response size
Client: Delphi
Patch: Jens Geyer
diff --git a/lib/delphi/src/Thrift.Transport.WinHTTP.pas b/lib/delphi/src/Thrift.Transport.WinHTTP.pas
index ec8c87f..2f961a0 100644
--- a/lib/delphi/src/Thrift.Transport.WinHTTP.pas
+++ b/lib/delphi/src/Thrift.Transport.WinHTTP.pas
@@ -262,7 +262,7 @@
 
 function TWinHTTPClientImpl.GetIsOpen: Boolean;
 begin
-  Result := True;
+  Result := Assigned( FOutputMemoryStream);
 end;
 
 procedure TWinHTTPClientImpl.Open;
@@ -427,7 +427,7 @@
 
 procedure TWinHTTPClientImpl.THTTPResponseStream.CheckReadBytesAvailable( const value : Integer);
 begin
-  if Int64(value) > Int64(FRequest.QueryDataAvailable)
+  if Int64(value) > Int64(FRequest.QueryTotalResponseSize)
   then raise TTransportExceptionEndOfFile.Create('Not enough input data');
 end;