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
commit cc8c2c630393f109779816b7650a33f50b7763b5 Author: Jens Geyer <[email protected]> AuthorDate: Mon Mar 29 22:38:30 2021 +0200 THRIFT-5385 XML-HTTP client reports IsOpen=TRUE even if it is not Client: Delphi Patch: Jens Geyer --- lib/delphi/src/Thrift.Transport.MsxmlHTTP.pas | 6 ++++-- lib/delphi/test/TestClient.pas | 7 +++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/delphi/src/Thrift.Transport.MsxmlHTTP.pas b/lib/delphi/src/Thrift.Transport.MsxmlHTTP.pas index bdc65d1..a3f387b 100644 --- a/lib/delphi/src/Thrift.Transport.MsxmlHTTP.pas +++ b/lib/delphi/src/Thrift.Transport.MsxmlHTTP.pas @@ -197,7 +197,7 @@ end; function TMsxmlHTTPClientImpl.GetIsOpen: Boolean; begin - Result := True; + Result := Assigned(FOutputStream); end; procedure TMsxmlHTTPClientImpl.Open; @@ -264,7 +264,9 @@ end; procedure TMsxmlHTTPClientImpl.Write( const pBuf : Pointer; off, len : Integer); begin - FOutputStream.Write( pBuf, off, len); + if FOutputStream <> nil + then FOutputStream.Write( pBuf, off, len) + else raise TTransportExceptionNotOpen.Create('Transport closed'); end; diff --git a/lib/delphi/test/TestClient.pas b/lib/delphi/test/TestClient.pas index 6c962ab..ebc0796 100644 --- a/lib/delphi/test/TestClient.pas +++ b/lib/delphi/test/TestClient.pas @@ -474,6 +474,10 @@ begin on e:Exception do Expect( FALSE, 'Unexpected exception "'+e.ClassName+'": '+e.Message); end; + // re-open connection if needed + if not FTransport.IsOpen + then FTransport.Open; + // case 2: exception type NOT declared in IDL at the function call // this will close the connection try @@ -505,6 +509,9 @@ begin end; {$ENDIF Exceptions} + // re-open connection if needed + if not FTransport.IsOpen + then FTransport.Open; // simple things StartTestGroup( 'simple Thrift calls', test_BaseTypes);
