summaryrefslogtreecommitdiff
path: root/lib/delphi
diff options
context:
space:
mode:
authorJens Geyer <jensg@apache.org>2021-03-29 22:38:30 +0200
committerJens Geyer <jensg@apache.org>2021-03-29 22:59:58 +0200
commitcc8c2c630393f109779816b7650a33f50b7763b5 (patch)
tree159defe53d94ebf75966eb639d90d0880ac59a6f /lib/delphi
parent7e537505f014d8ede86f30a7500136c2f3e99505 (diff)
downloadthrift-cc8c2c630393f109779816b7650a33f50b7763b5.tar.gz
THRIFT-5385 XML-HTTP client reports IsOpen=TRUE even if it is not
Client: Delphi Patch: Jens Geyer
Diffstat (limited to 'lib/delphi')
-rw-r--r--lib/delphi/src/Thrift.Transport.MsxmlHTTP.pas6
-rw-r--r--lib/delphi/test/TestClient.pas7
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 bdc65d1fd..a3f387bac 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 6c962ab17..ebc0796fe 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);