diff options
author | Yuxuan 'fishy' Wang <yuxuan.wang@reddit.com> | 2019-06-07 20:47:18 +0800 |
---|---|---|
committer | Duru Can Celasun <can@dcc.im> | 2019-06-19 22:52:24 +0200 |
commit | 4d46c1124450eeb77d2a6adc7ea5fab304bfeb4a (patch) | |
tree | e09ae02059d241dd78a761bd3e4133c4e8082001 /test/go | |
parent | 823474ec89355f72d3f0720ae5dacc2036d41c03 (diff) | |
download | thrift-4d46c1124450eeb77d2a6adc7ea5fab304bfeb4a.tar.gz |
THRIFT-4612: THeader support in go library
Client: go
Implement THeaderTransport and THeaderProtocol, with support of:
* clients:
- headers
- framedBinary
- unframedBinary
- framedCompact
- unframedCompact
* transforms:
- none
- zlib
* info types:
- key_value
* wrapped protocols:
- TBinary
- TCompact
The support list is in general on par of the THeader implementation in
the python library.
The cross-test passes, except ones related to cpp/nodejs http transport,
which were also failing for non-theader protocols.
This change also fixes two bugs:
1. A small issue in test/go/src/bin/testserver/main.go
2. A bug in TFrameTransport go implementation
Diffstat (limited to 'test/go')
-rw-r--r-- | test/go/src/bin/testserver/main.go | 4 | ||||
-rw-r--r-- | test/go/src/common/client.go | 2 | ||||
-rw-r--r-- | test/go/src/common/server.go | 2 |
3 files changed, 6 insertions, 2 deletions
diff --git a/test/go/src/bin/testserver/main.go b/test/go/src/bin/testserver/main.go index ca2d967b6..6fc1185a2 100644 --- a/test/go/src/bin/testserver/main.go +++ b/test/go/src/bin/testserver/main.go @@ -32,7 +32,7 @@ var host = flag.String("host", "localhost", "Host to connect") var port = flag.Int64("port", 9090, "Port number to connect") var domain_socket = flag.String("domain-socket", "", "Domain Socket (e.g. /tmp/ThriftTest.thrift), instead of host and port") var transport = flag.String("transport", "buffered", "Transport: buffered, framed, http, zlib") -var protocol = flag.String("protocol", "binary", "Protocol: binary, compact, json") +var protocol = flag.String("protocol", "binary", "Protocol: binary, compact, json, header") var ssl = flag.Bool("ssl", false, "Encrypted Transport using SSL") var zlib = flag.Bool("zlib", false, "Wrapped Transport using Zlib") var certPath = flag.String("certPath", "keys", "Directory that contains SSL certificates") @@ -43,7 +43,7 @@ func main() { processor, serverTransport, transportFactory, protocolFactory, err := common.GetServerParams(*host, *port, *domain_socket, *transport, *protocol, *ssl, *certPath, common.PrintingHandler) if err != nil { - log.Fatalf("Unable to process server params: ", err) + log.Fatalf("Unable to process server params: %v", err) } if *transport == "http" { diff --git a/test/go/src/common/client.go b/test/go/src/common/client.go index 236ce43ea..ed820aeaf 100644 --- a/test/go/src/common/client.go +++ b/test/go/src/common/client.go @@ -55,6 +55,8 @@ func StartClient( protocolFactory = thrift.NewTJSONProtocolFactory() case "binary": protocolFactory = thrift.NewTBinaryProtocolFactoryDefault() + case "header": + protocolFactory = thrift.NewTHeaderProtocolFactory() default: return nil, nil, fmt.Errorf("Invalid protocol specified %s", protocol) } diff --git a/test/go/src/common/server.go b/test/go/src/common/server.go index 5ac440002..c6674ae75 100644 --- a/test/go/src/common/server.go +++ b/test/go/src/common/server.go @@ -60,6 +60,8 @@ func GetServerParams( protocolFactory = thrift.NewTJSONProtocolFactory() case "binary": protocolFactory = thrift.NewTBinaryProtocolFactoryDefault() + case "header": + protocolFactory = thrift.NewTHeaderProtocolFactory() default: return nil, nil, nil, nil, fmt.Errorf("Invalid protocol specified %s", protocol) } |