THRIFT-4984: Handle wrapped io.EOF errors
TCompactProtocol (which is used by THeaderTransport to read headers)
could wrap the underlying error with TProtocolException, which breaks
err == io.EOF test in some cases.
Client: go
This closes #1922.
diff --git a/lib/go/thrift/simple_server.go b/lib/go/thrift/simple_server.go
index aa5a6a6..756d4cf 100644
--- a/lib/go/thrift/simple_server.go
+++ b/lib/go/thrift/simple_server.go
@@ -221,7 +221,9 @@
if err == nil {
return nil
}
- if err == io.EOF {
+ // err could be io.EOF wrapped with TProtocolException,
+ // so that err == io.EOF doesn't necessarily work in some cases.
+ if err.Error() == io.EOF.Error() {
return nil
}
if err, ok := err.(TTransportException); ok && err.TypeId() == END_OF_FILE {