THRIFT-5385 XML-HTTP client reports IsOpen=TRUE even if it is not
Client: Delphi
Patch: Jens Geyer
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 @@
function TMsxmlHTTPClientImpl.GetIsOpen: Boolean;
begin
- Result := True;
+ Result := Assigned(FOutputStream);
end;
procedure TMsxmlHTTPClientImpl.Open;
@@ -264,7 +264,9 @@
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 @@
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 @@
end;
{$ENDIF Exceptions}
+ // re-open connection if needed
+ if not FTransport.IsOpen
+ then FTransport.Open;
// simple things
StartTestGroup( 'simple Thrift calls', test_BaseTypes);