You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by je...@apache.org on 2017/12/03 01:02:31 UTC
[01/50] [abbrv] thrift git commit: THRIFT-4355 Fix javascript
indentation of default values Client: js
Repository: thrift
Updated Branches:
refs/heads/0.11.0 0dd823580 -> 1310dc1eb
THRIFT-4355 Fix javascript indentation of default values
Client: js
This closes #1388
Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/8b8a8efe
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/8b8a8efe
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/8b8a8efe
Branch: refs/heads/0.11.0
Commit: 8b8a8efea13d1c97f856053af0a5c0e6a8a76354
Parents: b628736
Author: Brian Forbis <bf...@athenahealth.com>
Authored: Sat Oct 7 19:57:40 2017 -0400
Committer: James E. King, III <jk...@apache.org>
Committed: Tue Oct 10 08:46:46 2017 -0700
----------------------------------------------------------------------
compiler/cpp/src/thrift/generate/t_js_generator.cc | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/thrift/blob/8b8a8efe/compiler/cpp/src/thrift/generate/t_js_generator.cc
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/thrift/generate/t_js_generator.cc b/compiler/cpp/src/thrift/generate/t_js_generator.cc
index c146da7..f45ef57 100644
--- a/compiler/cpp/src/thrift/generate/t_js_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_js_generator.cc
@@ -558,7 +558,7 @@ string t_js_generator::render_const_value(t_type* type, t_const_value* value) {
} else if (type->is_enum()) {
out << value->get_integer();
} else if (type->is_struct() || type->is_xception()) {
- out << "new " << js_type_namespace(type->get_program()) << type->get_name() << "({" << endl;
+ out << "new " << js_type_namespace(type->get_program()) << type->get_name() << "({";
indent_up();
const vector<t_field*>& fields = ((t_struct*)type)->get_members();
vector<t_field*>::const_iterator f_iter;
@@ -576,12 +576,12 @@ string t_js_generator::render_const_value(t_type* type, t_const_value* value) {
}
if (v_iter != val.begin())
out << ",";
- out << render_const_value(g_type_string, v_iter->first);
+ out << endl << indent() << render_const_value(g_type_string, v_iter->first);
out << " : ";
out << render_const_value(field_type, v_iter->second);
}
-
- out << "})";
+ indent_down();
+ out << endl << indent() << "})";
} else if (type->is_map()) {
t_type* ktype = ((t_map*)type)->get_key_type();
@@ -600,9 +600,8 @@ string t_js_generator::render_const_value(t_type* type, t_const_value* value) {
out << " : ";
out << render_const_value(vtype, v_iter->second);
}
-
indent_down();
- out << endl << "}";
+ out << endl << indent() << "}";
} else if (type->is_list() || type->is_set()) {
t_type* etype;
if (type->is_list()) {
[38/50] [abbrv] thrift git commit: Fix remote client for HTTP
transport Client: go
Posted by je...@apache.org.
Fix remote client for HTTP transport
Client: go
Assign parsedUrl to the variable in the outer scope instead of creating
a new one. Previously the outer parsedUrl was never assigned and was
therefore always empty.
This closes #1411
Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/cde4d418
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/cde4d418
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/cde4d418
Branch: refs/heads/0.11.0
Commit: cde4d4181a252323d87e7ac086ce495cd1227c5c
Parents: 39eaae6
Author: Dylan Trotter <tr...@users.noreply.github.com>
Authored: Tue Nov 7 09:56:17 2017 -0800
Committer: James E. King, III <jk...@apache.org>
Committed: Mon Nov 20 07:34:01 2017 -0500
----------------------------------------------------------------------
compiler/cpp/src/thrift/generate/t_go_generator.cc | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/thrift/blob/cde4d418/compiler/cpp/src/thrift/generate/t_go_generator.cc
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/thrift/generate/t_go_generator.cc b/compiler/cpp/src/thrift/generate/t_go_generator.cc
index e869b00..6cce32b 100644
--- a/compiler/cpp/src/thrift/generate/t_go_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_go_generator.cc
@@ -2130,7 +2130,7 @@ void t_go_generator::generate_service_remote(t_service* tservice) {
f_remote << indent() << "var urlString string" << endl;
f_remote << indent() << "var framed bool" << endl;
f_remote << indent() << "var useHttp bool" << endl;
- f_remote << indent() << "var parsedUrl url.URL" << endl;
+ f_remote << indent() << "var parsedUrl *url.URL" << endl;
f_remote << indent() << "var trans thrift.TTransport" << endl;
f_remote << indent() << "_ = strconv.Atoi" << endl;
f_remote << indent() << "_ = math.Abs" << endl;
@@ -2147,7 +2147,8 @@ void t_go_generator::generate_service_remote(t_service* tservice) {
f_remote << indent() << "flag.Parse()" << endl;
f_remote << indent() << endl;
f_remote << indent() << "if len(urlString) > 0 {" << endl;
- f_remote << indent() << " parsedUrl, err := url.Parse(urlString)" << endl;
+ f_remote << indent() << " var err error" << endl;
+ f_remote << indent() << " parsedUrl, err = url.Parse(urlString)" << endl;
f_remote << indent() << " if err != nil {" << endl;
f_remote << indent() << " fmt.Fprintln(os.Stderr, \"Error parsing URL: \", err)" << endl;
f_remote << indent() << " flag.Usage()" << endl;
[44/50] [abbrv] thrift git commit: THRIFT-3602 Make Tornado server
send exception on unexpected handler error Client: py
Posted by je...@apache.org.
THRIFT-3602 Make Tornado server send exception on unexpected handler error
Client: py
This closes #839
This closes #1425
Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/66c3dbf2
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/66c3dbf2
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/66c3dbf2
Branch: refs/heads/0.11.0
Commit: 66c3dbf2dec91718922e815c50a55900b78a58e1
Parents: 6f82640
Author: Nobuaki Sukegawa <ns...@apache.org>
Authored: Wed Feb 10 19:37:26 2016 +0900
Committer: James E. King, III <jk...@apache.org>
Committed: Thu Nov 30 12:36:33 2017 -0500
----------------------------------------------------------------------
.../cpp/src/thrift/generate/t_py_generator.cc | 55 +++++++++++++-------
test/py.tornado/test_suite.py | 22 ++++----
2 files changed, 48 insertions(+), 29 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/thrift/blob/66c3dbf2/compiler/cpp/src/thrift/generate/t_py_generator.cc
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/thrift/generate/t_py_generator.cc b/compiler/cpp/src/thrift/generate/t_py_generator.cc
index 8851c31..3b51714 100644
--- a/compiler/cpp/src/thrift/generate/t_py_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_py_generator.cc
@@ -1995,17 +1995,16 @@ void t_py_generator::generate_process_function(t_service* tservice, t_function*
indent_down();
} else if (gen_tornado_) {
- // TODO: Propagate arbitrary exception raised by handler to client as does plain "py"
-
// Generate the function call
t_struct* arg_struct = tfunction->get_arglist();
const std::vector<t_field*>& fields = arg_struct->get_members();
vector<t_field*>::const_iterator f_iter;
- if (xceptions.size() > 0) {
- f_service_ << indent() << "try:" << endl;
- indent_up();
+ if (!tfunction->is_oneway()) {
+ indent(f_service_) << "msg_type = TMessageType.REPLY" << endl;
}
+ f_service_ << indent() << "try:" << endl;
+ indent_up();
f_service_ << indent();
if (!tfunction->is_oneway() && !tfunction->get_returntype()->is_void()) {
f_service_ << "result.success = ";
@@ -2022,27 +2021,43 @@ void t_py_generator::generate_process_function(t_service* tservice, t_function*
}
f_service_ << "))" << endl;
- if (!tfunction->is_oneway() && xceptions.size() > 0) {
- indent_down();
+ indent_down();
+ if (!tfunction->is_oneway()) {
for (x_iter = xceptions.begin(); x_iter != xceptions.end(); ++x_iter) {
- f_service_ << indent() << "except " << type_name((*x_iter)->get_type()) << " as "
- << (*x_iter)->get_name() << ":" << endl;
- if (!tfunction->is_oneway()) {
- indent_up();
- f_service_ << indent() << "result." << (*x_iter)->get_name() << " = "
- << (*x_iter)->get_name() << endl;
- indent_down();
- } else {
- f_service_ << indent() << "pass" << endl;
- }
+ const string& xname = (*x_iter)->get_name();
+ f_service_ << indent() << "except " << type_name((*x_iter)->get_type()) << " as " << xname
+ << ":" << endl
+ << indent() << indent_str() << "result." << xname << " = " << xname << endl;
}
}
+ f_service_ << indent() << "except TTransport.TTransportException:" << endl
+ << indent() << indent_str() << "raise" << endl;
+ if (!tfunction->is_oneway()) {
+ f_service_ << indent() << "except TApplicationException as ex:" << endl
+ << indent() << indent_str()
+ << "logging.exception('TApplication exception in handler')" << endl
+ << indent() << indent_str() << "msg_type = TMessageType.EXCEPTION" << endl
+ << indent() << indent_str() << "result = ex" << endl
+ << indent() << "except Exception:" << endl
+ << indent() << indent_str()
+ << "logging.exception('Unexpected exception in handler')" << endl
+ << indent() << indent_str() << "msg_type = TMessageType.EXCEPTION" << endl
+ << indent() << indent_str()
+ << "result = TApplicationException(TApplicationException.INTERNAL_ERROR, "
+ "'Internal error')"
+ << endl;
+ } else {
+ f_service_ << indent() << "except Exception:" << endl
+ << indent() << indent_str()
+ << "logging.exception('Exception in oneway handler')" << endl;
+ }
if (!tfunction->is_oneway()) {
f_service_ << indent() << "oprot.writeMessageBegin(\"" << tfunction->get_name()
- << "\", TMessageType.REPLY, seqid)" << endl << indent() << "result.write(oprot)"
- << endl << indent() << "oprot.writeMessageEnd()" << endl << indent()
- << "oprot.trans.flush()" << endl;
+ << "\", msg_type, seqid)" << endl
+ << indent() << "result.write(oprot)" << endl
+ << indent() << "oprot.writeMessageEnd()" << endl
+ << indent() << "oprot.trans.flush()" << endl;
}
// Close function
http://git-wip-us.apache.org/repos/asf/thrift/blob/66c3dbf2/test/py.tornado/test_suite.py
----------------------------------------------------------------------
diff --git a/test/py.tornado/test_suite.py b/test/py.tornado/test_suite.py
index 32d1c2e..447fde6 100755
--- a/test/py.tornado/test_suite.py
+++ b/test/py.tornado/test_suite.py
@@ -21,8 +21,8 @@
import datetime
import glob
-import sys
import os
+import sys
import time
import unittest
@@ -40,8 +40,8 @@ from tornado import gen
from tornado.testing import AsyncTestCase, get_unused_port, gen_test
from thrift import TTornado
+from thrift.Thrift import TApplicationException
from thrift.protocol import TBinaryProtocol
-from thrift.transport.TTransport import TTransportException
from ThriftTest import ThriftTest
from ThriftTest.ttypes import Xception, Xtruct
@@ -55,6 +55,8 @@ class TestHandler(object):
pass
def testString(self, s):
+ if s == 'unexpected_error':
+ raise Exception(s)
return s
def testByte(self, b):
@@ -85,7 +87,7 @@ class TestHandler(object):
x.message = s
raise x
elif s == 'throw_undeclared':
- raise ValueError("foo")
+ raise ValueError('testing undeclared exception')
def testOneway(self, seconds):
start = time.time()
@@ -97,6 +99,7 @@ class TestHandler(object):
self.test_instance.io_loop.add_timeout(
datetime.timedelta(seconds=seconds),
fire_oneway)
+ raise Exception('testing exception in oneway method')
def testNest(self, thing):
return thing
@@ -187,10 +190,11 @@ class ThriftTestCase(AsyncTestCase):
self.assertEqual(y.i32_thing, -3)
self.assertEqual(y.i64_thing, -5)
+ @gen_test
def test_oneway(self):
- self.client.testOneway(0)
- start, end, seconds = self.wait(timeout=1)
- self.assertAlmostEqual(seconds, (end - start), places=3)
+ self.client.testOneway(1)
+ v = yield self.client.testI32(-1)
+ self.assertEqual(v, -1)
@gen_test
def test_map(self):
@@ -203,8 +207,6 @@ class ThriftTestCase(AsyncTestCase):
@gen_test
def test_exception(self):
- yield self.client.testException('Safe')
-
try:
yield self.client.testException('Xception')
except Xception as ex:
@@ -214,11 +216,13 @@ class ThriftTestCase(AsyncTestCase):
self.fail("should have gotten exception")
try:
yield self.client.testException('throw_undeclared')
- except TTransportException as ex:
+ except TApplicationException:
pass
else:
self.fail("should have gotten exception")
+ yield self.client.testException('Safe')
+
def suite():
suite = unittest.TestSuite()
[29/50] [abbrv] thrift git commit: update docker build instructions
Posted by je...@apache.org.
update docker build instructions
Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/cfb0130a
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/cfb0130a
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/cfb0130a
Branch: refs/heads/0.11.0
Commit: cfb0130a75987e73c86a4e9269f23c3d7d0cb54c
Parents: 4f77ab8
Author: James E. King, III <jk...@apache.org>
Authored: Sat Nov 11 09:39:19 2017 -0500
Committer: James E. King, III <jk...@apache.org>
Committed: Sat Nov 11 09:40:02 2017 -0500
----------------------------------------------------------------------
README.md | 7 ++++-
build/docker/README.md | 62 ++++++++++++++++++++++++++++++++++++++++-----
2 files changed, 62 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/thrift/blob/cfb0130a/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 4230681..2ef9a5e 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
Apache Thrift
=============
-Last Modified: 2014-03-16
+Last Modified: 2017--10
License
=======
@@ -171,3 +171,8 @@ To run the cross-language test suite, please run:
This will run a set of tests that use different language clients and
servers.
+Development
+===========
+
+To build the same way Travis CI builds the project you should use docker.
+We have [comprehensive building instructions for docker](build/docker/README.md).
http://git-wip-us.apache.org/repos/asf/thrift/blob/cfb0130a/build/docker/README.md
----------------------------------------------------------------------
diff --git a/build/docker/README.md b/build/docker/README.md
index 4cada36..dd0b178 100644
--- a/build/docker/README.md
+++ b/build/docker/README.md
@@ -49,17 +49,67 @@ These containers may be in various states, and may not build everything.
* stretch
* make check in lib/cpp fails due to https://svn.boost.org/trac10/ticket/12507
-## Building Locally ##
+## Building like Travis CI does, locally ##
-From the Apache Thrift code base root:
+We recommend you build locally the same way Travis CI does, so that when you submit your pull request you will run into fewer surprises. To make it a little easier, put the following into your `~/.bash_aliases` file:
-* Build the image
+ # Kill all running containers.
+ alias dockerkillall='docker kill $(docker ps -q)'
- docker build -t thrift build/docker/ubuntu-xenial
+ # Delete all stopped containers.
+ alias dockercleanc='printf "\n>>> Deleting stopped containers\n\n" && docker rm $(docker ps -a -q)'
-* Open a command prompt in the image
+ # Delete all untagged images.
+ alias dockercleani='printf "\n>>> Deleting untagged images\n\n" && docker rmi $(docker images -q -f dangling=true)'
- docker run -v $(pwd):/thrift/src -it thrift /bin/bash
+ # Delete all stopped containers and untagged images.
+ alias dockerclean='dockercleanc || true && dockercleani'
+
+ # Build a thrift docker image (run from top level of git repo): argument #1 is image type (ubuntu, centos, etc).
+ function dockerbuild
+ {
+ docker build -t $1 build/docker/$1
+ }
+
+ # Run a thrift docker image: argument #1 is image type (ubuntu, centos, etc).
+ function dockerrun
+ {
+ docker run -v $(pwd):/thrift/src -it $1 /bin/bash
+ }
+
+To pull down the current image being used to build (the same way Travis CI does it) - if it is out of date in any way it will build a new one for you:
+
+ thrift$ DOCKER_REPO=thrift/thrift-build DISTRO=ubuntu-xenial build/docker/refresh.sh
+
+To run all unit tests (just like Travis CI):
+
+ thrift$ dockerrun ubuntu-xenial
+ root@8caf56b0ce7b:/thrift/src# build/docker/scripts/autotools.sh
+
+To run the cross tests (just like Travis CI):
+
+ thrift$ dockerrun ubuntu-xenial
+ root@8caf56b0ce7b:/thrift/src# build/docker/scripts/cross-test.sh
+
+When you are done, you want to clean up occasionally so that docker isn't using lots of extra disk space:
+
+ thrift$ dockerclean
+
+You need to run the docker commands from the root of the git repository for them to work.
+
+When you are done in the root docker shell you can `exit` to go back to your user host shell. Once the unit tests and cross test passes locally, then submit he changes, and squash the pull request to one commit to make it easier to merge. Thanks. I am going to update the docker README.md with this information so others can leverage it too. Now you are building like Travis CI does!
+
+## Raw Commands for Building with Docker ##
+
+If you do not want to use the same scripts Travis CI does, you can do it manually:
+
+Build the image:
+
+ thrift$ docker build -t thrift build/docker/ubuntu-xenial
+
+Open a command prompt in the image:
+
+ thrift$ docker run -v $(pwd):/thrift/src -it thrift /bin/bash
## Core Tool Versions per Dockerfile ##
[16/50] [abbrv] thrift git commit: add stdc++ back for php extension
build Client: php
Posted by je...@apache.org.
add stdc++ back for php extension build
Client: php
This closes #1400
Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/e5494555
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/e5494555
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/e5494555
Branch: refs/heads/0.11.0
Commit: e54945551f7fcd7d7decc959871f370b489f7fa0
Parents: 350fe75
Author: Robert Lu <ro...@gmail.com>
Authored: Thu Oct 26 02:39:17 2017 +0800
Committer: James E. King, III <jk...@apache.org>
Committed: Thu Oct 26 12:02:20 2017 -0400
----------------------------------------------------------------------
lib/php/src/ext/thrift_protocol/config.m4 | 2 ++
1 file changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/thrift/blob/e5494555/lib/php/src/ext/thrift_protocol/config.m4
----------------------------------------------------------------------
diff --git a/lib/php/src/ext/thrift_protocol/config.m4 b/lib/php/src/ext/thrift_protocol/config.m4
index c54be3e..e2138c8 100644
--- a/lib/php/src/ext/thrift_protocol/config.m4
+++ b/lib/php/src/ext/thrift_protocol/config.m4
@@ -25,6 +25,8 @@ PHP_ARG_ENABLE(thrift_protocol, whether to enable the thrift_protocol extension,
if test "$PHP_THRIFT_PROTOCOL" != "no"; then
PHP_REQUIRE_CXX()
+ PHP_ADD_LIBRARY_WITH_PATH(stdc++, "", THRIFT_PROTOCOL_SHARED_LIBADD)
+ PHP_SUBST(THRIFT_PROTOCOL_SHARED_LIBADD)
CXXFLAGS="$CXXFLAGS -std=c++11"
PHP_NEW_EXTENSION(thrift_protocol, php_thrift_protocol.cpp, $ext_shared)
[50/50] [abbrv] thrift git commit: Version 0.11.0
Posted by je...@apache.org.
Version 0.11.0
Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/1310dc1e
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/1310dc1e
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/1310dc1e
Branch: refs/heads/0.11.0
Commit: 1310dc1eb4014457a667a7287d1fa113432c7a54
Parents: 1c7bf3e
Author: Jens Geyer <je...@apache.org>
Authored: Wed Nov 29 22:35:29 2017 +0100
Committer: Jens Geyer <je...@apache.org>
Committed: Fri Dec 1 23:13:19 2017 +0100
----------------------------------------------------------------------
CHANGES | 303 +++++++++++++++++++
LANGUAGES.md | 2 +-
Thrift.podspec | 4 +-
appveyor.yml | 2 +-
build/cmake/DefineCMakeDefaults.cmake | 2 +-
composer.json | 2 +-
configure.ac | 2 +-
contrib/Rebus/Properties/AssemblyInfo.cs | 4 +-
contrib/fb303/py/setup.py | 2 +-
contrib/thrift-maven-plugin/pom.xml | 2 +-
contrib/vagrant/centos-6.5/README.md | 2 +-
contrib/zeromq/csharp/ThriftZMQ.csproj | 20 +-
debian/changelog | 3 +-
doap.rdf | 5 +
lib/cocoa/src/Thrift.h | 2 +-
lib/cpp/src/thrift/windows/config.h | 1 +
.../ThriftMSBuildTask/ThriftMSBuildTask.csproj | 2 +-
lib/csharp/src/Properties/AssemblyInfo.cs | 4 +-
lib/csharp/src/Thrift.csproj | 2 +-
lib/csharp/test/JSON/Properties/AssemblyInfo.cs | 4 +-
.../Multiplex/Client/MultiplexClient.csproj | 2 +-
.../Multiplex/Client/Properties/AssemblyInfo.cs | 4 +-
.../Multiplex/Server/MultiplexServer.csproj | 2 +-
.../Multiplex/Server/Properties/AssemblyInfo.cs | 4 +-
.../ThriftMVCTest/Properties/AssemblyInfo.cs | 4 +-
lib/d/src/thrift/base.d | 2 +-
lib/dart/pubspec.yaml | 4 +-
lib/delphi/src/Thrift.pas | 2 +-
lib/erl/src/thrift.app.src | 2 +-
lib/go/thrift/serializer_types_test.go | 2 +-
lib/haxe/README.md | 6 +-
lib/haxe/haxelib.json | 2 +-
lib/hs/thrift.cabal | 2 +-
lib/java/build.properties | 2 +-
lib/js/package.json | 2 +-
lib/js/src/thrift.js | 2 +-
lib/lua/THttpTransport.lua | 2 +-
lib/netcore/Thrift/Properties/AssemblyInfo.cs | 4 +-
.../Transports/Client/THttpClientTransport.cs | 2 +-
lib/ocaml/_oasis | 2 +-
lib/perl/lib/Thrift.pm | 2 +-
lib/py/setup.py | 2 +-
lib/rb/thrift.gemspec | 2 +-
lib/rs/Cargo.toml | 2 +-
lib/st/package.xml | 2 +-
package.json | 2 +-
sonar-project.properties | 6 +-
test/csharp/Properties/AssemblyInfo.cs | 4 +-
test/csharp/ThriftTest.csproj | 2 +-
test/dart/test_client/pubspec.yaml | 2 +-
test/erl/src/thrift_test.app.src | 2 +-
.../CsharpClient/Properties/AssemblyInfo.cs | 4 +-
.../CsharpServer/Properties/AssemblyInfo.cs | 4 +-
tutorial/dart/client/pubspec.yaml | 4 +-
tutorial/dart/console_client/pubspec.yaml | 2 +-
tutorial/dart/server/pubspec.yaml | 2 +-
tutorial/delphi/DelphiClient/DelphiClient.dproj | 4 +-
tutorial/delphi/DelphiServer/DelphiServer.dproj | 4 +-
tutorial/hs/ThriftTutorial.cabal | 2 +-
tutorial/ocaml/_oasis | 2 +-
60 files changed, 404 insertions(+), 76 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/thrift/blob/1310dc1e/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 7b674d6..e0a3e0b 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,308 @@
Apache Thrift Changelog
+Thrift 0.11.0
+--------------------------------------------------------------------------------
+## Sub-task
+ * [THRIFT-2733] - Erlang coding standards
+ * [THRIFT-2740] - Perl coding standards
+ * [THRIFT-3610] - Streamline exception handling in Python server handler
+ * [THRIFT-3686] - Java processor should report internal error on uncaught exception
+ * [THRIFT-4047] - Skip() should throw TProtocolException.INVALID_DATA on unknown data types
+ * [THRIFT-4048] - Skip() should throw TProtocolException.INVALID_DATA on unknown data types
+ * [THRIFT-4049] - Skip() should throw TProtocolException.INVALID_DATA on unknown data types
+ * [THRIFT-4050] - Skip() should throw TProtocolException.INVALID_DATA on unknown data types
+ * [THRIFT-4051] - Skip() should throw TProtocolException.INVALID_DATA on unknown data types
+ * [THRIFT-4052] - Skip() should throw TProtocolException.INVALID_DATA on unknown data types
+ * [THRIFT-4053] - Skip() should throw TProtocolException.INVALID_DATA on unknown data types
+ * [THRIFT-4054] - Skip() should throw TProtocolException.INVALID_DATA on unknown data types
+ * [THRIFT-4055] - Skip() should throw TProtocolException.INVALID_DATA on unknown data types
+ * [THRIFT-4056] - Skip() should throw TProtocolException.INVALID_DATA on unknown data types
+ * [THRIFT-4057] - Skip() should throw TProtocolException.INVALID_DATA on unknown data types
+ * [THRIFT-4058] - Skip() should throw TProtocolException.INVALID_DATA on unknown data types
+ * [THRIFT-4136] - Align is_binary() method with is_string() to simplify those checks
+ * [THRIFT-4137] - Fix remaining undefined behavior invalid vptr casts in Thrift Compiler
+ * [THRIFT-4138] - Fix remaining undefined behavior invalid vptr casts in C++ library
+ * [THRIFT-4296] - Fix Ubuntu Xenial build environment for the python language
+ * [THRIFT-4298] - Fix Ubuntu Xenial build environment for the go 1.6 language
+ * [THRIFT-4299] - Fix Ubuntu Xenial build environment for the D language
+ * [THRIFT-4300] - Fix make cross in Ubuntu Xenial docker environment, once all language support issues are fixed
+ * [THRIFT-4302] - Fix Ubuntu Xenial make cross testing for lua and php7
+ * [THRIFT-4398] - Update EXTRA_DIST for "make dist"
+
+## Bug
+ * [THRIFT-381] - Fail fast if configure detects C++ problems
+ * [THRIFT-1677] - MinGW support broken
+ * [THRIFT-1805] - Thrift should not swallow ALL exceptions
+ * [THRIFT-2026] - Fix TCompactProtocol 64 bit builds
+ * [THRIFT-2642] - Recursive structs don't work in python
+ * [THRIFT-2889] - stable release 0.9.2, erlang tutorial broken
+ * [THRIFT-2913] - Ruby Server Thrift::ThreadPoolServer should serve inside a thread
+ * [THRIFT-2998] - Node.js: Missing header from http request
+ * [THRIFT-3000] - .NET implementation has trouble with mixed IP modes
+ * [THRIFT-3281] - Travis CI build passed but the log says BUILD FAILED
+ * [THRIFT-3358] - Makefile:1362: *** missing separator. Stop.
+ * [THRIFT-3600] - Make TTwisted server send exception on unexpected handler error
+ * [THRIFT-3602] - Make Tornado server send exception on unexpected handler error
+ * [THRIFT-3657] - D TFileWriterTransport close should use non-priority send
+ * [THRIFT-3700] - Go Map has wrong default value when optional
+ * [THRIFT-3703] - Unions Field Count Does Not Consider Map/Set/List Fields
+ * [THRIFT-3730] - server log error twice
+ * [THRIFT-3778] - go client can not pass method parameter to server of other language if no field_id is given
+ * [THRIFT-3784] - thrift-maven-plugin generates invalid include directories for IDL in dependency JARs
+ * [THRIFT-3801] - Node Thrift client throws exception with multiplexer and responses that are bigger than a single buffer
+ * [THRIFT-3821] - TMemoryBuffer buffer may overflow when resizing
+ * [THRIFT-3832] - Thrift version 0.9.3 example on Windows, Visual Studio, linking errors during compiling
+ * [THRIFT-3847] - thrift/config.h includes a #define for VERSION which will likely conflict with existing user environment or code
+ * [THRIFT-3873] - Fix various build warnings when using Visual Studio
+ * [THRIFT-3891] - TNonblockingServer configured with more than one IO threads does not always return from serve() upon stop()
+ * [THRIFT-3892] - Thrift uses TLS SNI extension provided by OpenSSL library. Older version of OpenSSL(< 0.9.8f) may create problem because they do not support 'SSL_set_tlsext_host_name()'.
+ * [THRIFT-3895] - Build fails using Java 1.8 with Ant < 1.9
+ * [THRIFT-3896] - map<string,string> data with number string key cannot access that deserialized by php extension
+ * [THRIFT-3938] - Python TNonblockingServer does not work with SSL
+ * [THRIFT-3944] - TSSLSocket has dead code in checkHandshake
+ * [THRIFT-3946] - Java 1.5 compatibility broken for binary fields (java5 option)
+ * [THRIFT-3960] - Inherited services in Lua generator are not named correctly
+ * [THRIFT-3962] - Ant build.xml broken on Windows for Java library
+ * [THRIFT-3963] - Thrift.cabal filename does not match module name
+ * [THRIFT-3967] - gobject/gparam.h:166:33: warning: enumerator value for ‘G_PARAM_DEPRECATED’ is not an integer constant expression
+ * [THRIFT-3968] - Deserializing empty string/binary fields
+ * [THRIFT-3974] - Using clang-3.8 and ThreadSanitizer on the concurrency_test claims bad PThread behavior
+ * [THRIFT-3984] - PHP7 extension causes segfault
+ * [THRIFT-4008] - broken ci due to upstream dependency versioning break
+ * [THRIFT-4009] - Use @implementer instead of implements in TTwisted.py
+ * [THRIFT-4010] - Q.fcall messing up with *this* pointer inside called function
+ * [THRIFT-4011] - Sets of Thrift structs generate Go code that can't be serialized to JSON
+ * [THRIFT-4012] - Python Twisted implementation uses implements, not compatible with Py3
+ * [THRIFT-4014] - align C# meta data in AssemblyInfo.cs
+ * [THRIFT-4015] - Fix wrongly spelled "Thirft"s
+ * [THRIFT-4016] - testInsanity() impl does not conform to test spec in ThriftTest.thrift
+ * [THRIFT-4023] - Skip unexpected field types on read/write
+ * [THRIFT-4024] - Skip() should throw on unknown data types
+ * [THRIFT-4026] - TSSLSocket doesn't work with Python < 2.7.9
+ * [THRIFT-4029] - Accelerated protocols do not build from thrift-py 0.10.0 on PyPI
+ * [THRIFT-4031] - Go plugin generates invalid code for lists of typedef'ed built-in types
+ * [THRIFT-4033] - Default build WITH_PLUGIN=ON for all builds results in packaging errors
+ * [THRIFT-4034] - CMake doesn't work to build compiler on MacOS
+ * [THRIFT-4036] - Add .NET Core environment/build support to the docker image
+ * [THRIFT-4038] - socket check: checking an unsigned number against >= 0 never fails
+ * [THRIFT-4042] - ExtractionError when using accelerated thrift in a multiprocess test
+ * [THRIFT-4043] - thrift perl debian package is placing files in the wrong place
+ * [THRIFT-4044] - Build job 17 failing on every pull request; hspec core (haskell) 2.4 issue
+ * [THRIFT-4046] - MinGW with gcc 6.2 does not compile on Windows
+ * [THRIFT-4060] - Thrift printTo ostream overload mechanism breaks down when types are nested
+ * [THRIFT-4062] - Remove debug print from TServiceClient
+ * [THRIFT-4065] - Document Perl ForkingServer signal restriction imposed by THRIFT-3848 and remove unnecessary code
+ * [THRIFT-4068] - A code comment in Java ServerSocket is wrong around accept()
+ * [THRIFT-4073] - enum files are still being generated with unused imports
+ * [THRIFT-4076] - Appveyor builds failing because ant 1.9.8 was removed from apache servers
+ * [THRIFT-4077] - AI_ADDRCONFIG redefined after recent change to PlatformSocket header
+ * [THRIFT-4079] - Generated perl code that returns structures from included thrift files is missing a necessary use clause
+ * [THRIFT-4087] - Spurious exception destroying TThreadedServer because of incorrect join() call
+ * [THRIFT-4102] - TBufferedTransport performance issue since 0.10.0
+ * [THRIFT-4106] - concurrency_test fails randomly
+ * [THRIFT-4108] - c_glib thrift ssl has multiple bugs and deprecated functions
+ * [THRIFT-4109] - Configure Script uses string comparison for versions
+ * [THRIFT-4129] - C++ TNonblockingServer fd leak when failing to dispatch new connections
+ * [THRIFT-4131] - Javascript with WebSocket handles oneway methods wrong
+ * [THRIFT-4134] - Fix remaining undefined behavior invalid vptr casts
+ * [THRIFT-4140] - Use of non-thread-safe function gmtime()
+ * [THRIFT-4141] - Installation of haxe in docker files refers to a redirect link and fails
+ * [THRIFT-4146] - Appveyor builds are being triggered by apache master pushes
+ * [THRIFT-4147] - Rust: protocol should accept transports with non-static lifetime
+ * [THRIFT-4148] - [maven-thrift-plugin] compile error while import a thrift in dependency jar file.
+ * [THRIFT-4149] - System.out pollutes log files
+ * [THRIFT-4154] - PHP close() of a TSocket needs to close any type of socket
+ * [THRIFT-4158] - minor issue in README-MSYS2.md
+ * [THRIFT-4159] - Building tests fails on MSYS2 (MinGW64) due to a (small?) linker error
+ * [THRIFT-4160] - TNonblocking server fix use of closed/freed connections
+ * [THRIFT-4161] - TNonBlocking server using uninitialized event in error paths
+ * [THRIFT-4162] - TNonBlocking handling of TSockets in error state is incorrect after fd is closed
+ * [THRIFT-4164] - Core in TSSLSocket cleanupOpenSSL when destroying a mutex used by openssl
+ * [THRIFT-4165] - C++ build has many warnings under c++03 due to recent changes, cmake needs better platform-independent language level control
+ * [THRIFT-4166] - Recent fix to remove boost::lexical_cast usage broke VS2010
+ * [THRIFT-4167] - Missing compile flag
+ * [THRIFT-4170] - Support lua 5.1 or earlier properly for object length determination
+ * [THRIFT-4172] - node.js tutorial client does not import assert, connection issues are not handled properly
+ * [THRIFT-4177] - Java compiler produces deep copy constructor that could make shallow copy instead
+ * [THRIFT-4184] - Building on Appveyor: invalid escape sequence \L
+ * [THRIFT-4185] - fb303 counter encoding fix
+ * [THRIFT-4189] - Framed/buffered transport Dispose() does not dispose the nested transport
+ * [THRIFT-4193] - Lower the default maxReadBufferBytes for non-blocking servers
+ * [THRIFT-4195] - Compilation to GO produces broken code
+ * [THRIFT-4196] - Cannot generate recursive Rust types
+ * [THRIFT-4204] - typo in compact spec
+ * [THRIFT-4206] - Strings in container fields are not decoded properly with py:dynamic and py:utf8strings
+ * [THRIFT-4208] - C# NamedPipesServer not really working in some scenarios
+ * [THRIFT-4211] - Fix GError glib management under Thrift
+ * [THRIFT-4212] - c_glib flush tries to close SSL even if socket is invalid
+ * [THRIFT-4213] - Travis build fails at curl -sSL https://www.npmjs.com/install.sh | sh
+ * [THRIFT-4215] - Golang TTransportFactory Pattern Squelches Errors
+ * [THRIFT-4216] - Golang Http Clients Do Not Respect User Options
+ * [THRIFT-4218] - Set TCP_NODELAY for PHP client socket
+ * [THRIFT-4219] - Golang HTTP clients created with Nil buffer
+ * [THRIFT-4231] - TJSONProtocol throws unexpected non-Thrift-exception on null strings
+ * [THRIFT-4232] - ./configure does bad ant version check
+ * [THRIFT-4234] - Travis build fails cross language tests with "Unsupported security protocol type"
+ * [THRIFT-4237] - Go TServerSocket Race Conditions
+ * [THRIFT-4240] - Go TSimpleServer does not close properly
+ * [THRIFT-4243] - Go TSimpleServer race on wait in Stop() method
+ * [THRIFT-4245] - Golang TFramedTransport's writeBuffer increases if writes to transport failed
+ * [THRIFT-4246] - Sequence number mismatch on multiplexed clients
+ * [THRIFT-4247] - Compile fails with openssl 1.1
+ * [THRIFT-4248] - Compile fails - strncpy, memcmp, memset not declared in src/thrift/transport/TSSLSocket.cpp
+ * [THRIFT-4251] - Java Epoll Selector Bug
+ * [THRIFT-4257] - Typescript async callbacks do not provide the correct types
+ * [THRIFT-4258] - Boost/std thread wrapping faultiness
+ * [THRIFT-4260] - Go context generation issue. Context is parameter in Interface not in implementation
+ * [THRIFT-4261] - Go context generation issue: breaking change in generated code regarding thrift.TProcessorFunction interface
+ * [THRIFT-4262] - Invalid binding to InterlockedCompareExchange64() with 64-bit targets
+ * [THRIFT-4263] - Fix use after free bug for thrown exceptions
+ * [THRIFT-4266] - Erlang library throws during skipping fields of composite type (maps, lists, structs, sets)
+ * [THRIFT-4268] - Erlang library emits debugging output in transport layer
+ * [THRIFT-4273] - erlang:now/0: Deprecated BIF.
+ * [THRIFT-4274] - Python feature tests for SSL/TLS failing
+ * [THRIFT-4279] - Wrong path in include directive in generated Thrift sources
+ * [THRIFT-4283] - TNamedPipeServer race condition in interrupt
+ * [THRIFT-4284] - File contains a NBSP: lib/nodejs/lib/thrift/web_server.js
+ * [THRIFT-4290] - C# nullable option generates invalid code for non-required enum field with default value
+ * [THRIFT-4292] - TimerManager::remove() is not implemented
+ * [THRIFT-4307] - Make ssl-open timeout effective in golang client
+ * [THRIFT-4312] - Erlang client cannot connect to Python server: exception error: econnrefused
+ * [THRIFT-4313] - Program code of the Erlang tutorial files contain syntax errors
+ * [THRIFT-4316] - TByteBuffer.java will read too much data if a previous read returns fewer bytes than requested
+ * [THRIFT-4319] - command line switch for "evhttp" incorrectly resolved to anon pipes
+ * [THRIFT-4323] - range check errors or NPE in edge cases
+ * [THRIFT-4324] - field names can conflict with local vars in generated code
+ * [THRIFT-4328] - Travis CI builds are timing out (job 1) and haxe builds are failing since 9/11
+ * [THRIFT-4329] - c_glib Doesn't have a multiplexed processor
+ * [THRIFT-4331] - C++: TSSLSockets bug in handling huge messages, bug in handling polling
+ * [THRIFT-4332] - Binary protocol has memory leaks
+ * [THRIFT-4334] - Perl indentation incorrect when defaulting field attribute to a struct
+ * [THRIFT-4339] - Thrift Framed Transport in Erlang crashes server when client disconnects
+ * [THRIFT-4340] - Erlang fix a crash on client close
+ * [THRIFT-4355] - Javascript indentation incorrect when defaulting field attribute to a struct
+ * [THRIFT-4356] - thrift_protocol call Transport cause Segmentation fault
+ * [THRIFT-4359] - Haxe compiler looks like it is producing incorrect code for map or set key that is binary type
+ * [THRIFT-4362] - Missing size-check can lead to huge memory allocation
+ * [THRIFT-4364] - Website contributing guide erroneously recommends submitting patches in JIRA
+ * [THRIFT-4365] - Perl generated code uses indirect object syntax, which occasionally causes compilation errors.
+ * [THRIFT-4367] - python TProcessor.process is missing "self"
+ * [THRIFT-4370] - Ubuntu Artful cppcheck and flake8 are more stringent and causing SCA build job failures
+ * [THRIFT-4372] - Pipe write operations across a network are limited to 65,535 bytes per write.
+ * [THRIFT-4374] - cannot load thrift_protocol due to undefined symbol: _ZTVN10__cxxabiv120__si_class_type_infoE
+ * [THRIFT-4376] - Coverity high impact issue resolution
+ * [THRIFT-4377] - haxe. socket handles leak in TSimpleServer
+ * [THRIFT-4381] - Wrong isset bitfield value after transmission
+ * [THRIFT-4384] - Using multiple services simultaneously is not thread-safe.
+ * [THRIFT-4385] - Go remote client -u flag is broken
+ * [THRIFT-4392] - compiler/..../plugin.thrift structs mis-ordered blows up ocaml generator
+ * [THRIFT-4395] - Unable to build in the ubuntu-xenial docker image: clap 2.28 requires Rust 1.20
+ * [THRIFT-4396] - inconsistent (or plain wrong) version numbers in master/trunk
+
+## Documentation
+ * [THRIFT-4157] - outdated readme about Haxe installation on Linux
+
+## Improvement
+ * [THRIFT-105] - make a thrift_spec for a structures with negative tags
+ * [THRIFT-281] - Cocoa library code needs comments, badly
+ * [THRIFT-775] - performance improvements for Perl
+ * [THRIFT-2221] - Generate c++ code with std::shared_ptr instead of boost::shared_ptr.
+ * [THRIFT-2364] - OCaml: Use Oasis exclusively for build process
+ * [THRIFT-2504] - TMultiplexedProcessor should allow registering default processor called if no service name is present
+ * [THRIFT-3207] - Enable build with OpenSSL 1.1.0 series
+ * [THRIFT-3272] - Perl SSL Authentication Support
+ * [THRIFT-3357] - Generate EnumSet/EnumMap where elements/keys are enums
+ * [THRIFT-3369] - Implement SSL/TLS support on C with c_glib
+ * [THRIFT-3467] - Go Maps for Thrift Sets Should Have Values of Type struct{}
+ * [THRIFT-3627] - Missing basic code style consistency of JavaScript.
+ * [THRIFT-3706] - There's no support for Multiplexed protocol on c_glib library
+ * [THRIFT-3766] - Add getUnderlyingTransport() to TZlibTransport
+ * [THRIFT-3776] - Go code from multiple thrift files with the same namespace
+ * [THRIFT-3823] - Escape documentation while generating non escaped documetation
+ * [THRIFT-3854] - allow users to clear read buffers
+ * [THRIFT-3859] - Unix Domain Socket Support in Objective-C
+ * [THRIFT-3921] - C++ code should print enums as strings
+ * [THRIFT-3926] - There should be an error emitted when http status code is not 200
+ * [THRIFT-4000] - Add union test to Test Suite
+ * [THRIFT-4007] - Micro-optimization of TTransport.py
+ * [THRIFT-4040] - Add real cause of TNonblockingServerSocket error to exception
+ * [THRIFT-4064] - Update node library dependencies
+ * [THRIFT-4069] - All perl packages should have proper namespace, version syntax, and use proper thrift exceptions
+ * [THRIFT-4071] - Consolidate the Travis CI jobs where possible to put less stress on the Apache Foundation's allocation of CI build slaves
+ * [THRIFT-4072] - Add the possibility to send custom headers in TCurlClient
+ * [THRIFT-4075] - Better MinGW support for headers-only boost (without thread library)
+ * [THRIFT-4081] - Provide a MinGW 64-bit Appveyor CI build for better pull request validation
+ * [THRIFT-4084] - Improve SSL security in thrift by adding a make cross client that checks to make sure SSLv3 protocol cannot be negotiated
+ * [THRIFT-4095] - Add multiplexed protocol to Travis CI for make cross
+ * [THRIFT-4099] - Auto-derive Hash for generated Rust structs
+ * [THRIFT-4110] - The debian build files do not produce a "-dbg" package for debug symbols of libthrift0
+ * [THRIFT-4114] - Space after '///' in doc comments
+ * [THRIFT-4126] - Validate objects in php extension
+ * [THRIFT-4130] - Ensure Apache Http connection is released back to pool after use
+ * [THRIFT-4151] - Thrift Mutex Contention Profiling (pthreads) should be disabled by default
+ * [THRIFT-4168] - Travis CI builds are being triggered by apache master pushes
+ * [THRIFT-4176] - Implement a threaded and threadpool server type for Rust
+ * [THRIFT-4183] - Named pipe client blocks forever on Open() when there is no server at the other end
+ * [THRIFT-4190] - improve C# TThreadPoolServer defaults
+ * [THRIFT-4197] - Implement transparent gzip compression for HTTP transport
+ * [THRIFT-4198] - Ruby should log Thrift internal errors to global logger
+ * [THRIFT-4203] - thrift server stop gracefully
+ * [THRIFT-4205] - c_glib is not linking against glib + gobject
+ * [THRIFT-4209] - warning CS0414 in T[TLS]ServerSocket.cs
+ * [THRIFT-4210] - include Thrift.45.csproj into CI runs
+ * [THRIFT-4217] - HttpClient should support gzip and deflate
+ * [THRIFT-4222] - Support Unix Domain Sockets in Golang TServerSocket
+ * [THRIFT-4233] - Make THsHaServer.invoker available (get method only) in inherited classes
+ * [THRIFT-4236] - Support context in go generated code.
+ * [THRIFT-4238] - JSON generator: make annotation-aware
+ * [THRIFT-4269] - Don't append '.' to Erlang namespace if it ends in '_'.
+ * [THRIFT-4270] - Generate Erlang mapping functions for const maps and lists
+ * [THRIFT-4275] - Add support for zope.interface only, apart from twisted support.
+ * [THRIFT-4285] - Pull generated send/recv into library to allow behaviour to be customised
+ * [THRIFT-4287] - Add c++ compiler "no_skeleton" flag option
+ * [THRIFT-4288] - Implement logging levels properly for node.js
+ * [THRIFT-4295] - Refresh the Docker image file suite for Ubuntu, Debian, and CentOS
+ * [THRIFT-4305] - Emit ddoc for generated items
+ * [THRIFT-4306] - Thrift imports not replicated to D service output
+ * [THRIFT-4315] - Add default message for TApplicationException
+ * [THRIFT-4318] - Delphi performance improvements
+ * [THRIFT-4325] - Simplify automake cross compilation by relying on one global THRIFT compiler path
+ * [THRIFT-4327] - Improve TimerManager API to allow removing specific task
+ * [THRIFT-4330] - Allow unused crates in Rust files
+ * [THRIFT-4333] - Erlang tutorial examples are using a different port (9999)
+ * [THRIFT-4343] - Change CI builds to use node.js 8.x LTS once available
+ * [THRIFT-4345] - Create a docker build environment that uses the minimum supported language levels
+ * [THRIFT-4346] - Allow Zlib transport factory to wrap other transports
+ * [THRIFT-4348] - Perl HTTP Client custom HTTP headers
+ * [THRIFT-4350] - Update netcore build for dotnet 2.0 sdk and make cross validation
+ * [THRIFT-4351] - Use Travis CI Build Stages to optimize the CI build
+ * [THRIFT-4353] - cannot read via thrift_protocol at server side
+ * [THRIFT-4378] - add set stopTimeoutUnit method to TThreadPoolServer
+
+## New Feature
+ * [THRIFT-750] - C++ Compiler Virtual Function Option
+ * [THRIFT-2945] - Implement support for Rust language
+ * [THRIFT-3857] - thrift js:node complier support an object as parameter not an instance of struct
+ * [THRIFT-3933] - Port official C# .NET library for Thrift to C# .NET Core libary
+ * [THRIFT-4039] - Update of Apache Thrift .Net Core lib
+ * [THRIFT-4113] - Provide a buffer transport for reading/writing in memory byte stream
+
+## Question
+ * [THRIFT-2956] - autoconf - possibly undefined macro - AC_PROG_BISON
+ * [THRIFT-4223] - Add support to the isServing() method for the C++ library
+
+## Task
+ * [THRIFT-3622] - Fix deprecated uses of std::auto_ptr
+ * [THRIFT-4028] - Please remove System.out.format from the source code
+ * [THRIFT-4186] - Build and test rust client in Travis
+
+## Test
+ * [THRIFT-4264] - PHP - Support both shared & static linking of sockets library
+
+## Wish
+ * [THRIFT-4344] - Define and maintain the minimum language level for all languages in one place
+
+
Thrift 0.10.0
--------------------------------------------------------------------------------
## Bug
http://git-wip-us.apache.org/repos/asf/thrift/blob/1310dc1e/LANGUAGES.md
----------------------------------------------------------------------
diff --git a/LANGUAGES.md b/LANGUAGES.md
index 79fcf28..2f68a4e 100644
--- a/LANGUAGES.md
+++ b/LANGUAGES.md
@@ -1,7 +1,7 @@
# Apache Thrift Language Support #
Last Modified: 2017-10-05<br>
-Version: 0.10.0+
+Version: 0.11.0+
Thrift supports many programming languages and has an impressive test suite that exercises most of the languages, protocols, and transports that represents a matrix of thousands of possible combinations. Each language typically has a minimum required version as well as support libraries - some mandatory and some optional. All of this information is provided below to help you assess whether you can use Apache Thrift with your project. Obviously this is a complex matrix to maintain and may not be correct in all cases - if you spot an error please inform the developers using the mailing list.
http://git-wip-us.apache.org/repos/asf/thrift/blob/1310dc1e/Thrift.podspec
----------------------------------------------------------------------
diff --git a/Thrift.podspec b/Thrift.podspec
index 39d3780..6f8ebb7 100644
--- a/Thrift.podspec
+++ b/Thrift.podspec
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "Thrift"
- s.version = "1.0.0"
+ s.version = "0.11.0"
s.summary = "Apache Thrift is a lightweight, language-independent software stack with an associated code generation mechanism for RPC."
s.description = <<-DESC
The Apache Thrift software framework, for scalable cross-language services development, combines a software stack with a code generation engine to build services that work efficiently and seamlessly between C++, Java, Python, PHP, Ruby, Erlang, Perl, Haskell, C#, Cocoa, JavaScript, Node.js, Smalltalk, OCaml and Delphi and other languages.
@@ -13,6 +13,6 @@ The Apache Thrift software framework, for scalable cross-language services devel
s.osx.deployment_target = '10.8'
s.ios.framework = 'CFNetwork'
s.osx.framework = 'CoreServices'
- s.source = { :git => "https://github.com/apache/thrift.git", :tag => "thrift-1.0.0" }
+ s.source = { :git => "https://github.com/apache/thrift.git", :tag => "thrift-0.11.0" }
s.source_files = 'lib/cocoa/src/**/*.{h,m,swift}'
end
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/thrift/blob/1310dc1e/appveyor.yml
----------------------------------------------------------------------
diff --git a/appveyor.yml b/appveyor.yml
index 4c2e364..073ffd4 100755
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -19,7 +19,7 @@
# build Apache Thrift on AppVeyor - https://ci.appveyor.com
-version: '1.0.0-dev.{build}'
+version: '0.11.0.{build}'
shallow_clone: true
http://git-wip-us.apache.org/repos/asf/thrift/blob/1310dc1e/build/cmake/DefineCMakeDefaults.cmake
----------------------------------------------------------------------
diff --git a/build/cmake/DefineCMakeDefaults.cmake b/build/cmake/DefineCMakeDefaults.cmake
index 2899937..bb32399 100644
--- a/build/cmake/DefineCMakeDefaults.cmake
+++ b/build/cmake/DefineCMakeDefaults.cmake
@@ -35,7 +35,7 @@ set(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON)
set(CMAKE_COLOR_MAKEFILE ON)
# Define the generic version of the libraries here
-set(GENERIC_LIB_VERSION "0.1.0")
+set(GENERIC_LIB_VERSION "0.11.0")
set(GENERIC_LIB_SOVERSION "0")
# Set the default build type to release with debug info
http://git-wip-us.apache.org/repos/asf/thrift/blob/1310dc1e/composer.json
----------------------------------------------------------------------
diff --git a/composer.json b/composer.json
index ad71f91..9d6454e 100644
--- a/composer.json
+++ b/composer.json
@@ -24,7 +24,7 @@
"minimum-stability": "dev",
"extra": {
"branch-alias": {
- "dev-master": "1.0.0-dev"
+ "dev-master": "0.11.0"
}
}
}
http://git-wip-us.apache.org/repos/asf/thrift/blob/1310dc1e/configure.ac
----------------------------------------------------------------------
diff --git a/configure.ac b/configure.ac
index 073ad8d..6a7a1a5 100755
--- a/configure.ac
+++ b/configure.ac
@@ -20,7 +20,7 @@
AC_PREREQ(2.65)
AC_CONFIG_MACRO_DIR([./aclocal])
-AC_INIT([thrift], [1.0.0-dev])
+AC_INIT([thrift], [0.11.0])
AC_CONFIG_AUX_DIR([.])
http://git-wip-us.apache.org/repos/asf/thrift/blob/1310dc1e/contrib/Rebus/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/contrib/Rebus/Properties/AssemblyInfo.cs b/contrib/Rebus/Properties/AssemblyInfo.cs
index e476eab..9c4d7cc 100644
--- a/contrib/Rebus/Properties/AssemblyInfo.cs
+++ b/contrib/Rebus/Properties/AssemblyInfo.cs
@@ -34,5 +34,5 @@ using System.Runtime.InteropServices;
[assembly: Guid("0af10984-40d3-453d-b1e5-421529e8c7e2")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: AssemblyVersion("0.11.0.0")]
+[assembly: AssemblyFileVersion("0.11.0.0")]
http://git-wip-us.apache.org/repos/asf/thrift/blob/1310dc1e/contrib/fb303/py/setup.py
----------------------------------------------------------------------
diff --git a/contrib/fb303/py/setup.py b/contrib/fb303/py/setup.py
index 4321ce2..9dafa88 100644
--- a/contrib/fb303/py/setup.py
+++ b/contrib/fb303/py/setup.py
@@ -26,7 +26,7 @@ except:
from distutils.core import setup, Extension, Command
setup(name='thrift_fb303',
- version='1.0.0-dev',
+ version='0.11.0',
description='Python bindings for the Apache Thrift FB303',
author=['Thrift Developers'],
author_email=['dev@thrift.apache.org'],
http://git-wip-us.apache.org/repos/asf/thrift/blob/1310dc1e/contrib/thrift-maven-plugin/pom.xml
----------------------------------------------------------------------
diff --git a/contrib/thrift-maven-plugin/pom.xml b/contrib/thrift-maven-plugin/pom.xml
index 0af5957..76d0d4f 100644
--- a/contrib/thrift-maven-plugin/pom.xml
+++ b/contrib/thrift-maven-plugin/pom.xml
@@ -27,7 +27,7 @@
<artifactId>thrift-maven-plugin</artifactId>
<packaging>maven-plugin</packaging>
<name>thrift-maven-plugin</name>
- <version>1.0-SNAPSHOT</version>
+ <version>0.11.0</version>
<build>
<plugins>
<plugin>
http://git-wip-us.apache.org/repos/asf/thrift/blob/1310dc1e/contrib/vagrant/centos-6.5/README.md
----------------------------------------------------------------------
diff --git a/contrib/vagrant/centos-6.5/README.md b/contrib/vagrant/centos-6.5/README.md
index 76dca44..bd7f022 100644
--- a/contrib/vagrant/centos-6.5/README.md
+++ b/contrib/vagrant/centos-6.5/README.md
@@ -11,7 +11,7 @@ This will download and launch the base box VM under VirtualBox and run the Apach
$ vagrant ssh
[vagrant@thrift ~]$ cd /thrift
[vagrant@thrift thrift]$ compiler/cpp/thrift --version
- Thrift version 1.0.0-dev
+ Thrift version 0.11.0
The provisioning script (inside the Vagrantfile) runs ./bootstrap.sh, ./configure, make and make check, but does not install thrift. To install thrift run "make install".
http://git-wip-us.apache.org/repos/asf/thrift/blob/1310dc1e/contrib/zeromq/csharp/ThriftZMQ.csproj
----------------------------------------------------------------------
diff --git a/contrib/zeromq/csharp/ThriftZMQ.csproj b/contrib/zeromq/csharp/ThriftZMQ.csproj
index 6b46530..32a8c49 100755
--- a/contrib/zeromq/csharp/ThriftZMQ.csproj
+++ b/contrib/zeromq/csharp/ThriftZMQ.csproj
@@ -1,4 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -25,7 +43,7 @@
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
- <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+ <ApplicationVersion>0.11.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
http://git-wip-us.apache.org/repos/asf/thrift/blob/1310dc1e/debian/changelog
----------------------------------------------------------------------
diff --git a/debian/changelog b/debian/changelog
index f2da232..68629d6 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,7 +1,8 @@
-thrift (1.0.0-dev) stable; urgency=low
+thrift (0.11.0) stable; urgency=low
* update version
* fix libthrift0.install
+ * update to 0.11.0
-- Roger Meier <ro...@apache.org> Tue, 08 Jan 2013 22:40:12 +0100
thrift (0.9.0) stable; urgency=low
http://git-wip-us.apache.org/repos/asf/thrift/blob/1310dc1e/doap.rdf
----------------------------------------------------------------------
diff --git a/doap.rdf b/doap.rdf
index 75274aa..06447c7 100755
--- a/doap.rdf
+++ b/doap.rdf
@@ -60,6 +60,11 @@
<release rdf:parseType="Collection">
<Version>
<name>Apache Thrift</name>
+ <created>2017-11-30</created>
+ <revision>0.11.0</revision>
+ </Version>
+ <Version>
+ <name>Apache Thrift</name>
<created>2017-03-01</created>
<revision>0.10.0</revision>
</Version>
http://git-wip-us.apache.org/repos/asf/thrift/blob/1310dc1e/lib/cocoa/src/Thrift.h
----------------------------------------------------------------------
diff --git a/lib/cocoa/src/Thrift.h b/lib/cocoa/src/Thrift.h
index 6fc594a..89486b2 100644
--- a/lib/cocoa/src/Thrift.h
+++ b/lib/cocoa/src/Thrift.h
@@ -17,4 +17,4 @@
* under the License.
*/
-#define ThriftVersion @"1.0.0-dev"
+#define ThriftVersion @"0.11.0"
http://git-wip-us.apache.org/repos/asf/thrift/blob/1310dc1e/lib/cpp/src/thrift/windows/config.h
----------------------------------------------------------------------
diff --git a/lib/cpp/src/thrift/windows/config.h b/lib/cpp/src/thrift/windows/config.h
index bc4aa42..a361eac 100644
--- a/lib/cpp/src/thrift/windows/config.h
+++ b/lib/cpp/src/thrift/windows/config.h
@@ -70,6 +70,7 @@
#pragma warning(disable : 4996) // Deprecated posix name.
#endif
+#define VERSION "0.11.0"
#define HAVE_GETTIMEOFDAY 1
#define HAVE_SYS_STAT_H 1
http://git-wip-us.apache.org/repos/asf/thrift/blob/1310dc1e/lib/csharp/ThriftMSBuildTask/ThriftMSBuildTask.csproj
----------------------------------------------------------------------
diff --git a/lib/csharp/ThriftMSBuildTask/ThriftMSBuildTask.csproj b/lib/csharp/ThriftMSBuildTask/ThriftMSBuildTask.csproj
index ae86081..1ee29d1 100644
--- a/lib/csharp/ThriftMSBuildTask/ThriftMSBuildTask.csproj
+++ b/lib/csharp/ThriftMSBuildTask/ThriftMSBuildTask.csproj
@@ -45,7 +45,7 @@
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
- <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+ <ApplicationVersion>0.11.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
http://git-wip-us.apache.org/repos/asf/thrift/blob/1310dc1e/lib/csharp/src/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/lib/csharp/src/Properties/AssemblyInfo.cs b/lib/csharp/src/Properties/AssemblyInfo.cs
index dcbe747..ab6921e 100644
--- a/lib/csharp/src/Properties/AssemblyInfo.cs
+++ b/lib/csharp/src/Properties/AssemblyInfo.cs
@@ -51,5 +51,5 @@ using System.Runtime.InteropServices;
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
-[assembly: AssemblyVersion("1.0.0.1")]
-[assembly: AssemblyFileVersion("1.0.0.1")]
+[assembly: AssemblyVersion("0.11.0.1")]
+[assembly: AssemblyFileVersion("0.11.0.1")]
http://git-wip-us.apache.org/repos/asf/thrift/blob/1310dc1e/lib/csharp/src/Thrift.csproj
----------------------------------------------------------------------
diff --git a/lib/csharp/src/Thrift.csproj b/lib/csharp/src/Thrift.csproj
index 83bc4f7..9040ca5 100644
--- a/lib/csharp/src/Thrift.csproj
+++ b/lib/csharp/src/Thrift.csproj
@@ -45,7 +45,7 @@
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
- <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+ <ApplicationVersion>0.11.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
http://git-wip-us.apache.org/repos/asf/thrift/blob/1310dc1e/lib/csharp/test/JSON/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/lib/csharp/test/JSON/Properties/AssemblyInfo.cs b/lib/csharp/test/JSON/Properties/AssemblyInfo.cs
index fdff4a1..fe0c46b 100644
--- a/lib/csharp/test/JSON/Properties/AssemblyInfo.cs
+++ b/lib/csharp/test/JSON/Properties/AssemblyInfo.cs
@@ -51,5 +51,5 @@ using System.Runtime.InteropServices;
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: AssemblyVersion("0.11.0.0")]
+[assembly: AssemblyFileVersion("0.11.0.0")]
http://git-wip-us.apache.org/repos/asf/thrift/blob/1310dc1e/lib/csharp/test/Multiplex/Client/MultiplexClient.csproj
----------------------------------------------------------------------
diff --git a/lib/csharp/test/Multiplex/Client/MultiplexClient.csproj b/lib/csharp/test/Multiplex/Client/MultiplexClient.csproj
index 6221e14..ed9616b 100644
--- a/lib/csharp/test/Multiplex/Client/MultiplexClient.csproj
+++ b/lib/csharp/test/Multiplex/Client/MultiplexClient.csproj
@@ -46,7 +46,7 @@
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
- <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+ <ApplicationVersion>0.11.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
http://git-wip-us.apache.org/repos/asf/thrift/blob/1310dc1e/lib/csharp/test/Multiplex/Client/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/lib/csharp/test/Multiplex/Client/Properties/AssemblyInfo.cs b/lib/csharp/test/Multiplex/Client/Properties/AssemblyInfo.cs
index f686ded..e2d433e 100644
--- a/lib/csharp/test/Multiplex/Client/Properties/AssemblyInfo.cs
+++ b/lib/csharp/test/Multiplex/Client/Properties/AssemblyInfo.cs
@@ -51,5 +51,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: AssemblyVersion("0.11.0.0")]
+[assembly: AssemblyFileVersion("0.11.0.0")]
http://git-wip-us.apache.org/repos/asf/thrift/blob/1310dc1e/lib/csharp/test/Multiplex/Server/MultiplexServer.csproj
----------------------------------------------------------------------
diff --git a/lib/csharp/test/Multiplex/Server/MultiplexServer.csproj b/lib/csharp/test/Multiplex/Server/MultiplexServer.csproj
index dc1d123..e0ca45c 100644
--- a/lib/csharp/test/Multiplex/Server/MultiplexServer.csproj
+++ b/lib/csharp/test/Multiplex/Server/MultiplexServer.csproj
@@ -46,7 +46,7 @@
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
- <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+ <ApplicationVersion>0.11.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
http://git-wip-us.apache.org/repos/asf/thrift/blob/1310dc1e/lib/csharp/test/Multiplex/Server/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/lib/csharp/test/Multiplex/Server/Properties/AssemblyInfo.cs b/lib/csharp/test/Multiplex/Server/Properties/AssemblyInfo.cs
index 5d40546..8f63d65 100644
--- a/lib/csharp/test/Multiplex/Server/Properties/AssemblyInfo.cs
+++ b/lib/csharp/test/Multiplex/Server/Properties/AssemblyInfo.cs
@@ -51,5 +51,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: AssemblyVersion("0.11.0.0")]
+[assembly: AssemblyFileVersion("0.11.0.0")]
http://git-wip-us.apache.org/repos/asf/thrift/blob/1310dc1e/lib/csharp/test/ThriftMVCTest/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/lib/csharp/test/ThriftMVCTest/Properties/AssemblyInfo.cs b/lib/csharp/test/ThriftMVCTest/Properties/AssemblyInfo.cs
index 1b1b833..8acb1c2 100644
--- a/lib/csharp/test/ThriftMVCTest/Properties/AssemblyInfo.cs
+++ b/lib/csharp/test/ThriftMVCTest/Properties/AssemblyInfo.cs
@@ -49,5 +49,5 @@ using System.Runtime.InteropServices;
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
-[assembly: AssemblyVersion("1.0.0.1")]
-[assembly: AssemblyFileVersion("1.0.0.1")]
+[assembly: AssemblyVersion("0.11.0.1")]
+[assembly: AssemblyFileVersion("0.11.0.1")]
http://git-wip-us.apache.org/repos/asf/thrift/blob/1310dc1e/lib/d/src/thrift/base.d
----------------------------------------------------------------------
diff --git a/lib/d/src/thrift/base.d b/lib/d/src/thrift/base.d
index 38034a7..8aea536 100644
--- a/lib/d/src/thrift/base.d
+++ b/lib/d/src/thrift/base.d
@@ -50,7 +50,7 @@ class TCompoundOperationException : TException {
/// The Thrift version string, used for informative purposes.
// Note: This is currently hardcoded, but will likely be filled in by the build
// system in future versions.
-enum VERSION = "1.0.0 dev";
+enum VERSION = "0.11.0";
/**
* Functions used for logging inside Thrift.
http://git-wip-us.apache.org/repos/asf/thrift/blob/1310dc1e/lib/dart/pubspec.yaml
----------------------------------------------------------------------
diff --git a/lib/dart/pubspec.yaml b/lib/dart/pubspec.yaml
index f7aa876..5d04226 100644
--- a/lib/dart/pubspec.yaml
+++ b/lib/dart/pubspec.yaml
@@ -16,7 +16,7 @@
# under the License.
name: thrift
-version: 1.0.0-dev
+version: 0.11.0
description: >
A Dart library for Apache Thrift
author: Apache Thrift Developers <de...@thrift.apache.org>
@@ -33,7 +33,7 @@ dependencies:
dev_dependencies:
# test
- mockito: ^1.0.0
+ mockito: ^0.11.0
test: ^0.12.0
# dart_dev - https://github.com/Workiva/dart_dev
http://git-wip-us.apache.org/repos/asf/thrift/blob/1310dc1e/lib/delphi/src/Thrift.pas
----------------------------------------------------------------------
diff --git a/lib/delphi/src/Thrift.pas b/lib/delphi/src/Thrift.pas
index 6eca3c9..edf20da 100644
--- a/lib/delphi/src/Thrift.pas
+++ b/lib/delphi/src/Thrift.pas
@@ -25,7 +25,7 @@ uses
SysUtils, Thrift.Protocol;
const
- Version = '1.0.0-dev';
+ Version = '0.11.0';
type
TApplicationExceptionSpecializedClass = class of TApplicationExceptionSpecialized;
http://git-wip-us.apache.org/repos/asf/thrift/blob/1310dc1e/lib/erl/src/thrift.app.src
----------------------------------------------------------------------
diff --git a/lib/erl/src/thrift.app.src b/lib/erl/src/thrift.app.src
index 1a23f0d..0247494 100644
--- a/lib/erl/src/thrift.app.src
+++ b/lib/erl/src/thrift.app.src
@@ -22,7 +22,7 @@
{description, "Thrift bindings"},
% The version of the applicaton
- {vsn, "1.0.0-dev"},
+ {vsn, "0.11.0"},
% All modules used by the application.
{modules, [
http://git-wip-us.apache.org/repos/asf/thrift/blob/1310dc1e/lib/go/thrift/serializer_types_test.go
----------------------------------------------------------------------
diff --git a/lib/go/thrift/serializer_types_test.go b/lib/go/thrift/serializer_types_test.go
index c8e3b3b..e6f8180 100644
--- a/lib/go/thrift/serializer_types_test.go
+++ b/lib/go/thrift/serializer_types_test.go
@@ -19,7 +19,7 @@
package thrift
-// Autogenerated by Thrift Compiler (1.0.0-dev)
+// Autogenerated by Thrift Compiler (0.11.0)
// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
/* THE FOLLOWING THRIFT FILE WAS USED TO CREATE THIS
http://git-wip-us.apache.org/repos/asf/thrift/blob/1310dc1e/lib/haxe/README.md
----------------------------------------------------------------------
diff --git a/lib/haxe/README.md b/lib/haxe/README.md
index 19bbbaa..ac70f25 100644
--- a/lib/haxe/README.md
+++ b/lib/haxe/README.md
@@ -69,10 +69,10 @@ Thrift Haxe bindings
Thrift Haxe bindings can be set up via the `haxelib` tool
either from the official ASF repo, or via the github mirror.
-- To set up any **stable version**, choose the appropriate branch (e.g. `0.10.0`):
+- To set up any **stable version**, choose the appropriate branch (e.g. `0.11.0`):
- - `haxelib git thrift https://git.apache.org/thrift.git 0.10.0 lib/haxe`
- - `haxelib git thrift https://github.com/apache/thrift.git 0.10.0 lib/haxe`
+ - `haxelib git thrift https://git.apache.org/thrift.git 0.11.0 lib/haxe`
+ - `haxelib git thrift https://github.com/apache/thrift.git 0.11.0 lib/haxe`
- To set up the current **development version**, use the `master` branch:
http://git-wip-us.apache.org/repos/asf/thrift/blob/1310dc1e/lib/haxe/haxelib.json
----------------------------------------------------------------------
diff --git a/lib/haxe/haxelib.json b/lib/haxe/haxelib.json
index f76990e..26caa79 100644
--- a/lib/haxe/haxelib.json
+++ b/lib/haxe/haxelib.json
@@ -4,7 +4,7 @@
"license": "Apache",
"tags": ["thrift", "rpc", "serialization", "cross", "framework"],
"description": "Haxe bindings for the Apache Thrift RPC and serialization framework",
- "version": "1.0.0-dev",
+ "version": "0.11.0",
"releasenote": "Licensed under Apache License, Version 2.0. The Apache Thrift compiler needs to be installed separately.",
"contributors": ["Apache Software Foundation (ASF)"],
"dependencies": { },
http://git-wip-us.apache.org/repos/asf/thrift/blob/1310dc1e/lib/hs/thrift.cabal
----------------------------------------------------------------------
diff --git a/lib/hs/thrift.cabal b/lib/hs/thrift.cabal
index fb33d9a..9754ab2 100644
--- a/lib/hs/thrift.cabal
+++ b/lib/hs/thrift.cabal
@@ -18,7 +18,7 @@
--
Name: thrift
-Version: 1.0.0-dev
+Version: 0.11.0
Cabal-Version: >= 1.8
License: OtherLicense
Category: Foreign
http://git-wip-us.apache.org/repos/asf/thrift/blob/1310dc1e/lib/java/build.properties
----------------------------------------------------------------------
diff --git a/lib/java/build.properties b/lib/java/build.properties
index 96cf8d3..fd35351 100644
--- a/lib/java/build.properties
+++ b/lib/java/build.properties
@@ -1,4 +1,4 @@
-thrift.version=1.0.0
+thrift.version=0.11.0
thrift.groupid=org.apache.thrift
release=false
http://git-wip-us.apache.org/repos/asf/thrift/blob/1310dc1e/lib/js/package.json
----------------------------------------------------------------------
diff --git a/lib/js/package.json b/lib/js/package.json
index 526528d..421de93 100644
--- a/lib/js/package.json
+++ b/lib/js/package.json
@@ -1,6 +1,6 @@
{
"name": "thrift",
- "version": "1.0.0",
+ "version": "0.11.0",
"devDependencies": {
"grunt": "^0.4.5",
"grunt-cli": "^1.2.0",
http://git-wip-us.apache.org/repos/asf/thrift/blob/1310dc1e/lib/js/src/thrift.js
----------------------------------------------------------------------
diff --git a/lib/js/src/thrift.js b/lib/js/src/thrift.js
index ab85e9d..d308c46 100644
--- a/lib/js/src/thrift.js
+++ b/lib/js/src/thrift.js
@@ -46,7 +46,7 @@ var Thrift = {
* @const {string} Version
* @memberof Thrift
*/
- Version: '1.0.0-dev',
+ Version: '0.11.0',
/**
* Thrift IDL type string to Id mapping.
http://git-wip-us.apache.org/repos/asf/thrift/blob/1310dc1e/lib/lua/THttpTransport.lua
----------------------------------------------------------------------
diff --git a/lib/lua/THttpTransport.lua b/lib/lua/THttpTransport.lua
index 5bbfece..041e421 100644
--- a/lib/lua/THttpTransport.lua
+++ b/lib/lua/THttpTransport.lua
@@ -25,7 +25,7 @@ THttpTransport = TTransportBase:new{
wBuf = '',
rBuf = '',
CRLF = '\r\n',
- VERSION = '1.0.0',
+ VERSION = '0.11.0',
isServer = true
}
http://git-wip-us.apache.org/repos/asf/thrift/blob/1310dc1e/lib/netcore/Thrift/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/lib/netcore/Thrift/Properties/AssemblyInfo.cs b/lib/netcore/Thrift/Properties/AssemblyInfo.cs
index e3118ab..61cd3e3 100644
--- a/lib/netcore/Thrift/Properties/AssemblyInfo.cs
+++ b/lib/netcore/Thrift/Properties/AssemblyInfo.cs
@@ -52,5 +52,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
-[assembly: AssemblyVersion("1.0.0.1")]
-[assembly: AssemblyFileVersion("1.0.0.1")]
\ No newline at end of file
+[assembly: AssemblyVersion("0.11.0.1")]
+[assembly: AssemblyFileVersion("0.11.0.1")]
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/thrift/blob/1310dc1e/lib/netcore/Thrift/Transports/Client/THttpClientTransport.cs
----------------------------------------------------------------------
diff --git a/lib/netcore/Thrift/Transports/Client/THttpClientTransport.cs b/lib/netcore/Thrift/Transports/Client/THttpClientTransport.cs
index bc36bb3..1e83f97 100644
--- a/lib/netcore/Thrift/Transports/Client/THttpClientTransport.cs
+++ b/lib/netcore/Thrift/Transports/Client/THttpClientTransport.cs
@@ -151,7 +151,7 @@ namespace Thrift.Transports.Client
}
httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/x-thrift"));
- httpClient.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue("THttpClientTransport", "1.0.0"));
+ httpClient.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue("THttpClientTransport", "0.11.0"));
if (CustomHeaders != null)
{
http://git-wip-us.apache.org/repos/asf/thrift/blob/1310dc1e/lib/ocaml/_oasis
----------------------------------------------------------------------
diff --git a/lib/ocaml/_oasis b/lib/ocaml/_oasis
index 4dd95e5..19033e6 100644
--- a/lib/ocaml/_oasis
+++ b/lib/ocaml/_oasis
@@ -1,5 +1,5 @@
Name: libthrift-ocaml
-Version: 1.0
+Version: 0.11.0
OASISFormat: 0.3
Synopsis: OCaml bindings for the Apache Thrift RPC system
Authors: Apache Thrift Developers <de...@thrift.apache.org>
http://git-wip-us.apache.org/repos/asf/thrift/blob/1310dc1e/lib/perl/lib/Thrift.pm
----------------------------------------------------------------------
diff --git a/lib/perl/lib/Thrift.pm b/lib/perl/lib/Thrift.pm
index 592d1dd..cb62353 100644
--- a/lib/perl/lib/Thrift.pm
+++ b/lib/perl/lib/Thrift.pm
@@ -31,6 +31,6 @@ use warnings;
#
package Thrift;
-use version 0.77; our $VERSION = version->declare("v1.0_0");
+use version 0.77; our $VERSION = version->declare("v0.11.0");
1;
http://git-wip-us.apache.org/repos/asf/thrift/blob/1310dc1e/lib/py/setup.py
----------------------------------------------------------------------
diff --git a/lib/py/setup.py b/lib/py/setup.py
index 4056b9b..e3435c7 100644
--- a/lib/py/setup.py
+++ b/lib/py/setup.py
@@ -87,7 +87,7 @@ def run_setup(with_binary):
twisted_deps = ['twisted']
setup(name='thrift',
- version='1.0.0-dev',
+ version='0.11.0',
description='Python bindings for the Apache Thrift RPC system',
author='Thrift Developers',
author_email='dev@thrift.apache.org',
http://git-wip-us.apache.org/repos/asf/thrift/blob/1310dc1e/lib/rb/thrift.gemspec
----------------------------------------------------------------------
diff --git a/lib/rb/thrift.gemspec b/lib/rb/thrift.gemspec
index 166a93f..291b81f 100644
--- a/lib/rb/thrift.gemspec
+++ b/lib/rb/thrift.gemspec
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
Gem::Specification.new do |s|
s.name = 'thrift'
- s.version = '1.0.0.0'
+ s.version = '0.11.0.0'
s.authors = ['Thrift Developers']
s.email = ['dev@thrift.apache.org']
s.homepage = 'http://thrift.apache.org'
http://git-wip-us.apache.org/repos/asf/thrift/blob/1310dc1e/lib/rs/Cargo.toml
----------------------------------------------------------------------
diff --git a/lib/rs/Cargo.toml b/lib/rs/Cargo.toml
index 5f8f5e8..8e68175 100644
--- a/lib/rs/Cargo.toml
+++ b/lib/rs/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "thrift"
description = "Rust bindings for the Apache Thrift RPC system"
-version = "1.0.0"
+version = "0.11.0"
license = "Apache-2.0"
authors = ["Apache Thrift Developers <de...@thrift.apache.org>"]
homepage = "http://thrift.apache.org"
http://git-wip-us.apache.org/repos/asf/thrift/blob/1310dc1e/lib/st/package.xml
----------------------------------------------------------------------
diff --git a/lib/st/package.xml b/lib/st/package.xml
index 72194fc..5044e2a 100644
--- a/lib/st/package.xml
+++ b/lib/st/package.xml
@@ -17,7 +17,7 @@
specific language governing permissions and limitations
under the License.
-->
-<!-- Apache Thrift Smalltalk library version 1.0 -->
+<!-- Apache Thrift Smalltalk library version 0.11.0 -->
<package>
<name>libthrift-st</name>
<file>thrift.st</file>
http://git-wip-us.apache.org/repos/asf/thrift/blob/1310dc1e/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index cd6c710..24851b2 100644
--- a/package.json
+++ b/package.json
@@ -6,7 +6,7 @@
"type": "git",
"url": "https://git-wip-us.apache.org/repos/asf/thrift.git"
},
- "version": "1.0.0-dev",
+ "version": "0.11.0",
"author": {
"name": "Apache Thrift Developers",
"email": "dev@thrift.apache.org",
http://git-wip-us.apache.org/repos/asf/thrift/blob/1310dc1e/sonar-project.properties
----------------------------------------------------------------------
diff --git a/sonar-project.properties b/sonar-project.properties
index b465fd1..6bc9989 100755
--- a/sonar-project.properties
+++ b/sonar-project.properties
@@ -16,7 +16,7 @@ development, combines a software stack with a code generation engine to build
services that work efficiently and seamlessly between all major languages.
# Apache Thrift Version
-sonar.projectVersion=1.0.0-dev
+sonar.projectVersion=0.11.0
# use this to set another version string
# $ sonar-runner -D sonar.projectVersion=`git rev-parse HEAD`
# set projectDate in combination with projectVersion for imports of old releases
@@ -54,7 +54,7 @@ module1.sonar.projectName=Apache Thrift - Java Library
module1.sonar.projectBaseDir=lib/java
module1.sonar.sources=src
module1.sonar.tests=test
-module1.sonar.binaries=build/libthrift-1.0.0.jar
+module1.sonar.binaries=build/libthrift-0.11.0.jar
module1.sonar.libraries=build/lib/*.jar
module1.sonar.language=java
@@ -62,7 +62,7 @@ module2.sonar.projectName=Apache Thrift - Java Tutorial
module2.sonar.projectBaseDir=.
module2.sonar.sources=tutorial/java/src, tutorial/java/gen-java
module2.sonar.binaries=tutorial/java/tutorial.jar
-module2.sonar.libraries=lib/java/build/lib/*.jar,lib/java/build/libthrift-1.0.0.jar
+module2.sonar.libraries=lib/java/build/lib/*.jar,lib/java/build/libthrift-0.11.0.jar
module2.sonar.language=java
module3.sonar.projectName=Apache Thrift - JavaScript Library
http://git-wip-us.apache.org/repos/asf/thrift/blob/1310dc1e/test/csharp/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/test/csharp/Properties/AssemblyInfo.cs b/test/csharp/Properties/AssemblyInfo.cs
index b1101a1..e2def42 100644
--- a/test/csharp/Properties/AssemblyInfo.cs
+++ b/test/csharp/Properties/AssemblyInfo.cs
@@ -51,5 +51,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: AssemblyVersion("0.11.0.0")]
+[assembly: AssemblyFileVersion("0.11.0.0")]
http://git-wip-us.apache.org/repos/asf/thrift/blob/1310dc1e/test/csharp/ThriftTest.csproj
----------------------------------------------------------------------
diff --git a/test/csharp/ThriftTest.csproj b/test/csharp/ThriftTest.csproj
index 65c0daf..8fe40aa 100644
--- a/test/csharp/ThriftTest.csproj
+++ b/test/csharp/ThriftTest.csproj
@@ -46,7 +46,7 @@
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
- <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+ <ApplicationVersion>0.11.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
http://git-wip-us.apache.org/repos/asf/thrift/blob/1310dc1e/test/dart/test_client/pubspec.yaml
----------------------------------------------------------------------
diff --git a/test/dart/test_client/pubspec.yaml b/test/dart/test_client/pubspec.yaml
index a91aa45..e386c0e 100644
--- a/test/dart/test_client/pubspec.yaml
+++ b/test/dart/test_client/pubspec.yaml
@@ -16,7 +16,7 @@
# under the License.
name: thrift_test_client
-version: 1.0.0-dev
+version: 0.11.0
description: A client integration test for the Dart Thrift library
author: Apache Thrift Developers <de...@thrift.apache.org>
homepage: http://thrift.apache.org
http://git-wip-us.apache.org/repos/asf/thrift/blob/1310dc1e/test/erl/src/thrift_test.app.src
----------------------------------------------------------------------
diff --git a/test/erl/src/thrift_test.app.src b/test/erl/src/thrift_test.app.src
index 7896a95..b552970 100644
--- a/test/erl/src/thrift_test.app.src
+++ b/test/erl/src/thrift_test.app.src
@@ -22,7 +22,7 @@
{description, "Thrift cross language test"},
% The version of the applicaton
- {vsn, "1.0.0-dev"},
+ {vsn, "0.11.0"},
% All modules used by the application.
{modules, [
http://git-wip-us.apache.org/repos/asf/thrift/blob/1310dc1e/tutorial/csharp/CsharpClient/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/tutorial/csharp/CsharpClient/Properties/AssemblyInfo.cs b/tutorial/csharp/CsharpClient/Properties/AssemblyInfo.cs
index 1ff658c..2b801c2 100644
--- a/tutorial/csharp/CsharpClient/Properties/AssemblyInfo.cs
+++ b/tutorial/csharp/CsharpClient/Properties/AssemblyInfo.cs
@@ -51,5 +51,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: AssemblyVersion("0.11.0.0")]
+[assembly: AssemblyFileVersion("0.11.0.0")]
http://git-wip-us.apache.org/repos/asf/thrift/blob/1310dc1e/tutorial/csharp/CsharpServer/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/tutorial/csharp/CsharpServer/Properties/AssemblyInfo.cs b/tutorial/csharp/CsharpServer/Properties/AssemblyInfo.cs
index 74fa476..b11cbdf 100644
--- a/tutorial/csharp/CsharpServer/Properties/AssemblyInfo.cs
+++ b/tutorial/csharp/CsharpServer/Properties/AssemblyInfo.cs
@@ -51,5 +51,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: AssemblyVersion("0.11.0.0")]
+[assembly: AssemblyFileVersion("0.11.0.0")]
http://git-wip-us.apache.org/repos/asf/thrift/blob/1310dc1e/tutorial/dart/client/pubspec.yaml
----------------------------------------------------------------------
diff --git a/tutorial/dart/client/pubspec.yaml b/tutorial/dart/client/pubspec.yaml
index db64afc..51b7ad2 100644
--- a/tutorial/dart/client/pubspec.yaml
+++ b/tutorial/dart/client/pubspec.yaml
@@ -16,7 +16,7 @@
# under the License.
name: tutorial_client
-version: 1.0.0-dev
+version: 0.11.0
description: A Dart client implementation of the Apache Thrift tutorial
author: Apache Thrift Developers <de...@thrift.apache.org>
homepage: http://thrift.apache.org
@@ -25,7 +25,7 @@ environment:
sdk: ">=1.13.0 <2.0.0"
dependencies:
- browser: ^0.10.0
+ browser: ^0.11.0
shared:
path: ../gen-dart/shared
thrift:
http://git-wip-us.apache.org/repos/asf/thrift/blob/1310dc1e/tutorial/dart/console_client/pubspec.yaml
----------------------------------------------------------------------
diff --git a/tutorial/dart/console_client/pubspec.yaml b/tutorial/dart/console_client/pubspec.yaml
index cea13ac..dea5449 100644
--- a/tutorial/dart/console_client/pubspec.yaml
+++ b/tutorial/dart/console_client/pubspec.yaml
@@ -16,7 +16,7 @@
# under the License.
name: tutorial_console_client
-version: 1.0.0-dev
+version: 0.11.0
description: >
A Dart console client to implementation of the Apache Thrift tutorial
author: Apache Thrift Developers <de...@thrift.apache.org>
http://git-wip-us.apache.org/repos/asf/thrift/blob/1310dc1e/tutorial/dart/server/pubspec.yaml
----------------------------------------------------------------------
diff --git a/tutorial/dart/server/pubspec.yaml b/tutorial/dart/server/pubspec.yaml
index 4833a4a..b925d2f 100644
--- a/tutorial/dart/server/pubspec.yaml
+++ b/tutorial/dart/server/pubspec.yaml
@@ -16,7 +16,7 @@
# under the License.
name: tutorial_server
-version: 1.0.0-dev
+version: 0.11.0
description: A Dart server to support the Apache Thrift tutorial
author: Apache Thrift Developers <de...@thrift.apache.org>
homepage: http://thrift.apache.org
http://git-wip-us.apache.org/repos/asf/thrift/blob/1310dc1e/tutorial/delphi/DelphiClient/DelphiClient.dproj
----------------------------------------------------------------------
diff --git a/tutorial/delphi/DelphiClient/DelphiClient.dproj b/tutorial/delphi/DelphiClient/DelphiClient.dproj
index 34aa533..38226b3 100644
--- a/tutorial/delphi/DelphiClient/DelphiClient.dproj
+++ b/tutorial/delphi/DelphiClient/DelphiClient.dproj
@@ -97,13 +97,13 @@
<VersionInfoKeys>
<VersionInfoKeys Name="CompanyName"/>
<VersionInfoKeys Name="FileDescription">Thrift Tutorial</VersionInfoKeys>
- <VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys>
+ <VersionInfoKeys Name="FileVersion">0.11.0.0</VersionInfoKeys>
<VersionInfoKeys Name="InternalName">DelphiClient</VersionInfoKeys>
<VersionInfoKeys Name="LegalCopyright">Copyright © 2012 The Apache Software Foundation</VersionInfoKeys>
<VersionInfoKeys Name="LegalTrademarks"/>
<VersionInfoKeys Name="OriginalFilename">DelphiClient.exe</VersionInfoKeys>
<VersionInfoKeys Name="ProductName">Thrift</VersionInfoKeys>
- <VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
+ <VersionInfoKeys Name="ProductVersion">0.11.0.0</VersionInfoKeys>
<VersionInfoKeys Name="Comments"/>
</VersionInfoKeys>
<Source>
http://git-wip-us.apache.org/repos/asf/thrift/blob/1310dc1e/tutorial/delphi/DelphiServer/DelphiServer.dproj
----------------------------------------------------------------------
diff --git a/tutorial/delphi/DelphiServer/DelphiServer.dproj b/tutorial/delphi/DelphiServer/DelphiServer.dproj
index 74811bc..ad47a53 100644
--- a/tutorial/delphi/DelphiServer/DelphiServer.dproj
+++ b/tutorial/delphi/DelphiServer/DelphiServer.dproj
@@ -96,13 +96,13 @@
<VersionInfoKeys>
<VersionInfoKeys Name="CompanyName"/>
<VersionInfoKeys Name="FileDescription">Thrift Tutorial</VersionInfoKeys>
- <VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys>
+ <VersionInfoKeys Name="FileVersion">0.11.0.0</VersionInfoKeys>
<VersionInfoKeys Name="InternalName">DelphiServer</VersionInfoKeys>
<VersionInfoKeys Name="LegalCopyright">Copyright © 2012 The Apache Software Foundation</VersionInfoKeys>
<VersionInfoKeys Name="LegalTrademarks"/>
<VersionInfoKeys Name="OriginalFilename">DelphiServer.exe</VersionInfoKeys>
<VersionInfoKeys Name="ProductName">Thrift</VersionInfoKeys>
- <VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
+ <VersionInfoKeys Name="ProductVersion">0.11.0.0</VersionInfoKeys>
<VersionInfoKeys Name="Comments"/>
</VersionInfoKeys>
<Source>
http://git-wip-us.apache.org/repos/asf/thrift/blob/1310dc1e/tutorial/hs/ThriftTutorial.cabal
----------------------------------------------------------------------
diff --git a/tutorial/hs/ThriftTutorial.cabal b/tutorial/hs/ThriftTutorial.cabal
index 88f1379..98fbd7b 100755
--- a/tutorial/hs/ThriftTutorial.cabal
+++ b/tutorial/hs/ThriftTutorial.cabal
@@ -18,7 +18,7 @@
--
Name: ThriftTutorial
-Version: 0.1.0
+Version: 0.11.0
Cabal-Version: >= 1.4
License: OtherLicense
Category: Foreign
http://git-wip-us.apache.org/repos/asf/thrift/blob/1310dc1e/tutorial/ocaml/_oasis
----------------------------------------------------------------------
diff --git a/tutorial/ocaml/_oasis b/tutorial/ocaml/_oasis
index 4cab080..898261d 100644
--- a/tutorial/ocaml/_oasis
+++ b/tutorial/ocaml/_oasis
@@ -1,5 +1,5 @@
Name: tutorial
-Version: 1.0
+Version: 0.11.0
OASISFormat: 0.3
Synopsis: OCaml Tutorial example
Authors: Apache Thrift Developers <de...@thrift.apache.org>
[33/50] [abbrv] thrift git commit: THRIFT-4329: multiplexed processor,
client and server for c_glib Client: c_glib
Posted by je...@apache.org.
http://git-wip-us.apache.org/repos/asf/thrift/blob/87ad2bca/lib/c_glib/test/testtransportsocket.c
----------------------------------------------------------------------
diff --git a/lib/c_glib/test/testtransportsocket.c b/lib/c_glib/test/testtransportsocket.c
index 8e96375..fedbad6 100755
--- a/lib/c_glib/test/testtransportsocket.c
+++ b/lib/c_glib/test/testtransportsocket.c
@@ -33,9 +33,9 @@ int
my_socket(int domain, int type, int protocol)
{
if (socket_error == 0)
- {
- return socket (domain, type, protocol);
- }
+ {
+ return socket (domain, type, protocol);
+ }
return -1;
}
@@ -44,9 +44,9 @@ ssize_t
my_recv(int socket, void *buffer, size_t length, int flags)
{
if (recv_error == 0)
- {
- return recv (socket, buffer, length, flags);
- }
+ {
+ return recv (socket, buffer, length, flags);
+ }
return -1;
}
@@ -55,9 +55,9 @@ ssize_t
my_send(int socket, const void *buffer, size_t length, int flags)
{
if (send_error == 0)
- {
- return send (socket, buffer, length, flags);
- }
+ {
+ return send (socket, buffer, length, flags);
+ }
return -1;
}
@@ -70,7 +70,7 @@ my_send(int socket, const void *buffer, size_t length, int flags)
#undef send
static void thrift_socket_server (const int port);
-
+static void thrift_socket_server_open (const int port, int times);
/* test object creation and destruction */
static void
test_create_and_destroy(void)
@@ -93,82 +93,100 @@ test_open_and_close(void)
ThriftSocket *tsocket = NULL;
ThriftTransport *transport = NULL;
GError *err = NULL;
+ int port = 51199;
+ pid_t pid;
+ int status;
- /* open a connection and close it */
- tsocket = g_object_new (THRIFT_TYPE_SOCKET, "hostname", "localhost",
- "port", 51188, NULL);
- transport = THRIFT_TRANSPORT (tsocket);
- thrift_socket_open (transport, NULL);
- g_assert (thrift_socket_is_open (transport) == TRUE);
- thrift_socket_close (transport, NULL);
- g_assert (thrift_socket_is_open (transport) == FALSE);
-
- /* test close failure */
- tsocket->sd = -1;
- thrift_socket_close (transport, NULL);
- g_object_unref (tsocket);
+ pid = fork ();
+ g_assert ( pid >= 0 );
- /* try a hostname lookup failure */
- tsocket = g_object_new (THRIFT_TYPE_SOCKET, "hostname", "localhost.broken",
- NULL);
- transport = THRIFT_TRANSPORT (tsocket);
- g_assert (thrift_socket_open (transport, &err) == FALSE);
- g_object_unref (tsocket);
- g_error_free (err);
- err = NULL;
-
- /* try an error call to socket() */
- tsocket = g_object_new (THRIFT_TYPE_SOCKET, "hostname", "localhost", NULL);
- transport = THRIFT_TRANSPORT (tsocket);
- socket_error = 1;
- g_assert (thrift_socket_open (transport, &err) == FALSE);
- socket_error = 0;
- g_object_unref (tsocket);
- g_error_free (err);
+ if ( pid == 0 )
+ {
+ /* child listens */
+ thrift_socket_server_open (port, 1);
+ exit (0);
+ } else {
+ /* parent connects, wait a bit for the socket to be created */
+ sleep (1);
+
+ /* open a connection and close it */
+ tsocket = g_object_new (THRIFT_TYPE_SOCKET, "hostname", "localhost",
+ "port", port, NULL);
+ transport = THRIFT_TRANSPORT (tsocket);
+ thrift_socket_open (transport, NULL);
+ g_assert (thrift_socket_is_open (transport) == TRUE);
+ thrift_socket_close (transport, NULL);
+ g_assert (thrift_socket_is_open (transport) == FALSE);
+
+ /* test close failure */
+ tsocket->sd = -1;
+ thrift_socket_close (transport, NULL);
+ g_object_unref (tsocket);
+
+ /* try a hostname lookup failure */
+ tsocket = g_object_new (THRIFT_TYPE_SOCKET, "hostname", "localhost.broken",
+ NULL);
+ transport = THRIFT_TRANSPORT (tsocket);
+ g_assert (thrift_socket_open (transport, &err) == FALSE);
+ g_object_unref (tsocket);
+ g_error_free (err);
+ err = NULL;
+
+ /* try an error call to socket() */
+ tsocket = g_object_new (THRIFT_TYPE_SOCKET, "hostname", "localhost", NULL);
+ transport = THRIFT_TRANSPORT (tsocket);
+ socket_error = 1;
+ g_assert (thrift_socket_open (transport, &err) == FALSE);
+ socket_error = 0;
+ g_object_unref (tsocket);
+ g_error_free (err);
+ g_assert ( wait (&status) == pid );
+ g_assert ( status == 0 );
+ }
}
static void
test_read_and_write(void)
{
- int status;
- pid_t pid;
ThriftSocket *tsocket = NULL;
ThriftTransport *transport = NULL;
+ pid_t pid;
int port = 51199;
+ int status;
guchar buf[10] = TEST_DATA; /* a buffer */
pid = fork ();
g_assert ( pid >= 0 );
if ( pid == 0 )
- {
- /* child listens */
- thrift_socket_server (port);
- exit (0);
- } else {
- /* parent connects, wait a bit for the socket to be created */
- sleep (1);
-
- tsocket = g_object_new (THRIFT_TYPE_SOCKET, "hostname", "localhost",
- "port", port, NULL);
- transport = THRIFT_TRANSPORT (tsocket);
- g_assert (thrift_socket_open (transport, NULL) == TRUE);
- g_assert (thrift_socket_is_open (transport));
- thrift_socket_write (transport, buf, 10, NULL);
-
- /* write fail */
- send_error = 1;
- thrift_socket_write (transport, buf, 1, NULL);
- send_error = 0;
-
- thrift_socket_write_end (transport, NULL);
- thrift_socket_flush (transport, NULL);
- thrift_socket_close (transport, NULL);
- g_object_unref (tsocket);
-
- g_assert ( wait (&status) == pid );
- g_assert ( status == 0 );
- }
+ {
+ /* child listens */
+ thrift_socket_server (port);
+ exit (0);
+ } else {
+ /* parent connects, wait a bit for the socket to be created */
+ sleep (1);
+
+ tsocket = g_object_new (THRIFT_TYPE_SOCKET, "hostname", "localhost",
+ "port", port, NULL);
+ transport = THRIFT_TRANSPORT (tsocket);
+ g_assert (thrift_socket_open (transport, NULL) == TRUE);
+ g_assert (thrift_socket_is_open (transport));
+ thrift_socket_write (transport, buf, 10, NULL);
+
+ /* write fail */
+ send_error = 1;
+ thrift_socket_write (transport, buf, 1, NULL);
+ send_error = 0;
+
+ thrift_socket_write_end (transport, NULL);
+ thrift_socket_flush (transport, NULL);
+ thrift_socket_close (transport, NULL);
+ g_object_unref (tsocket);
+
+ g_assert ( wait (&status) == pid );
+ g_assert ( status == 0 );
+ }
}
/* test ThriftSocket's peek() implementation */
@@ -183,9 +201,9 @@ test_peek(void)
GError *error = NULL;
client_transport = g_object_new (THRIFT_TYPE_SOCKET,
- "hostname", "localhost",
- "port", port,
- NULL);
+ "hostname", "localhost",
+ "port", port,
+ NULL);
/* thrift_transport_peek returns FALSE when the socket is closed */
g_assert (thrift_transport_is_open (client_transport) == FALSE);
@@ -196,81 +214,105 @@ test_peek(void)
g_assert (pid >= 0);
if (pid == 0)
- {
- ThriftServerTransport *server_transport = NULL;
-
- g_object_unref (client_transport);
-
- /* child listens */
- server_transport = g_object_new (THRIFT_TYPE_SERVER_SOCKET,
- "port", port,
- NULL);
- g_assert (server_transport != NULL);
-
- thrift_server_transport_listen (server_transport, &error);
- g_assert (error == NULL);
-
- client_transport = g_object_new
- (THRIFT_TYPE_BUFFERED_TRANSPORT,
- "transport", thrift_server_transport_accept (server_transport, &error),
- "r_buf_size", 0,
- "w_buf_size", sizeof data,
- NULL);
- g_assert (error == NULL);
- g_assert (client_transport != NULL);
-
- /* write exactly one character to the client */
- g_assert (thrift_transport_write (client_transport,
- &data,
- sizeof data,
- &error) == TRUE);
-
- thrift_transport_flush (client_transport, &error);
- thrift_transport_write_end (client_transport, &error);
- thrift_transport_close (client_transport, &error);
-
- g_object_unref (client_transport);
- g_object_unref (server_transport);
-
- exit (0);
- }
+ {
+ ThriftServerTransport *server_transport = NULL;
+
+ g_object_unref (client_transport);
+
+ /* child listens */
+ server_transport = g_object_new (THRIFT_TYPE_SERVER_SOCKET,
+ "port", port,
+ NULL);
+ g_assert (server_transport != NULL);
+
+ thrift_server_transport_listen (server_transport, &error);
+ g_assert (error == NULL);
+
+ client_transport = g_object_new
+ (THRIFT_TYPE_BUFFERED_TRANSPORT,
+ "transport", thrift_server_transport_accept (server_transport, &error),
+ "r_buf_size", 0,
+ "w_buf_size", sizeof data,
+ NULL);
+ g_assert (error == NULL);
+ g_assert (client_transport != NULL);
+
+ /* write exactly one character to the client */
+ g_assert (thrift_transport_write (client_transport,
+ &data,
+ sizeof data,
+ &error) == TRUE);
+
+ thrift_transport_flush (client_transport, &error);
+ thrift_transport_write_end (client_transport, &error);
+ thrift_transport_close (client_transport, &error);
+
+ g_object_unref (client_transport);
+ g_object_unref (server_transport);
+
+ exit (0);
+ }
else {
- /* parent connects, wait a bit for the socket to be created */
- sleep (1);
+ /* parent connects, wait a bit for the socket to be created */
+ sleep (1);
- /* connect to the child */
- thrift_transport_open (client_transport, &error);
- g_assert (error == NULL);
- g_assert (thrift_transport_is_open (client_transport) == TRUE);
+ /* connect to the child */
+ thrift_transport_open (client_transport, &error);
+ g_assert (error == NULL);
+ g_assert (thrift_transport_is_open (client_transport) == TRUE);
- /* thrift_transport_peek returns TRUE when the socket is open and there is
+ /* thrift_transport_peek returns TRUE when the socket is open and there is
data available to be read */
- g_assert (thrift_transport_peek (client_transport, &error) == TRUE);
- g_assert (error == NULL);
+ g_assert (thrift_transport_peek (client_transport, &error) == TRUE);
+ g_assert (error == NULL);
- /* read exactly one character from the server */
- g_assert_cmpint (thrift_transport_read (client_transport,
- &data,
- sizeof data,
- &error), ==, sizeof data);
+ /* read exactly one character from the server */
+ g_assert_cmpint (thrift_transport_read (client_transport,
+ &data,
+ sizeof data,
+ &error), ==, sizeof data);
- /* thrift_transport_peek returns FALSE when the socket is open but there is
+ /* thrift_transport_peek returns FALSE when the socket is open but there is
no (more) data available to be read */
- g_assert (thrift_transport_is_open (client_transport) == TRUE);
- g_assert (thrift_transport_peek (client_transport, &error) == FALSE);
- g_assert (error == NULL);
+ g_assert (thrift_transport_is_open (client_transport) == TRUE);
+ g_assert (thrift_transport_peek (client_transport, &error) == FALSE);
+ g_assert (error == NULL);
- thrift_transport_read_end (client_transport, &error);
- thrift_transport_close (client_transport, &error);
+ thrift_transport_read_end (client_transport, &error);
+ thrift_transport_close (client_transport, &error);
- g_object_unref (client_transport);
+ g_object_unref (client_transport);
- g_assert (wait (&status) == pid);
- g_assert (status == 0);
+ g_assert (wait (&status) == pid);
+ g_assert (status == 0);
}
}
static void
+thrift_socket_server_open (const int port, int times)
+{
+ int bytes = 0;
+ ThriftServerTransport *transport = NULL;
+ ThriftTransport *client = NULL;
+ guchar buf[10]; /* a buffer */
+ guchar match[10] = TEST_DATA;
+ int i;
+ ThriftServerSocket *tsocket = g_object_new (THRIFT_TYPE_SERVER_SOCKET,
+ "port", port, NULL);
+
+ transport = THRIFT_SERVER_TRANSPORT (tsocket);
+ thrift_server_transport_listen (transport, NULL);
+ for(i=0;i<times;i++){
+ client = thrift_server_transport_accept (transport, NULL);
+ g_assert (client != NULL);
+ thrift_socket_close (client, NULL);
+ g_object_unref (client);
+ }
+ g_object_unref (tsocket);
+}
+
+
+static void
thrift_socket_server (const int port)
{
int bytes = 0;
@@ -280,7 +322,7 @@ thrift_socket_server (const int port)
guchar match[10] = TEST_DATA;
ThriftServerSocket *tsocket = g_object_new (THRIFT_TYPE_SERVER_SOCKET,
- "port", port, NULL);
+ "port", port, NULL);
transport = THRIFT_SERVER_TRANSPORT (tsocket);
thrift_server_transport_listen (transport, NULL);
http://git-wip-us.apache.org/repos/asf/thrift/blob/87ad2bca/lib/c_glib/test/testtransportsslsocket.c
----------------------------------------------------------------------
diff --git a/lib/c_glib/test/testtransportsslsocket.c b/lib/c_glib/test/testtransportsslsocket.c
index f2f56f8..3c2644d 100644
--- a/lib/c_glib/test/testtransportsslsocket.c
+++ b/lib/c_glib/test/testtransportsslsocket.c
@@ -16,13 +16,14 @@
* specific language governing permissions and limitations
* under the License.
*/
+#define _POSIX_C_SOURCE 200112L /* https://stackoverflow.com/questions/37541985/storage-size-of-addrinfo-isnt-known */
+
-#include <netdb.h>
#include <sys/wait.h>
+#include <arpa/inet.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
-#include <arpa/inet.h>
#include <thrift/c_glib/transport/thrift_transport.h>
#include <thrift/c_glib/transport/thrift_buffered_transport.h>
@@ -30,7 +31,7 @@
#include <thrift/c_glib/transport/thrift_server_socket.h>
#include <thrift/c_glib/transport/thrift_ssl_socket.h>
-//#define TEST_DATA { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j' }
+/* #define TEST_DATA { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j' } */
#define TEST_DATA { "GET / HTTP/1.1\n\n" }
@@ -40,9 +41,9 @@ int
my_socket(int domain, int type, int protocol)
{
if (socket_error == 0)
- {
- return socket (domain, type, protocol);
- }
+ {
+ return socket (domain, type, protocol);
+ }
return -1;
}
@@ -51,9 +52,9 @@ ssize_t
my_recv(int socket, void *buffer, size_t length, int flags)
{
if (recv_error == 0)
- {
- return recv (socket, buffer, length, flags);
- }
+ {
+ return recv (socket, buffer, length, flags);
+ }
return -1;
}
@@ -62,9 +63,9 @@ ssize_t
my_send(int socket, const void *buffer, size_t length, int flags)
{
if (send_error == 0)
- {
- return send (socket, buffer, length, flags);
- }
+ {
+ return send (socket, buffer, length, flags);
+ }
return -1;
}
@@ -76,7 +77,7 @@ my_send(int socket, const void *buffer, size_t length, int flags)
#undef recv
#undef send
-static void thrift_ssl_socket_server (const int port);
+static void thrift_socket_server (const int port);
/* test object creation and destruction */
static void
@@ -111,18 +112,90 @@ test_ssl_create_and_set_properties(void)
}
static void
-test_ssl_open_and_close(void)
+test_ssl_open_and_close_non_ssl_server(void)
{
ThriftSSLSocket *tSSLSocket = NULL;
ThriftTransport *transport = NULL;
GError *error=NULL;
+ pid_t pid;
+ int non_ssl_port = 51198;
+ char errormsg[255];
+
+
+ pid = fork ();
+ g_assert ( pid >= 0 );
+
+ if ( pid == 0 )
+ {
+ /* child listens */
+ /* This is a non SSL server */
+ thrift_socket_server (non_ssl_port);
+ exit (0);
+ } else {
+ /* parent connects, wait a bit for the socket to be created */
+ sleep (1);
+
+ /* open a connection and close it */
+ tSSLSocket = thrift_ssl_socket_new_with_host(SSLTLS, "localhost", non_ssl_port, &error);
+
+ transport = THRIFT_TRANSPORT (tSSLSocket);
+ g_assert (thrift_ssl_socket_open (transport, &error) == FALSE);
+ g_assert_cmpstr(error->message, == ,"Error while connect/bind: 68 -> Connection reset by peer");
+ g_clear_error (&error);
+ g_assert (thrift_ssl_socket_is_open (transport) == FALSE);
+ thrift_ssl_socket_close (transport, NULL);
+ g_assert (thrift_ssl_socket_is_open (transport) == FALSE);
+
+ /* test close failure */
+ THRIFT_SOCKET(tSSLSocket)->sd = -1;
+ thrift_ssl_socket_close (transport, NULL);
+ g_object_unref (tSSLSocket);
+
+ /* try a hostname lookup failure */
+ tSSLSocket = thrift_ssl_socket_new_with_host(SSLTLS, "localhost.broken", non_ssl_port, &error);
+ transport = THRIFT_TRANSPORT (tSSLSocket);
+ g_assert (thrift_ssl_socket_open (transport, &error) == FALSE);
+ snprintf(errormsg, 255, "host lookup failed for localhost.broken:%d - Unknown host", non_ssl_port);
+ g_assert_cmpstr(error->message, ==, errormsg);
+ g_clear_error (&error);
+ g_object_unref (tSSLSocket);
+ error = NULL;
+
+ /* try an error call to socket() */
+ /*
+ tSSLSocket = thrift_ssl_socket_new_with_host(SSLTLS, "localhost", port, &error);
+ transport = THRIFT_TRANSPORT (tSSLSocket);
+ socket_error = 1;
+ assert (thrift_ssl_socket_open (transport, &error) == FALSE);
+ socket_error = 0;
+ g_object_unref (tSSLSocket);
+ g_error_free (error);
+ */
+ }
+}
+
+static void
+test_ssl_write_invalid_socket(void)
+{
+ ThriftSSLSocket *tSSLSocket = NULL;
+ ThriftTransport *transport = NULL;
+ GError *error=NULL;
+ char buffer[] = "this must not break";
/* open a connection and close it */
- tSSLSocket = thrift_ssl_socket_new_with_host(SSLTLS, "localhost", 51188, &error);
+ tSSLSocket = thrift_ssl_socket_new_with_host(SSLTLS, "localhost", 51188+1, &error);
transport = THRIFT_TRANSPORT (tSSLSocket);
- thrift_ssl_socket_open (transport, NULL);
- g_assert (thrift_ssl_socket_is_open (transport) == TRUE);
+ g_assert (thrift_ssl_socket_open (transport, NULL) == FALSE);
+ g_assert (thrift_ssl_socket_is_open (transport) == FALSE);
+
+ /* FIXME This must be tested but since the assertion inside thrift_ssl_socket_write breaks the test unit
+ it's disabled. They idea is to disable trap/coredump during this test
+ g_assert (thrift_ssl_socket_write(transport, buffer, sizeof(buffer), &error) == FALSE);
+ g_message ("write_failed_with_error: %s",
+ error != NULL ? error->message : "No");
+ g_clear_error (&error);
+ */
thrift_ssl_socket_close (transport, NULL);
g_assert (thrift_ssl_socket_is_open (transport) == FALSE);
@@ -130,23 +203,6 @@ test_ssl_open_and_close(void)
THRIFT_SOCKET(tSSLSocket)->sd = -1;
thrift_ssl_socket_close (transport, NULL);
g_object_unref (tSSLSocket);
-
- /* try a hostname lookup failure */
- tSSLSocket = thrift_ssl_socket_new_with_host(SSLTLS, "localhost.broken", 51188, &error);
- transport = THRIFT_TRANSPORT (tSSLSocket);
- g_assert (thrift_ssl_socket_open (transport, &error) == FALSE);
- g_object_unref (tSSLSocket);
- g_error_free (error);
- error = NULL;
-
- /* try an error call to socket() */
- tSSLSocket = thrift_ssl_socket_new_with_host(SSLTLS, "localhost", 51188, &error);
- transport = THRIFT_TRANSPORT (tSSLSocket);
- socket_error = 1;
- g_assert (thrift_ssl_socket_open (transport, &error) == FALSE);
- socket_error = 0;
- g_object_unref (tSSLSocket);
- g_error_free (error);
}
@@ -160,22 +216,22 @@ unsigned char * get_cn_name(X509_NAME* const name)
unsigned char *utf8 = NULL;
do
- {
- if(!name) break; /* failed */
+ {
+ if(!name) break; /* failed */
- idx = X509_NAME_get_index_by_NID(name, NID_commonName, -1);
- if(!(idx > -1)) break; /* failed */
+ idx = X509_NAME_get_index_by_NID(name, NID_commonName, -1);
+ if(!(idx > -1)) break; /* failed */
- X509_NAME_ENTRY* entry = X509_NAME_get_entry(name, idx);
- if(!entry) break; /* failed */
+ X509_NAME_ENTRY* entry = X509_NAME_get_entry(name, idx);
+ if(!entry) break; /* failed */
- ASN1_STRING* data = X509_NAME_ENTRY_get_data(entry);
- if(!data) break; /* failed */
+ ASN1_STRING* data = X509_NAME_ENTRY_get_data(entry);
+ if(!data) break; /* failed */
- int length = ASN1_STRING_to_UTF8(&utf8, data);
- if(!utf8 || !(length > 0)) break; /* failed */
+ int length = ASN1_STRING_to_UTF8(&utf8, data);
+ if(!utf8 || !(length > 0)) break; /* failed */
- } while (0);
+ } while (0);
return utf8;
}
@@ -197,34 +253,34 @@ int verify_ip(char * hostname, struct sockaddr_storage *addr)
int retval = 0;
- memset(&hints, 0, sizeof hints);
- hints.ai_family = AF_UNSPEC; // use AF_INET6 to force IPv6
+ memset(&hints, 0, sizeof (struct addrinfo));
+ hints.ai_family = AF_UNSPEC; /* use AF_INET6 to force IPv6 */
hints.ai_socktype = SOCK_STREAM;
if ( (res = getaddrinfo(hostname, NULL, &hints, &addr_info) ) != 0)
- {
- // get the host info
- g_error("Cannot get the host address");
- return retval;
- }
- // loop through all the results and connect to the first we can
- char dnshost[INET6_ADDRSTRLEN]; // bigger addr supported IPV6
+ {
+ /* get the host info */
+ g_error("Cannot get the host address");
+ return retval;
+ }
+ /* loop through all the results and connect to the first we can */
+ char dnshost[INET6_ADDRSTRLEN]; /* bigger addr supported IPV6 */
char socket_ip[INET6_ADDRSTRLEN];
if(inet_ntop(addr->ss_family, get_in_addr(addr), socket_ip, INET6_ADDRSTRLEN)==socket_ip){
- g_debug("We are connected to host %s checking against certificate...", socket_ip);
- int sizeip = socket_ip!=NULL ? strlen(socket_ip) : 0;
- for(p = addr_info; p != NULL; p = p->ai_next) {
- if(inet_ntop(p->ai_family, get_in_addr((struct sockaddr *)p->ai_addr), dnshost, INET6_ADDRSTRLEN)==dnshost){
- if(dnshost!=NULL){
- g_info("DNS address [%i -> %s]", p->ai_addr, dnshost);
- if(!strncmp(dnshost, socket_ip, sizeip)){
- retval=1;
- break; // if we get here, we must have connected successfully
- }
- }
+ g_debug("We are connected to host %s checking against certificate...", socket_ip);
+ int sizeip = socket_ip!=NULL ? strlen(socket_ip) : 0;
+ for(p = addr_info; p != NULL; p = p->ai_next) {
+ if(inet_ntop(p->ai_family, get_in_addr((struct sockaddr *)p->ai_addr), dnshost, INET6_ADDRSTRLEN)==dnshost){
+ if(dnshost!=NULL){
+ g_info("DNS address [%i -> %s]", p->ai_addr, dnshost);
+ if(!strncmp(dnshost, socket_ip, sizeip)){
+ retval=1;
+ break; /* if we get here, we must have connected successfully */
+ }
+ }
+ }
}
- }
}
if(addr_info)
@@ -236,25 +292,25 @@ int verify_ip(char * hostname, struct sockaddr_storage *addr)
static void
read_from_file(char *buffer, long size, const char *file_name)
{
- char ch;
- long index=0;
- FILE *fp;
+ char ch;
+ long index=0;
+ FILE *fp;
- fp = fopen(file_name,"r"); // read mode
+ fp = fopen(file_name,"r"); /* read mode */
- if( fp == NULL )
- {
- perror("Error while opening the file.\n");
- exit(EXIT_FAILURE);
- }
+ if( fp == NULL )
+ {
+ perror("Error while opening the file.\n");
+ exit(EXIT_FAILURE);
+ }
- printf("The contents of %s file are :\n", file_name);
+ printf("The contents of %s file are :\n", file_name);
- while(index<size && ( ch = fgetc(fp) ) != EOF ){
- buffer[index++] = ch;
- }
+ while(index<size && ( ch = fgetc(fp) ) != EOF ){
+ buffer[index++] = ch;
+ }
- fclose(fp);
+ fclose(fp);
}
#define ISSUER_CN_PINNING "The Apache Software Foundation"
@@ -269,25 +325,27 @@ gboolean verify_certificate_sn(X509 *cert, const unsigned char *serial_number)
BIGNUM *bn = ASN1_INTEGER_to_BN(serial, NULL);
if (!bn) {
- fprintf(stderr, "unable to convert ASN1INTEGER to BN\n");
- return EXIT_FAILURE;
+ fprintf(stderr, "unable to convert ASN1INTEGER to BN\n");
+ return EXIT_FAILURE;
}
char *tmp = BN_bn2dec(bn);
if (!tmp) {
- g_warning(stderr, "unable to convert BN to decimal string.\n");
- BN_free(bn);
- return EXIT_FAILURE;
+ g_warning(stderr, "unable to convert BN to decimal string.\n");
+ BN_free(bn);
+ return EXIT_FAILURE;
}
-// if (strlen(tmp) >= len) {
-// g_warn(stderr, "buffer length shorter than serial number\n");
-// BN_free(bn);
-// OPENSSL_free(tmp);
-// return EXIT_FAILURE;
-// }
+ /*
+ if (strlen(tmp) >= len) {
+ g_warn(stderr, "buffer length shorter than serial number\n");
+ BN_free(bn);
+ OPENSSL_free(tmp);
+ return EXIT_FAILURE;
+ }
+ */
if(!strncmp(serial_number, tmp, strlen(serial_number))){
- retval=TRUE;
+ retval=TRUE;
}else{
- g_warning("Serial number is not valid");
+ g_warning("Serial number is not valid");
}
BN_free(bn);
@@ -306,52 +364,52 @@ gboolean my_access_manager(ThriftTransport * transport, X509 *cert, struct socka
/* Issuer is the authority we trust that warrants nothing useful */
const unsigned char * issuer = get_cn_name(iname);
if(issuer){
- gboolean valid = TRUE;
- g_info("Issuer (cn) %s", issuer);
+ gboolean valid = TRUE;
+ g_info("Issuer (cn) %s", issuer);
- // Issuer pinning
- if(strncmp(ISSUER_CN_PINNING, issuer, strlen(ISSUER_CN_PINNING))){
- g_warning("The Issuer of the certificate is not valid");
- valid=FALSE;
- }
- OPENSSL_free(issuer);
- if(!valid)
- return valid;
+ /* Issuer pinning */
+ if(strncmp(ISSUER_CN_PINNING, issuer, strlen(ISSUER_CN_PINNING))){
+ g_warning("The Issuer of the certificate is not valid");
+ valid=FALSE;
+ }
+ OPENSSL_free(issuer);
+ if(!valid)
+ return valid;
}
/* Subject is who the certificate is issued to by the authority */
const unsigned char * subject = get_cn_name(sname);
if(subject){
- g_info("Subject (cn) %s", subject);
- gboolean valid = TRUE;
+ g_info("Subject (cn) %s", subject);
+ gboolean valid = TRUE;
- // Subject pinning
- if(strncmp(SUBJECT_CN_PINNING, subject, strlen(SUBJECT_CN_PINNING))){
- g_warning("The subject of the certificate is not valid");
- valid=FALSE;
- }
+ /* Subject pinning */
+ if(strncmp(SUBJECT_CN_PINNING, subject, strlen(SUBJECT_CN_PINNING))){
+ g_warning("The subject of the certificate is not valid");
+ valid=FALSE;
+ }
- if(!valid)
- return valid;
+ if(!valid)
+ return valid;
- // Host pinning
- if(verify_ip(subject, addr)){
- g_info("Verified subject");
- }else{
- g_info("Cannot verify subject");
- valid=FALSE;
- }
- OPENSSL_free(subject);
+ /* Host pinning */
+ if(verify_ip(subject, addr)){
+ g_info("Verified subject");
+ }else{
+ g_info("Cannot verify subject");
+ valid=FALSE;
+ }
+ OPENSSL_free(subject);
- if(!valid)
- return valid;
+ if(!valid)
+ return valid;
}
if(!verify_certificate_sn(cert, CERT_SERIAL_NUMBER)){
- return FALSE;
+ return FALSE;
}else{
- g_info("Verified serial number");
+ g_info("Verified serial number");
}
return TRUE;
@@ -369,32 +427,33 @@ test_ssl_authorization_manager(void)
pid_t pid;
ThriftSSLSocket *tSSLsocket = NULL;
ThriftTransport *transport = NULL;
- // int port = 51199;
+ /* int port = 51199; */
int port = 443;
GError *error=NULL;
guchar buf[17] = TEST_DATA; /* a buffer */
- // pid = fork ();
- // g_assert ( pid >= 0 );
- //
- // if ( pid == 0 )
- // {
- // /* child listens */
- // thrift_ssl_socket_server (port);
- // exit (0);
- // } else {
+/*
+ pid = fork ();
+ g_assert ( pid >= 0 );
+
+ if ( pid == 0 )
+ {
+ thrift_ssl_socket_server (port);
+ exit (0);
+ } else {
+ */
/* parent connects, wait a bit for the socket to be created */
sleep (1);
- // Test against level2 owncloud certificate
+ /* Test against level2 owncloud certificate */
tSSLsocket = thrift_ssl_socket_new_with_host(SSLTLS, "localhost", port, &error);
- thrift_ssl_socket_set_manager(tSSLsocket, my_access_manager); // Install pinning manager
- //thrift_ssl_load_cert_from_file(tSSLsocket, "./owncloud.level2crm.pem");
+ thrift_ssl_socket_set_manager(tSSLsocket, my_access_manager); /* Install pinning manager */
+ /* thrift_ssl_load_cert_from_file(tSSLsocket, "./owncloud.level2crm.pem"); */
unsigned char cert_buffer[65534];
read_from_file(cert_buffer, 65534, "../../keys/client.pem");
if(!thrift_ssl_load_cert_from_buffer(tSSLsocket, cert_buffer)){
- g_warning("Certificates cannot be loaded!");
+ g_warning("Certificates cannot be loaded!");
}
transport = THRIFT_TRANSPORT (tSSLsocket);
@@ -405,122 +464,24 @@ test_ssl_authorization_manager(void)
/* write fail */
send_error = 1;
- // thrift_ssl_socket_write (transport, buf, 1, NULL);
- // send_error = 0;
-
- // thrift_ssl_socket_write_end (transport, NULL);
- // thrift_ssl_socket_flush (transport, NULL);
+ /*
+ thrift_ssl_socket_write (transport, buf, 1, NULL);
+ send_error = 0;
+ thrift_ssl_socket_write_end (transport, NULL);
+ thrift_ssl_socket_flush (transport, NULL);
+ */
thrift_ssl_socket_close (transport, NULL);
g_object_unref (tSSLsocket);
- // g_assert ( wait (&status) == pid );
+ /* g_assert ( wait (&status) == pid ); */
g_assert ( status == 0 );
- // }
+ /* } */
}
#endif
-/* test ThriftSocket's peek() implementation */
-//static void
-//test_ssl_peek(void)
-//{
-// gint status;
-// pid_t pid;
-// guint port = 51199;
-// gchar data = 'A';
-// ThriftTransport *client_transport;
-// GError *error = NULL;
-//
-// client_transport = g_object_new (THRIFT_TYPE_SSL_SOCKET,
-// "hostname", "localhost",
-// "port", port,
-// NULL);
-//
-// /* thrift_transport_peek returns FALSE when the socket is closed */
-// g_assert (thrift_transport_is_open (client_transport) == FALSE);
-// g_assert (thrift_transport_peek (client_transport, &error) == FALSE);
-// g_assert (error == NULL);
-//
-// pid = fork ();
-// g_assert (pid >= 0);
-//
-// if (pid == 0)
-// {
-// ThriftServerTransport *server_transport = NULL;
-//
-// g_object_unref (client_transport);
-//
-// /* child listens */
-// server_transport = g_object_new (THRIFT_TYPE_SERVER_SOCKET,
-// "port", port,
-// NULL);
-// g_assert (server_transport != NULL);
-//
-// thrift_server_transport_listen (server_transport, &error);
-// g_assert (error == NULL);
-//
-// client_transport = g_object_new
-// (THRIFT_TYPE_BUFFERED_TRANSPORT,
-// "transport", thrift_server_transport_accept (server_transport, &error),
-// "r_buf_size", 0,
-// "w_buf_size", sizeof data,
-// NULL);
-// g_assert (error == NULL);
-// g_assert (client_transport != NULL);
-//
-// /* write exactly one character to the client */
-// g_assert (thrift_transport_write (client_transport,
-// &data,
-// sizeof data,
-// &error) == TRUE);
-//
-// thrift_transport_flush (client_transport, &error);
-// thrift_transport_write_end (client_transport, &error);
-// thrift_transport_close (client_transport, &error);
-//
-// g_object_unref (client_transport);
-// g_object_unref (server_transport);
-//
-// exit (0);
-// }
-// else {
-// /* parent connects, wait a bit for the socket to be created */
-// sleep (1);
-//
-// /* connect to the child */
-// thrift_transport_open (client_transport, &error);
-// g_assert (error == NULL);
-// g_assert (thrift_transport_is_open (client_transport) == TRUE);
-//
-// /* thrift_transport_peek returns TRUE when the socket is open and there is
-// data available to be read */
-// g_assert (thrift_transport_peek (client_transport, &error) == TRUE);
-// g_assert (error == NULL);
-//
-// /* read exactly one character from the server */
-// g_assert_cmpint (thrift_transport_read (client_transport,
-// &data,
-// sizeof data,
-// &error), ==, sizeof data);
-//
-// /* thrift_transport_peek returns FALSE when the socket is open but there is
-// no (more) data available to be read */
-// g_assert (thrift_transport_is_open (client_transport) == TRUE);
-// g_assert (thrift_transport_peek (client_transport, &error) == FALSE);
-// g_assert (error == NULL);
-//
-// thrift_transport_read_end (client_transport, &error);
-// thrift_transport_close (client_transport, &error);
-//
-// g_object_unref (client_transport);
-//
-// g_assert (wait (&status) == pid);
-// g_assert (status == 0);
-// }
-//}
-
static void
-thrift_ssl_socket_server (const int port)
+thrift_socket_server (const int port)
{
int bytes = 0;
ThriftServerTransport *transport = NULL;
@@ -529,7 +490,7 @@ thrift_ssl_socket_server (const int port)
guchar match[10] = TEST_DATA;
ThriftServerSocket *tsocket = g_object_new (THRIFT_TYPE_SERVER_SOCKET,
- "port", port, NULL);
+ "port", port, NULL);
transport = THRIFT_SERVER_TRANSPORT (tsocket);
thrift_server_transport_listen (transport, NULL);
@@ -566,10 +527,11 @@ main(int argc, char *argv[])
g_test_add_func ("/testtransportsslsocket/CreateAndDestroy", test_ssl_create_and_destroy);
g_test_add_func ("/testtransportsslsocket/CreateAndSetProperties", test_ssl_create_and_set_properties);
- g_test_add_func ("/testtransportsslsocket/OpenAndClose", test_ssl_open_and_close);
- // This test is disabled because server is not ready
- // g_test_add_func ("/testtransportsslsocket/AuthorizationManagerPinning", test_ssl_authorization_manager);
- // g_test_add_func ("/testtransportsslsocket/Peek", test_ssl_peek);
+ g_test_add_func ("/testtransportsslsocket/OpenAndCloseNonSSLServer", test_ssl_open_and_close_non_ssl_server);
+ g_test_add_func ("/testtransportsslsocket/OpenAndWriteInvalidSocket", test_ssl_write_invalid_socket);
+
+
+
retval = g_test_run ();
http://git-wip-us.apache.org/repos/asf/thrift/blob/87ad2bca/test/c_glib/Makefile.am
----------------------------------------------------------------------
diff --git a/test/c_glib/Makefile.am b/test/c_glib/Makefile.am
index 0c478f9..4a03d29 100755
--- a/test/c_glib/Makefile.am
+++ b/test/c_glib/Makefile.am
@@ -45,6 +45,8 @@ test_client_LDADD = \
test_server_SOURCES = \
src/thrift_test_handler.c \
src/thrift_test_handler.h \
+ src/thrift_second_service_handler.c \
+ src/thrift_second_service_handler.h \
src/test_server.c
test_server_LDADD = \
http://git-wip-us.apache.org/repos/asf/thrift/blob/87ad2bca/test/c_glib/src/test_client.c
----------------------------------------------------------------------
diff --git a/test/c_glib/src/test_client.c b/test/c_glib/src/test_client.c
index deff4e1..ef24ab7 100644
--- a/test/c_glib/src/test_client.c
+++ b/test/c_glib/src/test_client.c
@@ -412,7 +412,7 @@ main (int argc, char **argv)
"2nd",
&error)) {
printf (" = \"%s\"\n", string);
- if (strncmp (string, "testString(\"2nd\")", 18) != 0) {
+ if (strcmp (string, "testString(\"2nd\")") != 0) {
++fail_count;
}
http://git-wip-us.apache.org/repos/asf/thrift/blob/87ad2bca/test/c_glib/src/test_server.c
----------------------------------------------------------------------
diff --git a/test/c_glib/src/test_server.c b/test/c_glib/src/test_server.c
index 7f41d3f..2d716ec 100644
--- a/test/c_glib/src/test_server.c
+++ b/test/c_glib/src/test_server.c
@@ -23,6 +23,7 @@
#include <string.h>
#include <thrift/c_glib/thrift.h>
+#include <thrift/c_glib/processor/thrift_multiplexed_processor.h>
#include <thrift/c_glib/protocol/thrift_binary_protocol_factory.h>
#include <thrift/c_glib/protocol/thrift_compact_protocol_factory.h>
#include <thrift/c_glib/server/thrift_server.h>
@@ -37,8 +38,10 @@
#include <thrift/c_glib/transport/thrift_transport_factory.h>
#include "../gen-c_glib/t_test_thrift_test.h"
+#include "../gen-c_glib/t_test_second_service.h"
#include "thrift_test_handler.h"
+#include "thrift_second_service_handler.h"
/* Our server object, declared globally so it is accessible within the SIGINT
signal handler */
@@ -96,7 +99,10 @@ main (int argc, char **argv)
GType protocol_factory_type = THRIFT_TYPE_BINARY_PROTOCOL_FACTORY;
TTestThriftTestHandler *handler;
+ TTestThriftTestHandler *handler_second_service = NULL;
ThriftProcessor *processor;
+ ThriftProcessor *processor_test = NULL;
+ ThriftProcessor *processor_second_service = NULL;
ThriftServerTransport *server_transport;
ThriftTransportFactory *transport_factory;
ThriftProtocolFactory *protocol_factory;
@@ -138,6 +144,13 @@ main (int argc, char **argv)
protocol_factory_type = THRIFT_TYPE_COMPACT_PROTOCOL_FACTORY;
protocol_name = "compact";
}
+ else if (strncmp (protocol_option, "multi", 6) == 0) {
+ protocol_name = "binary:multi";
+ }
+ else if (strncmp (protocol_option, "multic", 7) == 0) {
+ protocol_factory_type = THRIFT_TYPE_COMPACT_PROTOCOL_FACTORY;
+ protocol_name = "compact:multic";
+ }
else if (strncmp (protocol_option, "binary", 7) != 0) {
fprintf (stderr, "Unknown protocol type %s\n", protocol_option);
options_valid = FALSE;
@@ -161,16 +174,57 @@ main (int argc, char **argv)
/* Establish all our connection objects */
handler = g_object_new (TYPE_THRIFT_TEST_HANDLER,
NULL);
- processor = g_object_new (T_TEST_TYPE_THRIFT_TEST_PROCESSOR,
- "handler", handler,
- NULL);
+
+
+
+ if(strstr(protocol_name, ":multi")){
+ /* When a multiplexed processor is involved the handler is not
+ registered as usual. We create the processor and the real
+ processor is registered. Multiple processors can be registered
+ at once. This is why we don't have a constructor property */
+ processor = g_object_new (THRIFT_TYPE_MULTIPLEXED_PROCESSOR,
+ NULL);
+
+ handler_second_service = g_object_new (TYPE_SECOND_SERVICE_HANDLER,
+ NULL);
+
+ processor_test = g_object_new (T_TEST_TYPE_THRIFT_TEST_PROCESSOR,
+ "handler", handler,
+ NULL);
+ processor_second_service = g_object_new (T_TEST_TYPE_SECOND_SERVICE_PROCESSOR,
+ "handler", handler_second_service,
+ NULL);
+
+ /* We register a test processor with Multiplexed name ThriftTest */
+ if(!thrift_multiplexed_processor_register_processor(processor,
+ "ThriftTest", processor_test,
+ &error)){
+ g_message ("thrift_server_serve: %s",
+ error != NULL ? error->message : "(null)");
+ g_clear_error (&error);
+ }
+ /* We register a second test processor with Multiplexed name SecondService
+ * we are responsible of freeing the processor when it's not used anymore */
+ if(!thrift_multiplexed_processor_register_processor(processor,
+ "SecondService", processor_second_service,
+ &error)){
+ g_message ("thrift_server_serve: %s",
+ error != NULL ? error->message : "(null)");
+ g_clear_error (&error);
+ }
+
+ }else{
+ processor = g_object_new (T_TEST_TYPE_THRIFT_TEST_PROCESSOR,
+ "handler", handler,
+ NULL);
+ }
server_transport = g_object_new (THRIFT_TYPE_SERVER_SOCKET,
"port", port,
NULL);
transport_factory = g_object_new (transport_factory_type,
NULL);
- if (strncmp (protocol_name, "compact", 8) == 0) {
+ if (strstr (protocol_name, "compact") != NULL) {
protocol_factory = g_object_new (protocol_factory_type,
"string_limit", string_limit,
"container_limit", container_limit,
@@ -222,6 +276,15 @@ main (int argc, char **argv)
g_object_unref (server_transport);
g_object_unref (processor);
g_object_unref (handler);
+ if(handler_second_service){
+ g_object_unref (handler_second_service);
+ }
+ if(processor_test){
+ g_object_unref (processor_test);
+ }
+ if(processor_second_service){
+ g_object_unref (processor_second_service);
+ }
return 0;
}
http://git-wip-us.apache.org/repos/asf/thrift/blob/87ad2bca/test/c_glib/src/thrift_second_service_handler.c
----------------------------------------------------------------------
diff --git a/test/c_glib/src/thrift_second_service_handler.c b/test/c_glib/src/thrift_second_service_handler.c
new file mode 100644
index 0000000..c464372
--- /dev/null
+++ b/test/c_glib/src/thrift_second_service_handler.c
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <inttypes.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <thrift/c_glib/thrift.h>
+#include <thrift/c_glib/thrift_application_exception.h>
+
+#include "thrift_second_service_handler.h"
+
+/* A handler that implements the TTestSecondServiceIf interface */
+
+G_DEFINE_TYPE (SecondServiceHandler,
+ second_service_handler,
+ T_TEST_TYPE_SECOND_SERVICE_HANDLER);
+
+
+gboolean
+second_service_handler_secondtest_string (TTestSecondServiceIf *iface,
+ gchar **_return,
+ const gchar *thing,
+ GError **error)
+{
+ THRIFT_UNUSED_VAR (iface);
+ THRIFT_UNUSED_VAR (error);
+ gchar buffer[256];
+
+ printf ("testSecondServiceMultiplexSecondTestString(\"%s\")\n", thing);
+ snprintf(buffer, 255, "testString(\"%s\")", thing);
+ *_return = g_strdup (buffer);
+
+ return TRUE;
+}
+
+gboolean
+second_service_handler_blah_blah (TTestSecondServiceIf *iface, GError **error)
+{
+ THRIFT_UNUSED_VAR (iface);
+ THRIFT_UNUSED_VAR (error);
+
+ printf ("blahBlah()\n");
+
+ return TRUE;
+}
+
+static void
+second_service_handler_init (SecondServiceHandler *self)
+{
+ THRIFT_UNUSED_VAR (self);
+}
+
+static void
+second_service_handler_class_init (SecondServiceHandlerClass *klass)
+{
+ TTestSecondServiceHandlerClass *base_class =
+ T_TEST_SECOND_SERVICE_HANDLER_CLASS (klass);
+
+
+ base_class->secondtest_string =
+ second_service_handler_secondtest_string;
+ base_class->blah_blah =
+ second_service_handler_blah_blah;
+
+}
http://git-wip-us.apache.org/repos/asf/thrift/blob/87ad2bca/test/c_glib/src/thrift_second_service_handler.h
----------------------------------------------------------------------
diff --git a/test/c_glib/src/thrift_second_service_handler.h b/test/c_glib/src/thrift_second_service_handler.h
new file mode 100644
index 0000000..bbe048c
--- /dev/null
+++ b/test/c_glib/src/thrift_second_service_handler.h
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef _SECOND_SERVICE_HANDLER_H
+#define _SECOND_SERVICE_HANDLER_H
+
+#include <glib-object.h>
+#include <stdio.h>
+
+#include "../gen-c_glib/t_test_second_service.h"
+
+G_BEGIN_DECLS
+
+/* A handler that implements the TTestSecondServiceIf interface */
+
+#define TYPE_SECOND_SERVICE_HANDLER (second_service_handler_get_type ())
+
+#define SECOND_SERVICE_HANDLER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ TYPE_SECOND_SERVICE_HANDLER, \
+ SecondServiceHandler))
+#define IS_SECOND_SERVICE_HANDLER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ TYPE_SECOND_SERVICE_HANDLER))
+#define SECOND_SERVICE_HANDLER_CLASS(c) \
+ (G_TYPE_CHECK_CLASS_CAST ((c), \
+ TYPE_SECOND_SERVICE_HANDLER, \
+ SecondServiceHandlerClass))
+#define IS_SECOND_SERVICE_HANDLER_CLASS(c) \
+ (G_TYPE_CHECK_CLASS_TYPE ((c), \
+ TYPE_SECOND_SERVICE_HANDLER))
+#define SECOND_SERVICE_HANDLER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ TYPE_SECOND_SERVICE_HANDLER, \
+ SecondServiceHandlerClass))
+
+typedef struct _SecondServiceHandler SecondServiceHandler;
+typedef struct _SecondServiceHandlerClass SecondServiceHandlerClass;
+
+struct _SecondServiceHandler {
+ TTestSecondServiceHandler parent;
+};
+
+struct _SecondServiceHandlerClass {
+ TTestSecondServiceHandlerClass parent;
+
+};
+
+/* Used by SECOND_SERVICE_HANDLER_GET_TYPE */
+GType second_service_handler_get_type (void);
+
+gboolean second_service_handler_blah_blah (TTestSecondServiceIf *iface, GError **error);
+gboolean second_service_handler_secondtest_string (TTestSecondServiceIf *iface, gchar ** _return, const gchar * thing, GError **error);
+
+G_END_DECLS
+
+#endif /* _SECOND_SERVICE_HANDLER_H */
http://git-wip-us.apache.org/repos/asf/thrift/blob/87ad2bca/test/features/tests.json
----------------------------------------------------------------------
diff --git a/test/features/tests.json b/test/features/tests.json
index 3ab3b68..41e07d7 100644
--- a/test/features/tests.json
+++ b/test/features/tests.json
@@ -66,7 +66,6 @@
"--string-limit=50"
],
"protocols": [
- "binary",
"compact"
],
"transports": ["buffered"],
@@ -84,7 +83,6 @@
"--container-limit=50"
],
"protocols": [
- "binary",
"compact"
],
"transports": ["buffered"],
http://git-wip-us.apache.org/repos/asf/thrift/blob/87ad2bca/test/tests.json
----------------------------------------------------------------------
diff --git a/test/tests.json b/test/tests.json
index e62af24..c1c3155 100644
--- a/test/tests.json
+++ b/test/tests.json
@@ -8,6 +8,12 @@
"command": [
"test_server",
"--lt-debug"
+ ],
+ "protocols": [
+ "binary:multi",
+ "compact:multic",
+ "multi",
+ "multic"
]
},
"client": {
[34/50] [abbrv] thrift git commit: THRIFT-4329: multiplexed processor,
client and server for c_glib Client: c_glib
Posted by je...@apache.org.
THRIFT-4329: multiplexed processor, client and server for c_glib
Client: c_glib
This closes #1361
Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/87ad2bca
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/87ad2bca
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/87ad2bca
Branch: refs/heads/0.11.0
Commit: 87ad2bcaaa5a9fe224ad7a9826b676ca9721ddd1
Parents: 95d5fb3
Author: Gonzalo Aguilar Delgado <ga...@level2crm.com>
Authored: Fri Sep 15 12:26:02 2017 +0200
Committer: James E. King, III <jk...@apache.org>
Committed: Sat Nov 18 21:10:18 2017 -0500
----------------------------------------------------------------------
lib/c_glib/CMakeLists.txt | 3 +
lib/c_glib/Makefile.am | 9 +-
.../processor/thrift_multiplexed_processor.c | 346 ++++++++++++++
.../processor/thrift_multiplexed_processor.h | 114 +++++
.../protocol/thrift_multiplexed_protocol.c | 2 +-
.../c_glib/protocol/thrift_protocol_decorator.c | 3 -
.../protocol/thrift_stored_message_protocol.c | 192 ++++++++
.../protocol/thrift_stored_message_protocol.h | 78 ++++
.../c_glib/transport/thrift_platform_socket.h | 12 +-
.../src/thrift/c_glib/transport/thrift_socket.c | 41 +-
.../thrift/c_glib/transport/thrift_ssl_socket.c | 234 ++++++----
.../thrift/c_glib/transport/thrift_ssl_socket.h | 16 +-
lib/c_glib/test/CMakeLists.txt | 2 +
lib/c_glib/test/testbufferedtransport.c | 318 +++++++------
lib/c_glib/test/testframedtransport.c | 311 +++++++------
lib/c_glib/test/testtransportsocket.c | 312 +++++++------
lib/c_glib/test/testtransportsslsocket.c | 462 +++++++++----------
test/c_glib/Makefile.am | 2 +
test/c_glib/src/test_client.c | 2 +-
test/c_glib/src/test_server.c | 71 ++-
test/c_glib/src/thrift_second_service_handler.c | 82 ++++
test/c_glib/src/thrift_second_service_handler.h | 73 +++
test/features/tests.json | 2 -
test/tests.json | 6 +
24 files changed, 1896 insertions(+), 797 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/thrift/blob/87ad2bca/lib/c_glib/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/lib/c_glib/CMakeLists.txt b/lib/c_glib/CMakeLists.txt
index 5e277f0..3743a68 100644
--- a/lib/c_glib/CMakeLists.txt
+++ b/lib/c_glib/CMakeLists.txt
@@ -33,9 +33,12 @@ set(thrift_c_glib_SOURCES
src/thrift/c_glib/thrift_application_exception.c
src/thrift/c_glib/processor/thrift_processor.c
src/thrift/c_glib/processor/thrift_dispatch_processor.c
+ src/thrift/c_glib/processor/thrift_multiplexed_processor.c
src/thrift/c_glib/protocol/thrift_protocol.c
src/thrift/c_glib/protocol/thrift_protocol_factory.c
+ src/thrift/c_glib/protocol/thrift_protocol_decorator.c
src/thrift/c_glib/protocol/thrift_binary_protocol.c
+ src/thrift/c_glib/protocol/thrift_stored_message_protocol.c
src/thrift/c_glib/protocol/thrift_binary_protocol_factory.c
src/thrift/c_glib/protocol/thrift_compact_protocol.c
src/thrift/c_glib/protocol/thrift_compact_protocol_factory.c
http://git-wip-us.apache.org/repos/asf/thrift/blob/87ad2bca/lib/c_glib/Makefile.am
----------------------------------------------------------------------
diff --git a/lib/c_glib/Makefile.am b/lib/c_glib/Makefile.am
index 871766b..49b5b23 100755
--- a/lib/c_glib/Makefile.am
+++ b/lib/c_glib/Makefile.am
@@ -34,10 +34,12 @@ libthrift_c_glib_la_SOURCES = src/thrift/c_glib/thrift.c \
src/thrift/c_glib/thrift_application_exception.c \
src/thrift/c_glib/processor/thrift_processor.c \
src/thrift/c_glib/processor/thrift_dispatch_processor.c \
+ src/thrift/c_glib/processor/thrift_multiplexed_processor.c \
src/thrift/c_glib/protocol/thrift_protocol.c \
src/thrift/c_glib/protocol/thrift_protocol_decorator.c \
src/thrift/c_glib/protocol/thrift_protocol_factory.c \
src/thrift/c_glib/protocol/thrift_binary_protocol.c \
+ src/thrift/c_glib/protocol/thrift_stored_message_protocol.c \
src/thrift/c_glib/protocol/thrift_multiplexed_protocol.c \
src/thrift/c_glib/protocol/thrift_binary_protocol_factory.c \
src/thrift/c_glib/protocol/thrift_compact_protocol.c \
@@ -75,7 +77,9 @@ include_protocol_HEADERS = src/thrift/c_glib/protocol/thrift_protocol.h \
src/thrift/c_glib/protocol/thrift_binary_protocol_factory.h \
src/thrift/c_glib/protocol/thrift_compact_protocol.h \
src/thrift/c_glib/protocol/thrift_compact_protocol_factory.h \
- src/thrift/c_glib/protocol/thrift_multiplexed_protocol.h
+ src/thrift/c_glib/protocol/thrift_multiplexed_protocol.h \
+ src/thrift/c_glib/protocol/thrift_stored_message_protocol.h
+
include_transportdir = $(include_thriftdir)/transport
include_transport_HEADERS = src/thrift/c_glib/transport/thrift_buffered_transport.h \
@@ -98,7 +102,8 @@ include_server_HEADERS = src/thrift/c_glib/server/thrift_server.h \
include_processordir = $(include_thriftdir)/processor
include_processor_HEADERS = src/thrift/c_glib/processor/thrift_processor.h \
- src/thrift/c_glib/processor/thrift_dispatch_processor.h
+ src/thrift/c_glib/processor/thrift_dispatch_processor.h \
+ src/thrift/c_glib/processor/thrift_multiplexed_processor.h
EXTRA_DIST = \
http://git-wip-us.apache.org/repos/asf/thrift/blob/87ad2bca/lib/c_glib/src/thrift/c_glib/processor/thrift_multiplexed_processor.c
----------------------------------------------------------------------
diff --git a/lib/c_glib/src/thrift/c_glib/processor/thrift_multiplexed_processor.c b/lib/c_glib/src/thrift/c_glib/processor/thrift_multiplexed_processor.c
new file mode 100644
index 0000000..68a0f4d
--- /dev/null
+++ b/lib/c_glib/src/thrift/c_glib/processor/thrift_multiplexed_processor.c
@@ -0,0 +1,346 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+#include <string.h>
+#include <stdio.h>
+
+#include <thrift/c_glib/thrift.h>
+#include <thrift/c_glib/processor/thrift_processor.h>
+#include <thrift/c_glib/processor/thrift_multiplexed_processor.h>
+#include <thrift/c_glib/protocol/thrift_multiplexed_protocol.h>
+#include <thrift/c_glib/protocol/thrift_stored_message_protocol.h>
+#include <thrift/c_glib/thrift_application_exception.h>
+
+G_DEFINE_TYPE(ThriftMultiplexedProcessor, thrift_multiplexed_processor, THRIFT_TYPE_PROCESSOR)
+
+
+enum
+{
+ PROP_THRIFT_MULTIPLEXED_PROCESSOR_DEFAULT_SERVICE_NAME = 1,
+ PROP_THRIFT_MULTIPLEXED_PROCESSOR_END
+};
+
+static GParamSpec *thrift_multiplexed_processor_obj_properties[PROP_THRIFT_MULTIPLEXED_PROCESSOR_END] = { NULL, };
+
+
+static gboolean
+thrift_multiplexed_processor_register_processor_impl(ThriftProcessor *processor, const gchar * multiplexed_processor_name, ThriftProcessor * multiplexed_processor , GError **error)
+{
+ ThriftMultiplexedProcessor *self = THRIFT_MULTIPLEXED_PROCESSOR(processor);
+ g_hash_table_replace(self->multiplexed_services,
+ g_strdup(multiplexed_processor_name),
+ g_object_ref (multiplexed_processor));
+
+ /* Make first registered become default */
+ if(!self->default_processor_name){
+ self->default_processor_name = g_strdup(multiplexed_processor_name);
+ }
+ return TRUE;
+}
+
+
+static gboolean
+thrift_multiplexed_processor_process_impl (ThriftProcessor *processor, ThriftProtocol *in,
+ ThriftProtocol *out, GError **error)
+{
+ gboolean retval = FALSE;
+ gboolean token_error = FALSE;
+ ThriftApplicationException *xception;
+ ThriftStoredMessageProtocol *stored_message_protocol = NULL;
+ ThriftMessageType message_type;
+ ThriftMultiplexedProcessor *self = THRIFT_MULTIPLEXED_PROCESSOR(processor);
+ ThriftProcessor *multiplexed_processor = NULL;
+ ThriftTransport *transport;
+ char *token=NULL;
+ int token_index=0;
+ char *state=NULL;
+ gchar *fname=NULL;
+ gint32 seqid, result;
+
+ /* FIXME It seems that previous processor is not managing error correctly */
+ if(*error!=NULL) {
+ g_debug ("thrift_multiplexed_processor: last error not removed: %s",
+ *error != NULL ? (*error)->message : "(null)");
+ g_clear_error (error);
+ }
+
+
+ THRIFT_PROTOCOL_GET_CLASS(in)->read_message_begin(in, &fname, &message_type, &seqid, error);
+
+ if(!(message_type == T_CALL || message_type == T_ONEWAY)) {
+ g_set_error (error,
+ THRIFT_MULTIPLEXED_PROCESSOR_ERROR,
+ THRIFT_MULTIPLEXED_PROCESSOR_ERROR_MESSAGE_TYPE,
+ "message type invalid for this processor");
+ }else{
+ /* Split by the token */
+ for (token = strtok_r(fname, THRIFT_MULTIPLEXED_PROTOCOL_DEFAULT_SEPARATOR, &state),
+ token_index=0;
+ token != NULL && !token_error;
+ token = strtok_r(NULL, THRIFT_MULTIPLEXED_PROTOCOL_DEFAULT_SEPARATOR, &state),
+ token_index++)
+ {
+ switch(token_index){
+ case 0:
+ /* It should be the service name */
+ multiplexed_processor = g_hash_table_lookup(self->multiplexed_services, token);
+ if(multiplexed_processor==NULL){
+ token_error=TRUE;
+ }
+ break;
+ case 1:
+ /* It should be the function name */
+ stored_message_protocol = g_object_new (THRIFT_TYPE_STORED_MESSAGE_PROTOCOL,
+ "protocol", in,
+ "name", token,
+ "type", message_type,
+ "seqid", seqid,
+ NULL);
+ break;
+ default:
+ g_set_error (error,
+ THRIFT_MULTIPLEXED_PROCESSOR_ERROR,
+ THRIFT_MULTIPLEXED_PROCESSOR_ERROR_MESSAGE_WRONGLY_MULTIPLEXED,
+ "the message has more tokens than expected!");
+ token_error=TRUE;
+ break;
+ }
+ }
+ /* Set default */
+ if(!stored_message_protocol &&
+ !multiplexed_processor &&
+ token_index==1 && self->default_processor_name){
+ /* It should be the service name */
+ multiplexed_processor = g_hash_table_lookup(self->multiplexed_services, self->default_processor_name);
+ if(multiplexed_processor==NULL){
+ g_set_error (error,
+ THRIFT_MULTIPLEXED_PROCESSOR_ERROR,
+ THRIFT_MULTIPLEXED_PROCESSOR_ERROR_SERVICE_UNAVAILABLE,
+ "service %s not available on this processor",
+ self->default_processor_name);
+ }else{
+ /* Set the message name to the original name */
+ stored_message_protocol = g_object_new (THRIFT_TYPE_STORED_MESSAGE_PROTOCOL,
+ "protocol", in,
+ "name", fname,
+ "type", message_type,
+ "seqid", seqid,
+ NULL);
+ }
+
+ }
+
+ if(stored_message_protocol!=NULL && multiplexed_processor!=NULL){
+ retval = THRIFT_PROCESSOR_GET_CLASS (multiplexed_processor)->process (multiplexed_processor, (ThriftProtocol *) stored_message_protocol, out, error) ;
+ }else{
+ if(!error)
+ g_set_error (error,
+ THRIFT_MULTIPLEXED_PROCESSOR_ERROR,
+ THRIFT_MULTIPLEXED_PROCESSOR_ERROR_SERVICE_UNAVAILABLE,
+ "service %s is not multiplexed in this processor",
+ fname);
+ }
+
+
+ }
+
+ if(!retval){
+ /* By default, return an application exception to the client indicating the
+ method name is not recognized. */
+ /* Copied from dispach processor */
+
+ if ((thrift_protocol_skip (in, T_STRUCT, error) < 0) ||
+ (thrift_protocol_read_message_end (in, error) < 0))
+ return retval;
+
+ g_object_get (in, "transport", &transport, NULL);
+ result = thrift_transport_read_end (transport, error);
+ g_object_unref (transport);
+ if (result < 0) {
+ /* We must free fname */
+ g_free(fname);
+ return retval;
+ }
+
+ if (thrift_protocol_write_message_begin (out,
+ fname,
+ T_EXCEPTION,
+ seqid,
+ error) < 0){
+ /* We must free fname */
+ g_free(fname);
+
+ return retval;
+ }
+
+
+ xception =
+ g_object_new (THRIFT_TYPE_APPLICATION_EXCEPTION,
+ "type", THRIFT_APPLICATION_EXCEPTION_ERROR_UNKNOWN_METHOD,
+ "message", (*error)->message,
+ NULL);
+ result = thrift_struct_write (THRIFT_STRUCT (xception),
+ out,
+ error);
+ g_object_unref (xception);
+ if ((result < 0) ||
+ (thrift_protocol_write_message_end (out, error) < 0))
+ return retval;
+
+ g_object_get (out, "transport", &transport, NULL);
+ retval =
+ ((thrift_transport_write_end (transport, error) >= 0) &&
+ (thrift_transport_flush (transport, error) >= 0));
+ g_object_unref (transport);
+ }else{
+ /* The protocol now has a copy we can free it */
+ g_free(fname);
+
+ }
+
+ /*
+ FIXME This makes everything fail, I don't know why.
+ if(stored_message_protocol!=NULL){
+ // After its use we must free it
+ g_object_unref(stored_message_protocol);
+ }
+ */
+ return retval;
+}
+
+/* define the GError domain for Thrift transports */
+GQuark
+thrift_multiplexed_processor_error_quark (void)
+{
+ return g_quark_from_static_string (THRIFT_MULTIPLEXED_PROCESSOR_ERROR_DOMAIN);
+}
+
+
+static void
+thrift_multiplexed_processor_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ ThriftMultiplexedProcessor *self = THRIFT_MULTIPLEXED_PROCESSOR (object);
+
+ switch (property_id)
+ {
+ case PROP_THRIFT_MULTIPLEXED_PROCESSOR_DEFAULT_SERVICE_NAME:
+ self->default_processor_name = g_value_dup_string (value);
+ break;
+
+ default:
+ /* We don't have any other property... */
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+thrift_multiplexed_processor_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ ThriftMultiplexedProcessor *self = THRIFT_MULTIPLEXED_PROCESSOR (object);
+
+ switch (property_id)
+ {
+ case PROP_THRIFT_MULTIPLEXED_PROCESSOR_DEFAULT_SERVICE_NAME:
+ g_value_set_string (value, self->default_processor_name);
+ break;
+
+ default:
+ /* We don't have any other property... */
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+/* destructor */
+static void
+thrift_multiplexed_processor_finalize (GObject *object)
+{
+ ThriftMultiplexedProcessor *self = THRIFT_MULTIPLEXED_PROCESSOR(object);
+
+ /* Free our multiplexed hash table */
+ g_hash_table_unref (self->multiplexed_services);
+ self->multiplexed_services = NULL;
+
+ if(self->default_processor_name){
+ g_free(self->default_processor_name);
+ self->default_processor_name=NULL;
+ }
+
+ /* Chain up to parent */
+ if (G_OBJECT_CLASS (thrift_multiplexed_processor_parent_class)->finalize)
+ (*G_OBJECT_CLASS (thrift_multiplexed_processor_parent_class)->finalize) (object);
+}
+
+/* class initializer for ThriftMultiplexedProcessor */
+static void
+thrift_multiplexed_processor_class_init (ThriftMultiplexedProcessorClass *cls)
+{
+ /* Override */
+ THRIFT_PROCESSOR_CLASS(cls)->process = thrift_multiplexed_processor_process_impl;
+ GObjectClass *gobject_class = G_OBJECT_CLASS (cls);
+
+ /* Object methods */
+ gobject_class->set_property = thrift_multiplexed_processor_set_property;
+ gobject_class->get_property = thrift_multiplexed_processor_get_property;
+ gobject_class->finalize = thrift_multiplexed_processor_finalize;
+
+ /* Class methods */
+ cls->register_processor = thrift_multiplexed_processor_register_processor_impl;
+
+
+ thrift_multiplexed_processor_obj_properties[PROP_THRIFT_MULTIPLEXED_PROCESSOR_DEFAULT_SERVICE_NAME] =
+ g_param_spec_string ("default",
+ "Default service name the protocol points to where no multiplexed client used",
+ "Set the default service name",
+ NULL,
+ (G_PARAM_READWRITE));
+
+ g_object_class_install_properties (gobject_class,
+ PROP_THRIFT_MULTIPLEXED_PROCESSOR_END,
+ thrift_multiplexed_processor_obj_properties);
+
+}
+
+static void
+thrift_multiplexed_processor_init (ThriftMultiplexedProcessor *self)
+{
+
+ /* Create our multiplexed services hash table */
+ self->multiplexed_services = g_hash_table_new_full (
+ g_str_hash,
+ g_str_equal,
+ g_free,
+ g_object_unref);
+ self->default_processor_name = NULL;
+}
+
+
+gboolean
+thrift_multiplexed_processor_register_processor(ThriftProcessor *processor, const gchar * multiplexed_processor_name, ThriftProcessor * multiplexed_processor , GError **error)
+{
+ return THRIFT_MULTIPLEXED_PROCESSOR_GET_CLASS(processor)->register_processor(processor, multiplexed_processor_name, multiplexed_processor, error);
+}
+
+
http://git-wip-us.apache.org/repos/asf/thrift/blob/87ad2bca/lib/c_glib/src/thrift/c_glib/processor/thrift_multiplexed_processor.h
----------------------------------------------------------------------
diff --git a/lib/c_glib/src/thrift/c_glib/processor/thrift_multiplexed_processor.h b/lib/c_glib/src/thrift/c_glib/processor/thrift_multiplexed_processor.h
new file mode 100644
index 0000000..6406616
--- /dev/null
+++ b/lib/c_glib/src/thrift/c_glib/processor/thrift_multiplexed_processor.h
@@ -0,0 +1,114 @@
+/*
+ * thrift_multiplexed_processor.h
+ *
+ * Created on: 14 sept. 2017
+ * Author: gaguilar
+ */
+
+#ifndef _THRIFT_MULTIPLEXED_MULTIPLEXED_PROCESSOR_H_
+#define _THRIFT_MULTIPLEXED_MULTIPLEXED_PROCESSOR_H_
+
+
+#include <glib-object.h>
+
+#include <thrift/c_glib/processor/thrift_processor.h>
+
+
+G_BEGIN_DECLS
+
+/*! \file thrift_multiplexed_processor.h
+ * \brief The multiplexed processor for c_glib.
+ */
+
+/* type macros */
+#define THRIFT_TYPE_MULTIPLEXED_PROCESSOR (thrift_multiplexed_processor_get_type ())
+#define THRIFT_MULTIPLEXED_PROCESSOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), THRIFT_TYPE_MULTIPLEXED_PROCESSOR, ThriftMultiplexedProcessor))
+#define THRIFT_IS_MULTIPLEXED_PROCESSOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), THRIFT_TYPE_MULTIPLEXED_PROCESSOR))
+#define THRIFT_MULTIPLEXED_PROCESSOR_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), THRIFT_TYPE_MULTIPLEXED_PROCESSOR, ThriftMultiplexedProcessorClass))
+#define THRIFT_IS_MULTIPLEXED_PROCESSOR_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), THRIFT_TYPE_MULTIPLEXED_PROCESSOR))
+#define THRIFT_MULTIPLEXED_PROCESSOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), THRIFT_TYPE_MULTIPLEXED_PROCESSOR, ThriftMultiplexedProcessorClass))
+
+/* define the GError domain string */
+#define THRIFT_MULTIPLEXED_PROCESSOR_ERROR_DOMAIN "thrift-multiplexed-processor-error-quark"
+
+
+/*!
+ * Thrift MultiplexedProcessor object
+ */
+struct _ThriftMultiplexedProcessor
+{
+ ThriftProcessor parent;
+
+ /* private */
+ gchar * default_processor_name;
+ GHashTable *multiplexed_services;
+};
+typedef struct _ThriftMultiplexedProcessor ThriftMultiplexedProcessor;
+
+/*!
+ * Thrift MultiplexedProcessor class
+ */
+struct _ThriftMultiplexedProcessorClass
+{
+ ThriftProcessorClass parent;
+
+ gboolean (* register_processor) (ThriftProcessor *self, const gchar * multiplexed_processor_name, ThriftProcessor * multiplexed_processor , GError **error);
+
+};
+typedef struct _ThriftMultiplexedProcessorClass ThriftMultiplexedProcessorClass;
+
+/* used by THRIFT_TYPE_MULTIPLEXED_PROCESSOR */
+GType thrift_multiplexed_processor_get_type (void);
+
+/*!
+ * Processes the request.
+ * \public \memberof ThriftMultiplexedProcessorClass
+ */
+gboolean thrift_multiplexed_processor_process (ThriftMultiplexedProcessor *processor,
+ ThriftProtocol *in, ThriftProtocol *out,
+ GError **error);
+
+
+/* Public API */
+
+/**
+ * @brief Registers a processor in the multiplexed processor under its name. It
+ * will take a reference to the processor so refcount will be incremented.
+ * It will also be decremented on object destruction.
+ *
+ * The first registered processor becomes default. But you can override it with
+ * "default" property.
+ *
+ * It returns a compliant error if it cannot be registered.
+ *
+ * @param processor Pointer to the multiplexed processor.
+ * @param multiplexed_processor_name Name of the processor you want to register
+ * @param multiplexed_processor Pointer to implemented processor you want multiplex.
+ * @param error Error object where we should store errors.
+ *
+ * @see https://developer.gnome.org/glib/stable/glib-Error-Reporting.html#g-set-error
+ */
+gboolean thrift_multiplexed_processor_register_processor(ThriftProcessor *processor, const gchar * multiplexed_processor_name, ThriftProcessor * multiplexed_processor , GError **error);
+
+
+/* define error/exception types */
+typedef enum
+{
+ THRIFT_MULTIPLEXED_PROCESSOR_ERROR_UNKNOWN,
+ THRIFT_MULTIPLEXED_PROCESSOR_ERROR_SERVICE_UNAVAILABLE,
+ THRIFT_MULTIPLEXED_PROCESSOR_ERROR_MESSAGE_TYPE,
+ THRIFT_MULTIPLEXED_PROCESSOR_ERROR_MESSAGE_WRONGLY_MULTIPLEXED,
+ THRIFT_MULTIPLEXED_PROCESSOR_ERROR_SEND,
+ THRIFT_MULTIPLEXED_PROCESSOR_ERROR_RECEIVE,
+ THRIFT_MULTIPLEXED_PROCESSOR_ERROR_CLOSE
+} ThriftMultiplexedProcessorError;
+
+
+GQuark thrift_multiplexed_processor_error_quark (void);
+#define THRIFT_MULTIPLEXED_PROCESSOR_ERROR (thrift_multiplexed_processor_error_quark ())
+
+
+G_END_DECLS
+
+
+#endif /* _THRIFT_MULTIPLEXED_MULTIPLEXED_PROCESSOR_H_ */
http://git-wip-us.apache.org/repos/asf/thrift/blob/87ad2bca/lib/c_glib/src/thrift/c_glib/protocol/thrift_multiplexed_protocol.c
----------------------------------------------------------------------
diff --git a/lib/c_glib/src/thrift/c_glib/protocol/thrift_multiplexed_protocol.c b/lib/c_glib/src/thrift/c_glib/protocol/thrift_multiplexed_protocol.c
index c74f048..727f4a8 100644
--- a/lib/c_glib/src/thrift/c_glib/protocol/thrift_multiplexed_protocol.c
+++ b/lib/c_glib/src/thrift/c_glib/protocol/thrift_multiplexed_protocol.c
@@ -57,7 +57,7 @@ thrift_multiplexed_protocol_write_message_begin (ThriftMultiplexedProtocol *prot
service_name = g_strdup(name);
}
- // relay to the protocol_decorator
+ /* relay to the protocol_decorator */
ret = thrift_protocol_decorator_write_message_begin(protocol, service_name, message_type, seqid, error);
g_free(service_name);
http://git-wip-us.apache.org/repos/asf/thrift/blob/87ad2bca/lib/c_glib/src/thrift/c_glib/protocol/thrift_protocol_decorator.c
----------------------------------------------------------------------
diff --git a/lib/c_glib/src/thrift/c_glib/protocol/thrift_protocol_decorator.c b/lib/c_glib/src/thrift/c_glib/protocol/thrift_protocol_decorator.c
index 1feec34..03f9420 100644
--- a/lib/c_glib/src/thrift/c_glib/protocol/thrift_protocol_decorator.c
+++ b/lib/c_glib/src/thrift/c_glib/protocol/thrift_protocol_decorator.c
@@ -486,13 +486,11 @@ thrift_protocol_decorator_set_property (GObject *object,
GParamSpec *pspec)
{
ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (object);
- g_debug("Is protocol decorator %i", THRIFT_IS_PROTOCOL_DECORATOR(object));
switch (property_id)
{
case PROP_THRIFT_TYPE_PROTOCOL_DECORATOR_CONCRETE_PROTOCOL:
self->concrete_protocol = g_value_dup_object (value);
- g_debug("Setting concrete protocol %p to %p in %s", (void *)self, (void *)self->concrete_protocol, g_type_name(G_TYPE_FROM_INSTANCE(object)));
break;
default:
@@ -509,7 +507,6 @@ thrift_protocol_decorator_get_property (GObject *object,
GParamSpec *pspec)
{
ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (object);
- g_debug("Is protocol decorator %i", THRIFT_IS_PROTOCOL_DECORATOR(object));
switch (property_id)
{
http://git-wip-us.apache.org/repos/asf/thrift/blob/87ad2bca/lib/c_glib/src/thrift/c_glib/protocol/thrift_stored_message_protocol.c
----------------------------------------------------------------------
diff --git a/lib/c_glib/src/thrift/c_glib/protocol/thrift_stored_message_protocol.c b/lib/c_glib/src/thrift/c_glib/protocol/thrift_stored_message_protocol.c
new file mode 100644
index 0000000..a0d560b
--- /dev/null
+++ b/lib/c_glib/src/thrift/c_glib/protocol/thrift_stored_message_protocol.c
@@ -0,0 +1,192 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <string.h>
+#include <stdio.h>
+#include <glib.h>
+#include <glib-object.h>
+
+#include <thrift/c_glib/thrift.h>
+#include <thrift/c_glib/protocol/thrift_protocol.h>
+#include <thrift/c_glib/protocol/thrift_protocol_decorator.h>
+#include <thrift/c_glib/protocol/thrift_stored_message_protocol.h>
+
+
+enum
+{
+ PROP_THRIFT_STORED_MESSAGE_PROTOCOL_MESSAGE_NAME = 1,
+ PROP_THRIFT_STORED_MESSAGE_PROTOCOL_MESSAGE_TYPE,
+ PROP_THRIFT_STORED_MESSAGE_PROTOCOL_SEQUENCE_ID,
+ PROP_THRIFT_STORED_MESSAGE_PROTOCOL_TRANSPORT, /* TODO ugly hack */
+ PROP_THRIFT_STORED_MESSAGE_PROTOCOL_END
+};
+
+G_DEFINE_TYPE(ThriftStoredMessageProtocol, thrift_stored_message_protocol, THRIFT_TYPE_PROTOCOL_DECORATOR)
+
+
+static GParamSpec *thrift_stored_message_protocol_obj_properties[PROP_THRIFT_STORED_MESSAGE_PROTOCOL_END] = { NULL, };
+
+gint32
+thrift_stored_message_protocol_read_message_begin (ThriftProtocol *protocol,
+ gchar **name,
+ ThriftMessageType *message_type,
+ gint32 *seqid, GError **error)
+{
+ gint32 ret = 0;
+ g_return_val_if_fail (THRIFT_IS_STORED_MESSAGE_PROTOCOL (protocol), -1);
+ THRIFT_UNUSED_VAR (error);
+
+ ThriftStoredMessageProtocol *self = THRIFT_STORED_MESSAGE_PROTOCOL (protocol);
+
+ /* We return the stored values on construction */
+ *name = self->name;
+ *message_type = self->mtype;
+ *seqid = self->seqid;
+
+ return ret;
+}
+
+
+static void
+thrift_stored_message_protocol_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ ThriftStoredMessageProtocol *self = THRIFT_STORED_MESSAGE_PROTOCOL (object);
+
+ switch (property_id)
+ {
+ case PROP_THRIFT_STORED_MESSAGE_PROTOCOL_MESSAGE_NAME:
+ self->name = g_value_dup_string (value);
+ break;
+ case PROP_THRIFT_STORED_MESSAGE_PROTOCOL_MESSAGE_TYPE:
+ self->mtype = g_value_get_int (value);
+ break;
+ case PROP_THRIFT_STORED_MESSAGE_PROTOCOL_SEQUENCE_ID:
+ self->seqid = g_value_get_int (value);
+ break;
+
+ default:
+ /* We don't have any other property... */
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+thrift_stored_message_protocol_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ ThriftStoredMessageProtocol *self = THRIFT_STORED_MESSAGE_PROTOCOL (object);
+ ThriftProtocolDecorator *decorator = THRIFT_PROTOCOL_DECORATOR (object);
+ ThriftTransport *transport=NULL;
+ switch (property_id)
+ {
+ case PROP_THRIFT_STORED_MESSAGE_PROTOCOL_MESSAGE_NAME:
+ g_value_set_string (value, self->name);
+ break;
+ case PROP_THRIFT_STORED_MESSAGE_PROTOCOL_TRANSPORT:
+ /* FIXME Since we don't override properties in the decorator as it should
+ we just override the properties that we know are used */
+ g_object_get(decorator->concrete_protocol,pspec->name, &transport, NULL);
+ g_value_set_pointer (value, transport);
+ break;
+
+ default:
+ /* We don't have any other property... */
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+
+static void
+thrift_stored_message_protocol_init (ThriftStoredMessageProtocol *protocol)
+{
+ protocol->name = NULL;
+}
+
+static void
+thrift_stored_message_protocol_finalize (GObject *gobject)
+{
+ ThriftStoredMessageProtocol *self = THRIFT_STORED_MESSAGE_PROTOCOL (gobject);
+
+ if (self->name) {
+ g_free(self->name);
+ self->name = NULL;
+ }
+
+ /* Always chain up to the parent class; as with dispose(), finalize()
+ * is guaranteed to exist on the parent's class virtual function table
+ */
+ G_OBJECT_CLASS (thrift_stored_message_protocol_parent_class)->finalize(gobject);
+}
+
+
+/* initialize the class */
+static void
+thrift_stored_message_protocol_class_init (ThriftStoredMessageProtocolClass *klass)
+{
+ ThriftProtocolClass *cls = THRIFT_PROTOCOL_CLASS (klass);
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ cls->read_message_begin = thrift_stored_message_protocol_read_message_begin;
+
+ object_class->set_property = thrift_stored_message_protocol_set_property;
+ object_class->get_property = thrift_stored_message_protocol_get_property;
+ object_class->finalize = thrift_stored_message_protocol_finalize;
+
+ thrift_stored_message_protocol_obj_properties[PROP_THRIFT_STORED_MESSAGE_PROTOCOL_MESSAGE_NAME] =
+ g_param_spec_string ("name",
+ "Service name the protocol points to",
+ "Set the service name",
+ NULL,
+ (G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
+ thrift_stored_message_protocol_obj_properties[PROP_THRIFT_STORED_MESSAGE_PROTOCOL_MESSAGE_TYPE] =
+ g_param_spec_int ("type",
+ "Message type in the wire",
+ "Set the message type in the wire",
+ T_CALL, T_ONEWAY,
+ T_CALL,
+ (G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
+ thrift_stored_message_protocol_obj_properties[PROP_THRIFT_STORED_MESSAGE_PROTOCOL_SEQUENCE_ID] =
+ g_param_spec_int ("seqid",
+ "Sequence id type in the wire",
+ "Set the Sequence id in the wire",
+ 0, G_MAXINT,
+ 0,
+ (G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
+
+ /* TODO Ugly hack, in theory we must override all properties from underlaying
+ protocol */
+ thrift_stored_message_protocol_obj_properties[PROP_THRIFT_STORED_MESSAGE_PROTOCOL_TRANSPORT] =
+ g_param_spec_pointer ("transport",
+ "Transport on the underlaying implementation",
+ "Transport of decorated protocol",
+ G_PARAM_READABLE);
+
+
+
+ g_object_class_install_properties (object_class,
+ PROP_THRIFT_STORED_MESSAGE_PROTOCOL_END,
+ thrift_stored_message_protocol_obj_properties);
+}
http://git-wip-us.apache.org/repos/asf/thrift/blob/87ad2bca/lib/c_glib/src/thrift/c_glib/protocol/thrift_stored_message_protocol.h
----------------------------------------------------------------------
diff --git a/lib/c_glib/src/thrift/c_glib/protocol/thrift_stored_message_protocol.h b/lib/c_glib/src/thrift/c_glib/protocol/thrift_stored_message_protocol.h
new file mode 100644
index 0000000..88782ac
--- /dev/null
+++ b/lib/c_glib/src/thrift/c_glib/protocol/thrift_stored_message_protocol.h
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef _THRIFT_STORED_MESSAGE_PROTOCOL_H
+#define _THRIFT_STORED_MESSAGE_PROTOCOL_H
+
+#include <glib-object.h>
+
+#include <thrift/c_glib/protocol/thrift_protocol.h>
+#include <thrift/c_glib/protocol/thrift_protocol_decorator.h>
+#include <thrift/c_glib/transport/thrift_transport.h>
+
+G_BEGIN_DECLS
+
+/*! \file thrift_stored_message_protocol.h
+ * \brief StoredMessage protocol implementation of a pre-stored message header
+ * on Thrift protocol. Implements the ThriftProtocol interface.
+ */
+
+/* type macros */
+#define THRIFT_TYPE_STORED_MESSAGE_PROTOCOL (thrift_stored_message_protocol_get_type ())
+#define THRIFT_STORED_MESSAGE_PROTOCOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), THRIFT_TYPE_STORED_MESSAGE_PROTOCOL, ThriftStoredMessageProtocol))
+#define THRIFT_IS_STORED_MESSAGE_PROTOCOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), THRIFT_TYPE_STORED_MESSAGE_PROTOCOL))
+#define THRIFT_STORED_MESSAGE_PROTOCOL_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), THRIFT_TYPE_STORED_MESSAGE_PROTOCOL, ThriftStoredMessageProtocolClass))
+#define THRIFT_IS_STORED_MESSAGE_PROTOCOL_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), THRIFT_TYPE_STORED_MESSAGE_PROTOCOL))
+#define THRIFT_STORED_MESSAGE_PROTOCOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), THRIFT_TYPE_STORED_MESSAGE_PROTOCOL, ThriftStoredMessageProtocolClass))
+
+/* constant */
+#define THRIFT_STORED_MESSAGE_PROTOCOL_DEFAULT_SEPARATOR ":"
+
+typedef struct _ThriftStoredMessageProtocol ThriftStoredMessageProtocol;
+
+
+
+/*!
+ * Thrift StoredMessage Protocol instance.
+ */
+struct _ThriftStoredMessageProtocol
+{
+ ThriftProtocolDecorator parent;
+
+ gchar *name;
+ ThriftMessageType mtype;
+ gint32 seqid;
+};
+
+typedef struct _ThriftStoredMessageProtocolClass ThriftStoredMessageProtocolClass;
+
+/*!
+ * Thrift StoredMessage Protocol class.
+ */
+struct _ThriftStoredMessageProtocolClass
+{
+ ThriftProtocolDecoratorClass parent;
+};
+
+/* used by THRIFT_TYPE_STORED_MESSAGE_PROTOCOL */
+GType thrift_stored_message_protocol_get_type (void);
+
+G_END_DECLS
+
+#endif /* _THRIFT_STORED_MESSAGE_PROTOCOL_H */
http://git-wip-us.apache.org/repos/asf/thrift/blob/87ad2bca/lib/c_glib/src/thrift/c_glib/transport/thrift_platform_socket.h
----------------------------------------------------------------------
diff --git a/lib/c_glib/src/thrift/c_glib/transport/thrift_platform_socket.h b/lib/c_glib/src/thrift/c_glib/transport/thrift_platform_socket.h
index ef4f00d..ede60f1 100644
--- a/lib/c_glib/src/thrift/c_glib/transport/thrift_platform_socket.h
+++ b/lib/c_glib/src/thrift/c_glib/transport/thrift_platform_socket.h
@@ -17,7 +17,7 @@
* under the License.
*/
-// clang-format off
+/* clang-format off */
#ifndef _THRIFT_TRANSPORT_PLATFORM_SOCKET_H_
# define _THRIFT_TRANSPORT_PLATFORM_SOCKET_H_
@@ -63,17 +63,17 @@
# define THRIFT_TIMESPEC thrift_timespec
# define THRIFT_CTIME_R thrift_ctime_r
# define THRIFT_POLL thrift_poll
-# if WINVER <= 0x0502 //XP, Server2003
+# if WINVER <= 0x0502 /* XP, Server2003 */
# define THRIFT_POLLFD thrift_pollfd
# define THRIFT_POLLIN 0x0300
# define THRIFT_POLLOUT 0x0010
-# else //Vista, Win7...
+# else /* Vista, Win7... */
# define THRIFT_POLLFD pollfd
# define THRIFT_POLLIN POLLIN
# define THRIFT_POLLOUT POLLOUT
-# endif //WINVER
+# endif /* WINVER */
# define THRIFT_SHUT_RDWR SD_BOTH
-#else //not _WIN32
+#else /* not _WIN32 */
# include <errno.h>
# define THRIFT_GET_SOCKET_ERROR errno
# define THRIFT_ERRNO errno
@@ -117,4 +117,4 @@
# define THRIFT_SHUT_RDWR SHUT_RDWR
#endif
-#endif // _THRIFT_TRANSPORT_PLATFORM_SOCKET_H_
+#endif /* _THRIFT_TRANSPORT_PLATFORM_SOCKET_H_ */
http://git-wip-us.apache.org/repos/asf/thrift/blob/87ad2bca/lib/c_glib/src/thrift/c_glib/transport/thrift_socket.c
----------------------------------------------------------------------
diff --git a/lib/c_glib/src/thrift/c_glib/transport/thrift_socket.c b/lib/c_glib/src/thrift/c_glib/transport/thrift_socket.c
index ce6b344..6dd0f0d 100644
--- a/lib/c_glib/src/thrift/c_glib/transport/thrift_socket.c
+++ b/lib/c_glib/src/thrift/c_glib/transport/thrift_socket.c
@@ -95,6 +95,25 @@ thrift_socket_peek (ThriftTransport *transport, GError **error)
return result;
}
+
+/* implements thrift_transport_close */
+gboolean
+thrift_socket_close (ThriftTransport *transport, GError **error)
+{
+ ThriftSocket *socket = THRIFT_SOCKET (transport);
+
+ if (close (socket->sd) == -1)
+ {
+ g_set_error (error, THRIFT_TRANSPORT_ERROR, THRIFT_TRANSPORT_ERROR_CLOSE,
+ "unable to close socket - %s",
+ strerror(errno));
+ return FALSE;
+ }
+
+ socket->sd = THRIFT_INVALID_SOCKET;
+ return TRUE;
+}
+
/* implements thrift_transport_open */
gboolean
thrift_socket_open (ThriftTransport *transport, GError **error)
@@ -128,7 +147,7 @@ thrift_socket_open (ThriftTransport *transport, GError **error)
/* create a socket structure */
memset (&pin, 0, sizeof(pin));
pin.sin_family = AF_INET;
- pin.sin_addr.s_addr = ((struct in_addr *) (hp->h_addr))->s_addr;
+ pin.sin_addr.s_addr = ((struct in_addr *) (hp->h_addr_list[0]))->s_addr;
pin.sin_port = htons (tsocket->port);
/* create the socket */
@@ -144,7 +163,8 @@ thrift_socket_open (ThriftTransport *transport, GError **error)
/* open a connection */
if (connect (tsocket->sd, (struct sockaddr *) &pin, sizeof(pin)) == -1)
{
- g_set_error (error, THRIFT_TRANSPORT_ERROR, THRIFT_TRANSPORT_ERROR_CONNECT,
+ thrift_socket_close(tsocket, NULL);
+ g_set_error (error, THRIFT_TRANSPORT_ERROR, THRIFT_TRANSPORT_ERROR_CONNECT,
"failed to connect to host %s:%d - %s",
tsocket->hostname, tsocket->port, strerror(errno));
return FALSE;
@@ -153,23 +173,6 @@ thrift_socket_open (ThriftTransport *transport, GError **error)
return TRUE;
}
-/* implements thrift_transport_close */
-gboolean
-thrift_socket_close (ThriftTransport *transport, GError **error)
-{
- ThriftSocket *socket = THRIFT_SOCKET (transport);
-
- if (close (socket->sd) == -1)
- {
- g_set_error (error, THRIFT_TRANSPORT_ERROR, THRIFT_TRANSPORT_ERROR_CLOSE,
- "unable to close socket - %s",
- strerror(errno));
- return FALSE;
- }
-
- socket->sd = THRIFT_INVALID_SOCKET;
- return TRUE;
-}
/* implements thrift_transport_read */
gint32
http://git-wip-us.apache.org/repos/asf/thrift/blob/87ad2bca/lib/c_glib/src/thrift/c_glib/transport/thrift_ssl_socket.c
----------------------------------------------------------------------
diff --git a/lib/c_glib/src/thrift/c_glib/transport/thrift_ssl_socket.c b/lib/c_glib/src/thrift/c_glib/transport/thrift_ssl_socket.c
index 4abeb93..ee55406 100644
--- a/lib/c_glib/src/thrift/c_glib/transport/thrift_ssl_socket.c
+++ b/lib/c_glib/src/thrift/c_glib/transport/thrift_ssl_socket.c
@@ -140,6 +140,84 @@ static void thrift_ssl_socket_dyn_lock_destroy_callback(void* lock, const char*
G_DEFINE_TYPE(ThriftSSLSocket, thrift_ssl_socket, THRIFT_TYPE_SOCKET)
+
+/**
+ * When there's a thread context attached, we pass the SSL socket context so it
+ * can check if the error is outside SSL, on I/O for example
+ * @param socket
+ * @param error_msg
+ * @param thrift_error_no
+ * @param ssl_error
+ * @param error
+ */
+static
+void thrift_ssl_socket_get_ssl_error(ThriftSSLSocket *socket, const guchar *error_msg, guint thrift_error_no, int ssl_error, GError **error)
+{
+ unsigned long error_code;
+ char buffer[1024];
+ int buffer_size=1024;
+ gboolean first_error = TRUE;
+ int ssl_error_type = SSL_get_error(socket->ssl, ssl_error);
+ if(ssl_error_type>0){
+ switch(ssl_error_type){
+ case SSL_ERROR_SSL:
+ buffer_size-=snprintf(buffer, buffer_size, "SSL %s: ", error_msg);
+ while ((error_code = ERR_get_error()) != 0 && buffer_size>1) {
+ const char* reason = ERR_reason_error_string(error_code);
+ if(reason!=NULL){
+ if(!first_error) {
+ buffer_size-=snprintf(buffer+(1024-buffer_size), buffer_size, "\n\t");
+ first_error=FALSE;
+ }
+ buffer_size-=snprintf(buffer+(1024-buffer_size), buffer_size, "%lX(%s) -> %s", error_code, reason, SSL_state_string(socket->ssl));
+ }
+ }
+ break;
+ case SSL_ERROR_SYSCALL:
+ buffer_size-=snprintf(buffer, buffer_size, "%s: ", error_msg);
+ buffer_size-=snprintf(buffer+(1024-buffer_size), buffer_size, "%lX -> %s", errno, strerror(errno));
+ break;
+ case SSL_ERROR_WANT_READ:
+ buffer_size-=snprintf(buffer, buffer_size, "%s: ", error_msg);
+ buffer_size-=snprintf(buffer+(1024-buffer_size), buffer_size, "%lX -> %s", ssl_error_type, "Error while reading from underlaying layer");
+ break;
+ case SSL_ERROR_WANT_WRITE:
+ buffer_size-=snprintf(buffer, buffer_size, "%s: ", error_msg);
+ buffer_size-=snprintf(buffer+(1024-buffer_size), buffer_size, "%lX -> %s", ssl_error_type, "Error while writting to underlaying layer");
+ break;
+
+ }
+ g_set_error (error, THRIFT_TRANSPORT_ERROR,
+ thrift_error_no, "%s", buffer);
+ }
+}
+
+/**
+ * For global SSL errors
+ * @param error_msg
+ * @param thrift_error_no
+ * @param error
+ */
+static
+void thrift_ssl_socket_get_error(const guchar *error_msg, guint thrift_error_no, GError **error)
+{
+ unsigned long error_code;
+ while ((error_code = ERR_get_error()) != 0) {
+ const char* reason = ERR_reason_error_string(error_code);
+ if (reason == NULL) {
+ g_set_error (error, THRIFT_TRANSPORT_ERROR,
+ thrift_error_no,
+ "SSL error %lX: %s", error_code, error_msg);
+ }else{
+ g_set_error (error, THRIFT_TRANSPORT_ERROR,
+ thrift_error_no,
+ "SSL error %lX %s: %s", error_code,reason, error_msg);
+ }
+ }
+}
+
+
+
/* implements thrift_transport_is_open */
gboolean
thrift_ssl_socket_is_open (ThriftTransport *transport)
@@ -159,10 +237,8 @@ thrift_ssl_socket_peek (ThriftTransport *transport, GError **error)
gchar byte;
rc = SSL_peek(ssl_socket->ssl, &byte, 1);
if (rc < 0) {
- g_set_error (error,
- THRIFT_TRANSPORT_ERROR,
- THRIFT_SSL_SOCKET_ERROR_SSL,
- "failed to peek at socket - id?");
+ thrift_ssl_socket_get_ssl_error(ssl_socket, "Check socket data",
+ THRIFT_SSL_SOCKET_ERROR_SSL, rc, error);
}
if (rc == 0) {
ERR_clear_error();
@@ -176,13 +252,14 @@ thrift_ssl_socket_peek (ThriftTransport *transport, GError **error)
gboolean
thrift_ssl_socket_open (ThriftTransport *transport, GError **error)
{
+ ERR_clear_error();
+
if (!thrift_socket_open(transport, error)) {
return FALSE;
}
if (!THRIFT_SSL_SOCKET_GET_CLASS(transport)->handle_handshake(transport, error)) {
- GError *tmperr;
- thrift_socket_close(transport, &tmperr);
+ thrift_ssl_socket_close(transport, NULL);
return FALSE;
}
@@ -194,13 +271,14 @@ gboolean
thrift_ssl_socket_close (ThriftTransport *transport, GError **error)
{
gboolean retval = FALSE;
- if(THRIFT_SSL_SOCKET(transport)->ssl) {
- int rc = SSL_shutdown(THRIFT_SSL_SOCKET(transport)->ssl);
- if (rc < 0) {
+ ThriftSSLSocket *ssl_socket = THRIFT_SSL_SOCKET(transport);
+ if(ssl_socket!=NULL && ssl_socket->ssl) {
+ int rc = SSL_shutdown(ssl_socket->ssl);
+/* if (rc < 0) {
int errno_copy = THRIFT_SSL_SOCKET_ERROR_SSL;
- }
- SSL_free(THRIFT_SSL_SOCKET(transport)->ssl);
- THRIFT_SSL_SOCKET(transport)->ssl = NULL;
+ }*/
+ SSL_free(ssl_socket->ssl);
+ ssl_socket->ssl = NULL;
ERR_remove_state(0);
}
return thrift_socket_close(transport, error);
@@ -216,9 +294,9 @@ thrift_ssl_socket_read (ThriftTransport *transport, gpointer buf,
guint bytes = 0;
guint retries = 0;
ThriftSocket *socket = THRIFT_SOCKET (transport);
- g_return_val_if_fail (socket->sd != THRIFT_INVALID_SOCKET, FALSE);
+ g_return_val_if_fail (socket->sd != THRIFT_INVALID_SOCKET && ssl_socket->ssl!=NULL, FALSE);
- for (retries=0; retries < maxRecvRetries_; retries++) {
+ for (retries=0; retries < maxRecvRetries_; retries++) {
bytes = SSL_read(ssl_socket->ssl, buf, len);
if (bytes >= 0)
break;
@@ -227,10 +305,11 @@ thrift_ssl_socket_read (ThriftTransport *transport, gpointer buf,
if (ERR_get_error() == 0 && errno_copy == THRIFT_EINTR) {
continue;
}
+ }else{
+ thrift_ssl_socket_get_ssl_error(ssl_socket, "Receive error",
+ THRIFT_SSL_SOCKET_ERROR_SSL, bytes, error);
+
}
- g_set_error (error, THRIFT_TRANSPORT_ERROR,
- THRIFT_TRANSPORT_ERROR_RECEIVE,
- "failed to read %d bytes - %s", len, strerror(errno));
return -1;
}
return bytes;
@@ -256,16 +335,15 @@ thrift_ssl_socket_write (ThriftTransport *transport, const gpointer buf,
gint ret = 0;
guint sent = 0;
ThriftSocket *socket = THRIFT_SOCKET (transport);
- g_return_val_if_fail (socket->sd != THRIFT_INVALID_SOCKET, FALSE);
+ g_return_val_if_fail (socket->sd != THRIFT_INVALID_SOCKET && ssl_socket->ssl!=NULL, FALSE);
while (sent < len)
{
ret = SSL_write (ssl_socket->ssl, (guint8 *)buf + sent, len - sent);
if (ret < 0)
{
- g_set_error (error, THRIFT_TRANSPORT_ERROR,
- THRIFT_TRANSPORT_ERROR_SEND,
- "failed to send %d bytes - %s", len, strerror(errno));
+ thrift_ssl_socket_get_ssl_error(ssl_socket, "Send error",
+ THRIFT_SSL_SOCKET_ERROR_SSL, ret, error);
return FALSE;
}
sent += ret;
@@ -295,7 +373,7 @@ thrift_ssl_socket_flush (ThriftTransport *transport, GError **error)
guint sent = 0;
ThriftSocket *socket = THRIFT_SOCKET (transport);
- g_return_val_if_fail (socket->sd != THRIFT_INVALID_SOCKET, FALSE);
+ g_return_val_if_fail (socket->sd != THRIFT_INVALID_SOCKET && ssl_socket->ssl!=NULL, FALSE);
BIO* bio = SSL_get_wbio(ssl_socket->ssl);
if (bio == NULL) {
@@ -331,8 +409,7 @@ thrift_ssl_socket_handle_handshake(ThriftTransport * transport, GError **error)
rc = SSL_connect(ssl_socket->ssl);
}
if (rc <= 0) {
- fprintf(stderr,"The error returned was %d\n", SSL_get_error(ssl_socket->ssl, rc));
- thrift_ssl_socket_get_error(error, "Not possible to connect", THRIFT_SSL_SOCKET_ERROR_CIPHER_NOT_AVAILABLE);
+ thrift_ssl_socket_get_ssl_error(ssl_socket, "Error while connect/bind", THRIFT_SSL_SOCKET_ERROR_CONNECT_BIND, rc, error);
return FALSE;
}
}else
@@ -390,16 +467,16 @@ gboolean thrift_ssl_load_cert_from_buffer(ThriftSSLSocket *ssl_socket, const cha
X509_STORE *cert_store = SSL_CTX_get_cert_store(ssl_socket->ctx);
if(cert_store!=NULL){
- int index = 0;
- while ((cacert = PEM_read_bio_X509(mem, NULL, 0, NULL))!=NULL) {
- if(cacert) {
- X509_STORE_add_cert(cert_store, cacert);
- X509_free(cacert);
- cacert=NULL;
- } /* Free immediately */
- index++;
- }
- retval=TRUE;
+ int index = 0;
+ while ((cacert = PEM_read_bio_X509(mem, NULL, 0, NULL))!=NULL) {
+ if(cacert) {
+ X509_STORE_add_cert(cert_store, cacert);
+ X509_free(cacert);
+ cacert=NULL;
+ } /* Free immediately */
+ index++;
+ }
+ retval=TRUE;
}
BIO_free(mem);
return retval;
@@ -416,46 +493,46 @@ thrift_ssl_socket_authorize(ThriftTransport * transport, GError **error)
if(cls!=NULL && ssl_socket->ssl!=NULL){
int rc = SSL_get_verify_result(ssl_socket->ssl);
if (rc != X509_V_OK) { /* verify authentication result */
- if (rc == X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT && ssl_socket->allow_selfsigned) {
- g_debug("The certificate is a self-signed certificate and configuration allows it");
- } else {
- g_set_error (error,
- THRIFT_TRANSPORT_ERROR,
- THRIFT_SSL_SOCKET_ERROR_SSL_CERT_VALIDATION_FAILED,
- "The certificate verification failed: %s (%d)", X509_verify_cert_error_string(rc), rc);
- return FALSE;
- }
+ if (rc == X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT && ssl_socket->allow_selfsigned) {
+ g_debug("The certificate is a self-signed certificate and configuration allows it");
+ } else {
+ g_set_error (error,
+ THRIFT_TRANSPORT_ERROR,
+ THRIFT_SSL_SOCKET_ERROR_SSL_CERT_VALIDATION_FAILED,
+ "The certificate verification failed: %s (%d)", X509_verify_cert_error_string(rc), rc);
+ return FALSE;
+ }
}
X509* cert = SSL_get_peer_certificate(ssl_socket->ssl);
if (cert == NULL) {
- if (SSL_get_verify_mode(ssl_socket->ssl) & SSL_VERIFY_FAIL_IF_NO_PEER_CERT) {
- g_set_error (error,
- THRIFT_TRANSPORT_ERROR,
- THRIFT_SSL_SOCKET_ERROR_SSL_CERT_VALIDATION_FAILED,
- "No certificate present. Are you connecting SSL server?");
- return FALSE;
- }
- g_debug("No certificate required");
- return TRUE;
+ if (SSL_get_verify_mode(ssl_socket->ssl) & SSL_VERIFY_FAIL_IF_NO_PEER_CERT) {
+ g_set_error (error,
+ THRIFT_TRANSPORT_ERROR,
+ THRIFT_SSL_SOCKET_ERROR_SSL_CERT_VALIDATION_FAILED,
+ "No certificate present. Are you connecting SSL server?");
+ return FALSE;
+ }
+ g_debug("No certificate required");
+ return TRUE;
}
/* certificate is present, since we don't support access manager we are done */
if (cls->authorize_peer == NULL) {
- X509_free(cert);
- g_debug("Certificate presented but we're not checking it");
- return TRUE;
+ X509_free(cert);
+ g_debug("Certificate presented but we're not checking it");
+ return TRUE;
} else {
- /* both certificate and access manager are present */
- struct sockaddr_storage sa;
- socklen_t saLength = sizeof(struct sockaddr_storage);
- if (getpeername(socket->sd, (struct sockaddr*)&sa, &saLength) != 0) {
- sa.ss_family = AF_UNSPEC;
- }
- authorization_result = cls->authorize_peer(transport, cert, &sa, error);
+ /* both certificate and access manager are present */
+ struct sockaddr_storage sa;
+ socklen_t saLength = sizeof(struct sockaddr_storage);
+ if (getpeername(socket->sd, (struct sockaddr*)&sa, &saLength) != 0) {
+ sa.ss_family = AF_UNSPEC;
+ }
+ authorization_result = cls->authorize_peer(transport, cert, &sa, error);
}
if(cert != NULL) {
- X509_free(cert);
+ X509_free(cert);
}
}
@@ -499,8 +576,8 @@ thrift_ssl_socket_finalize (GObject *object)
if(socket->ctx!=NULL){
g_debug("Freeing the context for the instance");
SSL_CTX_free(socket->ctx);
+ socket->ctx=NULL;
}
- socket->ctx=NULL;
}
if (G_OBJECT_CLASS (thrift_ssl_socket_parent_class)->finalize)
@@ -538,7 +615,7 @@ thrift_ssl_socket_set_property (GObject *object, guint property_id,
g_debug("Freeing the context since we are setting a new one");
SSL_CTX_free(socket->ctx);
}
- socket->ctx = g_value_get_pointer(value); // We copy the context
+ socket->ctx = g_value_get_pointer(value); /* We copy the context */
break;
case PROP_THRIFT_SSL_SELF_SIGNED:
@@ -664,7 +741,7 @@ thrift_ssl_socket_new_with_host(ThriftSSLSocketProtocol ssl_protocol, gchar *hos
SSL_CTX *ssl_context = NULL;
/* Create the context */
if((ssl_context=thrift_ssl_socket_context_initialize(ssl_protocol, error))==NULL){
- // FIXME Do error control
+ /* FIXME Do error control */
return thriftSSLSocket;
}
/* FIXME if the protocol is different? */
@@ -712,35 +789,18 @@ thrift_ssl_socket_context_initialize(ThriftSSLSocketProtocol ssl_protocol, GErro
}
if (context == NULL) {
- thrift_ssl_socket_get_error(error, "No cipher overlay", THRIFT_SSL_SOCKET_ERROR_CIPHER_NOT_AVAILABLE);
+ thrift_ssl_socket_get_error("No cipher overlay", THRIFT_SSL_SOCKET_ERROR_CIPHER_NOT_AVAILABLE, error);
return NULL;
}
SSL_CTX_set_mode(context, SSL_MODE_AUTO_RETRY);
- // Disable horribly insecure SSLv2 and SSLv3 protocols but allow a handshake
- // with older clients so they get a graceful denial.
+ /* Disable horribly insecure SSLv2 and SSLv3 protocols but allow a handshake
+ with older clients so they get a graceful denial. */
if (ssl_protocol == SSLTLS) {
SSL_CTX_set_options(context, SSL_OP_NO_SSLv2);
- SSL_CTX_set_options(context, SSL_OP_NO_SSLv3); // THRIFT-3164
+ SSL_CTX_set_options(context, SSL_OP_NO_SSLv3); /* THRIFT-3164 */
}
return context;
}
-void thrift_ssl_socket_get_error(GError **error, const guchar *error_msg, guint thrift_error_no)
-{
- unsigned long error_code;
- while ((error_code = ERR_get_error()) != 0) {
- const char* reason = ERR_reason_error_string(error_code);
- if (reason == NULL) {
- g_set_error (error, THRIFT_TRANSPORT_ERROR,
- thrift_error_no,
- "SSL error %lX: %s", error_code, error_msg);
- }else{
- g_set_error (error, THRIFT_TRANSPORT_ERROR,
- thrift_error_no,
- "SSL error %lX %s: %s", error_code,reason, error_msg);
- }
- }
-}
-
http://git-wip-us.apache.org/repos/asf/thrift/blob/87ad2bca/lib/c_glib/src/thrift/c_glib/transport/thrift_ssl_socket.h
----------------------------------------------------------------------
diff --git a/lib/c_glib/src/thrift/c_glib/transport/thrift_ssl_socket.h b/lib/c_glib/src/thrift/c_glib/transport/thrift_ssl_socket.h
index 659c88d..0ca465a 100644
--- a/lib/c_glib/src/thrift/c_glib/transport/thrift_ssl_socket.h
+++ b/lib/c_glib/src/thrift/c_glib/transport/thrift_ssl_socket.h
@@ -53,6 +53,7 @@ G_BEGIN_DECLS
typedef enum
{
THRIFT_SSL_SOCKET_ERROR_TRANSPORT=7,
+ THRIFT_SSL_SOCKET_ERROR_CONNECT_BIND,
THRIFT_SSL_SOCKET_ERROR_CIPHER_NOT_AVAILABLE,
THRIFT_SSL_SOCKET_ERROR_SSL,
THRIFT_SSL_SOCKET_ERROR_SSL_CERT_VALIDATION_FAILED
@@ -117,21 +118,6 @@ GType thrift_ssl_socket_get_type (void);
/* Public API */
/**
- * @brief Returns a error message for a defined error code.
- *
- * It uses gobject error functionality to get the error code of the last error
- * produced by this API.
- *
- * @param error Pointer to the error message.
- * @param error_msg Adds this message to the error that will be added to the
- * code.
- * @param thrift_error_no number of the error triggered.
- *
- * @see https://developer.gnome.org/glib/stable/glib-Error-Reporting.html#g-set-error
- */
-void thrift_ssl_socket_get_error(GError **error, const guchar *error_msg, guint thrift_error_no);
-
-/**
* @brief Set a pinning manager instead of the default one.
*
* The pinning manager will be used during the SSL handshake to check certificate
http://git-wip-us.apache.org/repos/asf/thrift/blob/87ad2bca/lib/c_glib/test/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/lib/c_glib/test/CMakeLists.txt b/lib/c_glib/test/CMakeLists.txt
index 2c87dbc..fb3e41c 100644
--- a/lib/c_glib/test/CMakeLists.txt
+++ b/lib/c_glib/test/CMakeLists.txt
@@ -111,6 +111,8 @@ include_directories("${PROJECT_SOURCE_DIR}/test/c_glib/src" "${CMAKE_CURRENT_BIN
add_executable(testthrifttest testthrifttest.c
${PROJECT_SOURCE_DIR}/test/c_glib/src/thrift_test_handler.c
${PROJECT_SOURCE_DIR}/test/c_glib/src/thrift_test_handler.h
+ ${PROJECT_SOURCE_DIR}/test/c_glib/src/thrift_second_service_handler.c
+ ${PROJECT_SOURCE_DIR}/test/c_glib/src/thrift_second_service_handler.h
gen-c_glib/t_test_thrift_test_types.h)
target_link_libraries(testthrifttest testgenc)
add_test(NAME testthrifttest COMMAND testthrifttest)
http://git-wip-us.apache.org/repos/asf/thrift/blob/87ad2bca/lib/c_glib/test/testbufferedtransport.c
----------------------------------------------------------------------
diff --git a/lib/c_glib/test/testbufferedtransport.c b/lib/c_glib/test/testbufferedtransport.c
index 1c15ef2..c6e6b58 100755
--- a/lib/c_glib/test/testbufferedtransport.c
+++ b/lib/c_glib/test/testbufferedtransport.c
@@ -31,6 +31,7 @@
#include "../src/thrift/c_glib/transport/thrift_buffered_transport.c"
static void thrift_server (const int port);
+static void thrift_socket_server_open (const int port, int times);
/* test object creation and destruction */
static void
@@ -44,8 +45,8 @@ test_create_and_destroy(void)
object = g_object_new (THRIFT_TYPE_BUFFERED_TRANSPORT, NULL);
g_assert (object != NULL);
g_object_get (G_OBJECT (object), "transport", &transport,
- "r_buf_size", &r_buf_size,
- "w_buf_size", &w_buf_size, NULL);
+ "r_buf_size", &r_buf_size,
+ "w_buf_size", &w_buf_size, NULL);
g_object_unref (object);
}
@@ -55,35 +56,52 @@ test_open_and_close(void)
ThriftSocket *tsocket = NULL;
ThriftTransport *transport = NULL;
GError *err = NULL;
+ pid_t pid;
+ int port = 51199;
+ int status;
- /* create a ThriftSocket */
- tsocket = g_object_new (THRIFT_TYPE_SOCKET, "hostname", "localhost",
- "port", 51188, NULL);
-
- /* create a BufferedTransport wrapper of the Socket */
- transport = g_object_new (THRIFT_TYPE_BUFFERED_TRANSPORT,
- "transport", THRIFT_TRANSPORT (tsocket), NULL);
-
- /* this shouldn't work */
- g_assert (thrift_buffered_transport_open (transport, NULL) == FALSE);
- g_assert (thrift_buffered_transport_is_open (transport) == TRUE);
- g_assert (thrift_buffered_transport_close (transport, NULL) == TRUE);
- g_object_unref (transport);
- g_object_unref (tsocket);
-
- /* try and underlying socket failure */
- tsocket = g_object_new (THRIFT_TYPE_SOCKET, "hostname", "localhost.broken",
- NULL);
-
- /* create a BufferedTransport wrapper of the Socket */
- transport = g_object_new (THRIFT_TYPE_BUFFERED_TRANSPORT,
- "transport", THRIFT_TRANSPORT (tsocket), NULL);
+ pid = fork ();
+ g_assert ( pid >= 0 );
- g_assert (thrift_buffered_transport_open (transport, &err) == FALSE);
- g_object_unref (transport);
- g_object_unref (tsocket);
- g_error_free (err);
- err = NULL;
+ if ( pid == 0 )
+ {
+ /* child listens */
+ thrift_socket_server_open (port,1);
+ exit (0);
+ } else {
+ /* parent connects, wait a bit for the socket to be created */
+ sleep (1);
+ /* create a ThriftSocket */
+ tsocket = g_object_new (THRIFT_TYPE_SOCKET, "hostname", "localhost",
+ "port", port, NULL);
+
+ /* create a BufferedTransport wrapper of the Socket */
+ transport = g_object_new (THRIFT_TYPE_BUFFERED_TRANSPORT,
+ "transport", THRIFT_TRANSPORT (tsocket), NULL);
+
+ /* this shouldn't work */
+ g_assert (thrift_buffered_transport_open (transport, NULL) == TRUE);
+ g_assert (thrift_buffered_transport_is_open (transport) == TRUE);
+ g_assert (thrift_buffered_transport_close (transport, NULL) == TRUE);
+ g_object_unref (transport);
+ g_object_unref (tsocket);
+
+ /* try and underlying socket failure */
+ tsocket = g_object_new (THRIFT_TYPE_SOCKET, "hostname", "localhost.broken",
+ NULL);
+
+ /* create a BufferedTransport wrapper of the Socket */
+ transport = g_object_new (THRIFT_TYPE_BUFFERED_TRANSPORT,
+ "transport", THRIFT_TRANSPORT (tsocket), NULL);
+
+ g_assert (thrift_buffered_transport_open (transport, &err) == FALSE);
+ g_object_unref (transport);
+ g_object_unref (tsocket);
+ g_error_free (err);
+ err = NULL;
+ g_assert ( wait (&status) == pid );
+ g_assert ( status == 0 );
+ }
}
static void
@@ -100,57 +118,81 @@ test_read_and_write(void)
g_assert ( pid >= 0 );
if ( pid == 0 )
- {
- /* child listens */
- thrift_server (port);
- exit (0);
- } else {
- /* parent connects, wait a bit for the socket to be created */
- sleep (1);
-
- tsocket = g_object_new (THRIFT_TYPE_SOCKET, "hostname", "localhost",
- "port", port, NULL);
- transport = g_object_new (THRIFT_TYPE_BUFFERED_TRANSPORT,
- "transport", THRIFT_TRANSPORT (tsocket),
- "w_buf_size", 4, NULL);
-
- g_assert (thrift_buffered_transport_open (transport, NULL) == TRUE);
- g_assert (thrift_buffered_transport_is_open (transport));
-
- /* write 10 bytes */
- thrift_buffered_transport_write (transport, buf, 10, NULL);
-
- /* write 1 byte at a time */
- thrift_buffered_transport_write (transport, buf, 1, NULL);
- thrift_buffered_transport_write (transport, buf, 1, NULL);
- thrift_buffered_transport_write (transport, buf, 1, NULL);
-
- /* overflow the buffer */
- thrift_buffered_transport_write (transport, buf, 2, NULL);
- thrift_buffered_transport_write (transport, buf, 1, NULL);
- thrift_buffered_transport_flush (transport, NULL);
-
- /* write 1 byte and flush */
- thrift_buffered_transport_write (transport, buf, 1, NULL);
- thrift_buffered_transport_flush (transport, NULL);
-
- /* write and overflow buffer with 2 system calls */
- thrift_buffered_transport_write (transport, buf, 1, NULL);
- thrift_buffered_transport_write (transport, buf, 3, NULL);
-
- /* write 10 bytes */
- thrift_buffered_transport_write (transport, buf, 10, NULL);
-
- thrift_buffered_transport_write_end (transport, NULL);
- thrift_buffered_transport_flush (transport, NULL);
- thrift_buffered_transport_close (transport, NULL);
-
- g_object_unref (transport);
- g_object_unref (tsocket);
-
- g_assert ( wait (&status) == pid );
- g_assert ( status == 0 );
+ {
+ /* child listens */
+ thrift_server (port);
+ exit (0);
+ } else {
+ /* parent connects, wait a bit for the socket to be created */
+ sleep (1);
+
+ tsocket = g_object_new (THRIFT_TYPE_SOCKET, "hostname", "localhost",
+ "port", port, NULL);
+ transport = g_object_new (THRIFT_TYPE_BUFFERED_TRANSPORT,
+ "transport", THRIFT_TRANSPORT (tsocket),
+ "w_buf_size", 4, NULL);
+
+ g_assert (thrift_buffered_transport_open (transport, NULL) == TRUE);
+ g_assert (thrift_buffered_transport_is_open (transport));
+
+ /* write 10 bytes */
+ thrift_buffered_transport_write (transport, buf, 10, NULL);
+
+ /* write 1 byte at a time */
+ thrift_buffered_transport_write (transport, buf, 1, NULL);
+ thrift_buffered_transport_write (transport, buf, 1, NULL);
+ thrift_buffered_transport_write (transport, buf, 1, NULL);
+
+ /* overflow the buffer */
+ thrift_buffered_transport_write (transport, buf, 2, NULL);
+ thrift_buffered_transport_write (transport, buf, 1, NULL);
+ thrift_buffered_transport_flush (transport, NULL);
+
+ /* write 1 byte and flush */
+ thrift_buffered_transport_write (transport, buf, 1, NULL);
+ thrift_buffered_transport_flush (transport, NULL);
+
+ /* write and overflow buffer with 2 system calls */
+ thrift_buffered_transport_write (transport, buf, 1, NULL);
+ thrift_buffered_transport_write (transport, buf, 3, NULL);
+
+ /* write 10 bytes */
+ thrift_buffered_transport_write (transport, buf, 10, NULL);
+
+ thrift_buffered_transport_write_end (transport, NULL);
+ thrift_buffered_transport_flush (transport, NULL);
+ thrift_buffered_transport_close (transport, NULL);
+
+ g_object_unref (transport);
+ g_object_unref (tsocket);
+
+ g_assert ( wait (&status) == pid );
+ g_assert ( status == 0 );
+ }
+}
+
+
+static void
+thrift_socket_server_open (const int port, int times)
+{
+ int bytes = 0;
+ ThriftServerTransport *transport = NULL;
+ ThriftTransport *client = NULL;
+ guchar buf[10]; /* a buffer */
+ guchar match[10] = TEST_DATA;
+ int i;
+ ThriftServerSocket *tsocket = g_object_new (THRIFT_TYPE_SERVER_SOCKET,
+ "port", port, NULL);
+
+ transport = THRIFT_SERVER_TRANSPORT (tsocket);
+ thrift_server_transport_listen (transport, NULL);
+ for(i=0;i<times;i++){
+ client = thrift_server_transport_accept (transport, NULL);
+ g_assert (client != NULL);
+ thrift_socket_close (client, NULL);
+ g_object_unref (client);
}
+ g_object_unref (tsocket);
}
static void
@@ -163,15 +205,15 @@ thrift_server (const int port)
guchar match[10] = TEST_DATA;
ThriftServerSocket *tsocket = g_object_new (THRIFT_TYPE_SERVER_SOCKET,
- "port", port, NULL);
+ "port", port, NULL);
transport = THRIFT_SERVER_TRANSPORT (tsocket);
thrift_server_transport_listen (transport, NULL);
/* wrap the client in a BufferedTransport */
client = g_object_new (THRIFT_TYPE_BUFFERED_TRANSPORT, "transport",
- thrift_server_transport_accept (transport, NULL),
- "r_buf_size", 5, NULL);
+ thrift_server_transport_accept (transport, NULL),
+ "r_buf_size", 5, NULL);
g_assert (client != NULL);
/* read 10 bytes */
@@ -209,62 +251,62 @@ test_write_fail(void)
g_assert ( pid >= 0 );
if ( pid == 0 )
- {
- /* child listens */
- ThriftServerTransport *transport = NULL;
- ThriftTransport *client = NULL;
-
- ThriftServerSocket *tsocket = g_object_new (THRIFT_TYPE_SERVER_SOCKET,
- "port", port, NULL);
-
- transport = THRIFT_SERVER_TRANSPORT (tsocket);
- thrift_server_transport_listen (transport, NULL);
-
- /* wrap the client in a BufferedTransport */
- client = g_object_new (THRIFT_TYPE_BUFFERED_TRANSPORT, "transport",
- thrift_server_transport_accept (transport, NULL),
- "r_buf_size", 5, NULL);
- g_assert (client != NULL);
-
- /* just close socket */
- thrift_buffered_transport_close (client, NULL);
- g_object_unref (client);
- g_object_unref (tsocket);
- exit (0);
- } else {
- /* parent connects, wait a bit for the socket to be created */
- sleep (1);
-
- tsocket = g_object_new (THRIFT_TYPE_SOCKET, "hostname", "localhost",
- "port", port, NULL);
- transport = g_object_new (THRIFT_TYPE_BUFFERED_TRANSPORT,
- "transport", THRIFT_TRANSPORT (tsocket),
- "w_buf_size", 4, NULL);
-
-
- g_assert (thrift_buffered_transport_open (transport, NULL) == TRUE);
- g_assert (thrift_buffered_transport_is_open (transport));
-
- /* recognize disconnection */
- sleep(1);
- g_assert (thrift_buffered_transport_write (transport, buf, 10, NULL) == TRUE);
- g_assert (thrift_buffered_transport_write (transport, buf, 10, NULL) == FALSE);
-
- /* write and overflow buffer */
- g_assert (thrift_buffered_transport_write (transport, buf, 10, NULL) == FALSE);
-
- /* write 1 and flush */
- g_assert (thrift_buffered_transport_write (transport, buf, 1, NULL) == TRUE);
- g_assert (thrift_buffered_transport_flush (transport, NULL) == FALSE);
-
- thrift_buffered_transport_close (transport, NULL);
-
- g_object_unref (transport);
- g_object_unref (tsocket);
-
- g_assert ( wait (&status) == pid );
- g_assert ( status == 0 );
- }
+ {
+ /* child listens */
+ ThriftServerTransport *transport = NULL;
+ ThriftTransport *client = NULL;
+
+ ThriftServerSocket *tsocket = g_object_new (THRIFT_TYPE_SERVER_SOCKET,
+ "port", port, NULL);
+
+ transport = THRIFT_SERVER_TRANSPORT (tsocket);
+ thrift_server_transport_listen (transport, NULL);
+
+ /* wrap the client in a BufferedTransport */
+ client = g_object_new (THRIFT_TYPE_BUFFERED_TRANSPORT, "transport",
+ thrift_server_transport_accept (transport, NULL),
+ "r_buf_size", 5, NULL);
+ g_assert (client != NULL);
+
+ /* just close socket */
+ thrift_buffered_transport_close (client, NULL);
+ g_object_unref (client);
+ g_object_unref (tsocket);
+ exit (0);
+ } else {
+ /* parent connects, wait a bit for the socket to be created */
+ sleep (1);
+
+ tsocket = g_object_new (THRIFT_TYPE_SOCKET, "hostname", "localhost",
+ "port", port, NULL);
+ transport = g_object_new (THRIFT_TYPE_BUFFERED_TRANSPORT,
+ "transport", THRIFT_TRANSPORT (tsocket),
+ "w_buf_size", 4, NULL);
+
+
+ g_assert (thrift_buffered_transport_open (transport, NULL) == TRUE);
+ g_assert (thrift_buffered_transport_is_open (transport));
+
+ /* recognize disconnection */
+ sleep(1);
+ g_assert (thrift_buffered_transport_write (transport, buf, 10, NULL) == TRUE);
+ g_assert (thrift_buffered_transport_write (transport, buf, 10, NULL) == FALSE);
+
+ /* write and overflow buffer */
+ g_assert (thrift_buffered_transport_write (transport, buf, 10, NULL) == FALSE);
+
+ /* write 1 and flush */
+ g_assert (thrift_buffered_transport_write (transport, buf, 1, NULL) == TRUE);
+ g_assert (thrift_buffered_transport_flush (transport, NULL) == FALSE);
+
+ thrift_buffered_transport_close (transport, NULL);
+
+ g_object_unref (transport);
+ g_object_unref (tsocket);
+
+ g_assert ( wait (&status) == pid );
+ g_assert ( status == 0 );
+ }
}
int
http://git-wip-us.apache.org/repos/asf/thrift/blob/87ad2bca/lib/c_glib/test/testframedtransport.c
----------------------------------------------------------------------
diff --git a/lib/c_glib/test/testframedtransport.c b/lib/c_glib/test/testframedtransport.c
index 0328737..45397ce 100755
--- a/lib/c_glib/test/testframedtransport.c
+++ b/lib/c_glib/test/testframedtransport.c
@@ -30,6 +30,7 @@
#include "../src/thrift/c_glib/transport/thrift_framed_transport.c"
static void thrift_server (const int port);
+static void thrift_socket_server_open (const int port, int times);
/* test object creation and destruction */
static void
@@ -43,8 +44,8 @@ test_create_and_destroy(void)
object = g_object_new (THRIFT_TYPE_FRAMED_TRANSPORT, NULL);
g_assert (object != NULL);
g_object_get (G_OBJECT (object), "transport", &transport,
- "r_buf_size", &r_buf_size,
- "w_buf_size", &w_buf_size, NULL);
+ "r_buf_size", &r_buf_size,
+ "w_buf_size", &w_buf_size, NULL);
g_object_unref (object);
}
@@ -54,35 +55,53 @@ test_open_and_close(void)
ThriftSocket *tsocket = NULL;
ThriftTransport *transport = NULL;
GError *err = NULL;
+ pid_t pid;
+ int port = 51199;
+ int status;
- /* create a ThriftSocket */
- tsocket = g_object_new (THRIFT_TYPE_SOCKET, "hostname", "localhost",
- "port", 51188, NULL);
-
- /* create a BufferedTransport wrapper of the Socket */
- transport = g_object_new (THRIFT_TYPE_FRAMED_TRANSPORT,
- "transport", THRIFT_TRANSPORT (tsocket), NULL);
-
- /* this shouldn't work */
- g_assert (thrift_framed_transport_open (transport, NULL) == FALSE);
- g_assert (thrift_framed_transport_is_open (transport) == TRUE);
- g_assert (thrift_framed_transport_close (transport, NULL) == TRUE);
- g_object_unref (transport);
- g_object_unref (tsocket);
-
- /* try and underlying socket failure */
- tsocket = g_object_new (THRIFT_TYPE_SOCKET, "hostname", "localhost.broken",
- NULL);
-
- /* create a BufferedTransport wrapper of the Socket */
- transport = g_object_new (THRIFT_TYPE_FRAMED_TRANSPORT,
- "transport", THRIFT_TRANSPORT (tsocket), NULL);
+ pid = fork ();
+ g_assert ( pid >= 0 );
- g_assert (thrift_framed_transport_open (transport, &err) == FALSE);
- g_object_unref (transport);
- g_object_unref (tsocket);
- g_error_free (err);
- err = NULL;
+ if ( pid == 0 )
+ {
+ /* child listens */
+ thrift_socket_server_open (port,1);
+ exit (0);
+ } else {
+ /* parent connects, wait a bit for the socket to be created */
+ sleep (1);
+ /* create a ThriftSocket */
+ tsocket = g_object_new (THRIFT_TYPE_SOCKET, "hostname", "localhost",
+ "port", port, NULL);
+
+ /* create a BufferedTransport wrapper of the Socket */
+ transport = g_object_new (THRIFT_TYPE_FRAMED_TRANSPORT,
+ "transport", THRIFT_TRANSPORT (tsocket), NULL);
+
+ /* this shouldn't work */
+ g_assert (thrift_framed_transport_open (transport, NULL) == TRUE);
+ g_assert (thrift_framed_transport_is_open (transport) == TRUE);
+ g_assert (thrift_framed_transport_close (transport, NULL) == TRUE);
+ g_object_unref (transport);
+ g_object_unref (tsocket);
+
+ /* try and underlying socket failure */
+ tsocket = g_object_new (THRIFT_TYPE_SOCKET, "hostname", "localhost.broken",
+ NULL);
+
+ /* create a BufferedTransport wrapper of the Socket */
+ transport = g_object_new (THRIFT_TYPE_FRAMED_TRANSPORT,
+ "transport", THRIFT_TRANSPORT (tsocket), NULL);
+
+ g_assert (thrift_framed_transport_open (transport, &err) == FALSE);
+ g_object_unref (transport);
+ g_object_unref (tsocket);
+ g_error_free (err);
+ err = NULL;
+
+ g_assert ( wait (&status) == pid );
+ g_assert ( status == 0 );
+ }
}
static void
@@ -99,46 +118,46 @@ test_read_and_write(void)
g_assert ( pid >= 0 );
if ( pid == 0 )
- {
- /* child listens */
- thrift_server (port);
- exit (0);
- } else {
- /* parent connects, wait a bit for the socket to be created */
- sleep (1);
-
- tsocket = g_object_new (THRIFT_TYPE_SOCKET, "hostname", "localhost",
- "port", port, NULL);
- transport = g_object_new (THRIFT_TYPE_FRAMED_TRANSPORT,
- "transport", THRIFT_TRANSPORT (tsocket),
- "w_buf_size", 4, NULL);
-
- g_assert (thrift_framed_transport_open (transport, NULL) == TRUE);
- g_assert (thrift_framed_transport_is_open (transport));
-
- /* write 10 bytes */
- thrift_framed_transport_write (transport, buf, 10, NULL);
- thrift_framed_transport_flush (transport, NULL);
-
- thrift_framed_transport_write (transport, buf, 1, NULL);
- thrift_framed_transport_flush (transport, NULL);
-
- thrift_framed_transport_write (transport, buf, 10, NULL);
- thrift_framed_transport_flush (transport, NULL);
-
- thrift_framed_transport_write (transport, buf, 10, NULL);
- thrift_framed_transport_flush (transport, NULL);
-
- thrift_framed_transport_write_end (transport, NULL);
- thrift_framed_transport_flush (transport, NULL);
- thrift_framed_transport_close (transport, NULL);
-
- g_object_unref (transport);
- g_object_unref (tsocket);
-
- g_assert ( wait (&status) == pid );
- g_assert ( status == 0 );
- }
+ {
+ /* child listens */
+ thrift_server (port);
+ exit (0);
+ } else {
+ /* parent connects, wait a bit for the socket to be created */
+ sleep (1);
+
+ tsocket = g_object_new (THRIFT_TYPE_SOCKET, "hostname", "localhost",
+ "port", port, NULL);
+ transport = g_object_new (THRIFT_TYPE_FRAMED_TRANSPORT,
+ "transport", THRIFT_TRANSPORT (tsocket),
+ "w_buf_size", 4, NULL);
+
+ g_assert (thrift_framed_transport_open (transport, NULL) == TRUE);
+ g_assert (thrift_framed_transport_is_open (transport));
+
+ /* write 10 bytes */
+ thrift_framed_transport_write (transport, buf, 10, NULL);
+ thrift_framed_transport_flush (transport, NULL);
+
+ thrift_framed_transport_write (transport, buf, 1, NULL);
+ thrift_framed_transport_flush (transport, NULL);
+
+ thrift_framed_transport_write (transport, buf, 10, NULL);
+ thrift_framed_transport_flush (transport, NULL);
+
+ thrift_framed_transport_write (transport, buf, 10, NULL);
+ thrift_framed_transport_flush (transport, NULL);
+
+ thrift_framed_transport_write_end (transport, NULL);
+ thrift_framed_transport_flush (transport, NULL);
+ thrift_framed_transport_close (transport, NULL);
+
+ g_object_unref (transport);
+ g_object_unref (tsocket);
+
+ g_assert ( wait (&status) == pid );
+ g_assert ( status == 0 );
+ }
}
/* test reading from the transport after the peer has unexpectedly
@@ -155,76 +174,100 @@ test_read_after_peer_close(void)
g_assert (pid >= 0);
if (pid == 0)
- {
- ThriftServerTransport *server_transport = NULL;
- ThriftTransport *client_transport = NULL;
-
- /* child listens */
- server_transport = g_object_new (THRIFT_TYPE_SERVER_SOCKET,
- "port", port,
- NULL);
- g_assert (server_transport != NULL);
-
- thrift_server_transport_listen (server_transport, &err);
- g_assert (err == NULL);
-
- /* wrap the client transport in a ThriftFramedTransport */
- client_transport = g_object_new
- (THRIFT_TYPE_FRAMED_TRANSPORT,
- "transport", thrift_server_transport_accept (server_transport, &err),
- "r_buf_size", 0,
- NULL);
- g_assert (err == NULL);
- g_assert (client_transport != NULL);
-
- /* close the connection immediately after the client connects */
- thrift_transport_close (client_transport, NULL);
-
- g_object_unref (client_transport);
- g_object_unref (server_transport);
-
- exit (0);
- } else {
- ThriftSocket *tsocket = NULL;
- ThriftTransport *transport = NULL;
- guchar buf[10]; /* a buffer */
-
- /* parent connects, wait a bit for the socket to be created */
- sleep (1);
-
- tsocket = g_object_new (THRIFT_TYPE_SOCKET,
- "hostname", "localhost",
- "port", port,
- NULL);
- transport = g_object_new (THRIFT_TYPE_FRAMED_TRANSPORT,
- "transport", THRIFT_TRANSPORT (tsocket),
- "w_buf_size", 0,
- NULL);
-
- g_assert (thrift_transport_open (transport, NULL) == TRUE);
- g_assert (thrift_transport_is_open (transport));
-
- /* attempting to read from the transport after the peer has closed
+ {
+ ThriftServerTransport *server_transport = NULL;
+ ThriftTransport *client_transport = NULL;
+
+ /* child listens */
+ server_transport = g_object_new (THRIFT_TYPE_SERVER_SOCKET,
+ "port", port,
+ NULL);
+ g_assert (server_transport != NULL);
+
+ thrift_server_transport_listen (server_transport, &err);
+ g_assert (err == NULL);
+
+ /* wrap the client transport in a ThriftFramedTransport */
+ client_transport = g_object_new
+ (THRIFT_TYPE_FRAMED_TRANSPORT,
+ "transport", thrift_server_transport_accept (server_transport, &err),
+ "r_buf_size", 0,
+ NULL);
+ g_assert (err == NULL);
+ g_assert (client_transport != NULL);
+
+ /* close the connection immediately after the client connects */
+ thrift_transport_close (client_transport, NULL);
+
+ g_object_unref (client_transport);
+ g_object_unref (server_transport);
+
+ exit (0);
+ } else {
+ ThriftSocket *tsocket = NULL;
+ ThriftTransport *transport = NULL;
+ guchar buf[10]; /* a buffer */
+
+ /* parent connects, wait a bit for the socket to be created */
+ sleep (1);
+
+ tsocket = g_object_new (THRIFT_TYPE_SOCKET,
+ "hostname", "localhost",
+ "port", port,
+ NULL);
+ transport = g_object_new (THRIFT_TYPE_FRAMED_TRANSPORT,
+ "transport", THRIFT_TRANSPORT (tsocket),
+ "w_buf_size", 0,
+ NULL);
+
+ g_assert (thrift_transport_open (transport, NULL) == TRUE);
+ g_assert (thrift_transport_is_open (transport));
+
+ /* attempting to read from the transport after the peer has closed
the connection fails gracefully without generating a critical
warning or segmentation fault */
- thrift_transport_read (transport, buf, 10, &err);
- g_assert (err != NULL);
+ thrift_transport_read (transport, buf, 10, &err);
+ g_assert (err != NULL);
+
+ g_error_free (err);
+ err = NULL;
- g_error_free (err);
- err = NULL;
+ thrift_transport_read_end (transport, &err);
+ g_assert (err == NULL);
- thrift_transport_read_end (transport, &err);
- g_assert (err == NULL);
+ thrift_transport_close (transport, &err);
+ g_assert (err == NULL);
- thrift_transport_close (transport, &err);
- g_assert (err == NULL);
+ g_object_unref (transport);
+ g_object_unref (tsocket);
+
+ g_assert (wait (&status) == pid);
+ g_assert (status == 0);
+ }
+}
+
+static void
+thrift_socket_server_open (const int port, int times)
+{
+ int bytes = 0;
+ ThriftServerTransport *transport = NULL;
+ ThriftTransport *client = NULL;
+ guchar buf[10]; /* a buffer */
+ guchar match[10] = TEST_DATA;
+ int i;
- g_object_unref (transport);
- g_object_unref (tsocket);
+ ThriftServerSocket *tsocket = g_object_new (THRIFT_TYPE_SERVER_SOCKET,
+ "port", port, NULL);
- g_assert (wait (&status) == pid);
- g_assert (status == 0);
+ transport = THRIFT_SERVER_TRANSPORT (tsocket);
+ thrift_server_transport_listen (transport, NULL);
+ for(i=0;i<times;i++){
+ client = thrift_server_transport_accept (transport, NULL);
+ g_assert (client != NULL);
+ thrift_socket_close (client, NULL);
+ g_object_unref (client);
}
+ g_object_unref (tsocket);
}
static void
@@ -237,15 +280,15 @@ thrift_server (const int port)
guchar match[10] = TEST_DATA;
ThriftServerSocket *tsocket = g_object_new (THRIFT_TYPE_SERVER_SOCKET,
- "port", port, NULL);
+ "port", port, NULL);
transport = THRIFT_SERVER_TRANSPORT (tsocket);
thrift_server_transport_listen (transport, NULL);
/* wrap the client in a BufferedTransport */
client = g_object_new (THRIFT_TYPE_FRAMED_TRANSPORT, "transport",
- thrift_server_transport_accept (transport, NULL),
- "r_buf_size", 5, NULL);
+ thrift_server_transport_accept (transport, NULL),
+ "r_buf_size", 5, NULL);
g_assert (client != NULL);
/* read 10 bytes */
[04/50] [abbrv] thrift git commit: THRIFT-4351: use travis build
stages to optimize build, avoiding duplicate rebuilds of the same image,
and also allow personal docker hub repositories for private fork builds to be
optimized. Move ubsan build to artful
Posted by je...@apache.org.
THRIFT-4351: use travis build stages to optimize build,
avoiding duplicate rebuilds of the same image, and also
allow personal docker hub repositories for private fork
builds to be optimized. Move ubsan build to artful image
because it catches more stuff and fix what was found.
THRIFT-4345: solidify docker build strategy for maximum
coverage: trusty, xenial, artful as stock as they can be
THRIFT-4344: add top level language summary markdown and
update readme with a new image on the layered architecture
THRIFT-3847: remove VERSION macro from config.h which
was causing a conflict on artful builds.
THRIFT-4359: fix haxe map/set decode when key is binary,
as a missing break statement caused it to use an int
during decode
This closes #1389
Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/0ad20bdb
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/0ad20bdb
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/0ad20bdb
Branch: refs/heads/0.11.0
Commit: 0ad20bdbfe9abcbb0cc5332ff95651b5c975da91
Parents: 8b8a8ef
Author: James E. King, III <jk...@apache.org>
Authored: Sat Sep 30 15:44:16 2017 -0700
Committer: James E. King, III <jk...@apache.org>
Committed: Thu Oct 19 11:29:04 2017 -0400
----------------------------------------------------------------------
.gitignore | 1 +
.travis.yml | 283 ++++++++++-------
Dockerfile | 61 ----
LANGUAGES.md | 305 +++++++++++++++++++
Makefile.am | 4 +-
NOTICE | 4 +-
README.md | 14 +-
aclocal/ax_check_openssl.m4 | 6 +-
aclocal/ax_compare_version.m4 | 177 +++++++++++
aclocal/ax_lua.m4 | 6 +-
aclocal/ax_prog_dotnetcore_version.m4 | 8 +-
aclocal/ax_prog_haxe_version.m4 | 4 +-
aclocal/ax_prog_perl_modules.m4 | 4 +-
aclocal/m4_ax_compare_version.m4 | 177 -----------
bootstrap.sh | 3 +
build/docker/README.md | 138 +++++----
build/docker/check_unmodified.sh | 42 ---
build/docker/refresh.sh | 77 +++++
build/docker/run.sh | 30 ++
build/docker/scripts/sca.sh | 48 +++
build/docker/scripts/ubsan.sh | 27 +-
build/docker/ubuntu-artful/Dockerfile | 255 ++++++++++++++++
build/docker/ubuntu-trusty/Dockerfile | 302 +++++++++---------
build/docker/ubuntu-trusty/Dockerfile.orig | 231 ++++++++++++++
build/docker/ubuntu-xenial/Dockerfile | 43 ++-
build/docker/vars.sh | 23 ++
compiler/cpp/Makefile.am | 2 +-
.../src/thrift/generate/t_csharp_generator.cc | 1 +
.../cpp/src/thrift/generate/t_haxe_generator.cc | 2 +
.../cpp/src/thrift/generate/t_hs_generator.cc | 10 +-
.../src/thrift/generate/t_netcore_generator.cc | 1 +
compiler/cpp/src/thrift/parse/t_typedef.h | 7 +-
configure.ac | 1 -
doc/images/cgrn.png | Bin 0 -> 1125 bytes
doc/images/cred.png | Bin 0 -> 1169 bytes
doc/images/credfull.png | Bin 0 -> 1057 bytes
doc/images/cyel.png | Bin 0 -> 946 bytes
doc/images/thrift-layers.png | Bin 0 -> 27211 bytes
lib/cpp/test/TMemoryBufferTest.cpp | 3 +-
lib/cpp/test/concurrency/ThreadFactoryTests.h | 20 +-
lib/d/src/thrift/base.d | 2 +-
lib/go/test/Makefile.am | 4 +-
lib/js/Makefile.am | 10 +-
lib/nodejs/Makefile.am | 3 +-
lib/py/setup.py | 1 +
lib/py/src/ext/binary.h | 9 +-
lib/py/src/ext/compact.h | 3 +-
lib/py/src/ext/protocol.tcc | 2 +-
lib/py/src/protocol/TCompactProtocol.py | 3 +
lib/py/src/server/TNonblockingServer.py | 1 +
lib/py/src/transport/sslcompat.py | 1 +
lib/py/test/test_sslsocket.py | 1 +
lib/py/test/thrift_json.py | 1 +
test/features/string_limit.py | 1 +
test/go/Makefile.am | 6 +-
test/py/FastbinaryTest.py | 1 +
test/py/SerializationTest.py | 1 +
test/py/TestClient.py | 1 +
test/py/TestEof.py | 1 +
test/py/TestFrozen.py | 1 +
test/py/TestServer.py | 1 +
test/py/TestSocket.py | 1 +
test/test.py | 1 +
tutorial/hs/LICENSE | 239 +++++++++++++++
tutorial/hs/Makefile.am | 3 +
tutorial/hs/ThriftTutorial.cabal | 2 +-
tutorial/py/PythonClient.py | 1 +
tutorial/py/PythonServer.py | 1 +
68 files changed, 1925 insertions(+), 697 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index faa1a5b..8f1879e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -320,6 +320,7 @@ project.lock.json
/test/haxe/bin
/test/hs/TestClient
/test/hs/TestServer
+/test/php/php_ext_dir/
/test/py.twisted/_trial_temp/
/test/rb/Gemfile.lock
/test/netcore/**/.vs
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index fcd334a..0f9500c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -19,134 +19,193 @@
# build Apache Thrift on Travis CI - https://travis-ci.org/
+#
+# Docker Integration
+#
+# DOCKER_REPO
+# [required] The repository name (within your account).
+# DOCKER_PASS
+# [optional, secure] Your docker account password.
+# If you do not set this, each build job in the "test"
+# stage might rebuild the docker image and extend build
+# time by about 10 minutes per job. If you do set this
+# then each build job in the "docker" stage" will build
+# the docker image if Dockerfile has changed, and then
+# push the new tag up to your docker hub account.
+# DOCKER_USER
+# [required] Your docker hub account name.
+#
+# The resulting tag is:
+# $DOCKER_USER/$DOCKER_REPO:$DISTRO
+# example (and the default):
+# apache/thrift:ubuntu-xenial
+#
+
sudo: required
dist: trusty
+language: cpp
services:
- docker
install:
- - (travis_wait ./build/docker/check_unmodified.sh $DISTRO && touch .unmodified) || true
- - if [ ! -f .unmodified ]; then travis_retry travis_wait docker build -q -t thrift-build:$DISTRO build/docker/$DISTRO; fi
+ - if [[ `uname` == "Linux" ]]; then build/docker/refresh.sh; fi
-script:
- - docker run --net=host -e BUILD_LIBS="$BUILD_LIBS" $BUILD_ENV -v $(pwd):/thrift/src -it thrift-build:$DISTRO build/docker/scripts/$SCRIPT $BUILD_ARG
+stages:
+# - osx # up front for now (for testing)
+ - docker # docker images
+ - thrift # thrift build jobs
env:
global:
- - TEST_NAME=""
- SCRIPT="cmake.sh"
- BUILD_ARG=""
- BUILD_ENV="-e CC=clang -e CXX=clang++"
- DISTRO=ubuntu-xenial
- BUILD_LIBS="CPP C_GLIB HASKELL JAVA PYTHON TESTING TUTORIALS" # only meaningful for CMake builds
+ - TRAVIS_BUILD_STAGE=test
+ - DEFAULT_DOCKER_USER="apache"
+ - DEFAULT_DOCKER_REPO="thrift"
- matrix:
- - TEST_NAME="Cross Language Tests (Binary Protocol)"
- SCRIPT="cross-test.sh"
- BUILD_ARG="-'(binary)'"
- BUILD_ENV="-e CC=clang -e CXX=clang++ -e THRIFT_CROSSTEST_CONCURRENCY=4"
-
- - TEST_NAME="Cross Language Tests (Header, JSON Protocols)"
- SCRIPT="cross-test.sh"
- BUILD_ARG="-'(header|json)'"
- BUILD_ENV="-e CC=clang -e CXX=clang++ -e THRIFT_CROSSTEST_CONCURRENCY=4"
-
- - TEST_NAME="Cross Language Tests (Compact and Multiplexed Protocols)"
- SCRIPT="cross-test.sh"
- BUILD_ARG="-'(compact|multiplexed)'"
- BUILD_ENV="-e CC=clang -e CXX=clang++ -e THRIFT_CROSSTEST_CONCURRENCY=4"
-
- # Autotools builds
- # TODO: Remove them once migrated to CMake
-
- - TEST_NAME="Autotools (Ubuntu Trusty)"
- DISTRO=ubuntu-trusty
- SCRIPT="autotools.sh"
- BUILD_ENV="-e CC=gcc -e CXX=g++"
-
- - TEST_NAME="Autotools (Ubuntu Xenial)"
- SCRIPT="autotools.sh"
- BUILD_ENV="-e CC=gcc -e CXX=g++"
- BUILD_ARG="--enable-plugin"
-
- # CMake builds
-
- - TEST_NAME="CMake (Ubuntu Trusty)"
- DISTRO=ubuntu-trusty
-
- - TEST_NAME="CMake (Ubuntu Xenial)"
-
- # C++ specific options: compiler plug-in, threading model
-
- - TEST_NAME="C++98 (Boost Thread)"
- BUILD_LIBS="CPP TESTING TUTORIALS"
- BUILD_ARG="-DCMAKE_CXX_STANDARD=98 -DCMAKE_CXX_STANDARD_REQUIRED=ON -DCMAKE_CXX_EXTENSIONS=OFF --DWITH_BOOSTTHREADS=ON -DWITH_PYTHON=OFF -DWITH_C_GLIB=OFF -DWITH_JAVA=OFF -DWITH_HASKELL=OFF"
-
- - TEST_NAME="C++ (Std Thread) and Plugin"
- BUILD_LIBS="CPP TESTING TUTORIALS"
- BUILD_ARG="-DWITH_PLUGIN=ON -DWITH_STDTHREADS=ON -DWITH_PYTHON=OFF -DWITH_C_GLIB=OFF -DWITH_JAVA=OFF -DWITH_HASKELL=OFF"
-
- # Distribution
-
- - TEST_NAME="make dist"
- SCRIPT="make-dist.sh"
-
- - TEST_NAME="Debian Packages"
- SCRIPT="dpkg.sh"
-
- # C and C++ undefined behavior. This wraps autotools.sh, but each binary crashes if
- # undefined behavior occurs. Skips the known flaky tests.
-
- - TEST_NAME="UBSan"
- SCRIPT="ubsan.sh"
- BUILD_ARG="--without-haskell --without-nodejs --without-perl --without-python"
- UNSTABLE=true
-
-matrix:
- allow_failures:
- - env: UNSTABLE=true
+jobs:
include:
+ # ------------------------- phase: osx --------------------------
+ # - stage: osx
+ # os: osx
+ # osx_image: xcode9
+ # script: build/docker/scripts/autotools.sh
+
+ # ========================= stage: docker =========================
+ - stage: docker
+ script: true
+ env:
+ - JOB="Docker Build ubuntu-trusty 14.04"
+ - DISTRO=ubuntu-trusty
+ - TRAVIS_BUILD_STAGE=docker
+ - script: true
+ env:
+ - JOB="Docker Build ubuntu-xenial 16.04"
+ - DISTRO=ubuntu-xenial
+ - TRAVIS_BUILD_STAGE=docker
+ - script: true
+ env:
+ - JOB="Docker Build ubuntu-artful 17.10"
+ - DISTRO=ubuntu-artful
+ - TRAVIS_BUILD_STAGE=docker
+
+ # ========================= stage: thrift =======================
+ # ------------------------- phase: cross ------------------------
+ # apache/thrift official PR builds can exceed 50 minutes per job so combine all cross tests
+ - stage: thrift
+ script: build/docker/run.sh
+ if: repo = apache/thrift
+ env:
+ - JOB="Cross Language Tests"
+ - SCRIPT="cross-test.sh"
+ - BUILD_ARG=""
+ - BUILD_ENV="-e CC=clang -e CXX=clang++ -e THRIFT_CROSSTEST_CONCURRENCY=4"
+
+ # fork based PR builds cannot exceed 50 minutes per job
+ - stage: thrift
+ script: build/docker/run.sh
+ if: repo != apache/thrift
+ env:
+ - JOB="Cross Language Tests (Binary Protocol)"
+ - SCRIPT="cross-test.sh"
+ - BUILD_ARG="-'(binary)'"
+ - BUILD_ENV="-e CC=clang -e CXX=clang++ -e THRIFT_CROSSTEST_CONCURRENCY=4"
+
+ - stage: thrift
+ script: build/docker/run.sh
+ if: repo != apache/thrift
+ env:
+ - JOB="Cross Language Tests (Header, JSON Protocols)"
+ - SCRIPT="cross-test.sh"
+ - BUILD_ARG="-'(header|json)'"
+ - BUILD_ENV="-e CC=clang -e CXX=clang++ -e THRIFT_CROSSTEST_CONCURRENCY=4"
+
+ - stage: thrift
+ script: build/docker/run.sh
+ if: repo != apache/thrift
+ env:
+ - JOB="Cross Language Tests (Compact and Multiplexed Protocols)"
+ - SCRIPT="cross-test.sh"
+ - BUILD_ARG="-'(compact|multiplexed)'"
+ - BUILD_ENV="-e CC=clang -e CXX=clang++ -e THRIFT_CROSSTEST_CONCURRENCY=4"
+
+ # ------------------------- phase: sca --------------------------
# QA jobs for code analytics and metrics
- #
- # C/C++ static code analysis with cppcheck
- # add --error-exitcode=1 to --enable=all as soon as everything is fixed
- #
- # Python code style check with flake8
- #
- # search for TODO etc within source tree
- # some statistics about the code base
- # some info about the build machine
- - env: TEST_NAME="cppcheck, flake8, TODO FIXME HACK, LoC and system info"
- install:
- - travis_retry sudo apt-get update
- - travis_retry sudo apt-get install -ym cppcheck sloccount python-flake8
- script:
- # Compiler cppcheck (All)
- - cppcheck --force --quiet --inline-suppr --enable=all -j2 compiler/cpp/src
- # C++ cppcheck (All)
- - cppcheck --force --quiet --inline-suppr --enable=all -j2 lib/cpp/src lib/cpp/test test/cpp tutorial/cpp
- # C Glib cppcheck (All)
- - cppcheck --force --quiet --inline-suppr --enable=all -j2 lib/c_glib/src lib/c_glib/test test/c_glib/src tutorial/c_glib
- # Silent error checks
- - cppcheck --force --quiet --inline-suppr --error-exitcode=1 -j2 compiler/cpp/src
- - cppcheck --force --quiet --inline-suppr --error-exitcode=1 -j2 lib/cpp/src lib/cpp/test test/cpp tutorial/cpp
- - cppcheck --force --quiet --inline-suppr --error-exitcode=1 -j2 lib/c_glib/src lib/c_glib/test test/c_glib/src tutorial/c_glib
- # Python code style
- - flake8 --ignore=E501 lib/py
- - flake8 tutorial/py
- - flake8 --ignore=E501 test/py
- - flake8 test/py.twisted
- - flake8 test/py.tornado
- - flake8 --ignore=E501 test/test.py
- - flake8 --ignore=E501 test/crossrunner
- - flake8 test/features
- # TODO etc
- - grep -r TODO *
- - grep -r FIXME *
- - grep -r HACK *
- # LoC
- - sloccount .
- # System Info
- - dpkg -l
- - uname -a
+ - stage: thrift
+ script: build/docker/run.sh
+ env:
+ - JOB="Static Code Analysis"
+ - SCRIPT="sca.sh"
+ - DISTRO=ubuntu-artful
+
+ # C and C++ undefined behavior.
+ # A binary crashes if undefined behavior occurs and produces a stack trace.
+ # python is disabled, see: THRIFT-4360
+ - script: build/docker/run.sh
+ env:
+ - JOB="UBSan"
+ - SCRIPT="ubsan.sh"
+ - DISTRO=ubuntu-artful
+ - BUILD_ARG="--without-python --without-py3"
+
+ # ------------------------- phase: cmake ------------------------
+ - script: build/docker/run.sh
+ env:
+ - JOB="CMake (Ubuntu Xenial)"
+
+ # C++ specific options: compiler plug-in, threading model
+ - script: build/docker/run.sh
+ env:
+ - JOB="C++98 (Boost Thread)"
+ - SCRIPT="cmake.sh"
+ - BUILD_LIBS="CPP TESTING TUTORIALS"
+ - BUILD_ARG="-DCMAKE_CXX_STANDARD=98 -DCMAKE_CXX_STANDARD_REQUIRED=ON -DCMAKE_CXX_EXTENSIONS=OFF --DWITH_BOOSTTHREADS=ON -DWITH_PYTHON=OFF -DWITH_C_GLIB=OFF -DWITH_JAVA=OFF -DWITH_HASKELL=OFF"
+ - BUILD_ENV=""
+
+ - script: build/docker/run.sh
+ env:
+ - JOB="C++ (Std Thread) and Plugin"
+ - SCRIPT="cmake.sh"
+ - BUILD_LIBS="CPP TESTING TUTORIALS"
+ - BUILD_ARG="-DWITH_PLUGIN=ON -DWITH_STDTHREADS=ON -DWITH_PYTHON=OFF -DWITH_C_GLIB=OFF -DWITH_JAVA=OFF -DWITH_HASKELL=OFF"
+ - BUILD_ENV="-e CC=clang -e CXX=clang++"
+
+ # ------------------------- phase: autotools --------------------
+ # TODO: Remove them once migrated to CMake
+ - script: build/docker/run.sh
+ env:
+ - JOB="Autotools (Ubuntu Artful)"
+ - DISTRO=ubuntu-artful
+ - SCRIPT="autotools.sh"
+ - BUILD_ENV="-e CC=gcc -e CXX=g++"
+
+ - script: build/docker/run.sh
+ env:
+ - JOB="Autotools (Ubuntu Xenial)"
+ - DISTRO=ubuntu-xenial
+ - SCRIPT="autotools.sh"
+ - BUILD_ENV="-e CC=gcc -e CXX=g++"
+
+ - script: build/docker/run.sh
+ env:
+ - JOB="Autotools (Ubuntu Trusty)"
+ - DISTRO=ubuntu-trusty
+ - SCRIPT="autotools.sh"
+ - BUILD_ENV="-e CC=gcc -e CXX=g++"
+
+ # ------------------------- phase: dist -------------------------
+ - script: build/docker/run.sh
+ env:
+ - JOB="make dist"
+ - SCRIPT="make-dist.sh"
+ - BUILD_ENV="-e CC=gcc -e CXX=g++"
+
+ - script: build/docker/run.sh
+ env:
+ - JOB="Debian Packages"
+ - SCRIPT="dpkg.sh"
+ - BUILD_ENV="-e CC=gcc -e CXX=g++"
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/Dockerfile
----------------------------------------------------------------------
diff --git a/Dockerfile b/Dockerfile
deleted file mode 100644
index 0d7ad21..0000000
--- a/Dockerfile
+++ /dev/null
@@ -1,61 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-# Goal: provide a thrift-compiler Docker image
-#
-# Usage:
-# docker run -v "${PWD}:/data" thrift/thrift-compiler -gen cpp -o /data/ /data/test/ThriftTest.thrift
-#
-# further details on docker for thrift is here build/docker/
-#
-# TODO: push to apache/thrift-compiler instead of thrift/thrift-compiler
-
-FROM debian:jessie
-MAINTAINER Apache Thrift <de...@thrift.apache.org>
-
-ENV DEBIAN_FRONTEND noninteractive
-
-ADD . /thrift
-
-RUN buildDeps=" \
- flex \
- bison \
- g++ \
- make \
- cmake \
- curl \
- "; \
- apt-get update && apt-get install -y --no-install-recommends $buildDeps \
- && mkdir /tmp/cmake-build && cd /tmp/cmake-build \
- && cmake \
- -DBUILD_COMPILER=ON \
- -DBUILD_LIBRARIES=OFF \
- -DBUILD_TESTING=OFF \
- -DBUILD_EXAMPLES=OFF \
- /thrift \
- && cmake --build . --config Release \
- && make install \
- && curl -k -sSL "https://storage.googleapis.com/golang/go1.5.2.linux-amd64.tar.gz" -o /tmp/go.tar.gz \
- && tar xzf /tmp/go.tar.gz -C /tmp \
- && cp /tmp/go/bin/gofmt /usr/bin/gofmt \
- && apt-get purge -y --auto-remove $buildDeps \
- && apt-get clean \
- && rm -rf /tmp/* \
- && rm -rf /var/lib/apt/lists/*
-
-ENTRYPOINT ["thrift"]
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/LANGUAGES.md
----------------------------------------------------------------------
diff --git a/LANGUAGES.md b/LANGUAGES.md
new file mode 100644
index 0000000..e34cce3
--- /dev/null
+++ b/LANGUAGES.md
@@ -0,0 +1,305 @@
+# Apache Thrift Language Support #
+
+Last Modified: 2017-10-05<br>
+Version: 0.10.0+
+
+Thrift supports many programming languages and has an impressive test suite that exercises most of the languages, protocols, and transports that represents a matrix of thousands of possible combinations. Each language typically has a minimum required version as well as support libraries - some mandatory and some optional. All of this information is provided below to help you assess whether you can use Apache Thrift with your project. Obviously this is a complex matrix to maintain and may not be correct in all cases - if you spot an error please inform the developers using the mailing list.
+
+Apache Thrift has a choice of two build systems. The `autoconf` build system is the most complete build and is used to build all supported languages. The `cmake` build system has been designated by the project to replace `autoconf` however this transition will take quite some time to complete.
+
+The Language/Library Levels indicate the minimum and maximum versions that are used in the [continuous integration environments](build/docker/README.md) (Appveyor, Travis) for Apache Thrift. Note that while a language may contain support for protocols, transports, and servers, the extent to which each is tested as part of the overall build process varies. The definitive integration test for the project is called the "cross" test which executes a test matrix with clients and servers communicating across languages.
+
+<table style="font-size: 65%; padding: 1px;">
+<thead>
+<tr>
+<th rowspan=2>Language</th>
+<th colspan=2 align=center>Build Systems</th>
+<th colspan=2 align=center>Lang/Lib Levels</th>
+<th colspan=6 align=center>Low-Level Transports</th>
+<th colspan=3 align=center>Transport Wrappers</th>
+<th colspan=4 align=center>Protocols</th>
+<th colspan=5 align=center>Servers</th>
+<th rowspan=2>Open Issues</th>
+</tr>
+<tr>
+<!-- Build Systems ---------><th>autoconf</th><th>cmake</th>
+<!-- Lang/Lib Levels -------><th>Min</th><th>Max</th>
+<!-- Low-Level Transports --><th><a href="https://en.wikipedia.org/wiki/Unix_domain_socket">Domain</a></th><th> File </th><th>Memory</th><th> Pipe </th><th>Socket</th><th> TLS </th>
+<!-- Transport Wrappers ----><th>Framed</th><th> http </th><th> zlib </th>
+<!-- Protocols -------------><th><a href="doc/specs/thrift-binary-protocol.md">Binary</a></th><th><a href="doc/specs/thrift-compact-protocol.md">Compact</a></th><th> JSON </th><th>Multiplex</th>
+<!-- Servers ---------------><th>Forking</th><th>Nonblocking</th><th>Simple</th><th>Threaded</th><th>ThreadPool</th>
+</tr>
+</thead>
+<tbody>
+<tr align=center>
+<td align=left><a href="lib/as3/README.md">ActionScript</a></td>
+<!-- Build Systems ---------><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Language Levels -------><td colspan=2>ActionScript 3</td>
+<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Transport Wrappers ----><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Servers ---------------><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12313722">ActionScript</a></td>
+</tr>
+<tr align=center>
+<td align=left><a href="lib/c_glib/README.md">C (glib)</a></td>
+<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Language Levels -------><td>2.40.2</td><td>2.54.0</td>
+<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Servers ---------------><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12313854">C (glib)</a></td>
+</tr>
+<tr align=center>
+<td align=left><a href="lib/cpp/README.md">C++</a></td>
+<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Language Levels -------><td colspan=2>C++98, gcc </td>
+<!-- Low-Level Transports --><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Servers ---------------><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12312313">C++</a></td>
+</tr>
+<tr align=center>
+<td align=left><a href="lib/csharp/README.md">C#</a></td>
+<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Language Levels -------><td>.NET 3.5 / mono 3.2.8.0</td><td>.NET 4.6.1 / mono 4.6.2.7</td>
+<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Servers ---------------><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12312362">C# (.NET)</a></td>
+</tr>
+<tr align=center>
+<td align=left><a href="lib/cocoa/README.md">Cocoa</a></td>
+<!-- Build Systems ---------><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Language Levels -------><td colspan=2>unknown</td>
+<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Servers ---------------><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12312398">Cocoa</a></td>
+</tr>
+<tr align=center>
+<td align=left><a href="lib/d/README.md">D</a></td>
+<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Language Levels -------><td>2.070.2</td><td>2.076.0</td>
+<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Servers ---------------><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12317904">D</a></td>
+</tr>
+<tr align=center>
+<td align=left><a href="lib/dart/README.md">Dart</a></td>
+<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Language Levels -------><td>1.20.1</td><td>1.24.2</td>
+<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Servers ---------------><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12328006">Dart</a></td>
+</tr>
+<tr align=center>
+<td align=left><a href="lib/delphi/README.md">Delphi</a></td>
+<!-- Build Systems ---------><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Language Levels -------><td>2010</td><td>unknown</td>
+<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Servers ---------------><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12316601">Delphi</a></td>
+</tr>
+<tr align=center>
+<td align=left><a href="lib/netcore/README.md">.NET Core</a></td>
+<!-- Build Systems ---------><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Language Levels -------><td colspan=2>2.0.0</td>
+<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Servers ---------------><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12331176">.NET Core</a></td>
+</tr>
+<tr align=center>
+<td align=left><a href="lib/erl/README.md">Erlang</a></td>
+<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Language Levels -------><td>R16B03</td><td>20.0.4</td>
+<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Servers ---------------><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12312390">Erlang</a></td>
+</tr>
+<tr align=center>
+<td align=left><a href="lib/go/README.md">Go</a></td>
+<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Language Levels -------><td>1.2.1</td><td>1.8.3</td>
+<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Servers ---------------><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12314307">Go</a></td>
+</tr>
+<tr align=center>
+<td align=left><a href="lib/hs/README.md">Haskell</a></td>
+<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Language Levels -------><td>7.6.3</td><td>8.0.2</td>
+<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Servers ---------------><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12312704">Haskell</a></td>
+</tr>
+<tr align=center>
+<td align=left><a href="lib/haxe/README.md">Haxe</a></td>
+<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Language Levels -------><td colspan=2>3.2.1</td>
+<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Servers ---------------><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12324347">Haxe</a></td>
+</tr>
+<tr align=center>
+<td align=left><a href="lib/java/README.md">Java (SE)</a></td>
+<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Language Levels -------><td>1.7.0_151</td><td>1.8.0_144</td>
+<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Servers ---------------><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12312314">Java SE</a></td>
+</tr>
+<tr align=center>
+<td align=left><a href="lib/javame/README.md">Java (ME)</a></td>
+<!-- Build Systems ---------><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Language Levels -------><td colspan=2>unknown</td>
+<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Transport Wrappers ----><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Servers ---------------><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12313759">Java ME</a></td>
+</tr>
+<tr align=center>
+<td align=left><a href="lib/js/README.md">Javascript</a></td>
+<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Language Levels -------><td colspan=2>unknown</td>
+<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Transport Wrappers ----><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Protocols -------------><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Servers ---------------><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12313418">Javascript</a></td>
+</tr>
+<tr align=center>
+<td align=left><a href="lib/lua/README.md">Lua</a></td>
+<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Language Levels -------><td>5.1.5</td><td>5.3.3</td>
+<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Servers ---------------><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12322659">Lua</a></td>
+</tr>
+<tr align=center>
+<td align=left><a href="lib/nodejs/README.md">node.js</a></td>
+<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Language Levels -------><td>4.2.6</td><td>6.11.2</td>
+<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Servers ---------------><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12314320">node.js</a></td>
+</tr>
+<tr align=center>
+<td align=left><a href="lib/ocaml/README.md">OCaml</a></td>
+<!-- Build Systems ---------><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Language Levels -------><td>4.02.3</td><td>4.04.0</td>
+<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Servers ---------------><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12313660">OCaml</a></td>
+</tr>
+<tr align=center>
+<td align=left><a href="lib/perl/README.md">Perl</a></td>
+<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Language Levels -------><td>5.18.2</td><td>5.26.0</td>
+<!-- Low-Level Transports --><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Servers ---------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12312312">Perl</a></td>
+</tr>
+<tr align=center>
+<td align=left><a href="lib/php/README.md">PHP</a></td>
+<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Language Levels -------><td>5.5.9</td><td>7.1.8</td>
+<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Servers ---------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12312431">PHP</a></td>
+</tr>
+<tr align=center>
+<td align=left><a href="lib/py/README.md">Python</a></td>
+<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Language Levels -------><td>2.7.6, 3.4.3</td><td>2.7.14, 3.6.3</td>
+<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Transport Wrappers ----><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Servers ---------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12312315">Python</a></td>
+</tr>
+<tr align=center>
+<td align=left><a href="lib/rb/README.md">Ruby</a></td>
+<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Language Levels -------><td>1.9.3p484</td><td>2.3.3p222</td>
+<!-- Low-Level Transports --><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Servers ---------------><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12312316">Ruby</a></td>
+</tr>
+<tr align=center>
+<td align=left><a href="lib/rs/README.md">Rust</a></td>
+<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Language Levels -------><td>1.15.1</td><td>1.18.0</td>
+<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Servers ---------------><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12331420">Rust</a></td>
+</tr>
+<tr align=center>
+<td align=left><a href="lib/st/README.md">Smalltalk</a></td>
+<!-- Build Systems ---------><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Language Levels -------><td colspan=2>unknown</td>
+<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Transport Wrappers ----><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Servers ---------------><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12313861">Smalltalk</a></td>
+</tr>
+</tbody>
+<tfoot>
+<tr>
+<th rowspan=2>Language</th>
+<!-- Build Systems ---------><th>autoconf</th><th>cmake</th>
+<!-- Lang/Lib Levels -------><th>Min</th><th>Max</th>
+<!-- Low-Level Transports --><th><a href="https://en.wikipedia.org/wiki/Unix_domain_socket">Domain</a></th></th><th> File </th><th>Memory</th><th> Pipe </th><th>Socket</th><th> TLS </th>
+<!-- Transport Wrappers ----><th>Framed</th><th> http </th><th> zlib </th>
+<!-- Protocols -------------><th><a href="doc/specs/thrift-binary-protocol.md">Binary</a></th><th><a href="doc/specs/thrift-compact-protocol.md">Compact</a></th><th> JSON </th><th>Multiplex</th>
+<!-- Servers ---------------><th>Forking</th><th>Nonblocking</th><th>Simple</th><th>Threaded</th><th>ThreadPool</th>
+<th rowspan=2>Open Issues</th>
+</tr>
+<tr>
+<th colspan=2 align=center>Build Systems</th>
+<th colspan=2 align=center>Lang/Lib Levels</th>
+<th colspan=6 align=center>Low-Level Transports</th>
+<th colspan=3 align=center>Transport Wrappers</th>
+<th colspan=4 align=center>Protocols</th>
+<th colspan=5 align=center>Servers</th>
+</tr>
+</tfoot>
+</table>
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/Makefile.am
----------------------------------------------------------------------
diff --git a/Makefile.am b/Makefile.am
index 6d47642..4b3157c 100755
--- a/Makefile.am
+++ b/Makefile.am
@@ -43,7 +43,7 @@ dist-hook:
find $(distdir) -type d \( -iname ".svn" -or -iname ".git" \) | xargs rm -rf
print-version:
- @echo $(VERSION)
+ @echo $(PACKAGE_VERSION)
.PHONY: precross cross
precross-%: all
@@ -123,7 +123,7 @@ EXTRA_DIST = \
doap.rdf \
package.json \
sonar-project.properties \
- Dockerfile \
+ LANGUAGES.md \
LICENSE \
CHANGES \
NOTICE \
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/NOTICE
----------------------------------------------------------------------
diff --git a/NOTICE b/NOTICE
index c23995a..902dc8d 100644
--- a/NOTICE
+++ b/NOTICE
@@ -1,5 +1,5 @@
Apache Thrift
-Copyright 2006-2010 The Apache Software Foundation.
+Copyright 2006-2017 The Apache Software Foundation.
This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
\ No newline at end of file
+The Apache Software Foundation (http://www.apache.org/).
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index a55389a..80d77ef 100644
--- a/README.md
+++ b/README.md
@@ -33,15 +33,22 @@ level processing. The code generation system takes a simple definition
language as its input and generates code across programming languages that
uses the abstracted stack to build interoperable RPC clients and servers.
+
+
+Thrift makes it easy for programs written in different programming
+languages to share data and call remote procedures. With support
+for [over 20 programming languages](LANGUAGES.md), chances are Thrift
+supports the ones that you currently use.
+
Thrift is specifically designed to support non-atomic version changes
across client and server code.
For more details on Thrift's design and implementation, take a gander at
-the Thrift whitepaper included in this distribution or at the README.md files
+the Thrift whitepaper included in this distribution or at the README.md file
in your particular subdirectory of interest.
-Hierarchy
-=========
+Project Hierarchy
+=================
thrift/
@@ -60,6 +67,7 @@ thrift/
php/
py/
rb/
+ ...
test/
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/aclocal/ax_check_openssl.m4
----------------------------------------------------------------------
diff --git a/aclocal/ax_check_openssl.m4 b/aclocal/ax_check_openssl.m4
index a87c5a6..28e48cb 100644
--- a/aclocal/ax_check_openssl.m4
+++ b/aclocal/ax_check_openssl.m4
@@ -1,5 +1,5 @@
# ===========================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_check_openssl.html
+# https://www.gnu.org/software/autoconf-archive/ax_check_openssl.html
# ===========================================================================
#
# SYNOPSIS
@@ -32,7 +32,7 @@
# and this notice are preserved. This file is offered as-is, without any
# warranty.
-#serial 8
+#serial 10
AU_ALIAS([CHECK_SSL], [AX_CHECK_OPENSSL])
AC_DEFUN([AX_CHECK_OPENSSL], [
@@ -51,7 +51,7 @@ AC_DEFUN([AX_CHECK_OPENSSL], [
], [
# if pkg-config is installed and openssl has installed a .pc file,
# then use that information and don't search ssldirs
- AC_PATH_PROG([PKG_CONFIG], [pkg-config])
+ AC_CHECK_TOOL([PKG_CONFIG], [pkg-config])
if test x"$PKG_CONFIG" != x""; then
OPENSSL_LDFLAGS=`$PKG_CONFIG openssl --libs-only-L 2>/dev/null`
if test $? = 0; then
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/aclocal/ax_compare_version.m4
----------------------------------------------------------------------
diff --git a/aclocal/ax_compare_version.m4 b/aclocal/ax_compare_version.m4
new file mode 100644
index 0000000..9c8e208
--- /dev/null
+++ b/aclocal/ax_compare_version.m4
@@ -0,0 +1,177 @@
+# ===========================================================================
+# https://www.gnu.org/software/autoconf-archive/ax_compare_version.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_COMPARE_VERSION(VERSION_A, OP, VERSION_B, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
+#
+# DESCRIPTION
+#
+# This macro compares two version strings. Due to the various number of
+# minor-version numbers that can exist, and the fact that string
+# comparisons are not compatible with numeric comparisons, this is not
+# necessarily trivial to do in a autoconf script. This macro makes doing
+# these comparisons easy.
+#
+# The six basic comparisons are available, as well as checking equality
+# limited to a certain number of minor-version levels.
+#
+# The operator OP determines what type of comparison to do, and can be one
+# of:
+#
+# eq - equal (test A == B)
+# ne - not equal (test A != B)
+# le - less than or equal (test A <= B)
+# ge - greater than or equal (test A >= B)
+# lt - less than (test A < B)
+# gt - greater than (test A > B)
+#
+# Additionally, the eq and ne operator can have a number after it to limit
+# the test to that number of minor versions.
+#
+# eq0 - equal up to the length of the shorter version
+# ne0 - not equal up to the length of the shorter version
+# eqN - equal up to N sub-version levels
+# neN - not equal up to N sub-version levels
+#
+# When the condition is true, shell commands ACTION-IF-TRUE are run,
+# otherwise shell commands ACTION-IF-FALSE are run. The environment
+# variable 'ax_compare_version' is always set to either 'true' or 'false'
+# as well.
+#
+# Examples:
+#
+# AX_COMPARE_VERSION([3.15.7],[lt],[3.15.8])
+# AX_COMPARE_VERSION([3.15],[lt],[3.15.8])
+#
+# would both be true.
+#
+# AX_COMPARE_VERSION([3.15.7],[eq],[3.15.8])
+# AX_COMPARE_VERSION([3.15],[gt],[3.15.8])
+#
+# would both be false.
+#
+# AX_COMPARE_VERSION([3.15.7],[eq2],[3.15.8])
+#
+# would be true because it is only comparing two minor versions.
+#
+# AX_COMPARE_VERSION([3.15.7],[eq0],[3.15])
+#
+# would be true because it is only comparing the lesser number of minor
+# versions of the two values.
+#
+# Note: The characters that separate the version numbers do not matter. An
+# empty string is the same as version 0. OP is evaluated by autoconf, not
+# configure, so must be a string, not a variable.
+#
+# The author would like to acknowledge Guido Draheim whose advice about
+# the m4_case and m4_ifvaln functions make this macro only include the
+# portions necessary to perform the specific comparison specified by the
+# OP argument in the final configure script.
+#
+# LICENSE
+#
+# Copyright (c) 2008 Tim Toolan <to...@ele.uri.edu>
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice
+# and this notice are preserved. This file is offered as-is, without any
+# warranty.
+
+#serial 12
+
+dnl #########################################################################
+AC_DEFUN([AX_COMPARE_VERSION], [
+ AC_REQUIRE([AC_PROG_AWK])
+
+ # Used to indicate true or false condition
+ ax_compare_version=false
+
+ # Convert the two version strings to be compared into a format that
+ # allows a simple string comparison. The end result is that a version
+ # string of the form 1.12.5-r617 will be converted to the form
+ # 0001001200050617. In other words, each number is zero padded to four
+ # digits, and non digits are removed.
+ AS_VAR_PUSHDEF([A],[ax_compare_version_A])
+ A=`echo "$1" | sed -e 's/\([[0-9]]*\)/Z\1Z/g' \
+ -e 's/Z\([[0-9]]\)Z/Z0\1Z/g' \
+ -e 's/Z\([[0-9]][[0-9]]\)Z/Z0\1Z/g' \
+ -e 's/Z\([[0-9]][[0-9]][[0-9]]\)Z/Z0\1Z/g' \
+ -e 's/[[^0-9]]//g'`
+
+ AS_VAR_PUSHDEF([B],[ax_compare_version_B])
+ B=`echo "$3" | sed -e 's/\([[0-9]]*\)/Z\1Z/g' \
+ -e 's/Z\([[0-9]]\)Z/Z0\1Z/g' \
+ -e 's/Z\([[0-9]][[0-9]]\)Z/Z0\1Z/g' \
+ -e 's/Z\([[0-9]][[0-9]][[0-9]]\)Z/Z0\1Z/g' \
+ -e 's/[[^0-9]]//g'`
+
+ dnl # In the case of le, ge, lt, and gt, the strings are sorted as necessary
+ dnl # then the first line is used to determine if the condition is true.
+ dnl # The sed right after the echo is to remove any indented white space.
+ m4_case(m4_tolower($2),
+ [lt],[
+ ax_compare_version=`echo "x$A
+x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/false/;s/x${B}/true/;1q"`
+ ],
+ [gt],[
+ ax_compare_version=`echo "x$A
+x$B" | sed 's/^ *//' | sort | sed "s/x${A}/false/;s/x${B}/true/;1q"`
+ ],
+ [le],[
+ ax_compare_version=`echo "x$A
+x$B" | sed 's/^ *//' | sort | sed "s/x${A}/true/;s/x${B}/false/;1q"`
+ ],
+ [ge],[
+ ax_compare_version=`echo "x$A
+x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/true/;s/x${B}/false/;1q"`
+ ],[
+ dnl Split the operator from the subversion count if present.
+ m4_bmatch(m4_substr($2,2),
+ [0],[
+ # A count of zero means use the length of the shorter version.
+ # Determine the number of characters in A and B.
+ ax_compare_version_len_A=`echo "$A" | $AWK '{print(length)}'`
+ ax_compare_version_len_B=`echo "$B" | $AWK '{print(length)}'`
+
+ # Set A to no more than B's length and B to no more than A's length.
+ A=`echo "$A" | sed "s/\(.\{$ax_compare_version_len_B\}\).*/\1/"`
+ B=`echo "$B" | sed "s/\(.\{$ax_compare_version_len_A\}\).*/\1/"`
+ ],
+ [[0-9]+],[
+ # A count greater than zero means use only that many subversions
+ A=`echo "$A" | sed "s/\(\([[0-9]]\{4\}\)\{m4_substr($2,2)\}\).*/\1/"`
+ B=`echo "$B" | sed "s/\(\([[0-9]]\{4\}\)\{m4_substr($2,2)\}\).*/\1/"`
+ ],
+ [.+],[
+ AC_WARNING(
+ [illegal OP numeric parameter: $2])
+ ],[])
+
+ # Pad zeros at end of numbers to make same length.
+ ax_compare_version_tmp_A="$A`echo $B | sed 's/./0/g'`"
+ B="$B`echo $A | sed 's/./0/g'`"
+ A="$ax_compare_version_tmp_A"
+
+ # Check for equality or inequality as necessary.
+ m4_case(m4_tolower(m4_substr($2,0,2)),
+ [eq],[
+ test "x$A" = "x$B" && ax_compare_version=true
+ ],
+ [ne],[
+ test "x$A" != "x$B" && ax_compare_version=true
+ ],[
+ AC_WARNING([illegal OP parameter: $2])
+ ])
+ ])
+
+ AS_VAR_POPDEF([A])dnl
+ AS_VAR_POPDEF([B])dnl
+
+ dnl # Execute ACTION-IF-TRUE / ACTION-IF-FALSE.
+ if test "$ax_compare_version" = "true" ; then
+ m4_ifvaln([$4],[$4],[:])dnl
+ m4_ifvaln([$5],[else $5])dnl
+ fi
+]) dnl AX_COMPARE_VERSION
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/aclocal/ax_lua.m4
----------------------------------------------------------------------
diff --git a/aclocal/ax_lua.m4 b/aclocal/ax_lua.m4
index 9feb352..5920167 100644
--- a/aclocal/ax_lua.m4
+++ b/aclocal/ax_lua.m4
@@ -1,5 +1,5 @@
# ===========================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_lua.html
+# https://www.gnu.org/software/autoconf-archive/ax_lua.html
# ===========================================================================
#
# SYNOPSIS
@@ -166,7 +166,7 @@
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
-# with this program. If not, see <http://www.gnu.org/licenses/>.
+# with this program. If not, see <https://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
@@ -181,7 +181,7 @@
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
-#serial 39
+#serial 40
dnl =========================================================================
dnl AX_PROG_LUA([MINIMUM-VERSION], [TOO-BIG-VERSION],
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/aclocal/ax_prog_dotnetcore_version.m4
----------------------------------------------------------------------
diff --git a/aclocal/ax_prog_dotnetcore_version.m4 b/aclocal/ax_prog_dotnetcore_version.m4
index 45c7a4e..92c7495 100644
--- a/aclocal/ax_prog_dotnetcore_version.m4
+++ b/aclocal/ax_prog_dotnetcore_version.m4
@@ -1,6 +1,6 @@
-# ==============================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_prog_dotnetcore_version.html
-# ==============================================================================
+# ===============================================================================
+# https://www.gnu.org/software/autoconf-archive/ax_prog_dotnetcore_version.html
+# ===============================================================================
#
# SYNOPSIS
#
@@ -33,7 +33,7 @@
# and this notice are preserved. This file is offered as-is, without any
# warranty.
-#serial 1
+#serial 2
AC_DEFUN([AX_PROG_DOTNETCORE_VERSION],[
AC_REQUIRE([AC_PROG_SED])
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/aclocal/ax_prog_haxe_version.m4
----------------------------------------------------------------------
diff --git a/aclocal/ax_prog_haxe_version.m4 b/aclocal/ax_prog_haxe_version.m4
index 3dee430..fcacc67 100644
--- a/aclocal/ax_prog_haxe_version.m4
+++ b/aclocal/ax_prog_haxe_version.m4
@@ -1,5 +1,5 @@
# ===========================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_prog_haxe_version.html
+# https://www.gnu.org/software/autoconf-archive/ax_prog_haxe_version.html
# ===========================================================================
#
# SYNOPSIS
@@ -32,7 +32,7 @@
# and this notice are preserved. This file is offered as-is, without any
# warranty.
-#serial 1
+#serial 2
AC_DEFUN([AX_PROG_HAXE_VERSION],[
AC_REQUIRE([AC_PROG_SED])
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/aclocal/ax_prog_perl_modules.m4
----------------------------------------------------------------------
diff --git a/aclocal/ax_prog_perl_modules.m4 b/aclocal/ax_prog_perl_modules.m4
index 11a326c..70b3230 100644
--- a/aclocal/ax_prog_perl_modules.m4
+++ b/aclocal/ax_prog_perl_modules.m4
@@ -1,5 +1,5 @@
# ===========================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_prog_perl_modules.html
+# https://www.gnu.org/software/autoconf-archive/ax_prog_perl_modules.html
# ===========================================================================
#
# SYNOPSIS
@@ -32,7 +32,7 @@
# and this notice are preserved. This file is offered as-is, without any
# warranty.
-#serial 7
+#serial 8
AU_ALIAS([AC_PROG_PERL_MODULES], [AX_PROG_PERL_MODULES])
AC_DEFUN([AX_PROG_PERL_MODULES],[dnl
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/aclocal/m4_ax_compare_version.m4
----------------------------------------------------------------------
diff --git a/aclocal/m4_ax_compare_version.m4 b/aclocal/m4_ax_compare_version.m4
deleted file mode 100644
index 74dc0fd..0000000
--- a/aclocal/m4_ax_compare_version.m4
+++ /dev/null
@@ -1,177 +0,0 @@
-# ===========================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_compare_version.html
-# ===========================================================================
-#
-# SYNOPSIS
-#
-# AX_COMPARE_VERSION(VERSION_A, OP, VERSION_B, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
-#
-# DESCRIPTION
-#
-# This macro compares two version strings. Due to the various number of
-# minor-version numbers that can exist, and the fact that string
-# comparisons are not compatible with numeric comparisons, this is not
-# necessarily trivial to do in a autoconf script. This macro makes doing
-# these comparisons easy.
-#
-# The six basic comparisons are available, as well as checking equality
-# limited to a certain number of minor-version levels.
-#
-# The operator OP determines what type of comparison to do, and can be one
-# of:
-#
-# eq - equal (test A == B)
-# ne - not equal (test A != B)
-# le - less than or equal (test A <= B)
-# ge - greater than or equal (test A >= B)
-# lt - less than (test A < B)
-# gt - greater than (test A > B)
-#
-# Additionally, the eq and ne operator can have a number after it to limit
-# the test to that number of minor versions.
-#
-# eq0 - equal up to the length of the shorter version
-# ne0 - not equal up to the length of the shorter version
-# eqN - equal up to N sub-version levels
-# neN - not equal up to N sub-version levels
-#
-# When the condition is true, shell commands ACTION-IF-TRUE are run,
-# otherwise shell commands ACTION-IF-FALSE are run. The environment
-# variable 'ax_compare_version' is always set to either 'true' or 'false'
-# as well.
-#
-# Examples:
-#
-# AX_COMPARE_VERSION([3.15.7],[lt],[3.15.8])
-# AX_COMPARE_VERSION([3.15],[lt],[3.15.8])
-#
-# would both be true.
-#
-# AX_COMPARE_VERSION([3.15.7],[eq],[3.15.8])
-# AX_COMPARE_VERSION([3.15],[gt],[3.15.8])
-#
-# would both be false.
-#
-# AX_COMPARE_VERSION([3.15.7],[eq2],[3.15.8])
-#
-# would be true because it is only comparing two minor versions.
-#
-# AX_COMPARE_VERSION([3.15.7],[eq0],[3.15])
-#
-# would be true because it is only comparing the lesser number of minor
-# versions of the two values.
-#
-# Note: The characters that separate the version numbers do not matter. An
-# empty string is the same as version 0. OP is evaluated by autoconf, not
-# configure, so must be a string, not a variable.
-#
-# The author would like to acknowledge Guido Draheim whose advice about
-# the m4_case and m4_ifvaln functions make this macro only include the
-# portions necessary to perform the specific comparison specified by the
-# OP argument in the final configure script.
-#
-# LICENSE
-#
-# Copyright (c) 2008 Tim Toolan <to...@ele.uri.edu>
-#
-# Copying and distribution of this file, with or without modification, are
-# permitted in any medium without royalty provided the copyright notice
-# and this notice are preserved. This file is offered as-is, without any
-# warranty.
-
-#serial 11
-
-dnl #########################################################################
-AC_DEFUN([AX_COMPARE_VERSION], [
- AC_REQUIRE([AC_PROG_AWK])
-
- # Used to indicate true or false condition
- ax_compare_version=false
-
- # Convert the two version strings to be compared into a format that
- # allows a simple string comparison. The end result is that a version
- # string of the form 1.12.5-r617 will be converted to the form
- # 0001001200050617. In other words, each number is zero padded to four
- # digits, and non digits are removed.
- AS_VAR_PUSHDEF([A],[ax_compare_version_A])
- A=`echo "$1" | sed -e 's/\([[0-9]]*\)/Z\1Z/g' \
- -e 's/Z\([[0-9]]\)Z/Z0\1Z/g' \
- -e 's/Z\([[0-9]][[0-9]]\)Z/Z0\1Z/g' \
- -e 's/Z\([[0-9]][[0-9]][[0-9]]\)Z/Z0\1Z/g' \
- -e 's/[[^0-9]]//g'`
-
- AS_VAR_PUSHDEF([B],[ax_compare_version_B])
- B=`echo "$3" | sed -e 's/\([[0-9]]*\)/Z\1Z/g' \
- -e 's/Z\([[0-9]]\)Z/Z0\1Z/g' \
- -e 's/Z\([[0-9]][[0-9]]\)Z/Z0\1Z/g' \
- -e 's/Z\([[0-9]][[0-9]][[0-9]]\)Z/Z0\1Z/g' \
- -e 's/[[^0-9]]//g'`
-
- dnl # In the case of le, ge, lt, and gt, the strings are sorted as necessary
- dnl # then the first line is used to determine if the condition is true.
- dnl # The sed right after the echo is to remove any indented white space.
- m4_case(m4_tolower($2),
- [lt],[
- ax_compare_version=`echo "x$A
-x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/false/;s/x${B}/true/;1q"`
- ],
- [gt],[
- ax_compare_version=`echo "x$A
-x$B" | sed 's/^ *//' | sort | sed "s/x${A}/false/;s/x${B}/true/;1q"`
- ],
- [le],[
- ax_compare_version=`echo "x$A
-x$B" | sed 's/^ *//' | sort | sed "s/x${A}/true/;s/x${B}/false/;1q"`
- ],
- [ge],[
- ax_compare_version=`echo "x$A
-x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/true/;s/x${B}/false/;1q"`
- ],[
- dnl Split the operator from the subversion count if present.
- m4_bmatch(m4_substr($2,2),
- [0],[
- # A count of zero means use the length of the shorter version.
- # Determine the number of characters in A and B.
- ax_compare_version_len_A=`echo "$A" | $AWK '{print(length)}'`
- ax_compare_version_len_B=`echo "$B" | $AWK '{print(length)}'`
-
- # Set A to no more than B's length and B to no more than A's length.
- A=`echo "$A" | sed "s/\(.\{$ax_compare_version_len_B\}\).*/\1/"`
- B=`echo "$B" | sed "s/\(.\{$ax_compare_version_len_A\}\).*/\1/"`
- ],
- [[0-9]+],[
- # A count greater than zero means use only that many subversions
- A=`echo "$A" | sed "s/\(\([[0-9]]\{4\}\)\{m4_substr($2,2)\}\).*/\1/"`
- B=`echo "$B" | sed "s/\(\([[0-9]]\{4\}\)\{m4_substr($2,2)\}\).*/\1/"`
- ],
- [.+],[
- AC_WARNING(
- [illegal OP numeric parameter: $2])
- ],[])
-
- # Pad zeros at end of numbers to make same length.
- ax_compare_version_tmp_A="$A`echo $B | sed 's/./0/g'`"
- B="$B`echo $A | sed 's/./0/g'`"
- A="$ax_compare_version_tmp_A"
-
- # Check for equality or inequality as necessary.
- m4_case(m4_tolower(m4_substr($2,0,2)),
- [eq],[
- test "x$A" = "x$B" && ax_compare_version=true
- ],
- [ne],[
- test "x$A" != "x$B" && ax_compare_version=true
- ],[
- AC_WARNING([illegal OP parameter: $2])
- ])
- ])
-
- AS_VAR_POPDEF([A])dnl
- AS_VAR_POPDEF([B])dnl
-
- dnl # Execute ACTION-IF-TRUE / ACTION-IF-FALSE.
- if test "$ax_compare_version" = "true" ; then
- m4_ifvaln([$4],[$4],[:])dnl
- m4_ifvaln([$5],[else $5])dnl
- fi
-]) dnl AX_COMPARE_VERSION
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/bootstrap.sh
----------------------------------------------------------------------
diff --git a/bootstrap.sh b/bootstrap.sh
index 52ecda4..c7e000c 100755
--- a/bootstrap.sh
+++ b/bootstrap.sh
@@ -46,9 +46,12 @@ if [ "$AUTOMAKE_VERSION" \< "1.13" ]; then
exit 1
fi
+set -e
autoscan
$LIBTOOLIZE --copy --automake
aclocal -I ./aclocal
autoheader
+sed '/undef VERSION/d' config.hin > config.hin2
+mv config.hin2 config.hin
autoconf
automake --copy --add-missing --foreign
[18/50] [abbrv] thrift git commit: THRIFT-4376: fix a few high impact
coverity defects: 1458947: memory leak in compiler 1458787: resource leak in
c_glib led to discovery of assert() abuse 1459090: fix string.find result
check in JSON processor (unlikely
Posted by je...@apache.org.
http://git-wip-us.apache.org/repos/asf/thrift/blob/43f4bf2f/lib/c_glib/test/testtransportsocket.c
----------------------------------------------------------------------
diff --git a/lib/c_glib/test/testtransportsocket.c b/lib/c_glib/test/testtransportsocket.c
index d91507f..8e96375 100755
--- a/lib/c_glib/test/testtransportsocket.c
+++ b/lib/c_glib/test/testtransportsocket.c
@@ -17,7 +17,6 @@
* under the License.
*/
-#include <assert.h>
#include <netdb.h>
#include <sys/wait.h>
@@ -81,7 +80,7 @@ test_create_and_destroy(void)
GObject *object = NULL;
object = g_object_new (THRIFT_TYPE_SOCKET, NULL);
- assert (object != NULL);
+ g_assert (object != NULL);
g_object_get (G_OBJECT(object), "hostname", &hostname, "port", &port, NULL);
g_free (hostname);
@@ -100,9 +99,9 @@ test_open_and_close(void)
"port", 51188, NULL);
transport = THRIFT_TRANSPORT (tsocket);
thrift_socket_open (transport, NULL);
- assert (thrift_socket_is_open (transport) == TRUE);
+ g_assert (thrift_socket_is_open (transport) == TRUE);
thrift_socket_close (transport, NULL);
- assert (thrift_socket_is_open (transport) == FALSE);
+ g_assert (thrift_socket_is_open (transport) == FALSE);
/* test close failure */
tsocket->sd = -1;
@@ -113,7 +112,7 @@ test_open_and_close(void)
tsocket = g_object_new (THRIFT_TYPE_SOCKET, "hostname", "localhost.broken",
NULL);
transport = THRIFT_TRANSPORT (tsocket);
- assert (thrift_socket_open (transport, &err) == FALSE);
+ g_assert (thrift_socket_open (transport, &err) == FALSE);
g_object_unref (tsocket);
g_error_free (err);
err = NULL;
@@ -122,7 +121,7 @@ test_open_and_close(void)
tsocket = g_object_new (THRIFT_TYPE_SOCKET, "hostname", "localhost", NULL);
transport = THRIFT_TRANSPORT (tsocket);
socket_error = 1;
- assert (thrift_socket_open (transport, &err) == FALSE);
+ g_assert (thrift_socket_open (transport, &err) == FALSE);
socket_error = 0;
g_object_unref (tsocket);
g_error_free (err);
@@ -139,7 +138,7 @@ test_read_and_write(void)
guchar buf[10] = TEST_DATA; /* a buffer */
pid = fork ();
- assert ( pid >= 0 );
+ g_assert ( pid >= 0 );
if ( pid == 0 )
{
@@ -153,8 +152,8 @@ test_read_and_write(void)
tsocket = g_object_new (THRIFT_TYPE_SOCKET, "hostname", "localhost",
"port", port, NULL);
transport = THRIFT_TRANSPORT (tsocket);
- assert (thrift_socket_open (transport, NULL) == TRUE);
- assert (thrift_socket_is_open (transport));
+ g_assert (thrift_socket_open (transport, NULL) == TRUE);
+ g_assert (thrift_socket_is_open (transport));
thrift_socket_write (transport, buf, 10, NULL);
/* write fail */
@@ -167,8 +166,8 @@ test_read_and_write(void)
thrift_socket_close (transport, NULL);
g_object_unref (tsocket);
- assert ( wait (&status) == pid );
- assert ( status == 0 );
+ g_assert ( wait (&status) == pid );
+ g_assert ( status == 0 );
}
}
@@ -286,12 +285,12 @@ thrift_socket_server (const int port)
transport = THRIFT_SERVER_TRANSPORT (tsocket);
thrift_server_transport_listen (transport, NULL);
client = thrift_server_transport_accept (transport, NULL);
- assert (client != NULL);
+ g_assert (client != NULL);
/* read 10 bytes */
bytes = thrift_socket_read (client, buf, 10, NULL);
- assert (bytes == 10); /* make sure we've read 10 bytes */
- assert ( memcmp(buf, match, 10) == 0 ); /* make sure what we got matches */
+ g_assert (bytes == 10); /* make sure we've read 10 bytes */
+ g_assert ( memcmp(buf, match, 10) == 0 ); /* make sure what we got matches */
/* failed read */
recv_error = 1;
http://git-wip-us.apache.org/repos/asf/thrift/blob/43f4bf2f/lib/c_glib/test/testtransportsslsocket.c
----------------------------------------------------------------------
diff --git a/lib/c_glib/test/testtransportsslsocket.c b/lib/c_glib/test/testtransportsslsocket.c
index b4688f9..f2f56f8 100644
--- a/lib/c_glib/test/testtransportsslsocket.c
+++ b/lib/c_glib/test/testtransportsslsocket.c
@@ -17,7 +17,6 @@
* under the License.
*/
-#include <assert.h>
#include <netdb.h>
#include <sys/wait.h>
#include <sys/types.h>
@@ -40,33 +39,33 @@ static int socket_error = 0;
int
my_socket(int domain, int type, int protocol)
{
- if (socket_error == 0)
- {
- return socket (domain, type, protocol);
- }
- return -1;
+ if (socket_error == 0)
+ {
+ return socket (domain, type, protocol);
+ }
+ return -1;
}
static int recv_error = 0;
ssize_t
my_recv(int socket, void *buffer, size_t length, int flags)
{
- if (recv_error == 0)
- {
- return recv (socket, buffer, length, flags);
- }
- return -1;
+ if (recv_error == 0)
+ {
+ return recv (socket, buffer, length, flags);
+ }
+ return -1;
}
static int send_error = 0;
ssize_t
my_send(int socket, const void *buffer, size_t length, int flags)
{
- if (send_error == 0)
- {
- return send (socket, buffer, length, flags);
- }
- return -1;
+ if (send_error == 0)
+ {
+ return send (socket, buffer, length, flags);
+ }
+ return -1;
}
#define socket my_socket
@@ -83,71 +82,71 @@ static void thrift_ssl_socket_server (const int port);
static void
test_ssl_create_and_destroy(void)
{
- gchar *hostname = NULL;
- guint port = 0;
-
- GObject *object = NULL;
- object = g_object_new (THRIFT_TYPE_SSL_SOCKET, NULL);
- assert (object != NULL);
- g_object_get (G_OBJECT(object), "hostname", &hostname, "port", &port, NULL);
- g_free (hostname);
- g_object_unref (object);
+ gchar *hostname = NULL;
+ guint port = 0;
+
+ GObject *object = NULL;
+ object = g_object_new (THRIFT_TYPE_SSL_SOCKET, NULL);
+ g_assert (object != NULL);
+ g_object_get (G_OBJECT(object), "hostname", &hostname, "port", &port, NULL);
+ g_free (hostname);
+ g_object_unref (object);
}
static void
test_ssl_create_and_set_properties(void)
{
- gchar *hostname = NULL;
- guint port = 0;
- SSL_CTX* ssl_ctx= NULL;
- GError *error=NULL;
-
- GObject *object = NULL;
- object = thrift_ssl_socket_new(SSLTLS, &error);
- g_object_get (G_OBJECT(object), "hostname", &hostname, "port", &port, "ssl_context", &ssl_ctx, NULL);
- assert (ssl_ctx!=NULL);
-
- g_free (hostname);
- g_object_unref (object);
+ gchar *hostname = NULL;
+ guint port = 0;
+ SSL_CTX* ssl_ctx= NULL;
+ GError *error=NULL;
+
+ GObject *object = NULL;
+ object = thrift_ssl_socket_new(SSLTLS, &error);
+ g_object_get (G_OBJECT(object), "hostname", &hostname, "port", &port, "ssl_context", &ssl_ctx, NULL);
+ g_assert (ssl_ctx!=NULL);
+
+ g_free (hostname);
+ g_object_unref (object);
}
static void
test_ssl_open_and_close(void)
{
- ThriftSSLSocket *tSSLSocket = NULL;
- ThriftTransport *transport = NULL;
- GError *error=NULL;
-
- /* open a connection and close it */
- tSSLSocket = thrift_ssl_socket_new_with_host(SSLTLS, "localhost", 51188, &error);
-
- transport = THRIFT_TRANSPORT (tSSLSocket);
- thrift_ssl_socket_open (transport, NULL);
- assert (thrift_ssl_socket_is_open (transport) == TRUE);
- thrift_ssl_socket_close (transport, NULL);
- assert (thrift_ssl_socket_is_open (transport) == FALSE);
-
- /* test close failure */
- THRIFT_SOCKET(tSSLSocket)->sd = -1;
- thrift_ssl_socket_close (transport, NULL);
- g_object_unref (tSSLSocket);
-
- /* try a hostname lookup failure */
- tSSLSocket = thrift_ssl_socket_new_with_host(SSLTLS, "localhost.broken", 51188, &error);
- transport = THRIFT_TRANSPORT (tSSLSocket);
- assert (thrift_ssl_socket_open (transport, &error) == FALSE);
- g_object_unref (tSSLSocket);
- g_error_free (error);
- error = NULL;
-
- /* try an error call to socket() */
- tSSLSocket = thrift_ssl_socket_new_with_host(SSLTLS, "localhost", 51188, &error);
- transport = THRIFT_TRANSPORT (tSSLSocket);
- socket_error = 1;
- assert (thrift_ssl_socket_open (transport, &error) == FALSE);
- socket_error = 0;
- g_object_unref (tSSLSocket);
- g_error_free (error);
+ ThriftSSLSocket *tSSLSocket = NULL;
+ ThriftTransport *transport = NULL;
+ GError *error=NULL;
+
+ /* open a connection and close it */
+ tSSLSocket = thrift_ssl_socket_new_with_host(SSLTLS, "localhost", 51188, &error);
+
+ transport = THRIFT_TRANSPORT (tSSLSocket);
+ thrift_ssl_socket_open (transport, NULL);
+ g_assert (thrift_ssl_socket_is_open (transport) == TRUE);
+ thrift_ssl_socket_close (transport, NULL);
+ g_assert (thrift_ssl_socket_is_open (transport) == FALSE);
+
+ /* test close failure */
+ THRIFT_SOCKET(tSSLSocket)->sd = -1;
+ thrift_ssl_socket_close (transport, NULL);
+ g_object_unref (tSSLSocket);
+
+ /* try a hostname lookup failure */
+ tSSLSocket = thrift_ssl_socket_new_with_host(SSLTLS, "localhost.broken", 51188, &error);
+ transport = THRIFT_TRANSPORT (tSSLSocket);
+ g_assert (thrift_ssl_socket_open (transport, &error) == FALSE);
+ g_object_unref (tSSLSocket);
+ g_error_free (error);
+ error = NULL;
+
+ /* try an error call to socket() */
+ tSSLSocket = thrift_ssl_socket_new_with_host(SSLTLS, "localhost", 51188, &error);
+ transport = THRIFT_TRANSPORT (tSSLSocket);
+ socket_error = 1;
+ g_assert (thrift_ssl_socket_open (transport, &error) == FALSE);
+ socket_error = 0;
+ g_object_unref (tSSLSocket);
+ g_error_free (error);
}
@@ -157,27 +156,27 @@ test_ssl_open_and_close(void)
*/
unsigned char * get_cn_name(X509_NAME* const name)
{
- int idx = -1;
- unsigned char *utf8 = NULL;
+ int idx = -1;
+ unsigned char *utf8 = NULL;
- do
- {
- if(!name) break; /* failed */
+ do
+ {
+ if(!name) break; /* failed */
- idx = X509_NAME_get_index_by_NID(name, NID_commonName, -1);
- if(!(idx > -1)) break; /* failed */
+ idx = X509_NAME_get_index_by_NID(name, NID_commonName, -1);
+ if(!(idx > -1)) break; /* failed */
- X509_NAME_ENTRY* entry = X509_NAME_get_entry(name, idx);
- if(!entry) break; /* failed */
+ X509_NAME_ENTRY* entry = X509_NAME_get_entry(name, idx);
+ if(!entry) break; /* failed */
- ASN1_STRING* data = X509_NAME_ENTRY_get_data(entry);
- if(!data) break; /* failed */
+ ASN1_STRING* data = X509_NAME_ENTRY_get_data(entry);
+ if(!data) break; /* failed */
- int length = ASN1_STRING_to_UTF8(&utf8, data);
- if(!utf8 || !(length > 0)) break; /* failed */
+ int length = ASN1_STRING_to_UTF8(&utf8, data);
+ if(!utf8 || !(length > 0)) break; /* failed */
- } while (0);
- return utf8;
+ } while (0);
+ return utf8;
}
/*
@@ -185,77 +184,77 @@ unsigned char * get_cn_name(X509_NAME* const name)
*/
void *get_in_addr(struct sockaddr *sa)
{
- if (sa->sa_family == AF_INET)
- return &(((struct sockaddr_in*)sa)->sin_addr);
- return &(((struct sockaddr_in6*)sa)->sin6_addr);
+ if (sa->sa_family == AF_INET)
+ return &(((struct sockaddr_in*)sa)->sin_addr);
+ return &(((struct sockaddr_in6*)sa)->sin6_addr);
}
int verify_ip(char * hostname, struct sockaddr_storage *addr)
{
- struct addrinfo *addr_info,*p;
- struct addrinfo hints;
- int res;
- int retval = 0;
-
-
- memset(&hints, 0, sizeof hints);
- hints.ai_family = AF_UNSPEC; // use AF_INET6 to force IPv6
- hints.ai_socktype = SOCK_STREAM;
-
-
- if ( (res = getaddrinfo(hostname, NULL, &hints, &addr_info) ) != 0)
- {
- // get the host info
- g_error("Cannot get the host address");
- return retval;
- }
- // loop through all the results and connect to the first we can
- char dnshost[INET6_ADDRSTRLEN]; // bigger addr supported IPV6
- char socket_ip[INET6_ADDRSTRLEN];
- if(inet_ntop(addr->ss_family, get_in_addr(addr), socket_ip, INET6_ADDRSTRLEN)==socket_ip){
- g_debug("We are connected to host %s checking against certificate...", socket_ip);
- int sizeip = socket_ip!=NULL ? strlen(socket_ip) : 0;
- for(p = addr_info; p != NULL; p = p->ai_next) {
- if(inet_ntop(p->ai_family, get_in_addr((struct sockaddr *)p->ai_addr), dnshost, INET6_ADDRSTRLEN)==dnshost){
- if(dnshost!=NULL){
- g_info("DNS address [%i -> %s]", p->ai_addr, dnshost);
- if(!strncmp(dnshost, socket_ip, sizeip)){
- retval=1;
- break; // if we get here, we must have connected successfully
- }
- }
- }
- }
- }
-
- if(addr_info)
- freeaddrinfo(addr_info);
-
- return retval;
+ struct addrinfo *addr_info,*p;
+ struct addrinfo hints;
+ int res;
+ int retval = 0;
+
+
+ memset(&hints, 0, sizeof hints);
+ hints.ai_family = AF_UNSPEC; // use AF_INET6 to force IPv6
+ hints.ai_socktype = SOCK_STREAM;
+
+
+ if ( (res = getaddrinfo(hostname, NULL, &hints, &addr_info) ) != 0)
+ {
+ // get the host info
+ g_error("Cannot get the host address");
+ return retval;
+ }
+ // loop through all the results and connect to the first we can
+ char dnshost[INET6_ADDRSTRLEN]; // bigger addr supported IPV6
+ char socket_ip[INET6_ADDRSTRLEN];
+ if(inet_ntop(addr->ss_family, get_in_addr(addr), socket_ip, INET6_ADDRSTRLEN)==socket_ip){
+ g_debug("We are connected to host %s checking against certificate...", socket_ip);
+ int sizeip = socket_ip!=NULL ? strlen(socket_ip) : 0;
+ for(p = addr_info; p != NULL; p = p->ai_next) {
+ if(inet_ntop(p->ai_family, get_in_addr((struct sockaddr *)p->ai_addr), dnshost, INET6_ADDRSTRLEN)==dnshost){
+ if(dnshost!=NULL){
+ g_info("DNS address [%i -> %s]", p->ai_addr, dnshost);
+ if(!strncmp(dnshost, socket_ip, sizeip)){
+ retval=1;
+ break; // if we get here, we must have connected successfully
+ }
+ }
+ }
+ }
+ }
+
+ if(addr_info)
+ freeaddrinfo(addr_info);
+
+ return retval;
}
static void
read_from_file(char *buffer, long size, const char *file_name)
{
- char ch;
- long index=0;
- FILE *fp;
+ char ch;
+ long index=0;
+ FILE *fp;
- fp = fopen(file_name,"r"); // read mode
+ fp = fopen(file_name,"r"); // read mode
- if( fp == NULL )
- {
- perror("Error while opening the file.\n");
- exit(EXIT_FAILURE);
- }
+ if( fp == NULL )
+ {
+ perror("Error while opening the file.\n");
+ exit(EXIT_FAILURE);
+ }
- printf("The contents of %s file are :\n", file_name);
+ printf("The contents of %s file are :\n", file_name);
- while(index<size && ( ch = fgetc(fp) ) != EOF ){
- buffer[index++] = ch;
- }
+ while(index<size && ( ch = fgetc(fp) ) != EOF ){
+ buffer[index++] = ch;
+ }
- fclose(fp);
+ fclose(fp);
}
#define ISSUER_CN_PINNING "The Apache Software Foundation"
@@ -264,98 +263,98 @@ read_from_file(char *buffer, long size, const char *file_name)
gboolean verify_certificate_sn(X509 *cert, const unsigned char *serial_number)
{
- gboolean retval = FALSE;
-
- ASN1_INTEGER *serial = X509_get_serialNumber(cert);
-
- BIGNUM *bn = ASN1_INTEGER_to_BN(serial, NULL);
- if (!bn) {
- fprintf(stderr, "unable to convert ASN1INTEGER to BN\n");
- return EXIT_FAILURE;
- }
- char *tmp = BN_bn2dec(bn);
- if (!tmp) {
- g_warning(stderr, "unable to convert BN to decimal string.\n");
- BN_free(bn);
- return EXIT_FAILURE;
- }
-// if (strlen(tmp) >= len) {
-// g_warn(stderr, "buffer length shorter than serial number\n");
-// BN_free(bn);
-// OPENSSL_free(tmp);
-// return EXIT_FAILURE;
-// }
- if(!strncmp(serial_number, tmp, strlen(serial_number))){
- retval=TRUE;
- }else{
- g_warning("Serial number is not valid");
- }
-
- BN_free(bn);
- OPENSSL_free(tmp);
- return retval;
+ gboolean retval = FALSE;
+
+ ASN1_INTEGER *serial = X509_get_serialNumber(cert);
+
+ BIGNUM *bn = ASN1_INTEGER_to_BN(serial, NULL);
+ if (!bn) {
+ fprintf(stderr, "unable to convert ASN1INTEGER to BN\n");
+ return EXIT_FAILURE;
+ }
+ char *tmp = BN_bn2dec(bn);
+ if (!tmp) {
+ g_warning(stderr, "unable to convert BN to decimal string.\n");
+ BN_free(bn);
+ return EXIT_FAILURE;
+ }
+// if (strlen(tmp) >= len) {
+// g_warn(stderr, "buffer length shorter than serial number\n");
+// BN_free(bn);
+// OPENSSL_free(tmp);
+// return EXIT_FAILURE;
+// }
+ if(!strncmp(serial_number, tmp, strlen(serial_number))){
+ retval=TRUE;
+ }else{
+ g_warning("Serial number is not valid");
+ }
+
+ BN_free(bn);
+ OPENSSL_free(tmp);
+ return retval;
}
gboolean my_access_manager(ThriftTransport * transport, X509 *cert, struct sockaddr_storage *addr, GError **error)
{
- ThriftSSLSocket *sslSocket = THRIFT_SSL_SOCKET (transport);
-
- g_info("Processing access to the server");
- X509_NAME* iname = cert ? X509_get_issuer_name(cert) : NULL;
- X509_NAME* sname = cert ? X509_get_subject_name(cert) : NULL;
-
- /* Issuer is the authority we trust that warrants nothing useful */
- const unsigned char * issuer = get_cn_name(iname);
- if(issuer){
- gboolean valid = TRUE;
- g_info("Issuer (cn) %s", issuer);
-
- // Issuer pinning
- if(strncmp(ISSUER_CN_PINNING, issuer, strlen(ISSUER_CN_PINNING))){
- g_warning("The Issuer of the certificate is not valid");
- valid=FALSE;
- }
- OPENSSL_free(issuer);
- if(!valid)
- return valid;
- }
-
-
- /* Subject is who the certificate is issued to by the authority */
- const unsigned char * subject = get_cn_name(sname);
- if(subject){
- g_info("Subject (cn) %s", subject);
- gboolean valid = TRUE;
-
- // Subject pinning
- if(strncmp(SUBJECT_CN_PINNING, subject, strlen(SUBJECT_CN_PINNING))){
- g_warning("The subject of the certificate is not valid");
- valid=FALSE;
- }
-
- if(!valid)
- return valid;
-
- // Host pinning
- if(verify_ip(subject, addr)){
- g_info("Verified subject");
- }else{
- g_info("Cannot verify subject");
- valid=FALSE;
- }
- OPENSSL_free(subject);
-
- if(!valid)
- return valid;
- }
-
- if(!verify_certificate_sn(cert, CERT_SERIAL_NUMBER)){
- return FALSE;
- }else{
- g_info("Verified serial number");
- }
-
- return TRUE;
+ ThriftSSLSocket *sslSocket = THRIFT_SSL_SOCKET (transport);
+
+ g_info("Processing access to the server");
+ X509_NAME* iname = cert ? X509_get_issuer_name(cert) : NULL;
+ X509_NAME* sname = cert ? X509_get_subject_name(cert) : NULL;
+
+ /* Issuer is the authority we trust that warrants nothing useful */
+ const unsigned char * issuer = get_cn_name(iname);
+ if(issuer){
+ gboolean valid = TRUE;
+ g_info("Issuer (cn) %s", issuer);
+
+ // Issuer pinning
+ if(strncmp(ISSUER_CN_PINNING, issuer, strlen(ISSUER_CN_PINNING))){
+ g_warning("The Issuer of the certificate is not valid");
+ valid=FALSE;
+ }
+ OPENSSL_free(issuer);
+ if(!valid)
+ return valid;
+ }
+
+
+ /* Subject is who the certificate is issued to by the authority */
+ const unsigned char * subject = get_cn_name(sname);
+ if(subject){
+ g_info("Subject (cn) %s", subject);
+ gboolean valid = TRUE;
+
+ // Subject pinning
+ if(strncmp(SUBJECT_CN_PINNING, subject, strlen(SUBJECT_CN_PINNING))){
+ g_warning("The subject of the certificate is not valid");
+ valid=FALSE;
+ }
+
+ if(!valid)
+ return valid;
+
+ // Host pinning
+ if(verify_ip(subject, addr)){
+ g_info("Verified subject");
+ }else{
+ g_info("Cannot verify subject");
+ valid=FALSE;
+ }
+ OPENSSL_free(subject);
+
+ if(!valid)
+ return valid;
+ }
+
+ if(!verify_certificate_sn(cert, CERT_SERIAL_NUMBER)){
+ return FALSE;
+ }else{
+ g_info("Verified serial number");
+ }
+
+ return TRUE;
}
@@ -366,57 +365,57 @@ gboolean my_access_manager(ThriftTransport * transport, X509 *cert, struct socka
static void
test_ssl_authorization_manager(void)
{
- int status=0;
- pid_t pid;
- ThriftSSLSocket *tSSLsocket = NULL;
- ThriftTransport *transport = NULL;
- // int port = 51199;
- int port = 443;
- GError *error=NULL;
-
- guchar buf[17] = TEST_DATA; /* a buffer */
-
- // pid = fork ();
- // assert ( pid >= 0 );
- //
- // if ( pid == 0 )
- // {
- // /* child listens */
- // thrift_ssl_socket_server (port);
- // exit (0);
- // } else {
- /* parent connects, wait a bit for the socket to be created */
- sleep (1);
-
- // Test against level2 owncloud certificate
- tSSLsocket = thrift_ssl_socket_new_with_host(SSLTLS, "localhost", port, &error);
- thrift_ssl_socket_set_manager(tSSLsocket, my_access_manager); // Install pinning manager
- //thrift_ssl_load_cert_from_file(tSSLsocket, "./owncloud.level2crm.pem");
- unsigned char cert_buffer[65534];
- read_from_file(cert_buffer, 65534, "../../keys/client.pem");
- if(!thrift_ssl_load_cert_from_buffer(tSSLsocket, cert_buffer)){
- g_warning("Certificates cannot be loaded!");
- }
-
- transport = THRIFT_TRANSPORT (tSSLsocket);
- assert (thrift_ssl_socket_open (transport, NULL) == TRUE);
- assert (thrift_ssl_socket_is_open (transport));
-
- thrift_ssl_socket_write (transport, buf, 17, NULL);
-
- /* write fail */
- send_error = 1;
- // thrift_ssl_socket_write (transport, buf, 1, NULL);
- // send_error = 0;
-
- // thrift_ssl_socket_write_end (transport, NULL);
- // thrift_ssl_socket_flush (transport, NULL);
- thrift_ssl_socket_close (transport, NULL);
- g_object_unref (tSSLsocket);
-
- // assert ( wait (&status) == pid );
- assert ( status == 0 );
- // }
+ int status=0;
+ pid_t pid;
+ ThriftSSLSocket *tSSLsocket = NULL;
+ ThriftTransport *transport = NULL;
+ // int port = 51199;
+ int port = 443;
+ GError *error=NULL;
+
+ guchar buf[17] = TEST_DATA; /* a buffer */
+
+ // pid = fork ();
+ // g_assert ( pid >= 0 );
+ //
+ // if ( pid == 0 )
+ // {
+ // /* child listens */
+ // thrift_ssl_socket_server (port);
+ // exit (0);
+ // } else {
+ /* parent connects, wait a bit for the socket to be created */
+ sleep (1);
+
+ // Test against level2 owncloud certificate
+ tSSLsocket = thrift_ssl_socket_new_with_host(SSLTLS, "localhost", port, &error);
+ thrift_ssl_socket_set_manager(tSSLsocket, my_access_manager); // Install pinning manager
+ //thrift_ssl_load_cert_from_file(tSSLsocket, "./owncloud.level2crm.pem");
+ unsigned char cert_buffer[65534];
+ read_from_file(cert_buffer, 65534, "../../keys/client.pem");
+ if(!thrift_ssl_load_cert_from_buffer(tSSLsocket, cert_buffer)){
+ g_warning("Certificates cannot be loaded!");
+ }
+
+ transport = THRIFT_TRANSPORT (tSSLsocket);
+ g_assert (thrift_ssl_socket_open (transport, NULL) == TRUE);
+ g_assert (thrift_ssl_socket_is_open (transport));
+
+ thrift_ssl_socket_write (transport, buf, 17, NULL);
+
+ /* write fail */
+ send_error = 1;
+ // thrift_ssl_socket_write (transport, buf, 1, NULL);
+ // send_error = 0;
+
+ // thrift_ssl_socket_write_end (transport, NULL);
+ // thrift_ssl_socket_flush (transport, NULL);
+ thrift_ssl_socket_close (transport, NULL);
+ g_object_unref (tSSLsocket);
+
+ // g_assert ( wait (&status) == pid );
+ g_assert ( status == 0 );
+ // }
}
#endif
@@ -523,59 +522,59 @@ test_ssl_authorization_manager(void)
static void
thrift_ssl_socket_server (const int port)
{
- int bytes = 0;
- ThriftServerTransport *transport = NULL;
- ThriftTransport *client = NULL;
- guchar buf[10]; /* a buffer */
- guchar match[10] = TEST_DATA;
-
- ThriftServerSocket *tsocket = g_object_new (THRIFT_TYPE_SERVER_SOCKET,
- "port", port, NULL);
-
- transport = THRIFT_SERVER_TRANSPORT (tsocket);
- thrift_server_transport_listen (transport, NULL);
- client = thrift_server_transport_accept (transport, NULL);
- assert (client != NULL);
-
- /* read 10 bytes */
- bytes = thrift_ssl_socket_read (client, buf, 10, NULL);
- assert (bytes == 10); /* make sure we've read 10 bytes */
- assert ( memcmp(buf, match, 10) == 0 ); /* make sure what we got matches */
-
- /* failed read */
- recv_error = 1;
- thrift_ssl_socket_read (client, buf, 1, NULL);
- recv_error = 0;
-
- thrift_ssl_socket_read_end (client, NULL);
- thrift_ssl_socket_close (client, NULL);
- g_object_unref (tsocket);
- g_object_unref (client);
+ int bytes = 0;
+ ThriftServerTransport *transport = NULL;
+ ThriftTransport *client = NULL;
+ guchar buf[10]; /* a buffer */
+ guchar match[10] = TEST_DATA;
+
+ ThriftServerSocket *tsocket = g_object_new (THRIFT_TYPE_SERVER_SOCKET,
+ "port", port, NULL);
+
+ transport = THRIFT_SERVER_TRANSPORT (tsocket);
+ thrift_server_transport_listen (transport, NULL);
+ client = thrift_server_transport_accept (transport, NULL);
+ g_assert (client != NULL);
+
+ /* read 10 bytes */
+ bytes = thrift_ssl_socket_read (client, buf, 10, NULL);
+ g_assert (bytes == 10); /* make sure we've read 10 bytes */
+ g_assert ( memcmp(buf, match, 10) == 0 ); /* make sure what we got matches */
+
+ /* failed read */
+ recv_error = 1;
+ thrift_ssl_socket_read (client, buf, 1, NULL);
+ recv_error = 0;
+
+ thrift_ssl_socket_read_end (client, NULL);
+ thrift_ssl_socket_close (client, NULL);
+ g_object_unref (tsocket);
+ g_object_unref (client);
}
int
main(int argc, char *argv[])
{
- int retval;
+ int retval;
#if (!GLIB_CHECK_VERSION (2, 36, 0))
- g_type_init();
+ g_type_init();
#endif
- g_test_init (&argc, &argv, NULL);
+ g_test_init (&argc, &argv, NULL);
- thrift_ssl_socket_initialize_openssl();
+ thrift_ssl_socket_initialize_openssl();
- g_test_add_func ("/testtransportsslsocket/CreateAndDestroy", test_ssl_create_and_destroy);
- g_test_add_func ("/testtransportsslsocket/CreateAndSetProperties", test_ssl_create_and_set_properties);
- g_test_add_func ("/testtransportsslsocket/OpenAndClose", test_ssl_open_and_close);
- // This test is disabled because server is not ready
- // g_test_add_func ("/testtransportsslsocket/AuthorizationManagerPinning", test_ssl_authorization_manager);
- // g_test_add_func ("/testtransportsslsocket/Peek", test_ssl_peek);
+ g_test_add_func ("/testtransportsslsocket/CreateAndDestroy", test_ssl_create_and_destroy);
+ g_test_add_func ("/testtransportsslsocket/CreateAndSetProperties", test_ssl_create_and_set_properties);
+ g_test_add_func ("/testtransportsslsocket/OpenAndClose", test_ssl_open_and_close);
+ // This test is disabled because server is not ready
+ // g_test_add_func ("/testtransportsslsocket/AuthorizationManagerPinning", test_ssl_authorization_manager);
+ // g_test_add_func ("/testtransportsslsocket/Peek", test_ssl_peek);
- retval = g_test_run ();
+ retval = g_test_run ();
- thrift_ssl_socket_finalize_openssl();
+ thrift_ssl_socket_finalize_openssl();
- return retval;
+ return retval;
}
http://git-wip-us.apache.org/repos/asf/thrift/blob/43f4bf2f/lib/cpp/src/thrift/protocol/TJSONProtocol.cpp
----------------------------------------------------------------------
diff --git a/lib/cpp/src/thrift/protocol/TJSONProtocol.cpp b/lib/cpp/src/thrift/protocol/TJSONProtocol.cpp
index bbba260..a49a148 100644
--- a/lib/cpp/src/thrift/protocol/TJSONProtocol.cpp
+++ b/lib/cpp/src/thrift/protocol/TJSONProtocol.cpp
@@ -773,7 +773,7 @@ uint32_t TJSONProtocol::readJSONString(std::string& str, bool skipContext) {
continue;
} else {
size_t pos = kEscapeChars.find(ch);
- if (pos == std::string::npos) {
+ if (pos == kEscapeChars.npos) {
throw TProtocolException(TProtocolException::INVALID_DATA,
"Expected control char, got '" + std::string((const char*)&ch, 1)
+ "'.");
http://git-wip-us.apache.org/repos/asf/thrift/blob/43f4bf2f/test/known_failures_Linux.json
----------------------------------------------------------------------
diff --git a/test/known_failures_Linux.json b/test/known_failures_Linux.json
index d424772..3b835f3 100644
--- a/test/known_failures_Linux.json
+++ b/test/known_failures_Linux.json
@@ -131,6 +131,8 @@
"d-py_json_buffered-ip-ssl",
"d-py_json_framed-ip",
"d-py_json_framed-ip-ssl",
+ "erl-csharp_binary_buffered-ip",
+ "erl-csharp_compact_buffered-ip",
"erl-nodejs_binary_buffered-ip",
"erl-nodejs_compact_buffered-ip",
"erl-rb_binary-accel_buffered-ip",
@@ -167,6 +169,10 @@
"java-d_compact_buffered-ip",
"java-d_compact_buffered-ip-ssl",
"java-d_compact_framed-ip",
+ "rs-csharp_binary_buffered-ip",
+ "rs-csharp_compact_buffered-ip",
+ "rs-csharp_binary_framed-ip",
+ "rs-csharp_compact_framed-ip",
"rs-dart_binary_framed-ip",
"rs-dart_compact_framed-ip"
]
[15/50] [abbrv] thrift git commit: THRIFT-4370: build generated code
before running static code analysis;
fix E722 flake8 issues identified in python code
Posted by je...@apache.org.
THRIFT-4370: build generated code before running static code analysis;
fix E722 flake8 issues identified in python code
This closes #1399
Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/350fe753
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/350fe753
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/350fe753
Branch: refs/heads/0.11.0
Commit: 350fe7531feecf7df5208fa19d25730c6ce0a30d
Parents: 254e86b
Author: James E. King, III <jk...@apache.org>
Authored: Wed Oct 25 09:57:18 2017 -0400
Committer: James E. King, III <jk...@apache.org>
Committed: Thu Oct 26 11:37:02 2017 -0400
----------------------------------------------------------------------
build/docker/scripts/sca.sh | 20 +++++++++++++++++---
lib/py/setup.py | 2 +-
test/features/container_limit.py | 2 +-
test/features/string_limit.py | 2 +-
test/py/TestServer.py | 4 ++--
test/py/TestSocket.py | 6 +++---
6 files changed, 25 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/thrift/blob/350fe753/build/docker/scripts/sca.sh
----------------------------------------------------------------------
diff --git a/build/docker/scripts/sca.sh b/build/docker/scripts/sca.sh
index 2f2fb68..38803d4 100755
--- a/build/docker/scripts/sca.sh
+++ b/build/docker/scripts/sca.sh
@@ -2,6 +2,18 @@
set -ev
#
+# Generate thrift files so the static code analysis includes an analysis
+# of the files the thrift compiler spits out. If running interactively
+# set the NOBUILD environment variable to skip the boot/config/make phase.
+#
+
+if [[ -z "$NOBUILD" ]]; then
+ ./bootstrap.sh
+ ./configure --enable-tutorial=no
+ make -j3 precross
+fi
+
+#
# C/C++ static code analysis with cppcheck
# add --error-exitcode=1 to --enable=all as soon as everything is fixed
#
@@ -21,18 +33,20 @@ cppcheck --force --quiet --inline-suppr --enable=all -j2 lib/cpp/src lib/cpp/tes
cppcheck --force --quiet --inline-suppr --enable=all -j2 lib/c_glib/src lib/c_glib/test test/c_glib/src tutorial/c_glib
# Silent error checks
-cppcheck --force --quiet --inline-suppr --error-exitcode=1 -j2 compiler/cpp/src
+# See THRIFT-4371 : flex generated code triggers "possible null pointer dereference" in yy_init_buffer
+cppcheck --force --quiet --inline-suppr --suppress="*:thrift/thriftl.cc" --error-exitcode=1 -j2 compiler/cpp/src
cppcheck --force --quiet --inline-suppr --error-exitcode=1 -j2 lib/cpp/src lib/cpp/test test/cpp tutorial/cpp
cppcheck --force --quiet --inline-suppr --error-exitcode=1 -j2 lib/c_glib/src lib/c_glib/test test/c_glib/src tutorial/c_glib
# Python code style
flake8 --ignore=E501 lib/py
flake8 tutorial/py
-flake8 --ignore=E501 test/py
+# THRIFT-4371 : generated files are excluded because they haven't been scrubbed yet
+flake8 --ignore=E501 --exclude="*/gen-py*/*" test/py
flake8 test/py.twisted
flake8 test/py.tornado
flake8 --ignore=E501 test/test.py
-flake8 --ignore=E501 test/crossrunner
+flake8 --ignore=E501,E722 test/crossrunner
flake8 test/features
# TODO etc
http://git-wip-us.apache.org/repos/asf/thrift/blob/350fe753/lib/py/setup.py
----------------------------------------------------------------------
diff --git a/lib/py/setup.py b/lib/py/setup.py
index 3d14118..4056b9b 100644
--- a/lib/py/setup.py
+++ b/lib/py/setup.py
@@ -22,7 +22,7 @@
import sys
try:
from setuptools import setup, Extension
-except:
+except Exception:
from distutils.core import setup, Extension
from distutils.command.build_ext import build_ext
http://git-wip-us.apache.org/repos/asf/thrift/blob/350fe753/test/features/container_limit.py
----------------------------------------------------------------------
diff --git a/test/features/container_limit.py b/test/features/container_limit.py
index a16e364..88f8487 100644
--- a/test/features/container_limit.py
+++ b/test/features/container_limit.py
@@ -61,7 +61,7 @@ def main(argv):
print('[OK]: just limit')
try:
test_list(proto, list(range(args.limit + 1)))
- except:
+ except Exception:
print('[OK]: limit + 1')
else:
print('[ERROR]: limit + 1')
http://git-wip-us.apache.org/repos/asf/thrift/blob/350fe753/test/features/string_limit.py
----------------------------------------------------------------------
diff --git a/test/features/string_limit.py b/test/features/string_limit.py
index 14f57d0..b8991d6 100644
--- a/test/features/string_limit.py
+++ b/test/features/string_limit.py
@@ -51,7 +51,7 @@ def main(argv):
print('[OK]: just limit')
try:
test_string(proto, 'a' * (args.limit + 1))
- except:
+ except Exception:
print('[OK]: limit + 1')
else:
print('[ERROR]: limit + 1')
http://git-wip-us.apache.org/repos/asf/thrift/blob/350fe753/test/py/TestServer.py
----------------------------------------------------------------------
diff --git a/test/py/TestServer.py b/test/py/TestServer.py
index a7366a8..04ad62a 100755
--- a/test/py/TestServer.py
+++ b/test/py/TestServer.py
@@ -193,7 +193,7 @@ def main(options):
try:
pfactory.string_length_limit = options.string_limit
pfactory.container_length_limit = options.container_limit
- except:
+ except Exception:
# Ignore errors for those protocols that does not support length limit
pass
@@ -255,7 +255,7 @@ def main(options):
logging.info('Requesting server to stop()')
try:
server.stop()
- except:
+ except Exception:
pass
signal.signal(signal.SIGALRM, clean_shutdown)
signal.alarm(4)
http://git-wip-us.apache.org/repos/asf/thrift/blob/350fe753/test/py/TestSocket.py
----------------------------------------------------------------------
diff --git a/test/py/TestSocket.py b/test/py/TestSocket.py
index ae3160f..619eb10 100755
--- a/test/py/TestSocket.py
+++ b/test/py/TestSocket.py
@@ -36,7 +36,7 @@ class TimeoutTest(unittest.TestCase):
self.listen_sock.bind(('localhost', self.port))
self.listen_sock.listen(5)
break
- except:
+ except Exception:
if i == 49:
raise
@@ -50,7 +50,7 @@ class TimeoutTest(unittest.TestCase):
socket.setTimeout(10)
socket.open()
leaky.append(socket)
- except:
+ except Exception:
self.assert_(time.time() - starttime < 5.0)
def testWriteTimeout(self):
@@ -64,7 +64,7 @@ class TimeoutTest(unittest.TestCase):
while True:
lsock.write("hi" * 100)
- except:
+ except Exception:
self.assert_(time.time() - starttime < 5.0)
[48/50] [abbrv] thrift git commit: THRIFT-4396 inconsistent (or plain
wrong) version numbers in master/trunk Client: (multiple) Patch: Jens Geyer
Posted by je...@apache.org.
THRIFT-4396 inconsistent (or plain wrong) version numbers in master/trunk
Client: (multiple)
Patch: Jens Geyer
This closes #1422
Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/21474661
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/21474661
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/21474661
Branch: refs/heads/0.11.0
Commit: 214746619a6e44d8b3cc7394f3303e7bdf78c442
Parents: 026c9d0
Author: Jens Geyer <je...@apache.org>
Authored: Wed Nov 29 22:54:49 2017 +0100
Committer: Jens Geyer <je...@apache.org>
Committed: Thu Nov 30 20:46:39 2017 +0100
----------------------------------------------------------------------
composer.json | 2 +-
contrib/thrift.spec | 2 +-
doap.rdf | 8 ++++++++
lib/csharp/ThriftMSBuildTask/Properties/AssemblyInfo.cs | 4 ++--
lib/haxe/haxelib.json | 2 +-
5 files changed, 13 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/thrift/blob/21474661/composer.json
----------------------------------------------------------------------
diff --git a/composer.json b/composer.json
index 0f22b76..ad71f91 100644
--- a/composer.json
+++ b/composer.json
@@ -24,7 +24,7 @@
"minimum-stability": "dev",
"extra": {
"branch-alias": {
- "dev-master": "1.0.x-dev"
+ "dev-master": "1.0.0-dev"
}
}
}
http://git-wip-us.apache.org/repos/asf/thrift/blob/21474661/contrib/thrift.spec
----------------------------------------------------------------------
diff --git a/contrib/thrift.spec b/contrib/thrift.spec
index 93f000c..034ebc8 100644
--- a/contrib/thrift.spec
+++ b/contrib/thrift.spec
@@ -28,7 +28,7 @@ Name: thrift
License: Apache License v2.0
Group: Development
Summary: RPC and serialization framework
-Version: 0.9.1
+Version: 0.11.0
Release: 0
URL: http://thrift.apache.org
Packager: Thrift Developers <de...@thrift.apache.org>
http://git-wip-us.apache.org/repos/asf/thrift/blob/21474661/doap.rdf
----------------------------------------------------------------------
diff --git a/doap.rdf b/doap.rdf
index ac8d785..75274aa 100755
--- a/doap.rdf
+++ b/doap.rdf
@@ -38,10 +38,12 @@
<programming-language>C++</programming-language>
<programming-language>Cocoa</programming-language>
<programming-language>D</programming-language>
+ <programming-language>Dart</programming-language>
<programming-language>Delphi</programming-language>
<programming-language>Erlang</programming-language>
<programming-language>Go</programming-language>
<programming-language>Haskell</programming-language>
+ <programming-language>Haxe</programming-language>
<programming-language>Java</programming-language>
<programming-language>JavaScript</programming-language>
<programming-language>node.js</programming-language>
@@ -49,6 +51,7 @@
<programming-language>Perl</programming-language>
<programming-language>PHP</programming-language>
<programming-language>Python</programming-language>
+ <programming-language>Rust</programming-language>
<programming-language>SmallTalk</programming-language>
<category rdf:resource="http://projects.apache.org/category/http" />
<category rdf:resource="http://projects.apache.org/category/library" />
@@ -57,6 +60,11 @@
<release rdf:parseType="Collection">
<Version>
<name>Apache Thrift</name>
+ <created>2017-03-01</created>
+ <revision>0.10.0</revision>
+ </Version>
+ <Version>
+ <name>Apache Thrift</name>
<created>2015-09-25</created>
<revision>0.9.3</revision>
</Version>
http://git-wip-us.apache.org/repos/asf/thrift/blob/21474661/lib/csharp/ThriftMSBuildTask/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/lib/csharp/ThriftMSBuildTask/Properties/AssemblyInfo.cs b/lib/csharp/ThriftMSBuildTask/Properties/AssemblyInfo.cs
index 2e08e66..974cf27 100644
--- a/lib/csharp/ThriftMSBuildTask/Properties/AssemblyInfo.cs
+++ b/lib/csharp/ThriftMSBuildTask/Properties/AssemblyInfo.cs
@@ -56,5 +56,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("0.9.0.*")]
-[assembly: AssemblyFileVersion("0.9.0.*")]
+[assembly: AssemblyVersion("0.11.0.*")]
+[assembly: AssemblyFileVersion("0.11.0.*")]
http://git-wip-us.apache.org/repos/asf/thrift/blob/21474661/lib/haxe/haxelib.json
----------------------------------------------------------------------
diff --git a/lib/haxe/haxelib.json b/lib/haxe/haxelib.json
index 9f31884..f76990e 100644
--- a/lib/haxe/haxelib.json
+++ b/lib/haxe/haxelib.json
@@ -4,7 +4,7 @@
"license": "Apache",
"tags": ["thrift", "rpc", "serialization", "cross", "framework"],
"description": "Haxe bindings for the Apache Thrift RPC and serialization framework",
- "version": "1.0.0-alpha.160215",
+ "version": "1.0.0-dev",
"releasenote": "Licensed under Apache License, Version 2.0. The Apache Thrift compiler needs to be installed separately.",
"contributors": ["Apache Software Foundation (ASF)"],
"dependencies": { },
[46/50] [abbrv] thrift git commit: THRIFT-3657 D TFileWriterTransport
close should use non-priority send Client: D
Posted by je...@apache.org.
THRIFT-3657 D TFileWriterTransport close should use non-priority send
Client: D
This closes #884
This closes #1427
Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/1541f0a7
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/1541f0a7
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/1541f0a7
Branch: refs/heads/0.11.0
Commit: 1541f0a74d6b1f85b9658f8f65a46ed19b57f657
Parents: af56286
Author: Nobuaki Sukegawa <ns...@apache.org>
Authored: Mon Feb 22 02:16:30 2016 +0900
Committer: James E. King, III <jk...@apache.org>
Committed: Thu Nov 30 12:41:35 2017 -0500
----------------------------------------------------------------------
lib/d/src/thrift/transport/file.d | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/thrift/blob/1541f0a7/lib/d/src/thrift/transport/file.d
----------------------------------------------------------------------
diff --git a/lib/d/src/thrift/transport/file.d b/lib/d/src/thrift/transport/file.d
index 04d34ac..aac7289 100644
--- a/lib/d/src/thrift/transport/file.d
+++ b/lib/d/src/thrift/transport/file.d
@@ -637,7 +637,7 @@ final class TFileWriterTransport : TBaseTransport {
override void close() {
if (!isOpen) return;
- prioritySend(writerThread_, ShutdownMessage(), thisTid); // FIXME: Should use normal send here.
+ send(writerThread_, ShutdownMessage(), thisTid);
receive((ShutdownMessage msg, Tid tid){});
isOpen_ = false;
}
[02/50] [abbrv] thrift git commit: THRIFT-4351: use travis build
stages to optimize build, avoiding duplicate rebuilds of the same image,
and also allow personal docker hub repositories for private fork builds to be
optimized. Move ubsan build to artful
Posted by je...@apache.org.
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/tutorial/hs/LICENSE
----------------------------------------------------------------------
diff --git a/tutorial/hs/LICENSE b/tutorial/hs/LICENSE
new file mode 100644
index 0000000..3b6d7d7
--- /dev/null
+++ b/tutorial/hs/LICENSE
@@ -0,0 +1,239 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+--------------------------------------------------
+SOFTWARE DISTRIBUTED WITH THRIFT:
+
+The Apache Thrift software includes a number of subcomponents with
+separate copyright notices and license terms. Your use of the source
+code for the these subcomponents is subject to the terms and
+conditions of the following licenses.
+
+--------------------------------------------------
+Portions of the following files are licensed under the MIT License:
+
+ lib/erl/src/Makefile.am
+
+Please see doc/otp-base-license.txt for the full terms of this license.
+
+--------------------------------------------------
+For the aclocal/ax_boost_base.m4 and contrib/fb303/aclocal/ax_boost_base.m4 components:
+
+# Copyright (c) 2007 Thomas Porschberg <th...@randspringer.de>
+#
+# Copying and distribution of this file, with or without
+# modification, are permitted in any medium without royalty provided
+# the copyright notice and this notice are preserved.
+
+--------------------------------------------------
+For the lib/nodejs/lib/thrift/json_parse.js:
+
+/*
+ json_parse.js
+ 2015-05-02
+ Public Domain.
+ NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
+
+*/
+(By Douglas Crockford <do...@crockford.com>)
+--------------------------------------------------
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/tutorial/hs/Makefile.am
----------------------------------------------------------------------
diff --git a/tutorial/hs/Makefile.am b/tutorial/hs/Makefile.am
index f274eb6..a3eccc2 100755
--- a/tutorial/hs/Makefile.am
+++ b/tutorial/hs/Makefile.am
@@ -37,3 +37,6 @@ tutorialserver: all
tutorialclient: all
dist/build/HaskellClient/HaskellClient
+
+EXTRA_DIST = \
+ LICENSE
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/tutorial/hs/ThriftTutorial.cabal
----------------------------------------------------------------------
diff --git a/tutorial/hs/ThriftTutorial.cabal b/tutorial/hs/ThriftTutorial.cabal
index e6f0182..88f1379 100755
--- a/tutorial/hs/ThriftTutorial.cabal
+++ b/tutorial/hs/ThriftTutorial.cabal
@@ -27,7 +27,7 @@ Synopsis: Thrift Tutorial library package
Homepage: http://thrift.apache.org
Bug-Reports: https://issues.apache.org/jira/browse/THRIFT
Maintainer: dev@thrift.apache.org
-License-File: ../../LICENSE
+License-File: LICENSE
Description:
Haskell tutorial for the Apache Thrift RPC system. Requires the use of the thrift code generator.
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/tutorial/py/PythonClient.py
----------------------------------------------------------------------
diff --git a/tutorial/py/PythonClient.py b/tutorial/py/PythonClient.py
index c659716..a6c1966 100755
--- a/tutorial/py/PythonClient.py
+++ b/tutorial/py/PythonClient.py
@@ -81,6 +81,7 @@ def main():
# Close!
transport.close()
+
if __name__ == '__main__':
try:
main()
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/tutorial/py/PythonServer.py
----------------------------------------------------------------------
diff --git a/tutorial/py/PythonServer.py b/tutorial/py/PythonServer.py
index 7c590ba..e6421ef 100755
--- a/tutorial/py/PythonServer.py
+++ b/tutorial/py/PythonServer.py
@@ -82,6 +82,7 @@ class CalculatorHandler:
def zip(self):
print('zip()')
+
if __name__ == '__main__':
handler = CalculatorHandler()
processor = Calculator.Processor(handler)
[21/50] [abbrv] thrift git commit: THRIFT-2998: Set Content-Type for
HTTP request in Node.js wrapper. Client: nodejs
Posted by je...@apache.org.
THRIFT-2998: Set Content-Type for HTTP request in Node.js wrapper.
Client: nodejs
This closes #378
Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/5a4f7382
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/5a4f7382
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/5a4f7382
Branch: refs/heads/0.11.0
Commit: 5a4f7382d2c37231693890be11c6faaec495194a
Parents: 43f4bf2
Author: stanevt <tr...@autodesk.com>
Authored: Fri Feb 13 10:45:59 2015 -0500
Committer: James E. King, III <jk...@apache.org>
Committed: Sat Oct 28 17:54:17 2017 -0400
----------------------------------------------------------------------
lib/nodejs/lib/thrift/http_connection.js | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/thrift/blob/5a4f7382/lib/nodejs/lib/thrift/http_connection.js
----------------------------------------------------------------------
diff --git a/lib/nodejs/lib/thrift/http_connection.js b/lib/nodejs/lib/thrift/http_connection.js
index 163e5b7..5085538 100644
--- a/lib/nodejs/lib/thrift/http_connection.js
+++ b/lib/nodejs/lib/thrift/http_connection.js
@@ -214,10 +214,13 @@ util.inherits(HttpConnection, EventEmitter);
*/
HttpConnection.prototype.write = function(data) {
var self = this;
- self.nodeOptions.headers["Content-length"] = data.length;
+ var opts = self.nodeOptions;
+ opts.headers["Content-length"] = data.length;
+ if (!opts.headers["Content-Type"])
+ opts.headers["Content-Type"] = "application/x-thrift";
var req = (self.https) ?
- https.request(self.nodeOptions, self.responseCallback) :
- http.request(self.nodeOptions, self.responseCallback);
+ https.request(opts, self.responseCallback) :
+ http.request(opts, self.responseCallback);
req.on('error', function(err) {
self.emit("error", err);
});
[20/50] [abbrv] thrift git commit: THRIFT-4376: fix a few high impact
coverity defects: 1458947: memory leak in compiler 1458787: resource leak in
c_glib led to discovery of assert() abuse 1459090: fix string.find result
check in JSON processor (unlikely
Posted by je...@apache.org.
THRIFT-4376: fix a few high impact coverity defects:
1458947: memory leak in compiler
1458787: resource leak in c_glib led to discovery of assert() abuse
1459090: fix string.find result check in JSON processor (unlikely)
This closes #1404
Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/43f4bf2f
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/43f4bf2f
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/43f4bf2f
Branch: refs/heads/0.11.0
Commit: 43f4bf2fdd13c7466e3fea690d436c6a9540f303
Parents: d4df917
Author: James E. King, III <jk...@apache.org>
Authored: Sat Oct 28 12:54:02 2017 -0400
Committer: James E. King, III <jk...@apache.org>
Committed: Sat Oct 28 16:44:09 2017 -0400
----------------------------------------------------------------------
compiler/cpp/src/thrift/parse/t_function.h | 15 +-
.../protocol/thrift_multiplexed_protocol.c | 1 -
.../c_glib/protocol/thrift_protocol_decorator.c | 6 +-
.../transport/thrift_buffered_transport.c | 3 +-
.../c_glib/transport/thrift_framed_transport.c | 3 +-
.../c_glib/transport/thrift_memory_buffer.c | 1 -
lib/c_glib/test/testbinaryprotocol.c | 287 ++++-----
lib/c_glib/test/testbufferedtransport.c | 49 +-
lib/c_glib/test/testcompactprotocol.c | 643 +++++++++---------
lib/c_glib/test/testdebugproto.c | 9 +-
lib/c_glib/test/testfdtransport.c | 57 +-
lib/c_glib/test/testframedtransport.c | 27 +-
lib/c_glib/test/testmemorybuffer.c | 53 +-
lib/c_glib/test/testoptionalrequired.c | 31 +-
lib/c_glib/test/testsimpleserver.c | 7 +-
lib/c_glib/test/teststruct.c | 3 +-
lib/c_glib/test/testthrifttest.c | 9 +-
lib/c_glib/test/testtransportsocket.c | 27 +-
lib/c_glib/test/testtransportsslsocket.c | 645 +++++++++----------
lib/cpp/src/thrift/protocol/TJSONProtocol.cpp | 2 +-
test/known_failures_Linux.json | 6 +
21 files changed, 941 insertions(+), 943 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/thrift/blob/43f4bf2f/compiler/cpp/src/thrift/parse/t_function.h
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/thrift/parse/t_function.h b/compiler/cpp/src/thrift/parse/t_function.h
index 05dc930..22d2609 100644
--- a/compiler/cpp/src/thrift/parse/t_function.h
+++ b/compiler/cpp/src/thrift/parse/t_function.h
@@ -34,8 +34,12 @@
class t_function : public t_doc {
public:
t_function(t_type* returntype, std::string name, t_struct* arglist, bool oneway = false)
- : returntype_(returntype), name_(name), arglist_(arglist), oneway_(oneway) {
- xceptions_ = new t_struct(NULL);
+ : returntype_(returntype),
+ name_(name),
+ arglist_(arglist),
+ xceptions_(new t_struct(NULL)),
+ own_xceptions_(true),
+ oneway_(oneway) {
if (oneway_ && (!returntype_->is_void())) {
pwarning(1, "Oneway methods should return void.\n");
}
@@ -50,6 +54,7 @@ public:
name_(name),
arglist_(arglist),
xceptions_(xceptions),
+ own_xceptions_(false),
oneway_(oneway) {
if (oneway_ && !xceptions_->get_members().empty()) {
throw std::string("Oneway methods can't throw exceptions.");
@@ -59,7 +64,10 @@ public:
}
}
- ~t_function() {}
+ ~t_function() {
+ if (own_xceptions_)
+ delete xceptions_;
+ }
t_type* get_returntype() const { return returntype_; }
@@ -78,6 +86,7 @@ private:
std::string name_;
t_struct* arglist_;
t_struct* xceptions_;
+ bool own_xceptions_;
bool oneway_;
};
http://git-wip-us.apache.org/repos/asf/thrift/blob/43f4bf2f/lib/c_glib/src/thrift/c_glib/protocol/thrift_multiplexed_protocol.c
----------------------------------------------------------------------
diff --git a/lib/c_glib/src/thrift/c_glib/protocol/thrift_multiplexed_protocol.c b/lib/c_glib/src/thrift/c_glib/protocol/thrift_multiplexed_protocol.c
index dec4dbd..c74f048 100644
--- a/lib/c_glib/src/thrift/c_glib/protocol/thrift_multiplexed_protocol.c
+++ b/lib/c_glib/src/thrift/c_glib/protocol/thrift_multiplexed_protocol.c
@@ -50,7 +50,6 @@ thrift_multiplexed_protocol_write_message_begin (ThriftMultiplexedProtocol *prot
ThriftMultiplexedProtocol *self = THRIFT_MULTIPLEXED_PROTOCOL (protocol);
ThriftMultiplexedProtocolClass *multiplexClass = THRIFT_MULTIPLEXED_PROTOCOL_GET_CLASS(self);
- ThriftProtocolClass *cls = THRIFT_PROTOCOL_CLASS (multiplexClass);
if( (message_type == T_CALL || message_type == T_ONEWAY) && self->service_name != NULL) {
service_name = g_strdup_printf("%s%s%s", self->service_name, THRIFT_MULTIPLEXED_PROTOCOL_DEFAULT_SEPARATOR, name);
http://git-wip-us.apache.org/repos/asf/thrift/blob/43f4bf2f/lib/c_glib/src/thrift/c_glib/protocol/thrift_protocol_decorator.c
----------------------------------------------------------------------
diff --git a/lib/c_glib/src/thrift/c_glib/protocol/thrift_protocol_decorator.c b/lib/c_glib/src/thrift/c_glib/protocol/thrift_protocol_decorator.c
index 4480315..1feec34 100644
--- a/lib/c_glib/src/thrift/c_glib/protocol/thrift_protocol_decorator.c
+++ b/lib/c_glib/src/thrift/c_glib/protocol/thrift_protocol_decorator.c
@@ -52,7 +52,7 @@ thrift_protocol_decorator_write_message_begin (ThriftProtocol *protocol,
ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR (protocol);
ThriftProtocolClass *proto = THRIFT_PROTOCOL_GET_CLASS (self->concrete_protocol);
- g_debug("Concrete protocol %p | %p", self->concrete_protocol, proto);
+ g_debug("Concrete protocol %p | %p", (void *)self->concrete_protocol, (void *)proto);
return proto->write_message_begin (self->concrete_protocol, name,
message_type, seqid,
@@ -492,7 +492,7 @@ thrift_protocol_decorator_set_property (GObject *object,
{
case PROP_THRIFT_TYPE_PROTOCOL_DECORATOR_CONCRETE_PROTOCOL:
self->concrete_protocol = g_value_dup_object (value);
- g_debug("Setting concrete protocol %p to %p in %s", self, self->concrete_protocol, g_type_name(G_TYPE_FROM_INSTANCE(object)));
+ g_debug("Setting concrete protocol %p to %p in %s", (void *)self, (void *)self->concrete_protocol, g_type_name(G_TYPE_FROM_INSTANCE(object)));
break;
default:
@@ -534,7 +534,7 @@ thrift_protocol_decorator_get_concrete_protocol(ThriftProtocolDecorator *protoco
return NULL;
}
ThriftProtocolDecorator *self = THRIFT_PROTOCOL_DECORATOR(protocol);
- g_debug("Getting concrete protocol from %X -> %X", self, self->concrete_protocol);
+ g_debug("Getting concrete protocol from %p -> %p", (void *)self, (void *)self->concrete_protocol);
return retval;
}
http://git-wip-us.apache.org/repos/asf/thrift/blob/43f4bf2f/lib/c_glib/src/thrift/c_glib/transport/thrift_buffered_transport.c
----------------------------------------------------------------------
diff --git a/lib/c_glib/src/thrift/c_glib/transport/thrift_buffered_transport.c b/lib/c_glib/src/thrift/c_glib/transport/thrift_buffered_transport.c
index ede28cf..0ab3e93 100644
--- a/lib/c_glib/src/thrift/c_glib/transport/thrift_buffered_transport.c
+++ b/lib/c_glib/src/thrift/c_glib/transport/thrift_buffered_transport.c
@@ -17,7 +17,6 @@
* under the License.
*/
-#include <assert.h>
#include <netdb.h>
#include <stdlib.h>
#include <stdio.h>
@@ -84,7 +83,7 @@ thrift_buffered_transport_read_slow (ThriftTransport *transport, gpointer buf,
guint32 have = t->r_buf->len;
/* we shouldn't hit this unless the buffer doesn't have enough to read */
- assert (t->r_buf->len < want);
+ g_assert (t->r_buf->len < want);
/* first copy what we have in our buffer. */
if (have > 0)
http://git-wip-us.apache.org/repos/asf/thrift/blob/43f4bf2f/lib/c_glib/src/thrift/c_glib/transport/thrift_framed_transport.c
----------------------------------------------------------------------
diff --git a/lib/c_glib/src/thrift/c_glib/transport/thrift_framed_transport.c b/lib/c_glib/src/thrift/c_glib/transport/thrift_framed_transport.c
index 4c8b71f..c548246 100644
--- a/lib/c_glib/src/thrift/c_glib/transport/thrift_framed_transport.c
+++ b/lib/c_glib/src/thrift/c_glib/transport/thrift_framed_transport.c
@@ -17,7 +17,6 @@
* under the License.
*/
-#include <assert.h>
#include <netdb.h>
#include <stdlib.h>
#include <stdio.h>
@@ -120,7 +119,7 @@ thrift_framed_transport_read_slow (ThriftTransport *transport, gpointer buf,
gint32 result = -1;
/* we shouldn't hit this unless the buffer doesn't have enough to read */
- assert (t->r_buf->len < want);
+ g_assert (t->r_buf->len < want);
/* first copy what we have in our buffer, if there is anything left */
if (have > 0)
http://git-wip-us.apache.org/repos/asf/thrift/blob/43f4bf2f/lib/c_glib/src/thrift/c_glib/transport/thrift_memory_buffer.c
----------------------------------------------------------------------
diff --git a/lib/c_glib/src/thrift/c_glib/transport/thrift_memory_buffer.c b/lib/c_glib/src/thrift/c_glib/transport/thrift_memory_buffer.c
index b96db35..91818e9 100644
--- a/lib/c_glib/src/thrift/c_glib/transport/thrift_memory_buffer.c
+++ b/lib/c_glib/src/thrift/c_glib/transport/thrift_memory_buffer.c
@@ -17,7 +17,6 @@
* under the License.
*/
-#include <assert.h>
#include <netdb.h>
#include <stdlib.h>
#include <stdio.h>
http://git-wip-us.apache.org/repos/asf/thrift/blob/43f4bf2f/lib/c_glib/test/testbinaryprotocol.c
----------------------------------------------------------------------
diff --git a/lib/c_glib/test/testbinaryprotocol.c b/lib/c_glib/test/testbinaryprotocol.c
index 58f4df8..14f4fb0 100755
--- a/lib/c_glib/test/testbinaryprotocol.c
+++ b/lib/c_glib/test/testbinaryprotocol.c
@@ -19,7 +19,7 @@
/* Disable string-function optimizations when glibc is used, as these produce
compiler warnings about string length when a string function is used inside
- a call to assert () */
+ a call to g_assert () */
#ifdef __GLIBC__
#include <features.h>
#define __NO_STRING_INLINES 1
@@ -28,7 +28,6 @@
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
-#include <assert.h>
#include <netdb.h>
#include <string.h>
#include <sys/wait.h>
@@ -96,7 +95,7 @@ test_create_and_destroy(void)
/* create an object and then destroy it */
object = g_object_new (THRIFT_TYPE_BINARY_PROTOCOL, NULL);
- assert (object != NULL);
+ g_assert (object != NULL);
g_object_unref (object);
}
@@ -110,11 +109,11 @@ test_initialize(void)
/* create a ThriftTransport */
tsocket = g_object_new (THRIFT_TYPE_SOCKET, "hostname", "localhost",
"port", 51188, NULL);
- assert (tsocket != NULL);
+ g_assert (tsocket != NULL);
/* create a ThriftBinaryProtocol using the Transport */
protocol = g_object_new (THRIFT_TYPE_BINARY_PROTOCOL, "transport",
tsocket, NULL);
- assert (protocol != NULL);
+ g_assert (protocol != NULL);
/* fetch the properties */
g_object_get (G_OBJECT(protocol), "transport", &temp, NULL);
g_object_unref (temp);
@@ -139,7 +138,7 @@ test_read_and_write_primitives(void)
/* fork a server from the client */
pid = fork ();
- assert (pid >= 0);
+ g_assert (pid >= 0);
if (pid == 0)
{
@@ -155,48 +154,48 @@ test_read_and_write_primitives(void)
"port", port, NULL);
transport = THRIFT_TRANSPORT (tsocket);
thrift_transport_open (transport, NULL);
- assert (thrift_transport_is_open (transport));
+ g_assert (thrift_transport_is_open (transport));
/* create a ThriftBinaryTransport */
tb = g_object_new (THRIFT_TYPE_BINARY_PROTOCOL, "transport",
tsocket, NULL);
protocol = THRIFT_PROTOCOL (tb);
- assert (protocol != NULL);
+ g_assert (protocol != NULL);
/* write a bunch of primitives */
- assert (thrift_binary_protocol_write_bool (protocol, TEST_BOOL, NULL) > 0);
- assert (thrift_binary_protocol_write_byte (protocol, TEST_BYTE, NULL) > 0);
- assert (thrift_binary_protocol_write_i16 (protocol, TEST_I16, NULL) > 0);
- assert (thrift_binary_protocol_write_i32 (protocol, TEST_I32, NULL) > 0);
- assert (thrift_binary_protocol_write_i64 (protocol, TEST_I64, NULL) > 0);
- assert (thrift_binary_protocol_write_double (protocol,
+ g_assert (thrift_binary_protocol_write_bool (protocol, TEST_BOOL, NULL) > 0);
+ g_assert (thrift_binary_protocol_write_byte (protocol, TEST_BYTE, NULL) > 0);
+ g_assert (thrift_binary_protocol_write_i16 (protocol, TEST_I16, NULL) > 0);
+ g_assert (thrift_binary_protocol_write_i32 (protocol, TEST_I32, NULL) > 0);
+ g_assert (thrift_binary_protocol_write_i64 (protocol, TEST_I64, NULL) > 0);
+ g_assert (thrift_binary_protocol_write_double (protocol,
TEST_DOUBLE, NULL) > 0);
- assert (thrift_binary_protocol_write_string (protocol,
+ g_assert (thrift_binary_protocol_write_string (protocol,
TEST_STRING, NULL) > 0);
- assert (thrift_binary_protocol_write_string (protocol, "", NULL) > 0);
- assert (thrift_binary_protocol_write_binary (protocol, binary,
+ g_assert (thrift_binary_protocol_write_string (protocol, "", NULL) > 0);
+ g_assert (thrift_binary_protocol_write_binary (protocol, binary,
len, NULL) > 0);
- assert (thrift_binary_protocol_write_binary (protocol, NULL, 0, NULL) > 0);
- assert (thrift_binary_protocol_write_binary (protocol, binary,
+ g_assert (thrift_binary_protocol_write_binary (protocol, NULL, 0, NULL) > 0);
+ g_assert (thrift_binary_protocol_write_binary (protocol, binary,
len, NULL) > 0);
/* test write errors */
transport_write_error = 1;
- assert (thrift_binary_protocol_write_byte (protocol, TEST_BYTE,
+ g_assert (thrift_binary_protocol_write_byte (protocol, TEST_BYTE,
NULL) == -1);
- assert (thrift_binary_protocol_write_i16 (protocol, TEST_I16, NULL) == -1);
- assert (thrift_binary_protocol_write_i32 (protocol, TEST_I32, NULL) == -1);
- assert (thrift_binary_protocol_write_i64 (protocol, TEST_I64, NULL) == -1);
- assert (thrift_binary_protocol_write_double (protocol, TEST_DOUBLE,
+ g_assert (thrift_binary_protocol_write_i16 (protocol, TEST_I16, NULL) == -1);
+ g_assert (thrift_binary_protocol_write_i32 (protocol, TEST_I32, NULL) == -1);
+ g_assert (thrift_binary_protocol_write_i64 (protocol, TEST_I64, NULL) == -1);
+ g_assert (thrift_binary_protocol_write_double (protocol, TEST_DOUBLE,
NULL) == -1);
- assert (thrift_binary_protocol_write_binary (protocol, binary, len,
+ g_assert (thrift_binary_protocol_write_binary (protocol, binary, len,
NULL) == -1);
transport_write_error = 0;
/* test binary partial failure */
transport_write_count = 0;
transport_write_error_at = 1;
- assert (thrift_binary_protocol_write_binary (protocol, binary,
+ g_assert (thrift_binary_protocol_write_binary (protocol, binary,
len, NULL) == -1);
transport_write_error_at = -1;
@@ -204,8 +203,8 @@ test_read_and_write_primitives(void)
thrift_transport_close (transport, NULL);
g_object_unref (tsocket);
g_object_unref (protocol);
- assert (wait (&status) == pid);
- assert (status == 0);
+ g_assert (wait (&status) == pid);
+ g_assert (status == 0);
}
}
@@ -222,7 +221,7 @@ test_read_and_write_complex_types (void)
/* fork a server from the client */
pid = fork ();
- assert (pid >= 0);
+ g_assert (pid >= 0);
if (pid == 0)
{
@@ -238,33 +237,33 @@ test_read_and_write_complex_types (void)
"port", port, NULL);
transport = THRIFT_TRANSPORT (tsocket);
thrift_transport_open (transport, NULL);
- assert (thrift_transport_is_open (transport));
+ g_assert (thrift_transport_is_open (transport));
/* create a ThriftBinaryTransport */
tb = g_object_new (THRIFT_TYPE_BINARY_PROTOCOL, "transport",
tsocket, NULL);
protocol = THRIFT_PROTOCOL (tb);
- assert (protocol != NULL);
+ g_assert (protocol != NULL);
/* test structures */
- assert (thrift_binary_protocol_write_struct_begin (protocol,
+ g_assert (thrift_binary_protocol_write_struct_begin (protocol,
NULL, NULL) == 0);
- assert (thrift_binary_protocol_write_struct_end (protocol, NULL) == 0);
+ g_assert (thrift_binary_protocol_write_struct_end (protocol, NULL) == 0);
- assert (thrift_binary_protocol_write_field_begin (protocol, "test", T_VOID,
+ g_assert (thrift_binary_protocol_write_field_begin (protocol, "test", T_VOID,
1, NULL) > 0);
- assert (thrift_binary_protocol_write_field_end (protocol, NULL) == 0);
+ g_assert (thrift_binary_protocol_write_field_end (protocol, NULL) == 0);
/* test write error */
transport_write_error = 1;
- assert (thrift_binary_protocol_write_field_begin (protocol, "test", T_VOID,
+ g_assert (thrift_binary_protocol_write_field_begin (protocol, "test", T_VOID,
1, NULL) == -1);
transport_write_error = 0;
/* test 2nd write error */
transport_write_count = 0;
transport_write_error_at = 1;
- assert (thrift_binary_protocol_write_field_begin (protocol, "test", T_VOID,
+ g_assert (thrift_binary_protocol_write_field_begin (protocol, "test", T_VOID,
1, NULL) == -1);
transport_write_error_at = -1;
@@ -272,12 +271,12 @@ test_read_and_write_complex_types (void)
thrift_binary_protocol_write_byte (protocol, T_VOID, NULL);
/* test write_field_stop */
- assert (thrift_binary_protocol_write_field_stop (protocol, NULL) > 0);
+ g_assert (thrift_binary_protocol_write_field_stop (protocol, NULL) > 0);
/* write a map */
- assert (thrift_binary_protocol_write_map_begin (protocol, T_VOID, T_VOID,
+ g_assert (thrift_binary_protocol_write_map_begin (protocol, T_VOID, T_VOID,
1, NULL) > 0);
- assert (thrift_binary_protocol_write_map_end (protocol, NULL) == 0);
+ g_assert (thrift_binary_protocol_write_map_end (protocol, NULL) == 0);
/* test 2nd read failure on a map */
thrift_binary_protocol_write_byte (protocol, T_VOID, NULL);
@@ -288,21 +287,21 @@ test_read_and_write_complex_types (void)
/* test 1st write failure on a map */
transport_write_error = 1;
- assert (thrift_binary_protocol_write_map_begin (protocol, T_VOID, T_VOID,
+ g_assert (thrift_binary_protocol_write_map_begin (protocol, T_VOID, T_VOID,
1, NULL) == -1);
transport_write_error = 0;
/* test 2nd write failure on a map */
transport_write_count = 0;
transport_write_error_at = 1;
- assert (thrift_binary_protocol_write_map_begin (protocol, T_VOID, T_VOID,
+ g_assert (thrift_binary_protocol_write_map_begin (protocol, T_VOID, T_VOID,
1, NULL) == -1);
transport_write_error_at = -1;
/* test 3rd write failure on a map */
transport_write_count = 0;
transport_write_error_at = 2;
- assert (thrift_binary_protocol_write_map_begin (protocol, T_VOID, T_VOID,
+ g_assert (thrift_binary_protocol_write_map_begin (protocol, T_VOID, T_VOID,
1, NULL) == -1);
transport_write_error_at = -1;
@@ -312,9 +311,9 @@ test_read_and_write_complex_types (void)
thrift_binary_protocol_write_i32 (protocol, -10, NULL);
/* test list operations */
- assert (thrift_binary_protocol_write_list_begin (protocol, T_VOID,
+ g_assert (thrift_binary_protocol_write_list_begin (protocol, T_VOID,
1, NULL) > 0);
- assert (thrift_binary_protocol_write_list_end (protocol, NULL) == 0);
+ g_assert (thrift_binary_protocol_write_list_end (protocol, NULL) == 0);
/* test 2nd read failure on a list */
thrift_binary_protocol_write_byte (protocol, T_VOID, NULL);
@@ -325,27 +324,27 @@ test_read_and_write_complex_types (void)
/* test first write error on a list */
transport_write_error = 1;
- assert (thrift_binary_protocol_write_list_begin (protocol, T_VOID,
+ g_assert (thrift_binary_protocol_write_list_begin (protocol, T_VOID,
1, NULL) == -1);
transport_write_error = 0;
/* test 2nd write error on a list */
transport_write_count = 0;
transport_write_error_at = 1;
- assert (thrift_binary_protocol_write_list_begin (protocol, T_VOID,
+ g_assert (thrift_binary_protocol_write_list_begin (protocol, T_VOID,
1, NULL) == -1);
transport_write_error_at = -1;
/* test set operation s*/
- assert (thrift_binary_protocol_write_set_begin (protocol, T_VOID,
+ g_assert (thrift_binary_protocol_write_set_begin (protocol, T_VOID,
1, NULL) > 0);
- assert (thrift_binary_protocol_write_set_end (protocol, NULL) == 0);
+ g_assert (thrift_binary_protocol_write_set_end (protocol, NULL) == 0);
/* invalid version */
- assert (thrift_binary_protocol_write_i32 (protocol, -1, NULL) > 0);
+ g_assert (thrift_binary_protocol_write_i32 (protocol, -1, NULL) > 0);
/* sz > 0 for a message */
- assert (thrift_binary_protocol_write_i32 (protocol, 1, NULL) > 0);
+ g_assert (thrift_binary_protocol_write_i32 (protocol, 1, NULL) > 0);
/* send a valid message */
thrift_binary_protocol_write_i32 (protocol, 0x80010000, NULL);
@@ -360,26 +359,26 @@ test_read_and_write_complex_types (void)
thrift_binary_protocol_write_string (protocol, "test", NULL);
/* send a valid message */
- assert (thrift_binary_protocol_write_message_begin (protocol, "test",
+ g_assert (thrift_binary_protocol_write_message_begin (protocol, "test",
T_CALL, 1, NULL) > 0);
- assert (thrift_binary_protocol_write_message_end (protocol, NULL) == 0);
+ g_assert (thrift_binary_protocol_write_message_end (protocol, NULL) == 0);
/* send broken writes */
transport_write_error = 1;
- assert (thrift_binary_protocol_write_message_begin (protocol, "test",
+ g_assert (thrift_binary_protocol_write_message_begin (protocol, "test",
T_CALL, 1, NULL) == -1);
transport_write_error = 0;
transport_write_count = 0;
transport_write_error_at = 2;
- assert (thrift_binary_protocol_write_message_begin (protocol, "test",
+ g_assert (thrift_binary_protocol_write_message_begin (protocol, "test",
T_CALL, 1, NULL) == -1);
transport_write_error_at = -1;
transport_write_count = 0;
transport_write_error_at = 3;
- assert (thrift_binary_protocol_write_message_begin (protocol, "test",
+ g_assert (thrift_binary_protocol_write_message_begin (protocol, "test",
T_CALL, 1, NULL) == -1);
transport_write_error_at = -1;
@@ -387,8 +386,8 @@ test_read_and_write_complex_types (void)
thrift_transport_close (transport, NULL);
g_object_unref (tsocket);
g_object_unref (protocol);
- assert (wait (&status) == pid);
- assert (status == 0);
+ g_assert (wait (&status) == pid);
+ g_assert (status == 0);
}
}
@@ -408,7 +407,7 @@ test_read_and_write_many_frames (void)
/* fork a server from the client */
pid = fork ();
- assert (pid >= 0);
+ g_assert (pid >= 0);
if (pid == 0)
{
@@ -422,49 +421,49 @@ test_read_and_write_many_frames (void)
/* create a ThriftSocket */
tsocket = g_object_new (THRIFT_TYPE_SOCKET, "hostname", "localhost",
"port", port, NULL);
- assert (tsocket != NULL);
+ g_assert (tsocket != NULL);
transport = THRIFT_TRANSPORT (tsocket);
/* wrap in a framed transport */
ft = g_object_new (THRIFT_TYPE_FRAMED_TRANSPORT, "transport", transport,
"w_buf_size", 1, NULL);
- assert (ft != NULL);
+ g_assert (ft != NULL);
transport = THRIFT_TRANSPORT (ft);
thrift_transport_open (transport, NULL);
- assert (thrift_transport_is_open (transport));
+ g_assert (thrift_transport_is_open (transport));
/* create a binary protocol */
tb = g_object_new (THRIFT_TYPE_BINARY_PROTOCOL, "transport",
transport, NULL);
protocol = THRIFT_PROTOCOL (tb);
- assert (protocol != NULL);
+ g_assert (protocol != NULL);
/* write a bunch of primitives */
- assert (thrift_binary_protocol_write_bool (protocol, TEST_BOOL, NULL) > 0);
+ g_assert (thrift_binary_protocol_write_bool (protocol, TEST_BOOL, NULL) > 0);
thrift_transport_flush (transport, NULL);
- assert (thrift_binary_protocol_write_byte (protocol, TEST_BYTE, NULL) > 0);
+ g_assert (thrift_binary_protocol_write_byte (protocol, TEST_BYTE, NULL) > 0);
thrift_transport_flush (transport, NULL);
- assert (thrift_binary_protocol_write_i16 (protocol, TEST_I16, NULL) > 0);
+ g_assert (thrift_binary_protocol_write_i16 (protocol, TEST_I16, NULL) > 0);
thrift_transport_flush (transport, NULL);
- assert (thrift_binary_protocol_write_i32 (protocol, TEST_I32, NULL) > 0);
+ g_assert (thrift_binary_protocol_write_i32 (protocol, TEST_I32, NULL) > 0);
thrift_transport_flush (transport, NULL);
- assert (thrift_binary_protocol_write_i64 (protocol, TEST_I64, NULL) > 0);
+ g_assert (thrift_binary_protocol_write_i64 (protocol, TEST_I64, NULL) > 0);
thrift_transport_flush (transport, NULL);
- assert (thrift_binary_protocol_write_double (protocol,
+ g_assert (thrift_binary_protocol_write_double (protocol,
TEST_DOUBLE, NULL) > 0);
thrift_transport_flush (transport, NULL);
- assert (thrift_binary_protocol_write_string (protocol,
+ g_assert (thrift_binary_protocol_write_string (protocol,
TEST_STRING, NULL) > 0);
thrift_transport_flush (transport, NULL);
- assert (thrift_binary_protocol_write_string (protocol, "", NULL) > 0);
+ g_assert (thrift_binary_protocol_write_string (protocol, "", NULL) > 0);
thrift_transport_flush (transport, NULL);
- assert (thrift_binary_protocol_write_binary (protocol, binary,
+ g_assert (thrift_binary_protocol_write_binary (protocol, binary,
len, NULL) > 0);
thrift_transport_flush (transport, NULL);
- assert (thrift_binary_protocol_write_binary (protocol, NULL, 0, NULL) > 0);
+ g_assert (thrift_binary_protocol_write_binary (protocol, NULL, 0, NULL) > 0);
thrift_transport_flush (transport, NULL);
- assert (thrift_binary_protocol_write_binary (protocol, binary,
+ g_assert (thrift_binary_protocol_write_binary (protocol, binary,
len, NULL) > 0);
thrift_transport_flush (transport, NULL);
@@ -474,8 +473,8 @@ test_read_and_write_many_frames (void)
g_object_unref (ft);
g_object_unref (tsocket);
g_object_unref (tb);
- assert (wait (&status) == pid);
- assert (status == 0);
+ g_assert (wait (&status) == pid);
+ g_assert (status == 0);
}
}
@@ -504,68 +503,68 @@ thrift_server_primitives (const int port)
transport = THRIFT_SERVER_TRANSPORT (tsocket);
thrift_server_transport_listen (transport, NULL);
client = thrift_server_transport_accept (transport, NULL);
- assert (client != NULL);
+ g_assert (client != NULL);
tbp = g_object_new (THRIFT_TYPE_BINARY_PROTOCOL, "transport",
client, NULL);
protocol = THRIFT_PROTOCOL (tbp);
- assert (thrift_binary_protocol_read_bool (protocol,
+ g_assert (thrift_binary_protocol_read_bool (protocol,
&value_boolean, NULL) > 0);
- assert (thrift_binary_protocol_read_byte (protocol, &value_byte, NULL) > 0);
- assert (thrift_binary_protocol_read_i16 (protocol, &value_16, NULL) > 0);
- assert (thrift_binary_protocol_read_i32 (protocol, &value_32, NULL) > 0);
- assert (thrift_binary_protocol_read_i64 (protocol, &value_64, NULL) > 0);
- assert (thrift_binary_protocol_read_double (protocol,
+ g_assert (thrift_binary_protocol_read_byte (protocol, &value_byte, NULL) > 0);
+ g_assert (thrift_binary_protocol_read_i16 (protocol, &value_16, NULL) > 0);
+ g_assert (thrift_binary_protocol_read_i32 (protocol, &value_32, NULL) > 0);
+ g_assert (thrift_binary_protocol_read_i64 (protocol, &value_64, NULL) > 0);
+ g_assert (thrift_binary_protocol_read_double (protocol,
&value_double, NULL) > 0);
- assert (thrift_binary_protocol_read_string (protocol, &string, NULL) > 0);
- assert (thrift_binary_protocol_read_string (protocol, &empty_string,
+ g_assert (thrift_binary_protocol_read_string (protocol, &string, NULL) > 0);
+ g_assert (thrift_binary_protocol_read_string (protocol, &empty_string,
NULL) > 0);
- assert (thrift_binary_protocol_read_binary (protocol, &binary,
+ g_assert (thrift_binary_protocol_read_binary (protocol, &binary,
&len, NULL) > 0);
- assert (value_boolean == TEST_BOOL);
- assert (value_byte == TEST_BYTE);
- assert (value_16 == TEST_I16);
- assert (value_32 == TEST_I32);
- assert (value_64 == TEST_I64);
- assert (value_double == TEST_DOUBLE);
- assert (strcmp (TEST_STRING, string) == 0);
- assert (strcmp ("", empty_string) == 0);
- assert (memcmp (comparator, binary, len) == 0);
+ g_assert (value_boolean == TEST_BOOL);
+ g_assert (value_byte == TEST_BYTE);
+ g_assert (value_16 == TEST_I16);
+ g_assert (value_32 == TEST_I32);
+ g_assert (value_64 == TEST_I64);
+ g_assert (value_double == TEST_DOUBLE);
+ g_assert (strcmp (TEST_STRING, string) == 0);
+ g_assert (strcmp ("", empty_string) == 0);
+ g_assert (memcmp (comparator, binary, len) == 0);
g_free (string);
g_free (empty_string);
g_free (binary);
- assert (thrift_binary_protocol_read_binary (protocol, &binary,
+ g_assert (thrift_binary_protocol_read_binary (protocol, &binary,
&len, NULL) > 0);
- assert (binary == NULL);
- assert (len == 0);
+ g_assert (binary == NULL);
+ g_assert (len == 0);
g_free (binary);
transport_read_count = 0;
transport_read_error_at = 0;
- assert (thrift_binary_protocol_read_binary (protocol, &binary,
+ g_assert (thrift_binary_protocol_read_binary (protocol, &binary,
&len, NULL) == -1);
transport_read_error_at = -1;
transport_read_count = 0;
transport_read_error_at = 1;
- assert (thrift_binary_protocol_read_binary (protocol, &binary,
+ g_assert (thrift_binary_protocol_read_binary (protocol, &binary,
&len, NULL) == -1);
transport_read_error_at = -1;
transport_read_error = 1;
- assert (thrift_binary_protocol_read_bool (protocol,
+ g_assert (thrift_binary_protocol_read_bool (protocol,
&value_boolean, NULL) == -1);
- assert (thrift_binary_protocol_read_byte (protocol,
+ g_assert (thrift_binary_protocol_read_byte (protocol,
&value_byte, NULL) == -1);
- assert (thrift_binary_protocol_read_i16 (protocol,
+ g_assert (thrift_binary_protocol_read_i16 (protocol,
&value_16, NULL) == -1);
- assert (thrift_binary_protocol_read_i32 (protocol, &value_32, NULL) == -1);
- assert (thrift_binary_protocol_read_i64 (protocol, &value_64, NULL) == -1);
- assert (thrift_binary_protocol_read_double (protocol,
+ g_assert (thrift_binary_protocol_read_i32 (protocol, &value_32, NULL) == -1);
+ g_assert (thrift_binary_protocol_read_i64 (protocol, &value_64, NULL) == -1);
+ g_assert (thrift_binary_protocol_read_double (protocol,
&value_double, NULL) == -1);
transport_read_error = 0;
@@ -603,7 +602,7 @@ thrift_server_complex_types (const int port)
transport = THRIFT_SERVER_TRANSPORT (tsocket);
thrift_server_transport_listen (transport, NULL);
client = thrift_server_transport_accept (transport, NULL);
- assert (client != NULL);
+ g_assert (client != NULL);
tbp = g_object_new (THRIFT_TYPE_BINARY_PROTOCOL, "transport",
client, NULL);
@@ -618,7 +617,7 @@ thrift_server_complex_types (const int port)
/* test first read error on a field */
transport_read_error = 1;
- assert (thrift_binary_protocol_read_field_begin (protocol,
+ g_assert (thrift_binary_protocol_read_field_begin (protocol,
&field_name, &field_type,
&field_id, NULL) == -1);
transport_read_error = 0;
@@ -629,7 +628,7 @@ thrift_server_complex_types (const int port)
/* test 2nd read failure on a field */
transport_read_count = 0;
transport_read_error_at = 1;
- assert (thrift_binary_protocol_read_field_begin (protocol,
+ g_assert (thrift_binary_protocol_read_field_begin (protocol,
&field_name, &field_type,
&field_id, NULL) == -1);
transport_read_error_at = -1;
@@ -645,7 +644,7 @@ thrift_server_complex_types (const int port)
/* test read failure on a map */
transport_read_count = 0;
transport_read_error_at = 0;
- assert (thrift_binary_protocol_read_map_begin (protocol,
+ g_assert (thrift_binary_protocol_read_map_begin (protocol,
&key_type, &value_type,
&size, NULL) == -1);
transport_read_error_at = -1;
@@ -653,7 +652,7 @@ thrift_server_complex_types (const int port)
/* test 2nd read failure on a map */
transport_read_count = 0;
transport_read_error_at = 1;
- assert (thrift_binary_protocol_read_map_begin (protocol,
+ g_assert (thrift_binary_protocol_read_map_begin (protocol,
&key_type, &value_type,
&size, NULL) == -1);
transport_read_error_at = -1;
@@ -661,7 +660,7 @@ thrift_server_complex_types (const int port)
/* test 3rd read failure on a map */
transport_read_count = 0;
transport_read_error_at = 2;
- assert (thrift_binary_protocol_read_map_begin (protocol,
+ g_assert (thrift_binary_protocol_read_map_begin (protocol,
&key_type, &value_type,
&size, NULL) == -1);
transport_read_error_at = -1;
@@ -674,7 +673,7 @@ thrift_server_complex_types (const int port)
thrift_binary_protocol_read_byte (protocol, &value, NULL);
/* test negative map size */
- assert (thrift_binary_protocol_read_map_begin (protocol,
+ g_assert (thrift_binary_protocol_read_map_begin (protocol,
&key_type, &value_type,
&size, NULL) == -1);
@@ -684,7 +683,7 @@ thrift_server_complex_types (const int port)
/* test read failure */
transport_read_error = 1;
- assert (thrift_binary_protocol_read_list_begin (protocol, &element_type,
+ g_assert (thrift_binary_protocol_read_list_begin (protocol, &element_type,
&size, NULL) == -1);
transport_read_error = 0;
@@ -706,23 +705,23 @@ thrift_server_complex_types (const int port)
/* broken read */
transport_read_error = 1;
- assert (thrift_binary_protocol_read_message_begin (protocol, &message_name,
+ g_assert (thrift_binary_protocol_read_message_begin (protocol, &message_name,
&message_type, &seqid,
NULL) == -1);
transport_read_error = 0;
/* invalid protocol version */
- assert (thrift_binary_protocol_read_message_begin (protocol, &message_name,
+ g_assert (thrift_binary_protocol_read_message_begin (protocol, &message_name,
&message_type, &seqid,
NULL) == -1);
/* sz > 0 */
- assert (thrift_binary_protocol_read_message_begin (protocol, &message_name,
+ g_assert (thrift_binary_protocol_read_message_begin (protocol, &message_name,
&message_type, &seqid,
NULL) > 0);
/* read a valid message */
- assert (thrift_binary_protocol_read_message_begin (protocol, &message_name,
+ g_assert (thrift_binary_protocol_read_message_begin (protocol, &message_name,
&message_type, &seqid,
NULL) > 0);
g_free (message_name);
@@ -730,7 +729,7 @@ thrift_server_complex_types (const int port)
/* broken 2nd read on a message */
transport_read_count = 0;
transport_read_error_at = 1;
- assert (thrift_binary_protocol_read_message_begin (protocol, &message_name,
+ g_assert (thrift_binary_protocol_read_message_begin (protocol, &message_name,
&message_type, &seqid,
NULL) == -1);
transport_read_error_at = -1;
@@ -738,19 +737,19 @@ thrift_server_complex_types (const int port)
/* broken 3rd read on a message */
transport_read_count = 0;
transport_read_error_at = 3; /* read_string does two reads */
- assert (thrift_binary_protocol_read_message_begin (protocol, &message_name,
+ g_assert (thrift_binary_protocol_read_message_begin (protocol, &message_name,
&message_type, &seqid,
NULL) == -1);
g_free (message_name);
transport_read_error_at = -1;
/* read a valid message */
- assert (thrift_binary_protocol_read_message_begin (protocol, &message_name,
+ g_assert (thrift_binary_protocol_read_message_begin (protocol, &message_name,
&message_type, &seqid,
NULL) > 0);
g_free (message_name);
- assert (thrift_binary_protocol_read_message_end (protocol, NULL) == 0);
+ g_assert (thrift_binary_protocol_read_message_end (protocol, NULL) == 0);
/* handle 2nd write failure on a message */
thrift_binary_protocol_read_i32 (protocol, &version, NULL);
@@ -792,44 +791,44 @@ thrift_server_many_frames (const int port)
client = g_object_new (THRIFT_TYPE_FRAMED_TRANSPORT, "transport",
thrift_server_transport_accept (transport, NULL),
"r_buf_size", 1, NULL);
- assert (client != NULL);
+ g_assert (client != NULL);
tbp = g_object_new (THRIFT_TYPE_BINARY_PROTOCOL, "transport",
client, NULL);
protocol = THRIFT_PROTOCOL (tbp);
- assert (thrift_binary_protocol_read_bool (protocol,
+ g_assert (thrift_binary_protocol_read_bool (protocol,
&value_boolean, NULL) > 0);
- assert (thrift_binary_protocol_read_byte (protocol, &value_byte, NULL) > 0);
- assert (thrift_binary_protocol_read_i16 (protocol, &value_16, NULL) > 0);
- assert (thrift_binary_protocol_read_i32 (protocol, &value_32, NULL) > 0);
- assert (thrift_binary_protocol_read_i64 (protocol, &value_64, NULL) > 0);
- assert (thrift_binary_protocol_read_double (protocol,
+ g_assert (thrift_binary_protocol_read_byte (protocol, &value_byte, NULL) > 0);
+ g_assert (thrift_binary_protocol_read_i16 (protocol, &value_16, NULL) > 0);
+ g_assert (thrift_binary_protocol_read_i32 (protocol, &value_32, NULL) > 0);
+ g_assert (thrift_binary_protocol_read_i64 (protocol, &value_64, NULL) > 0);
+ g_assert (thrift_binary_protocol_read_double (protocol,
&value_double, NULL) > 0);
- assert (thrift_binary_protocol_read_string (protocol, &string, NULL) > 0);
- assert (thrift_binary_protocol_read_string (protocol, &empty_string,
+ g_assert (thrift_binary_protocol_read_string (protocol, &string, NULL) > 0);
+ g_assert (thrift_binary_protocol_read_string (protocol, &empty_string,
NULL) > 0);
- assert (thrift_binary_protocol_read_binary (protocol, &binary,
+ g_assert (thrift_binary_protocol_read_binary (protocol, &binary,
&len, NULL) > 0);
- assert (value_boolean == TEST_BOOL);
- assert (value_byte == TEST_BYTE);
- assert (value_16 == TEST_I16);
- assert (value_32 == TEST_I32);
- assert (value_64 == TEST_I64);
- assert (value_double == TEST_DOUBLE);
- assert (strcmp (TEST_STRING, string) == 0);
- assert (strcmp ("", empty_string) == 0);
- assert (memcmp (comparator, binary, len) == 0);
+ g_assert (value_boolean == TEST_BOOL);
+ g_assert (value_byte == TEST_BYTE);
+ g_assert (value_16 == TEST_I16);
+ g_assert (value_32 == TEST_I32);
+ g_assert (value_64 == TEST_I64);
+ g_assert (value_double == TEST_DOUBLE);
+ g_assert (strcmp (TEST_STRING, string) == 0);
+ g_assert (strcmp ("", empty_string) == 0);
+ g_assert (memcmp (comparator, binary, len) == 0);
g_free (string);
g_free (empty_string);
g_free (binary);
- assert (thrift_binary_protocol_read_binary (protocol, &binary,
+ g_assert (thrift_binary_protocol_read_binary (protocol, &binary,
&len, NULL) > 0);
- assert (binary == NULL);
- assert (len == 0);
+ g_assert (binary == NULL);
+ g_assert (len == 0);
g_free (binary);
thrift_transport_read_end (client, NULL);
http://git-wip-us.apache.org/repos/asf/thrift/blob/43f4bf2f/lib/c_glib/test/testbufferedtransport.c
----------------------------------------------------------------------
diff --git a/lib/c_glib/test/testbufferedtransport.c b/lib/c_glib/test/testbufferedtransport.c
index 3203a66..1c15ef2 100755
--- a/lib/c_glib/test/testbufferedtransport.c
+++ b/lib/c_glib/test/testbufferedtransport.c
@@ -17,7 +17,6 @@
* under the License.
*/
-#include <assert.h>
#include <netdb.h>
#include <signal.h>
#include <sys/wait.h>
@@ -43,7 +42,7 @@ test_create_and_destroy(void)
GObject *object = NULL;
object = g_object_new (THRIFT_TYPE_BUFFERED_TRANSPORT, NULL);
- assert (object != NULL);
+ g_assert (object != NULL);
g_object_get (G_OBJECT (object), "transport", &transport,
"r_buf_size", &r_buf_size,
"w_buf_size", &w_buf_size, NULL);
@@ -66,9 +65,9 @@ test_open_and_close(void)
"transport", THRIFT_TRANSPORT (tsocket), NULL);
/* this shouldn't work */
- assert (thrift_buffered_transport_open (transport, NULL) == FALSE);
- assert (thrift_buffered_transport_is_open (transport) == TRUE);
- assert (thrift_buffered_transport_close (transport, NULL) == TRUE);
+ g_assert (thrift_buffered_transport_open (transport, NULL) == FALSE);
+ g_assert (thrift_buffered_transport_is_open (transport) == TRUE);
+ g_assert (thrift_buffered_transport_close (transport, NULL) == TRUE);
g_object_unref (transport);
g_object_unref (tsocket);
@@ -80,7 +79,7 @@ test_open_and_close(void)
transport = g_object_new (THRIFT_TYPE_BUFFERED_TRANSPORT,
"transport", THRIFT_TRANSPORT (tsocket), NULL);
- assert (thrift_buffered_transport_open (transport, &err) == FALSE);
+ g_assert (thrift_buffered_transport_open (transport, &err) == FALSE);
g_object_unref (transport);
g_object_unref (tsocket);
g_error_free (err);
@@ -98,7 +97,7 @@ test_read_and_write(void)
guchar buf[10] = TEST_DATA; /* a buffer */
pid = fork ();
- assert ( pid >= 0 );
+ g_assert ( pid >= 0 );
if ( pid == 0 )
{
@@ -115,8 +114,8 @@ test_read_and_write(void)
"transport", THRIFT_TRANSPORT (tsocket),
"w_buf_size", 4, NULL);
- assert (thrift_buffered_transport_open (transport, NULL) == TRUE);
- assert (thrift_buffered_transport_is_open (transport));
+ g_assert (thrift_buffered_transport_open (transport, NULL) == TRUE);
+ g_assert (thrift_buffered_transport_is_open (transport));
/* write 10 bytes */
thrift_buffered_transport_write (transport, buf, 10, NULL);
@@ -149,8 +148,8 @@ test_read_and_write(void)
g_object_unref (transport);
g_object_unref (tsocket);
- assert ( wait (&status) == pid );
- assert ( status == 0 );
+ g_assert ( wait (&status) == pid );
+ g_assert ( status == 0 );
}
}
@@ -173,12 +172,12 @@ thrift_server (const int port)
client = g_object_new (THRIFT_TYPE_BUFFERED_TRANSPORT, "transport",
thrift_server_transport_accept (transport, NULL),
"r_buf_size", 5, NULL);
- assert (client != NULL);
+ g_assert (client != NULL);
/* read 10 bytes */
bytes = thrift_buffered_transport_read (client, buf, 10, NULL);
- assert (bytes == 10); /* make sure we've read 10 bytes */
- assert ( memcmp (buf, match, 10) == 0 ); /* make sure what we got matches */
+ g_assert (bytes == 10); /* make sure we've read 10 bytes */
+ g_assert ( memcmp (buf, match, 10) == 0 ); /* make sure what we got matches */
/* read 1 byte */
bytes = thrift_buffered_transport_read (client, buf, 1, NULL);
@@ -207,7 +206,7 @@ test_write_fail(void)
signal(SIGPIPE, SIG_IGN);
pid = fork ();
- assert ( pid >= 0 );
+ g_assert ( pid >= 0 );
if ( pid == 0 )
{
@@ -225,7 +224,7 @@ test_write_fail(void)
client = g_object_new (THRIFT_TYPE_BUFFERED_TRANSPORT, "transport",
thrift_server_transport_accept (transport, NULL),
"r_buf_size", 5, NULL);
- assert (client != NULL);
+ g_assert (client != NULL);
/* just close socket */
thrift_buffered_transport_close (client, NULL);
@@ -243,28 +242,28 @@ test_write_fail(void)
"w_buf_size", 4, NULL);
- assert (thrift_buffered_transport_open (transport, NULL) == TRUE);
- assert (thrift_buffered_transport_is_open (transport));
+ g_assert (thrift_buffered_transport_open (transport, NULL) == TRUE);
+ g_assert (thrift_buffered_transport_is_open (transport));
/* recognize disconnection */
sleep(1);
- assert (thrift_buffered_transport_write (transport, buf, 10, NULL) == TRUE);
- assert (thrift_buffered_transport_write (transport, buf, 10, NULL) == FALSE);
+ g_assert (thrift_buffered_transport_write (transport, buf, 10, NULL) == TRUE);
+ g_assert (thrift_buffered_transport_write (transport, buf, 10, NULL) == FALSE);
/* write and overflow buffer */
- assert (thrift_buffered_transport_write (transport, buf, 10, NULL) == FALSE);
+ g_assert (thrift_buffered_transport_write (transport, buf, 10, NULL) == FALSE);
/* write 1 and flush */
- assert (thrift_buffered_transport_write (transport, buf, 1, NULL) == TRUE);
- assert (thrift_buffered_transport_flush (transport, NULL) == FALSE);
+ g_assert (thrift_buffered_transport_write (transport, buf, 1, NULL) == TRUE);
+ g_assert (thrift_buffered_transport_flush (transport, NULL) == FALSE);
thrift_buffered_transport_close (transport, NULL);
g_object_unref (transport);
g_object_unref (tsocket);
- assert ( wait (&status) == pid );
- assert ( status == 0 );
+ g_assert ( wait (&status) == pid );
+ g_assert ( status == 0 );
}
}
[43/50] [abbrv] thrift git commit: THRIFT-3600 Make TTwisted server
send exception on unexpected handler error Client: py
Posted by je...@apache.org.
THRIFT-3600 Make TTwisted server send exception on unexpected handler error
Client: py
This closes #838
This closes #1424
Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/6f826403
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/6f826403
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/6f826403
Branch: refs/heads/0.11.0
Commit: 6f8264037c138b5042cbdbe8a444c2cff6065ee6
Parents: 1ce7a5b
Author: Nobuaki Sukegawa <ns...@apache.org>
Authored: Wed Feb 10 19:42:19 2016 +0900
Committer: James E. King, III <jk...@apache.org>
Committed: Thu Nov 30 12:36:11 2017 -0500
----------------------------------------------------------------------
.../cpp/src/thrift/generate/t_py_generator.cc | 112 +++++++++++--------
test/py.twisted/test_suite.py | 16 ++-
2 files changed, 75 insertions(+), 53 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/thrift/blob/6f826403/compiler/cpp/src/thrift/generate/t_py_generator.cc
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/thrift/generate/t_py_generator.cc b/compiler/cpp/src/thrift/generate/t_py_generator.cc
index 23d4b70..8851c31 100644
--- a/compiler/cpp/src/thrift/generate/t_py_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_py_generator.cc
@@ -1898,8 +1898,6 @@ void t_py_generator::generate_process_function(t_service* tservice, t_function*
}
if (gen_twisted_) {
- // TODO: Propagate arbitrary exception raised by handler to client as does plain "py"
-
// Generate the function call
t_struct* arg_struct = tfunction->get_arglist();
const std::vector<t_field*>& fields = arg_struct->get_members();
@@ -1918,65 +1916,83 @@ void t_py_generator::generate_process_function(t_service* tservice, t_function*
}
f_service_ << ")" << endl;
- // Shortcut out here for oneway functions
if (tfunction->is_oneway()) {
- f_service_ << indent() << "return d" << endl;
- indent_down();
- f_service_ << endl;
- return;
- }
-
- f_service_ << indent() << "d.addCallback(self.write_results_success_" << tfunction->get_name()
- << ", result, seqid, oprot)" << endl;
-
- if (xceptions.size() > 0) {
- f_service_ << indent() << "d.addErrback(self.write_results_exception_"
+ f_service_ << indent() << "d.addErrback(self.handle_exception_" << tfunction->get_name()
+ << ", seqid)" << endl;
+ } else {
+ f_service_ << indent() << "d.addCallback(self.write_results_success_" << tfunction->get_name()
+ << ", result, seqid, oprot)" << endl
+ << indent() << "d.addErrback(self.write_results_exception_"
<< tfunction->get_name() << ", result, seqid, oprot)" << endl;
}
-
- f_service_ << indent() << "return d" << endl;
+ f_service_ << indent() << "return d" << endl << endl;
indent_down();
- f_service_ << endl;
- indent(f_service_) << "def write_results_success_" << tfunction->get_name()
- << "(self, success, result, seqid, oprot):" << endl;
- indent_up();
- f_service_ << indent() << "result.success = success" << endl << indent()
- << "oprot.writeMessageBegin(\"" << tfunction->get_name()
- << "\", TMessageType.REPLY, seqid)" << endl << indent() << "result.write(oprot)"
- << endl << indent() << "oprot.writeMessageEnd()" << endl << indent()
- << "oprot.trans.flush()" << endl;
- indent_down();
+ if (tfunction->is_oneway()) {
+ indent(f_service_) << "def handle_exception_" << tfunction->get_name()
+ << "(self, error, seqid):" << endl;
+ } else {
+ indent(f_service_) << "def write_results_success_" << tfunction->get_name()
+ << "(self, success, result, seqid, oprot):" << endl;
+ indent_up();
+ f_service_ << indent() << "result.success = success" << endl
+ << indent() << "oprot.writeMessageBegin(\"" << tfunction->get_name()
+ << "\", TMessageType.REPLY, seqid)" << endl
+ << indent() << "result.write(oprot)" << endl
+ << indent() << "oprot.writeMessageEnd()" << endl
+ << indent() << "oprot.trans.flush()" << endl
+ << endl;
+ indent_down();
- // Try block for a function with exceptions
- if (!tfunction->is_oneway() && xceptions.size() > 0) {
- f_service_ << endl;
indent(f_service_) << "def write_results_exception_" << tfunction->get_name()
<< "(self, error, result, seqid, oprot):" << endl;
- indent_up();
- f_service_ << indent() << "try:" << endl;
+ }
+ indent_up();
+ if (!tfunction->is_oneway()) {
+ f_service_ << indent() << "msg_type = TMessageType.REPLY" << endl;
+ }
+ f_service_ << indent() << "try:" << endl;
- // Kinda absurd
- f_service_ << indent() << indent_str() << "error.raiseException()" << endl;
+ // Kinda absurd
+ f_service_ << indent() << indent_str() << "error.raiseException()" << endl;
+ if (!tfunction->is_oneway()) {
for (x_iter = xceptions.begin(); x_iter != xceptions.end(); ++x_iter) {
- f_service_ <<
- indent() << "except " << type_name((*x_iter)->get_type()) << " as " << (*x_iter)->get_name() << ":" << endl;
- if (!tfunction->is_oneway()) {
- indent_up();
- f_service_ << indent() << "result." << (*x_iter)->get_name() << " = "
- << (*x_iter)->get_name() << endl;
- indent_down();
- } else {
- f_service_ << indent() << "pass" << endl;
- }
+ const string& xname = (*x_iter)->get_name();
+ f_service_ << indent() << "except " << type_name((*x_iter)->get_type()) << " as " << xname
+ << ":" << endl;
+ indent_up();
+ f_service_ << indent() << "result." << xname << " = " << xname << endl;
+ indent_down();
}
- f_service_ << indent() << "oprot.writeMessageBegin(\"" << tfunction->get_name()
- << "\", TMessageType.REPLY, seqid)" << endl << indent() << "result.write(oprot)"
- << endl << indent() << "oprot.writeMessageEnd()" << endl << indent()
- << "oprot.trans.flush()" << endl;
- indent_down();
}
+ f_service_ << indent() << "except TTransport.TTransportException:" << endl
+ << indent() << indent_str() << "raise" << endl;
+ if (!tfunction->is_oneway()) {
+ f_service_ << indent() << "except TApplicationException as ex:" << endl
+ << indent() << indent_str()
+ << "logging.exception('TApplication exception in handler')" << endl
+ << indent() << indent_str() << "msg_type = TMessageType.EXCEPTION" << endl
+ << indent() << indent_str() << "result = ex" << endl
+ << indent() << "except Exception:" << endl
+ << indent() << indent_str()
+ << "logging.exception('Unexpected exception in handler')" << endl
+ << indent() << indent_str() << "msg_type = TMessageType.EXCEPTION" << endl
+ << indent() << indent_str()
+ << "result = TApplicationException(TApplicationException.INTERNAL_ERROR, "
+ "'Internal error')"
+ << endl
+ << indent() << "oprot.writeMessageBegin(\"" << tfunction->get_name()
+ << "\", msg_type, seqid)" << endl
+ << indent() << "result.write(oprot)" << endl
+ << indent() << "oprot.writeMessageEnd()" << endl
+ << indent() << "oprot.trans.flush()" << endl;
+ } else {
+ f_service_ << indent() << "except Exception:" << endl
+ << indent() << indent_str()
+ << "logging.exception('Exception in oneway handler')" << endl;
+ }
+ indent_down();
} else if (gen_tornado_) {
// TODO: Propagate arbitrary exception raised by handler to client as does plain "py"
http://git-wip-us.apache.org/repos/asf/thrift/blob/6f826403/test/py.twisted/test_suite.py
----------------------------------------------------------------------
diff --git a/test/py.twisted/test_suite.py b/test/py.twisted/test_suite.py
index 886de44..02eb7f1 100755
--- a/test/py.twisted/test_suite.py
+++ b/test/py.twisted/test_suite.py
@@ -19,14 +19,17 @@
# under the License.
#
-import sys
-import os
import glob
+import os
+import sys
import time
+
basepath = os.path.abspath(os.path.dirname(__file__))
sys.path.insert(0, os.path.join(basepath, 'gen-py.twisted'))
sys.path.insert(0, glob.glob(os.path.join(basepath, '../../lib/py/build/lib.*'))[0])
+from thrift.Thrift import TApplicationException
+
from ThriftTest import ThriftTest
from ThriftTest.ttypes import Xception, Xtruct
from thrift.transport import TTwisted
@@ -84,6 +87,7 @@ class TestHandler:
def fireOneway(t):
self.onewaysQueue.put((t, time.time(), seconds))
reactor.callLater(seconds, fireOneway, time.time())
+ raise Exception('')
def testNest(self, thing):
return thing
@@ -171,7 +175,6 @@ class ThriftTestCase(unittest.TestCase):
@defer.inlineCallbacks
def testException(self):
- yield self.client.testException('Safe')
try:
yield self.client.testException('Xception')
self.fail("should have gotten exception")
@@ -181,12 +184,15 @@ class ThriftTestCase(unittest.TestCase):
try:
yield self.client.testException("throw_undeclared")
- self.fail("should have thrown exception")
- except Exception: # type is undefined
+ self.fail("should have gotten exception")
+ except TApplicationException:
pass
+ yield self.client.testException('Safe')
+
@defer.inlineCallbacks
def testOneway(self):
yield self.client.testOneway(1)
start, end, seconds = yield self.handler.onewaysQueue.get()
self.assertAlmostEquals(seconds, (end - start), places=1)
+ self.assertEquals((yield self.client.testI32(-1)), -1)
[10/50] [abbrv] thrift git commit: THRIFT-4362 check "read length" in
readStringBody(int) Client: Java
Posted by je...@apache.org.
THRIFT-4362 check "read length" in readStringBody(int)
Client: Java
This closes #1398
Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/a39ba7f2
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/a39ba7f2
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/a39ba7f2
Branch: refs/heads/0.11.0
Commit: a39ba7f2946c08fa59dd0928e9c608a70ca52529
Parents: e7611d0
Author: christianc <ch...@energymeteo.de>
Authored: Tue Oct 24 09:25:20 2017 +0200
Committer: James E. King, III <jk...@apache.org>
Committed: Wed Oct 25 08:40:51 2017 -0400
----------------------------------------------------------------------
lib/java/src/org/apache/thrift/protocol/TBinaryProtocol.java | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/thrift/blob/a39ba7f2/lib/java/src/org/apache/thrift/protocol/TBinaryProtocol.java
----------------------------------------------------------------------
diff --git a/lib/java/src/org/apache/thrift/protocol/TBinaryProtocol.java b/lib/java/src/org/apache/thrift/protocol/TBinaryProtocol.java
index d7f8b83..aaa1fd8 100644
--- a/lib/java/src/org/apache/thrift/protocol/TBinaryProtocol.java
+++ b/lib/java/src/org/apache/thrift/protocol/TBinaryProtocol.java
@@ -373,6 +373,7 @@ public class TBinaryProtocol extends TProtocol {
}
public String readStringBody(int size) throws TException {
+ checkStringReadLength(size);
try {
byte[] buf = new byte[size];
trans_.readAll(buf, 0, size);
[49/50] [abbrv] thrift git commit: THRIFT-4398 Update EXTRA_DIST for
"make dist" Client: Build process Patch: Jens Geyer
Posted by je...@apache.org.
THRIFT-4398 Update EXTRA_DIST for "make dist"
Client: Build process
Patch: Jens Geyer
This closes #1431
Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/1c7bf3eb
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/1c7bf3eb
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/1c7bf3eb
Branch: refs/heads/0.11.0
Commit: 1c7bf3ebc43b8f2f2a800f6ed43643d001e12040
Parents: 2147466
Author: Jens Geyer <je...@apache.org>
Authored: Thu Nov 30 22:30:03 2017 +0100
Committer: Jens Geyer <je...@apache.org>
Committed: Fri Dec 1 23:13:19 2017 +0100
----------------------------------------------------------------------
Makefile.am | 4 ++++
lib/csharp/Makefile.am | 23 ++++++++++++-----------
lib/dart/Makefile.am | 4 ++++
lib/erl/Makefile.am | 1 +
lib/netcore/Makefile.am | 2 ++
lib/perl/Makefile.am | 3 +++
lib/py/Makefile.am | 1 +
lib/rs/test/Makefile.am | 4 ++++
test/csharp/Makefile.am | 8 ++++++++
test/haxe/Makefile.am | 28 +++++++++++++++-------------
test/netcore/Makefile.am | 1 +
tutorial/dart/Makefile.am | 3 +++
tutorial/go/Makefile.am | 3 +++
tutorial/haxe/Makefile.am | 28 +++++++++++++++-------------
tutorial/netcore/Makefile.am | 2 ++
15 files changed, 78 insertions(+), 37 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/thrift/blob/1c7bf3eb/Makefile.am
----------------------------------------------------------------------
diff --git a/Makefile.am b/Makefile.am
index 4b3157c..3d71fd4 100755
--- a/Makefile.am
+++ b/Makefile.am
@@ -111,9 +111,13 @@ EXTRA_DIST = \
.clang-format \
.editorconfig \
.travis.yml \
+ .rustfmt.toml \
+ .dockerignore \
appveyor.yml \
bower.json \
build \
+ bootstrap.sh \
+ cleanup.sh \
CMakeLists.txt \
composer.json \
contrib \
http://git-wip-us.apache.org/repos/asf/thrift/blob/1c7bf3eb/lib/csharp/Makefile.am
----------------------------------------------------------------------
diff --git a/lib/csharp/Makefile.am b/lib/csharp/Makefile.am
index f113e1a..be49d5e 100644
--- a/lib/csharp/Makefile.am
+++ b/lib/csharp/Makefile.am
@@ -97,14 +97,15 @@ clean-local:
$(RM) Thrift.45.dll
EXTRA_DIST = \
- $(THRIFTCODE) \
- ThriftMSBuildTask \
- src/Thrift.csproj \
- src/Thrift.45.csproj \
- src/Thrift.sln \
- src/Transport/TSilverlightSocket.cs \
- src/Transport/THttpTaskAsyncHandler.cs \
- src/TAsyncProcessor.cs \
- test \
- coding_standards.md \
- README.md
+ $(THRIFTCODE) \
+ ThriftMSBuildTask \
+ src/Thrift.csproj \
+ src/Thrift.45.csproj \
+ src/Thrift.sln \
+ src/Net35/ExtensionsNet35.cs \
+ src/Transport/TSilverlightSocket.cs \
+ src/Transport/THttpTaskAsyncHandler.cs \
+ src/TAsyncProcessor.cs \
+ test \
+ coding_standards.md \
+ README.md
http://git-wip-us.apache.org/repos/asf/thrift/blob/1c7bf3eb/lib/dart/Makefile.am
----------------------------------------------------------------------
diff --git a/lib/dart/Makefile.am b/lib/dart/Makefile.am
index 910db50..ab6ddc0 100644
--- a/lib/dart/Makefile.am
+++ b/lib/dart/Makefile.am
@@ -27,3 +27,7 @@ clean-local:
find . -type f -name "pubspec.lock" | xargs $(RM)
check-local: all
+
+EXTRA_DIST = \
+ .analysis_options
+
http://git-wip-us.apache.org/repos/asf/thrift/blob/1c7bf3eb/lib/erl/Makefile.am
----------------------------------------------------------------------
diff --git a/lib/erl/Makefile.am b/lib/erl/Makefile.am
index 20aadeb..8867f88 100644
--- a/lib/erl/Makefile.am
+++ b/lib/erl/Makefile.am
@@ -82,6 +82,7 @@ EXTRA_DIST = \
src \
coding_standards.md \
rebar.config \
+ rebar.config.script \
rebar.test.config \
test \
README.md
http://git-wip-us.apache.org/repos/asf/thrift/blob/1c7bf3eb/lib/netcore/Makefile.am
----------------------------------------------------------------------
diff --git a/lib/netcore/Makefile.am b/lib/netcore/Makefile.am
index 5262993..facee11 100644
--- a/lib/netcore/Makefile.am
+++ b/lib/netcore/Makefile.am
@@ -25,6 +25,7 @@ TESTDIR = Tests/Thrift.PublicInterfaces.Compile.Tests
GENDIR = $(TESTDIR)/gen-netcore
THRIFTCODE = \
+ Thrift/Thrift.csproj \
Thrift/ITAsyncProcessor.cs \
Thrift/ITProcessorFactory.cs \
Thrift/SingletonTProcessorFactory.cs \
@@ -72,6 +73,7 @@ THRIFTCODE = \
Thrift/Transports/Client/TTlsSocketClientTransport.cs \
Thrift/Transports/Server/THttpServerTransport.cs \
Thrift/Transports/Server/TNamedPipeServerTransport.cs \
+ Thrift/Transports/Server/TServerFramedTransport.cs \
Thrift/Transports/Server/TServerSocketTransport.cs \
Thrift/Transports/Server/TTlsServerSocketTransport.cs
http://git-wip-us.apache.org/repos/asf/thrift/blob/1c7bf3eb/lib/perl/Makefile.am
----------------------------------------------------------------------
diff --git a/lib/perl/Makefile.am b/lib/perl/Makefile.am
index 0d2c8d3..fa0f16b 100644
--- a/lib/perl/Makefile.am
+++ b/lib/perl/Makefile.am
@@ -38,12 +38,14 @@ clean-local:
EXTRA_DIST = \
coding_standards.md \
+ build-cpan-dist.sh \
Makefile.PL \
test.pl \
lib/Thrift.pm \
lib/Thrift.pm \
lib/Thrift/BinaryProtocol.pm \
lib/Thrift/BufferedTransport.pm \
+ lib/Thrift/Exception.pm \
lib/Thrift/FramedTransport.pm \
lib/Thrift/HttpClient.pm \
lib/Thrift/MemoryBuffer.pm \
@@ -59,6 +61,7 @@ EXTRA_DIST = \
lib/Thrift/SSLServerSocket.pm \
lib/Thrift/UnixServerSocket.pm \
lib/Thrift/UnixSocket.pm \
+ lib/Thrift/Type.pm \
lib/Thrift/Transport.pm \
README.md
http://git-wip-us.apache.org/repos/asf/thrift/blob/1c7bf3eb/lib/py/Makefile.am
----------------------------------------------------------------------
diff --git a/lib/py/Makefile.am b/lib/py/Makefile.am
index fd9ce25..5861858 100644
--- a/lib/py/Makefile.am
+++ b/lib/py/Makefile.am
@@ -49,6 +49,7 @@ check-local: all py3-test
EXTRA_DIST = \
CMakeLists.txt \
+ MANIFEST.in \
coding_standards.md \
compat \
setup.py \
http://git-wip-us.apache.org/repos/asf/thrift/blob/1c7bf3eb/lib/rs/test/Makefile.am
----------------------------------------------------------------------
diff --git a/lib/rs/test/Makefile.am b/lib/rs/test/Makefile.am
index 87208d7..8edd756 100644
--- a/lib/rs/test/Makefile.am
+++ b/lib/rs/test/Makefile.am
@@ -44,6 +44,10 @@ clean-local:
EXTRA_DIST = \
Cargo.toml \
+ thrifts/Base_One.thrift \
+ thrifts/Base_Two.thrift \
+ thrifts/Midlayer.thrift \
+ thrifts/Ultimate.thrift \
src/lib.rs \
src/bin/kitchen_sink_server.rs \
src/bin/kitchen_sink_client.rs
http://git-wip-us.apache.org/repos/asf/thrift/blob/1c7bf3eb/test/csharp/Makefile.am
----------------------------------------------------------------------
diff --git a/test/csharp/Makefile.am b/test/csharp/Makefile.am
index 7aa332c..ad166e3 100644
--- a/test/csharp/Makefile.am
+++ b/test/csharp/Makefile.am
@@ -85,3 +85,11 @@ check-local: TestClientServer.exe
MONO_PATH=$(LIBDIR) timeout 10 mono TestClientServer.exe server --port=$(TESTPORT) &
sleep 1
MONO_PATH=$(LIBDIR) mono TestClientServer.exe client --port=$(TESTPORT)
+
+EXTRA_DIST = \
+ Properties/AssemblyInfo.cs \
+ ThriftTest.csproj \
+ ThriftTest.sln \
+ Program.cs \
+ TestServer.cs \
+ TestClient.cs
http://git-wip-us.apache.org/repos/asf/thrift/blob/1c7bf3eb/test/haxe/Makefile.am
----------------------------------------------------------------------
diff --git a/test/haxe/Makefile.am b/test/haxe/Makefile.am
index 4edaa30..6c0483e 100644
--- a/test/haxe/Makefile.am
+++ b/test/haxe/Makefile.am
@@ -87,16 +87,18 @@ check_php_web: $(BIN_PHP_WEB) $(BIN_CPP)
EXTRA_DIST = \
- src \
- cpp.hxml \
- csharp.hxml \
- flash.hxml \
- java.hxml \
- javascript.hxml \
- neko.hxml \
- php.hxml \
- python.hxml \
- project.hide \
- TestClientServer.hxproj \
- make_all.bat \
- make_all.sh
+ src \
+ cpp.hxml \
+ csharp.hxml \
+ flash.hxml \
+ java.hxml \
+ javascript.hxml \
+ neko.hxml \
+ php.hxml \
+ python.hxml \
+ router.php \
+ project.hide \
+ php-web-server.hxml \
+ TestClientServer.hxproj \
+ make_all.bat \
+ make_all.sh
http://git-wip-us.apache.org/repos/asf/thrift/blob/1c7bf3eb/test/netcore/Makefile.am
----------------------------------------------------------------------
diff --git a/test/netcore/Makefile.am b/test/netcore/Makefile.am
index e84a57a..e029a24 100644
--- a/test/netcore/Makefile.am
+++ b/test/netcore/Makefile.am
@@ -52,6 +52,7 @@ EXTRA_DIST = \
$(THRIFTCODE) \
ThriftTest.sln \
ThriftTest/ThriftTest.csproj \
+ ThriftTest/Properties/launchSettings.json \
build.cmd \
build.sh \
README.md
http://git-wip-us.apache.org/repos/asf/thrift/blob/1c7bf3eb/tutorial/dart/Makefile.am
----------------------------------------------------------------------
diff --git a/tutorial/dart/Makefile.am b/tutorial/dart/Makefile.am
index 2e8cd34..0495aca 100644
--- a/tutorial/dart/Makefile.am
+++ b/tutorial/dart/Makefile.am
@@ -67,4 +67,7 @@ EXTRA_DIST = \
console_client/pubspec.yaml \
server/bin/main.dart \
server/pubspec.yaml \
+ console_client/.analysis_options \
+ client/.analysis_options \
+ server/.analysis_options \
build.sh
http://git-wip-us.apache.org/repos/asf/thrift/blob/1c7bf3eb/tutorial/go/Makefile.am
----------------------------------------------------------------------
diff --git a/tutorial/go/Makefile.am b/tutorial/go/Makefile.am
index 30662f5..a146d5c 100644
--- a/tutorial/go/Makefile.am
+++ b/tutorial/go/Makefile.am
@@ -61,6 +61,9 @@ EXTRA_DIST = \
src/handler.go \
src/server.go \
src/main.go \
+ src/go17.go \
+ src/handler_go17.go \
+ src/pre_go17.go \
server.crt \
server.key
http://git-wip-us.apache.org/repos/asf/thrift/blob/1c7bf3eb/tutorial/haxe/Makefile.am
----------------------------------------------------------------------
diff --git a/tutorial/haxe/Makefile.am b/tutorial/haxe/Makefile.am
index 13ac48d..e6f2713 100644
--- a/tutorial/haxe/Makefile.am
+++ b/tutorial/haxe/Makefile.am
@@ -80,16 +80,18 @@ clean-local:
$(RM) -r gen-haxe bin
EXTRA_DIST = \
- src \
- cpp.hxml \
- csharp.hxml \
- flash.hxml \
- java.hxml \
- javascript.hxml \
- neko.hxml \
- php.hxml \
- python.hxml \
- project.hide \
- Tutorial.hxproj \
- make_all.bat \
- make_all.sh
+ src \
+ cpp.hxml \
+ csharp.hxml \
+ flash.hxml \
+ java.hxml \
+ javascript.hxml \
+ php-web-server.hxml \
+ neko.hxml \
+ php.hxml \
+ python.hxml \
+ router.php \
+ project.hide \
+ Tutorial.hxproj \
+ make_all.bat \
+ make_all.sh
http://git-wip-us.apache.org/repos/asf/thrift/blob/1c7bf3eb/tutorial/netcore/Makefile.am
----------------------------------------------------------------------
diff --git a/tutorial/netcore/Makefile.am b/tutorial/netcore/Makefile.am
index 2e62ee0..ef3d618 100644
--- a/tutorial/netcore/Makefile.am
+++ b/tutorial/netcore/Makefile.am
@@ -65,8 +65,10 @@ EXTRA_DIST = \
Interfaces/Interfaces.csproj \
Client/Client.csproj \
Client/ThriftTest.pfx \
+ Client/Properties/launchSettings.json \
Server/Server.csproj \
Server/ThriftTest.pfx \
+ Server/Properties/launchSettings.json \
build.cmd \
build.sh \
README.md
[13/50] [abbrv] thrift git commit: THRIFT-4356: fix segment fault for
thrift_protocol NOTE: drops php5 support for PHP extension (thrift_protocol)
however library still can support PHP5 as evidenced by CI build Client: php
Posted by je...@apache.org.
THRIFT-4356: fix segment fault for thrift_protocol
NOTE: drops php5 support for PHP extension (thrift_protocol)
however library still can support PHP5 as evidenced by CI build
Client: php
This closes #1385
This closes #1391
Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/9dff0efc
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/9dff0efc
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/9dff0efc
Branch: refs/heads/0.11.0
Commit: 9dff0efc1e099a67e386c95bddc4079daf2b7141
Parents: 1df2d9b
Author: Robert Lu <ro...@gmail.com>
Authored: Wed Oct 4 03:18:38 2017 +0800
Committer: James E. King, III <jk...@apache.org>
Committed: Wed Oct 25 08:57:04 2017 -0400
----------------------------------------------------------------------
.../cpp/src/thrift/generate/t_php_generator.cc | 47 +-
lib/php/Makefile.am | 1 -
lib/php/src/ext/thrift_protocol/config.m4 | 31 +-
.../ext/thrift_protocol/php_thrift_protocol.cpp | 1113 +++++++++---------
.../thrift_protocol/php_thrift_protocol7.cpp | 1102 -----------------
5 files changed, 596 insertions(+), 1698 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/thrift/blob/9dff0efc/compiler/cpp/src/thrift/generate/t_php_generator.cc
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/thrift/generate/t_php_generator.cc b/compiler/cpp/src/thrift/generate/t_php_generator.cc
index 9b5062c..11771c2 100644
--- a/compiler/cpp/src/thrift/generate/t_php_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_php_generator.cc
@@ -210,6 +210,17 @@ public:
std::string type_to_enum(t_type* ttype);
std::string type_to_phpdoc(t_type* ttype);
+ bool php_is_scalar(t_type *ttype) {
+ ttype = ttype->get_true_type();
+ if(ttype->is_base_type()) {
+ return true;
+ } else if(ttype->is_enum()) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
std::string php_namespace_base(const t_program* p) {
std::string ns = p->get_namespace("php");
const char* delimiter = "\\";
@@ -1332,11 +1343,24 @@ void t_php_generator::generate_process_function(std::ofstream& out, t_service* t
string resultname = php_namespace(tservice->get_program()) + service_name_ + "_"
+ tfunction->get_name() + "_result";
+ out << indent() << "$bin_accel = ($input instanceof "
+ << "TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary_after_message_begin');"
+ << endl;
+ out << indent() << "if ($bin_accel)" << endl;
+ scope_up(out);
+
+ out << indent() << "$args = thrift_protocol_read_binary_after_message_begin($input, '" << argsname
+ << "', $input->isStrictRead());" << endl;
+
+ scope_down(out);
+ out << indent() << "else" << endl;
+ scope_up(out);
out << indent() << "$args = new " << argsname << "();" << endl << indent()
<< "$args->read($input);" << endl;
if (!binary_inline_) {
out << indent() << "$input->readMessageEnd();" << endl;
}
+ scope_down(out);
t_struct* xs = tfunction->get_xceptions();
const std::vector<t_field*>& xceptions = xs->get_members();
@@ -2093,11 +2117,12 @@ void t_php_generator::generate_deserialize_set_element(ofstream& out, t_set* tse
generate_deserialize_field(out, &felem);
- indent(out) << "if (is_scalar($" << elem << ")) {" << endl;
- indent(out) << " $" << prefix << "[$" << elem << "] = true;" << endl;
- indent(out) << "} else {" << endl;
- indent(out) << " $" << prefix << " []= $" << elem << ";" << endl;
- indent(out) << "}" << endl;
+ t_type* elem_type = tset->get_elem_type();
+ if(php_is_scalar(elem_type)) {
+ indent(out) << "$" << prefix << "[$" << elem << "] = true;" << endl;
+ } else {
+ indent(out) << "$" << prefix << "[] = $" << elem << ";" << endl;
+ }
}
void t_php_generator::generate_deserialize_list_element(ofstream& out,
@@ -2285,11 +2310,13 @@ void t_php_generator::generate_serialize_container(ofstream& out, t_type* ttype,
string iter_val = tmp("iter");
indent(out) << "foreach ($" << prefix << " as $" << iter << " => $" << iter_val << ")" << endl;
scope_up(out);
- indent(out) << "if (is_scalar($" << iter_val << ")) {" << endl;
- generate_serialize_set_element(out, (t_set*)ttype, iter);
- indent(out) << "} else {" << endl;
- generate_serialize_set_element(out, (t_set*)ttype, iter_val);
- indent(out) << "}" << endl;
+
+ t_type* elem_type = ((t_set*)ttype)->get_elem_type();
+ if(php_is_scalar(elem_type)) {
+ generate_serialize_set_element(out, (t_set*)ttype, iter);
+ } else {
+ generate_serialize_set_element(out, (t_set*)ttype, iter_val);
+ }
scope_down(out);
} else if (ttype->is_list()) {
string iter = tmp("iter");
http://git-wip-us.apache.org/repos/asf/thrift/blob/9dff0efc/lib/php/Makefile.am
----------------------------------------------------------------------
diff --git a/lib/php/Makefile.am b/lib/php/Makefile.am
index 8e62960..5aa3be4 100755
--- a/lib/php/Makefile.am
+++ b/lib/php/Makefile.am
@@ -133,7 +133,6 @@ EXTRA_DIST = \
src/autoload.php \
src/ext/thrift_protocol/config.m4 \
src/ext/thrift_protocol/config.w32 \
- src/ext/thrift_protocol/php_thrift_protocol7.cpp \
src/ext/thrift_protocol/php_thrift_protocol.cpp \
src/ext/thrift_protocol/php_thrift_protocol.h \
src/ext/thrift_protocol/run-tests.php \
http://git-wip-us.apache.org/repos/asf/thrift/blob/9dff0efc/lib/php/src/ext/thrift_protocol/config.m4
----------------------------------------------------------------------
diff --git a/lib/php/src/ext/thrift_protocol/config.m4 b/lib/php/src/ext/thrift_protocol/config.m4
index 0fe3ef4..c54be3e 100644
--- a/lib/php/src/ext/thrift_protocol/config.m4
+++ b/lib/php/src/ext/thrift_protocol/config.m4
@@ -2,24 +2,31 @@ dnl Copyright (C) 2009 Facebook
dnl Copying and distribution of this file, with or without modification,
dnl are permitted in any medium without royalty provided the copyright
dnl notice and this notice are preserved.
+dnl
+dnl Licensed to the Apache Software Foundation (ASF) under one
+dnl or more contributor license agreements. See the NOTICE file
+dnl distributed with this work for additional information
+dnl regarding copyright ownership. The ASF licenses this file
+dnl to you under the Apache License, Version 2.0 (the
+dnl "License"); you may not use this file except in compliance
+dnl with the License. You may obtain a copy of the License at
+dnl
+dnl http://www.apache.org/licenses/LICENSE-2.0
+dnl
+dnl Unless required by applicable law or agreed to in writing,
+dnl software distributed under the License is distributed on an
+dnl "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+dnl KIND, either express or implied. See the License for the
+dnl specific language governing permissions and limitations
+dnl under the License.
PHP_ARG_ENABLE(thrift_protocol, whether to enable the thrift_protocol extension,
-[ --enable-thrift_protocol Enable the fbthrift_protocol extension])
+[ --enable-thrift_protocol Enable the thrift_protocol extension])
if test "$PHP_THRIFT_PROTOCOL" != "no"; then
PHP_REQUIRE_CXX()
- PHP_ADD_LIBRARY_WITH_PATH(stdc++, "", THRIFT_PROTOCOL_SHARED_LIBADD)
CXXFLAGS="$CXXFLAGS -std=c++11"
- AC_MSG_CHECKING([check for supported PHP versions])
- PHP_THRIFT_FOUND_VERSION=`${PHP_CONFIG} --version`
- PHP_THRIFT_FOUND_VERNUM=`echo "${PHP_THRIFT_FOUND_VERSION}" | $AWK 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 100 + [$]2) * 100 + [$]3;}'`
- if test "$PHP_THRIFT_FOUND_VERNUM" -ge "50000"; then
- PHP_SUBST(THRIFT_PROTOCOL_SHARED_LIBADD)
- PHP_NEW_EXTENSION(thrift_protocol, php_thrift_protocol.cpp php_thrift_protocol7.cpp, $ext_shared)
- AC_MSG_RESULT([supported ($PHP_THRIFT_FOUND_VERSION)])
- else
- AC_MSG_ERROR([unsupported PHP version ($PHP_THRIFT_FOUND_VERSION)])
- fi
+ PHP_NEW_EXTENSION(thrift_protocol, php_thrift_protocol.cpp, $ext_shared)
fi
http://git-wip-us.apache.org/repos/asf/thrift/blob/9dff0efc/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp
----------------------------------------------------------------------
diff --git a/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp b/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp
index 5374286..75ef2ec 100644
--- a/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp
+++ b/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp
@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
@@ -26,23 +25,14 @@
#include "zend_exceptions.h"
#include "php_thrift_protocol.h"
-/* GUARD FOR PHP 5 */
-#if PHP_VERSION_ID < 70000 && PHP_VERSION_ID > 50000
+#if PHP_VERSION_ID >= 70000
#include <sys/types.h>
-#if defined( WIN32 ) || defined( _WIN64 )
-typedef int int32_t;
-typedef signed char int8_t;
-typedef unsigned char uint8_t;
-typedef unsigned short uint16_t;
-typedef long long int64_t;
-typedef unsigned uint32_t;
-typedef short int16_t;
-typedef unsigned long long uint64_t;
-#else
-#include <arpa/inet.h>
-#endif
+#include <arpa/inet.h>
+
+#include <cstdint>
#include <stdexcept>
+#include <algorithm>
#ifndef bswap_64
#define bswap_64(x) (((uint64_t)(x) << 56) | \
@@ -96,21 +86,21 @@ const int INVALID_DATA = 1;
const int BAD_VERSION = 4;
static zend_function_entry thrift_protocol_functions[] = {
- PHP_FE(thrift_protocol_write_binary, NULL)
- PHP_FE(thrift_protocol_read_binary, NULL)
- PHP_FE(thrift_protocol_read_binary_after_message_begin, NULL)
- {NULL, NULL, NULL}
-} ;
+ PHP_FE(thrift_protocol_write_binary, nullptr)
+ PHP_FE(thrift_protocol_read_binary, nullptr)
+ PHP_FE(thrift_protocol_read_binary_after_message_begin, nullptr)
+ {nullptr, nullptr, nullptr}
+};
zend_module_entry thrift_protocol_module_entry = {
STANDARD_MODULE_HEADER,
"thrift_protocol",
thrift_protocol_functions,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
"1.0",
STANDARD_MODULE_PROPERTIES
};
@@ -121,42 +111,61 @@ ZEND_GET_MODULE(thrift_protocol)
class PHPExceptionWrapper : public std::exception {
public:
- PHPExceptionWrapper(zval* _ex) throw() : ex(_ex) {
- snprintf(_what, 40, "PHP exception zval=%p", ex);
+ PHPExceptionWrapper(zval* _ex) throw() {
+ ZVAL_COPY(&ex, _ex);
+ snprintf(_what, 40, "PHP exception zval=%p", _ex);
}
- const char* what() const throw() { return _what; }
- ~PHPExceptionWrapper() throw() {}
- operator zval*() const throw() { return const_cast<zval*>(ex); } // Zend API doesn't do 'const'...
+
+ PHPExceptionWrapper(zend_object* _exobj) throw() {
+ ZVAL_OBJ(&ex, _exobj);
+ snprintf(_what, 40, "PHP exception zval=%p", _exobj);
+ }
+ ~PHPExceptionWrapper() throw() {
+ zval_dtor(&ex);
+ }
+
+ const char* what() const throw() {
+ return _what;
+ }
+ operator zval*() const throw() {
+ return const_cast<zval*>(&ex);
+ } // Zend API doesn't do 'const'...
protected:
- zval* ex;
+ zval ex;
char _what[40];
} ;
class PHPTransport {
-public:
- zval* protocol() { return p; }
- zval* transport() { return t; }
protected:
- PHPTransport() {}
+ PHPTransport(zval* _p, size_t _buffer_size) {
+ assert(Z_TYPE_P(_p) == IS_OBJECT);
+
+ ZVAL_UNDEF(&t);
- void construct_with_zval(zval* _p, size_t _buffer_size) {
buffer = reinterpret_cast<char*>(emalloc(_buffer_size));
buffer_ptr = buffer;
buffer_used = 0;
buffer_size = _buffer_size;
- p = _p;
// Get the transport for the passed protocol
zval gettransport;
- ZVAL_STRING(&gettransport, "getTransport", 0);
- MAKE_STD_ZVAL(t);
- ZVAL_NULL(t);
- TSRMLS_FETCH();
- call_user_function(EG(function_table), &p, &gettransport, t, 0, NULL TSRMLS_CC);
+ ZVAL_STRING(&gettransport, "getTransport");
+ call_user_function(nullptr, _p, &gettransport, &t, 0, nullptr);
+
+ zval_dtor(&gettransport);
+
+ if (EG(exception)) {
+ zend_object *ex = EG(exception);
+ EG(exception) = nullptr;
+ throw PHPExceptionWrapper(ex);
+ }
+
+ assert(Z_TYPE(t) == IS_OBJECT);
}
+
~PHPTransport() {
efree(buffer);
- zval_ptr_dtor(&t);
+ zval_dtor(&t);
}
char* buffer;
@@ -164,20 +173,14 @@ protected:
size_t buffer_used;
size_t buffer_size;
- zval* p;
- zval* t;
+ zval t;
};
class PHPOutputTransport : public PHPTransport {
public:
- PHPOutputTransport(zval* _p, size_t _buffer_size = 8192) {
- construct_with_zval(_p, _buffer_size);
- }
-
- ~PHPOutputTransport() {
- //flush();
- }
+ PHPOutputTransport(zval* _p, size_t _buffer_size = 8192) : PHPTransport(_p, _buffer_size) { }
+ ~PHPOutputTransport() { }
void write(const char* data, size_t len) {
if ((len + buffer_used) > buffer_size) {
@@ -235,32 +238,35 @@ protected:
}
}
void directFlush() {
- zval ret;
+ zval ret, flushfn;
ZVAL_NULL(&ret);
- zval flushfn;
- ZVAL_STRING(&flushfn, "flush", 0);
- TSRMLS_FETCH();
- call_user_function(EG(function_table), &t, &flushfn, &ret, 0, NULL TSRMLS_CC);
+ ZVAL_STRING(&flushfn, "flush");
+
+ call_user_function(EG(function_table), &(this->t), &flushfn, &ret, 0, nullptr);
+ zval_dtor(&flushfn);
zval_dtor(&ret);
+ if (EG(exception)) {
+ zend_object *ex = EG(exception);
+ EG(exception) = nullptr;
+ throw PHPExceptionWrapper(ex);
+ }
}
void directWrite(const char* data, size_t len) {
- zval writefn;
- ZVAL_STRING(&writefn, "write", 0);
- char* newbuf = (char*)emalloc(len + 1);
- memcpy(newbuf, data, len);
- newbuf[len] = '\0';
- zval *args[1];
- MAKE_STD_ZVAL(args[0]);
- ZVAL_STRINGL(args[0], newbuf, len, 0);
- TSRMLS_FETCH();
- zval ret;
+ zval args[1], ret, writefn;
+
+ ZVAL_STRING(&writefn, "write");
+ ZVAL_STRINGL(&args[0], data, len);
+
ZVAL_NULL(&ret);
- call_user_function(EG(function_table), &t, &writefn, &ret, 1, args TSRMLS_CC);
- zval_ptr_dtor(args);
+ call_user_function(EG(function_table), &(this->t), &writefn, &ret, 1, args);
+
+ zval_dtor(&writefn);
zval_dtor(&ret);
+ zval_dtor(&args[0]);
+
if (EG(exception)) {
- zval* ex = EG(exception);
- EG(exception) = NULL;
+ zend_object *ex = EG(exception);
+ EG(exception) = nullptr;
throw PHPExceptionWrapper(ex);
}
}
@@ -268,8 +274,7 @@ protected:
class PHPInputTransport : public PHPTransport {
public:
- PHPInputTransport(zval* _p, size_t _buffer_size = 8192) {
- construct_with_zval(_p, _buffer_size);
+ PHPInputTransport(zval* _p, size_t _buffer_size = 8192) : PHPTransport(_p, _buffer_size) {
}
~PHPInputTransport() {
@@ -278,24 +283,21 @@ public:
void put_back() {
if (buffer_used) {
- zval putbackfn;
- ZVAL_STRING(&putbackfn, "putBack", 0);
-
- char* newbuf = (char*)emalloc(buffer_used + 1);
- memcpy(newbuf, buffer_ptr, buffer_used);
- newbuf[buffer_used] = '\0';
-
- zval *args[1];
- MAKE_STD_ZVAL(args[0]);
- ZVAL_STRINGL(args[0], newbuf, buffer_used, 0);
+ zval args[1], ret, putbackfn;
+ ZVAL_STRINGL(&args[0], buffer_ptr, buffer_used);
+ ZVAL_STRING(&putbackfn, "putBack");
+ ZVAL_NULL(&ret);
- TSRMLS_FETCH();
+ call_user_function(EG(function_table), &(this->t), &putbackfn, &ret, 1, args);
- zval ret;
- ZVAL_NULL(&ret);
- call_user_function(EG(function_table), &t, &putbackfn, &ret, 1, args TSRMLS_CC);
- zval_ptr_dtor(args);
+ zval_dtor(&putbackfn);
zval_dtor(&ret);
+ zval_dtor(&args[0]);
+ if (EG(exception)) {
+ zend_object *ex = EG(exception);
+ EG(exception) = nullptr;
+ throw PHPExceptionWrapper(ex);
+ }
}
buffer_used = 0;
buffer_ptr = buffer;
@@ -303,7 +305,7 @@ public:
void skip(size_t len) {
while (len) {
- size_t chunk_size = MIN(len, buffer_used);
+ size_t chunk_size = std::min(len, buffer_used);
if (chunk_size) {
buffer_ptr = reinterpret_cast<char*>(buffer_ptr) + chunk_size;
buffer_used -= chunk_size;
@@ -316,7 +318,7 @@ public:
void readBytes(void* buf, size_t len) {
while (len) {
- size_t chunk_size = MIN(len, buffer_used);
+ size_t chunk_size = std::min(len, buffer_used);
if (chunk_size) {
memcpy(buf, buffer_ptr, chunk_size);
buffer_ptr = reinterpret_cast<char*>(buffer_ptr) + chunk_size;
@@ -357,29 +359,29 @@ protected:
void refill() {
assert(buffer_used == 0);
zval retval;
- ZVAL_NULL(&retval);
-
- zval *args[1];
- MAKE_STD_ZVAL(args[0]);
- ZVAL_LONG(args[0], buffer_size);
+ zval args[1];
+ zval funcname;
- TSRMLS_FETCH();
+ ZVAL_NULL(&retval);
+ ZVAL_LONG(&args[0], buffer_size);
- zval funcname;
- ZVAL_STRING(&funcname, "read", 0);
+ ZVAL_STRING(&funcname, "read");
- call_user_function(EG(function_table), &t, &funcname, &retval, 1, args TSRMLS_CC);
- zval_ptr_dtor(args);
+ call_user_function(EG(function_table), &(this->t), &funcname, &retval, 1, args);
+ zval_dtor(&args[0]);
+ zval_dtor(&funcname);
if (EG(exception)) {
zval_dtor(&retval);
- zval* ex = EG(exception);
- EG(exception) = NULL;
+
+ zend_object *ex = EG(exception);
+ EG(exception) = nullptr;
throw PHPExceptionWrapper(ex);
}
buffer_used = Z_STRLEN(retval);
memcpy(buffer, Z_STRVAL(retval), buffer_used);
+
zval_dtor(&retval);
buffer_ptr = buffer;
@@ -387,57 +389,130 @@ protected:
};
+static
void binary_deserialize_spec(zval* zthis, PHPInputTransport& transport, HashTable* spec);
+static
void binary_serialize_spec(zval* zthis, PHPOutputTransport& transport, HashTable* spec);
-void binary_serialize(int8_t thrift_typeID, PHPOutputTransport& transport, zval** value, HashTable* fieldspec);
-void skip_element(long thrift_typeID, PHPInputTransport& transport);
-void protocol_writeMessageBegin(zval *transport, const char* method_name, int32_t msgtype, int32_t seqID);
-
+static
+void binary_serialize(int8_t thrift_typeID, PHPOutputTransport& transport, zval* value, HashTable* fieldspec);
+static inline
+bool ttype_is_scalar(int8_t t);
// Create a PHP object given a typename and call the ctor, optionally passing up to 2 arguments
-void createObject(const char* obj_typename, zval* return_value, int nargs = 0, zval* arg1 = NULL, zval* arg2 = NULL) {
- TSRMLS_FETCH();
- size_t obj_typename_len = strlen(obj_typename);
- zend_class_entry* ce = zend_fetch_class(obj_typename, obj_typename_len, ZEND_FETCH_CLASS_DEFAULT TSRMLS_CC);
+static
+void createObject(const char* obj_typename, zval* return_value, int nargs = 0, zval* arg1 = nullptr, zval* arg2 = nullptr) {
+ /* is there a better way to do that on the stack ? */
+ zend_string *obj_name = zend_string_init(obj_typename, strlen(obj_typename), 0);
+ zend_class_entry* ce = zend_fetch_class(obj_name, ZEND_FETCH_CLASS_DEFAULT);
+ zend_string_release(obj_name);
+
if (! ce) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Class %s does not exist", obj_typename);
+ php_error_docref(nullptr, E_ERROR, "Class %s does not exist", obj_typename);
RETURN_NULL();
}
- object_and_properties_init(return_value, ce, NULL);
- zend_function* constructor = zend_std_get_constructor(return_value TSRMLS_CC);
- zval* ctor_rv = NULL;
- zend_call_method(&return_value, ce, &constructor, NULL, 0, &ctor_rv, nargs, arg1, arg2 TSRMLS_CC);
- zval_ptr_dtor(&ctor_rv);
+ object_and_properties_init(return_value, ce, nullptr);
+ zend_function* constructor = zend_std_get_constructor(Z_OBJ_P(return_value));
+ zval ctor_rv;
+ zend_call_method(return_value, ce, &constructor, NULL, 0, &ctor_rv, nargs, arg1, arg2);
+ zval_dtor(&ctor_rv);
+ if (EG(exception)) {
+ zend_object *ex = EG(exception);
+ EG(exception) = nullptr;
+ throw PHPExceptionWrapper(ex);
+ }
}
+static
void throw_tprotocolexception(const char* what, long errorcode) {
- TSRMLS_FETCH();
+ zval zwhat, zerrorcode;
+
+ ZVAL_STRING(&zwhat, what);
+ ZVAL_LONG(&zerrorcode, errorcode);
- zval *zwhat, *zerrorcode;
- MAKE_STD_ZVAL(zwhat);
- MAKE_STD_ZVAL(zerrorcode);
+ zval ex;
+ createObject("\\Thrift\\Exception\\TProtocolException", &ex, 2, &zwhat, &zerrorcode);
- ZVAL_STRING(zwhat, what, 1);
- ZVAL_LONG(zerrorcode, errorcode);
+ zval_dtor(&zwhat);
+ zval_dtor(&zerrorcode);
- zval* ex;
- MAKE_STD_ZVAL(ex);
- createObject("\\Thrift\\Exception\\TProtocolException", ex, 2, zwhat, zerrorcode);
- zval_ptr_dtor(&zwhat);
- zval_ptr_dtor(&zerrorcode);
- throw PHPExceptionWrapper(ex);
+ throw PHPExceptionWrapper(&ex);
}
// Sets EG(exception), call this and then RETURN_NULL();
-void throw_zend_exception_from_std_exception(const std::exception& ex TSRMLS_DC) {
- zend_throw_exception(zend_exception_get_default(TSRMLS_C), const_cast<char*>(ex.what()), 0 TSRMLS_CC);
+static
+void throw_zend_exception_from_std_exception(const std::exception& ex) {
+ zend_throw_exception(zend_exception_get_default(), const_cast<char*>(ex.what()), 0);
+}
+
+static
+void skip_element(long thrift_typeID, PHPInputTransport& transport) {
+ switch (thrift_typeID) {
+ case T_STOP:
+ case T_VOID:
+ return;
+ case T_STRUCT:
+ while (true) {
+ int8_t ttype = transport.readI8(); // get field type
+ if (ttype == T_STOP) break;
+ transport.skip(2); // skip field number, I16
+ skip_element(ttype, transport); // skip field payload
+ }
+ return;
+ case T_BOOL:
+ case T_BYTE:
+ transport.skip(1);
+ return;
+ case T_I16:
+ transport.skip(2);
+ return;
+ case T_I32:
+ transport.skip(4);
+ return;
+ case T_U64:
+ case T_I64:
+ case T_DOUBLE:
+ transport.skip(8);
+ return;
+ //case T_UTF7: // aliases T_STRING
+ case T_UTF8:
+ case T_UTF16:
+ case T_STRING: {
+ uint32_t len = transport.readU32();
+ transport.skip(len);
+ } return;
+ case T_MAP: {
+ int8_t keytype = transport.readI8();
+ int8_t valtype = transport.readI8();
+ uint32_t size = transport.readU32();
+ for (uint32_t i = 0; i < size; ++i) {
+ skip_element(keytype, transport);
+ skip_element(valtype, transport);
+ }
+ } return;
+ case T_LIST:
+ case T_SET: {
+ int8_t valtype = transport.readI8();
+ uint32_t size = transport.readU32();
+ for (uint32_t i = 0; i < size; ++i) {
+ skip_element(valtype, transport);
+ }
+ } return;
+ };
+
+ char errbuf[128];
+ sprintf(errbuf, "Unknown thrift typeID %ld", thrift_typeID);
+ throw_tprotocolexception(errbuf, INVALID_DATA);
}
+static inline
+bool zval_is_bool(zval* v) {
+ return Z_TYPE_P(v) == IS_TRUE || Z_TYPE_P(v) == IS_FALSE;
+}
+static
void binary_deserialize(int8_t thrift_typeID, PHPInputTransport& transport, zval* return_value, HashTable* fieldspec) {
- zval** val_ptr;
- Z_TYPE_P(return_value) = IS_NULL; // just in case
+ ZVAL_NULL(return_value);
switch (thrift_typeID) {
case T_STOP:
@@ -445,20 +520,28 @@ void binary_deserialize(int8_t thrift_typeID, PHPInputTransport& transport, zval
RETURN_NULL();
return;
case T_STRUCT: {
- if (zend_hash_find(fieldspec, "class", 6, (void**)&val_ptr) != SUCCESS) {
+ zval* val_ptr = zend_hash_str_find(fieldspec, "class", sizeof("class")-1);
+ if (val_ptr == nullptr) {
throw_tprotocolexception("no class type in spec", INVALID_DATA);
skip_element(T_STRUCT, transport);
RETURN_NULL();
}
- char* structType = Z_STRVAL_PP(val_ptr);
+
+ char* structType = Z_STRVAL_P(val_ptr);
+ // Create an object in PHP userland based on our spec
createObject(structType, return_value);
if (Z_TYPE_P(return_value) == IS_NULL) {
// unable to create class entry
skip_element(T_STRUCT, transport);
RETURN_NULL();
}
- TSRMLS_FETCH();
- zval* spec = zend_read_static_property(zend_get_class_entry(return_value TSRMLS_CC), "_TSPEC", 6, false TSRMLS_CC);
+
+ zval* spec = zend_read_static_property(Z_OBJCE_P(return_value), "_TSPEC", sizeof("_TSPEC")-1, false);
+ if (EG(exception)) {
+ zend_object *ex = EG(exception);
+ EG(exception) = nullptr;
+ throw PHPExceptionWrapper(ex);
+ }
if (Z_TYPE_P(spec) != IS_ARRAY) {
char errbuf[128];
snprintf(errbuf, 128, "spec for %s is wrong type: %d\n", structType, Z_TYPE_P(spec));
@@ -510,10 +593,10 @@ void binary_deserialize(int8_t thrift_typeID, PHPInputTransport& transport, zval
case T_STRING: {
uint32_t size = transport.readU32();
if (size) {
- char* strbuf = (char*) emalloc(size + 1);
+ char strbuf[size+1];
transport.readBytes(strbuf, size);
strbuf[size] = '\0';
- ZVAL_STRINGL(return_value, strbuf, size, 0);
+ ZVAL_STRINGL(return_value, strbuf, size);
} else {
ZVAL_EMPTY_STRING(return_value);
}
@@ -525,43 +608,38 @@ void binary_deserialize(int8_t thrift_typeID, PHPInputTransport& transport, zval
uint32_t size = transport.readU32();
array_init(return_value);
- zend_hash_find(fieldspec, "key", 4, (void**)&val_ptr);
- HashTable* keyspec = Z_ARRVAL_PP(val_ptr);
- zend_hash_find(fieldspec, "val", 4, (void**)&val_ptr);
- HashTable* valspec = Z_ARRVAL_PP(val_ptr);
+ zval *val_ptr;
+ val_ptr = zend_hash_str_find(fieldspec, "key", sizeof("key")-1);
+ HashTable* keyspec = Z_ARRVAL_P(val_ptr);
+ val_ptr = zend_hash_str_find(fieldspec, "val", sizeof("val")-1);
+ HashTable* valspec = Z_ARRVAL_P(val_ptr);
for (uint32_t s = 0; s < size; ++s) {
- zval *value;
- MAKE_STD_ZVAL(value);
-
- zval* key;
- MAKE_STD_ZVAL(key);
-
- binary_deserialize(types[0], transport, key, keyspec);
- binary_deserialize(types[1], transport, value, valspec);
- if (Z_TYPE_P(key) == IS_LONG) {
- zend_hash_index_update(return_value->value.ht, Z_LVAL_P(key), &value, sizeof(zval *), NULL);
+ zval key, value;
+
+ binary_deserialize(types[0], transport, &key, keyspec);
+ binary_deserialize(types[1], transport, &value, valspec);
+ if (Z_TYPE(key) == IS_LONG) {
+ zend_hash_index_update(Z_ARR_P(return_value), Z_LVAL(key), &value);
+ } else {
+ if (Z_TYPE(key) != IS_STRING) convert_to_string(&key);
+ zend_symtable_update(Z_ARR_P(return_value), Z_STR(key), &value);
}
- else {
- if (Z_TYPE_P(key) != IS_STRING) convert_to_string(key);
- zend_symtable_update(return_value->value.ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &value, sizeof(zval *), NULL);
- }
- zval_ptr_dtor(&key);
+ zval_dtor(&key);
}
return; // return_value already populated
}
case T_LIST: { // array with autogenerated numeric keys
int8_t type = transport.readI8();
uint32_t size = transport.readU32();
- zend_hash_find(fieldspec, "elem", 5, (void**)&val_ptr);
- HashTable* elemspec = Z_ARRVAL_PP(val_ptr);
+ zval *val_ptr = zend_hash_str_find(fieldspec, "elem", sizeof("elem")-1);
+ HashTable* elemspec = Z_ARRVAL_P(val_ptr);
array_init(return_value);
for (uint32_t s = 0; s < size; ++s) {
- zval *value;
- MAKE_STD_ZVAL(value);
- binary_deserialize(type, transport, value, elemspec);
- zend_hash_next_index_insert(return_value->value.ht, &value, sizeof(zval *), NULL);
+ zval value;
+ binary_deserialize(type, transport, &value, elemspec);
+ zend_hash_next_index_insert(Z_ARR_P(return_value), &value);
}
return;
}
@@ -571,28 +649,24 @@ void binary_deserialize(int8_t thrift_typeID, PHPInputTransport& transport, zval
transport.readBytes(&type, 1);
transport.readBytes(&size, 4);
size = ntohl(size);
- zend_hash_find(fieldspec, "elem", 5, (void**)&val_ptr);
- HashTable* elemspec = Z_ARRVAL_PP(val_ptr);
+ zval *val_ptr = zend_hash_str_find(fieldspec, "elem", sizeof("elem")-1);
+ HashTable* elemspec = Z_ARRVAL_P(val_ptr);
array_init(return_value);
for (uint32_t s = 0; s < size; ++s) {
- zval* key;
- zval* value;
- MAKE_STD_ZVAL(key);
- MAKE_STD_ZVAL(value);
- ZVAL_TRUE(value);
+ zval key, value;
+ ZVAL_TRUE(&value);
- binary_deserialize(type, transport, key, elemspec);
+ binary_deserialize(type, transport, &key, elemspec);
- if (Z_TYPE_P(key) == IS_LONG) {
- zend_hash_index_update(return_value->value.ht, Z_LVAL_P(key), &value, sizeof(zval *), NULL);
- }
- else {
- if (Z_TYPE_P(key) != IS_STRING) convert_to_string(key);
- zend_symtable_update(return_value->value.ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &value, sizeof(zval *), NULL);
+ if (Z_TYPE(key) == IS_LONG) {
+ zend_hash_index_update(Z_ARR_P(return_value), Z_LVAL(key), &value);
+ } else {
+ if (Z_TYPE(key) != IS_STRING) convert_to_string(&key);
+ zend_symtable_update(Z_ARR_P(return_value), Z_STR(key), &value);
}
- zval_ptr_dtor(&key);
+ zval_dtor(&key);
}
return;
}
@@ -603,251 +677,68 @@ void binary_deserialize(int8_t thrift_typeID, PHPInputTransport& transport, zval
throw_tprotocolexception(errbuf, INVALID_DATA);
}
-void skip_element(long thrift_typeID, PHPInputTransport& transport) {
- switch (thrift_typeID) {
- case T_STOP:
- case T_VOID:
- return;
- case T_STRUCT:
- while (true) {
- int8_t ttype = transport.readI8(); // get field type
- if (ttype == T_STOP) break;
- transport.skip(2); // skip field number, I16
- skip_element(ttype, transport); // skip field payload
- }
- return;
- case T_BOOL:
- case T_BYTE:
- transport.skip(1);
- return;
- case T_I16:
- transport.skip(2);
- return;
- case T_I32:
- transport.skip(4);
- return;
- case T_U64:
- case T_I64:
- case T_DOUBLE:
- transport.skip(8);
- return;
- //case T_UTF7: // aliases T_STRING
- case T_UTF8:
- case T_UTF16:
- case T_STRING: {
- uint32_t len = transport.readU32();
- transport.skip(len);
- } return;
- case T_MAP: {
- int8_t keytype = transport.readI8();
- int8_t valtype = transport.readI8();
- uint32_t size = transport.readU32();
- for (uint32_t i = 0; i < size; ++i) {
- skip_element(keytype, transport);
- skip_element(valtype, transport);
- }
- } return;
- case T_LIST:
- case T_SET: {
- int8_t valtype = transport.readI8();
- uint32_t size = transport.readU32();
- for (uint32_t i = 0; i < size; ++i) {
- skip_element(valtype, transport);
- }
- } return;
- };
-
- char errbuf[128];
- sprintf(errbuf, "Unknown thrift typeID %ld", thrift_typeID);
- throw_tprotocolexception(errbuf, INVALID_DATA);
-}
-
-void protocol_writeMessageBegin(zval* transport, const char* method_name, int32_t msgtype, int32_t seqID) {
- TSRMLS_FETCH();
- zval *args[3];
-
- MAKE_STD_ZVAL(args[0]);
- ZVAL_STRINGL(args[0], (char*)method_name, strlen(method_name), 1);
-
- MAKE_STD_ZVAL(args[1]);
- ZVAL_LONG(args[1], msgtype);
-
- MAKE_STD_ZVAL(args[2]);
- ZVAL_LONG(args[2], seqID);
-
- zval ret;
- ZVAL_NULL(&ret);
-
- zval writeMessagefn;
- ZVAL_STRING(&writeMessagefn, "writeMessageBegin", 0);
-
- call_user_function(EG(function_table), &transport, &writeMessagefn, &ret, 3, args TSRMLS_CC);
-
- zval_ptr_dtor(&args[0]);
- zval_ptr_dtor(&args[1]);
- zval_ptr_dtor(&args[2]);
- zval_dtor(&ret);
-}
-
-void binary_serialize_hashtable_key(int8_t keytype, PHPOutputTransport& transport, HashTable* ht, HashPosition& ht_pos) {
+static
+void binary_serialize_hashtable_key(int8_t keytype, PHPOutputTransport& transport, HashTable* ht, HashPosition& ht_pos, HashTable* spec) {
bool keytype_is_numeric = (!((keytype == T_STRING) || (keytype == T_UTF8) || (keytype == T_UTF16)));
- char* key;
+ zend_string* key;
uint key_len;
long index = 0;
- zval* z;
- MAKE_STD_ZVAL(z);
+ zval z;
- int res = zend_hash_get_current_key_ex(ht, &key, &key_len, (ulong*)&index, 0, &ht_pos);
- if (keytype_is_numeric) {
- if (res == HASH_KEY_IS_STRING) {
- index = strtol(key, NULL, 10);
- }
- ZVAL_LONG(z, index);
+ int res = zend_hash_get_current_key_ex(ht, &key, (zend_ulong*)&index, &ht_pos);
+ if (res == HASH_KEY_IS_STRING) {
+ ZVAL_STR_COPY(&z, key);
} else {
- char buf[64];
- if (res == HASH_KEY_IS_STRING) {
- key_len -= 1; // skip the null terminator
- } else {
- sprintf(buf, "%ld", index);
- key = buf; key_len = strlen(buf);
- }
- ZVAL_STRINGL(z, key, key_len, 1);
+ ZVAL_LONG(&z, index);
}
- binary_serialize(keytype, transport, &z, NULL);
- zval_ptr_dtor(&z);
-}
-
-inline bool ttype_is_int(int8_t t) {
- return ((t == T_BYTE) || ((t >= T_I16) && (t <= T_I64)));
-}
-
-inline bool ttypes_are_compatible(int8_t t1, int8_t t2) {
- // Integer types of different widths are considered compatible;
- // otherwise the typeID must match.
- return ((t1 == t2) || (ttype_is_int(t1) && ttype_is_int(t2)));
+ binary_serialize(keytype, transport, &z, spec);
+ zval_dtor(&z);
}
-//is used to validate objects before serialization and after deserialization. For now, only required fields are validated.
static
-void validate_thrift_object(zval* object) {
-
- HashPosition key_ptr;
- zval** val_ptr;
-
- TSRMLS_FETCH();
- zend_class_entry* object_class_entry = zend_get_class_entry(object TSRMLS_CC);
- HashTable* spec = Z_ARRVAL_P(zend_read_static_property(object_class_entry, "_TSPEC", 6, false TSRMLS_CC));
-
- for (zend_hash_internal_pointer_reset_ex(spec, &key_ptr); zend_hash_get_current_data_ex(spec, (void**)&val_ptr, &key_ptr) == SUCCESS; zend_hash_move_forward_ex(spec, &key_ptr)) {
- ulong fieldno;
- if (zend_hash_get_current_key_ex(spec, NULL, NULL, &fieldno, 0, &key_ptr) != HASH_KEY_IS_LONG) {
- throw_tprotocolexception("Bad keytype in TSPEC (expected 'long')", INVALID_DATA);
- return;
- }
- HashTable* fieldspec = Z_ARRVAL_PP(val_ptr);
-
- // field name
- zend_hash_find(fieldspec, "var", 4, (void**)&val_ptr);
- char* varname = Z_STRVAL_PP(val_ptr);
-
- zend_hash_find(fieldspec, "isRequired", 11, (void**)&val_ptr);
- bool is_required = Z_BVAL_PP(val_ptr);
-
- zval* prop = zend_read_property(object_class_entry, object, varname, strlen(varname), false TSRMLS_CC);
-
- if (is_required && Z_TYPE_P(prop) == IS_NULL) {
- char errbuf[128];
- snprintf(errbuf, 128, "Required field %s.%s is unset!", object_class_entry->name, varname);
- throw_tprotocolexception(errbuf, INVALID_DATA);
- }
- }
-}
-
-void binary_deserialize_spec(zval* zthis, PHPInputTransport& transport, HashTable* spec) {
- // SET and LIST have 'elem' => array('type', [optional] 'class')
- // MAP has 'val' => array('type', [optiona] 'class')
- TSRMLS_FETCH();
- zend_class_entry* ce = zend_get_class_entry(zthis TSRMLS_CC);
- while (true) {
- zval** val_ptr = NULL;
-
- int8_t ttype = transport.readI8();
- if (ttype == T_STOP) {
- validate_thrift_object(zthis);
- return;
- }
- int16_t fieldno = transport.readI16();
- if (zend_hash_index_find(spec, fieldno, (void**)&val_ptr) == SUCCESS) {
- HashTable* fieldspec = Z_ARRVAL_PP(val_ptr);
- // pull the field name
- // zend hash tables use the null at the end in the length... so strlen(hash key) + 1.
- zend_hash_find(fieldspec, "var", 4, (void**)&val_ptr);
- char* varname = Z_STRVAL_PP(val_ptr);
-
- // and the type
- zend_hash_find(fieldspec, "type", 5, (void**)&val_ptr);
- if (Z_TYPE_PP(val_ptr) != IS_LONG) convert_to_long(*val_ptr);
- int8_t expected_ttype = Z_LVAL_PP(val_ptr);
-
- if (ttypes_are_compatible(ttype, expected_ttype)) {
- zval* rv = NULL;
- MAKE_STD_ZVAL(rv);
- binary_deserialize(ttype, transport, rv, fieldspec);
- zend_update_property(ce, zthis, varname, strlen(varname), rv TSRMLS_CC);
- zval_ptr_dtor(&rv);
- } else {
- skip_element(ttype, transport);
- }
- } else {
- skip_element(ttype, transport);
- }
- }
-}
-
-void binary_serialize(int8_t thrift_typeID, PHPOutputTransport& transport, zval** value, HashTable* fieldspec) {
+void binary_serialize(int8_t thrift_typeID, PHPOutputTransport& transport, zval* value, HashTable* fieldspec) {
// At this point the typeID (and field num, if applicable) should've already been written to the output so all we need to do is write the payload.
switch (thrift_typeID) {
case T_STOP:
case T_VOID:
return;
case T_STRUCT: {
- TSRMLS_FETCH();
- if (Z_TYPE_PP(value) != IS_OBJECT) {
+ if (Z_TYPE_P(value) != IS_OBJECT) {
throw_tprotocolexception("Attempt to send non-object type as a T_STRUCT", INVALID_DATA);
}
- zval* spec = zend_read_static_property(zend_get_class_entry(*value TSRMLS_CC), "_TSPEC", 6, false TSRMLS_CC);
- if (Z_TYPE_P(spec) != IS_ARRAY) {
+ zval* spec = zend_read_static_property(Z_OBJCE_P(value), "_TSPEC", sizeof("_TSPEC")-1, true);
+ if (!spec || Z_TYPE_P(spec) != IS_ARRAY) {
throw_tprotocolexception("Attempt to send non-Thrift object as a T_STRUCT", INVALID_DATA);
}
- binary_serialize_spec(*value, transport, Z_ARRVAL_P(spec));
+ binary_serialize_spec(value, transport, Z_ARRVAL_P(spec));
} return;
case T_BOOL:
- if (Z_TYPE_PP(value) != IS_BOOL) convert_to_boolean(*value);
- transport.writeI8(Z_BVAL_PP(value) ? 1 : 0);
+ if (!zval_is_bool(value)) convert_to_boolean(value);
+ transport.writeI8(Z_TYPE_INFO_P(value) == IS_TRUE ? 1 : 0);
return;
case T_BYTE:
- if (Z_TYPE_PP(value) != IS_LONG) convert_to_long(*value);
- transport.writeI8(Z_LVAL_PP(value));
+ if (Z_TYPE_P(value) != IS_LONG) convert_to_long(value);
+ transport.writeI8(Z_LVAL_P(value));
return;
case T_I16:
- if (Z_TYPE_PP(value) != IS_LONG) convert_to_long(*value);
- transport.writeI16(Z_LVAL_PP(value));
+ if (Z_TYPE_P(value) != IS_LONG) convert_to_long(value);
+ transport.writeI16(Z_LVAL_P(value));
return;
case T_I32:
- if (Z_TYPE_PP(value) != IS_LONG) convert_to_long(*value);
- transport.writeI32(Z_LVAL_PP(value));
+ if (Z_TYPE_P(value) != IS_LONG) convert_to_long(value);
+ transport.writeI32(Z_LVAL_P(value));
return;
case T_I64:
case T_U64: {
int64_t l_data;
#if defined(_LP64) || defined(_WIN64)
- if (Z_TYPE_PP(value) != IS_LONG) convert_to_long(*value);
- l_data = Z_LVAL_PP(value);
+ if (Z_TYPE_P(value) != IS_LONG) convert_to_long(value);
+ l_data = Z_LVAL_P(value);
#else
- if (Z_TYPE_PP(value) != IS_DOUBLE) convert_to_double(*value);
- l_data = (int64_t)Z_DVAL_PP(value);
+ if (Z_TYPE_P(value) != IS_DOUBLE) convert_to_double(value);
+ l_data = (int64_t)Z_DVAL_P(value);
#endif
transport.writeI64(l_data);
} return;
@@ -856,124 +747,265 @@ void binary_serialize(int8_t thrift_typeID, PHPOutputTransport& transport, zval*
int64_t c;
double d;
} a;
- if (Z_TYPE_PP(value) != IS_DOUBLE) convert_to_double(*value);
- a.d = Z_DVAL_PP(value);
+ if (Z_TYPE_P(value) != IS_DOUBLE) convert_to_double(value);
+ a.d = Z_DVAL_P(value);
transport.writeI64(a.c);
} return;
- //case T_UTF7:
case T_UTF8:
case T_UTF16:
case T_STRING:
- if (Z_TYPE_PP(value) != IS_STRING) convert_to_string(*value);
- transport.writeString(Z_STRVAL_PP(value), Z_STRLEN_PP(value));
+ if (Z_TYPE_P(value) != IS_STRING) convert_to_string(value);
+ transport.writeString(Z_STRVAL_P(value), Z_STRLEN_P(value));
return;
case T_MAP: {
- if (Z_TYPE_PP(value) != IS_ARRAY) convert_to_array(*value);
- if (Z_TYPE_PP(value) != IS_ARRAY) {
+ if (Z_TYPE_P(value) != IS_ARRAY) convert_to_array(value);
+ if (Z_TYPE_P(value) != IS_ARRAY) {
throw_tprotocolexception("Attempt to send an incompatible type as an array (T_MAP)", INVALID_DATA);
}
- HashTable* ht = Z_ARRVAL_PP(value);
- zval** val_ptr;
+ HashTable* ht = Z_ARRVAL_P(value);
+ zval* val_ptr;
- zend_hash_find(fieldspec, "ktype", 6, (void**)&val_ptr);
- if (Z_TYPE_PP(val_ptr) != IS_LONG) convert_to_long(*val_ptr);
- uint8_t keytype = Z_LVAL_PP(val_ptr);
+ val_ptr = zend_hash_str_find(fieldspec, "ktype", sizeof("ktype")-1);
+ if (Z_TYPE_P(val_ptr) != IS_LONG) convert_to_long(val_ptr);
+ uint8_t keytype = Z_LVAL_P(val_ptr);
transport.writeI8(keytype);
- zend_hash_find(fieldspec, "vtype", 6, (void**)&val_ptr);
- if (Z_TYPE_PP(val_ptr) != IS_LONG) convert_to_long(*val_ptr);
- uint8_t valtype = Z_LVAL_PP(val_ptr);
+ val_ptr = zend_hash_str_find(fieldspec, "vtype", sizeof("vtype")-1);
+ if (Z_TYPE_P(val_ptr) != IS_LONG) convert_to_long(val_ptr);
+ uint8_t valtype = Z_LVAL_P(val_ptr);
transport.writeI8(valtype);
- zend_hash_find(fieldspec, "val", 4, (void**)&val_ptr);
- HashTable* valspec = Z_ARRVAL_PP(val_ptr);
+ val_ptr = zend_hash_str_find(fieldspec, "val", sizeof("val")-1);
+ HashTable* valspec = Z_ARRVAL_P(val_ptr);
+ HashTable* keyspec = Z_ARRVAL_P(zend_hash_str_find(fieldspec, "key", sizeof("key")-1));
transport.writeI32(zend_hash_num_elements(ht));
HashPosition key_ptr;
- for (zend_hash_internal_pointer_reset_ex(ht, &key_ptr); zend_hash_get_current_data_ex(ht, (void**)&val_ptr, &key_ptr) == SUCCESS; zend_hash_move_forward_ex(ht, &key_ptr)) {
- binary_serialize_hashtable_key(keytype, transport, ht, key_ptr);
+ for (zend_hash_internal_pointer_reset_ex(ht, &key_ptr);
+ (val_ptr = zend_hash_get_current_data_ex(ht, &key_ptr)) != nullptr;
+ zend_hash_move_forward_ex(ht, &key_ptr)) {
+ binary_serialize_hashtable_key(keytype, transport, ht, key_ptr, keyspec);
binary_serialize(valtype, transport, val_ptr, valspec);
}
} return;
case T_LIST: {
- if (Z_TYPE_PP(value) != IS_ARRAY) convert_to_array(*value);
- if (Z_TYPE_PP(value) != IS_ARRAY) {
+ if (Z_TYPE_P(value) != IS_ARRAY) convert_to_array(value);
+ if (Z_TYPE_P(value) != IS_ARRAY) {
throw_tprotocolexception("Attempt to send an incompatible type as an array (T_LIST)", INVALID_DATA);
}
- HashTable* ht = Z_ARRVAL_PP(value);
- zval** val_ptr;
+ HashTable* ht = Z_ARRVAL_P(value);
+ zval* val_ptr;
- zend_hash_find(fieldspec, "etype", 6, (void**)&val_ptr);
- if (Z_TYPE_PP(val_ptr) != IS_LONG) convert_to_long(*val_ptr);
- uint8_t valtype = Z_LVAL_PP(val_ptr);
+ val_ptr = zend_hash_str_find(fieldspec, "etype", sizeof("etype")-1);
+ if (Z_TYPE_P(val_ptr) != IS_LONG) convert_to_long(val_ptr);
+ uint8_t valtype = Z_LVAL_P(val_ptr);
transport.writeI8(valtype);
- zend_hash_find(fieldspec, "elem", 5, (void**)&val_ptr);
- HashTable* valspec = Z_ARRVAL_PP(val_ptr);
+ val_ptr = zend_hash_str_find(fieldspec, "elem", sizeof("elem")-1);
+ HashTable* valspec = Z_ARRVAL_P(val_ptr);
transport.writeI32(zend_hash_num_elements(ht));
HashPosition key_ptr;
- for (zend_hash_internal_pointer_reset_ex(ht, &key_ptr); zend_hash_get_current_data_ex(ht, (void**)&val_ptr, &key_ptr) == SUCCESS; zend_hash_move_forward_ex(ht, &key_ptr)) {
+ for (zend_hash_internal_pointer_reset_ex(ht, &key_ptr);
+ (val_ptr = zend_hash_get_current_data_ex(ht, &key_ptr)) != nullptr;
+ zend_hash_move_forward_ex(ht, &key_ptr)) {
binary_serialize(valtype, transport, val_ptr, valspec);
}
} return;
case T_SET: {
- if (Z_TYPE_PP(value) != IS_ARRAY) convert_to_array(*value);
- if (Z_TYPE_PP(value) != IS_ARRAY) {
+ if (Z_TYPE_P(value) != IS_ARRAY) convert_to_array(value);
+ if (Z_TYPE_P(value) != IS_ARRAY) {
throw_tprotocolexception("Attempt to send an incompatible type as an array (T_SET)", INVALID_DATA);
}
- HashTable* ht = Z_ARRVAL_PP(value);
- zval** val_ptr;
+ HashTable* ht = Z_ARRVAL_P(value);
+ zval* val_ptr;
- zend_hash_find(fieldspec, "etype", 6, (void**)&val_ptr);
- if (Z_TYPE_PP(val_ptr) != IS_LONG) convert_to_long(*val_ptr);
- uint8_t keytype = Z_LVAL_PP(val_ptr);
+ val_ptr = zend_hash_str_find(fieldspec, "etype", sizeof("etype")-1);
+ HashTable* spec = Z_ARRVAL_P(zend_hash_str_find(fieldspec, "elem", sizeof("elem")-1));
+ if (Z_TYPE_P(val_ptr) != IS_LONG) convert_to_long(val_ptr);
+ uint8_t keytype = Z_LVAL_P(val_ptr);
transport.writeI8(keytype);
transport.writeI32(zend_hash_num_elements(ht));
HashPosition key_ptr;
- for (zend_hash_internal_pointer_reset_ex(ht, &key_ptr); zend_hash_get_current_data_ex(ht, (void**)&val_ptr, &key_ptr) == SUCCESS; zend_hash_move_forward_ex(ht, &key_ptr)) {
- binary_serialize_hashtable_key(keytype, transport, ht, key_ptr);
+ if(ttype_is_scalar(keytype)){
+ for (zend_hash_internal_pointer_reset_ex(ht, &key_ptr);
+ (val_ptr = zend_hash_get_current_data_ex(ht, &key_ptr)) != nullptr;
+ zend_hash_move_forward_ex(ht, &key_ptr)) {
+ binary_serialize_hashtable_key(keytype, transport, ht, key_ptr, spec);
+ }
+ } else {
+ for (zend_hash_internal_pointer_reset_ex(ht, &key_ptr);
+ (val_ptr = zend_hash_get_current_data_ex(ht, &key_ptr)) != nullptr;
+ zend_hash_move_forward_ex(ht, &key_ptr)) {
+ binary_serialize(keytype, transport, val_ptr, spec);
+ }
}
} return;
};
+
char errbuf[128];
- sprintf(errbuf, "Unknown thrift typeID %d", thrift_typeID);
+ snprintf(errbuf, 128, "Unknown thrift typeID %d", thrift_typeID);
throw_tprotocolexception(errbuf, INVALID_DATA);
}
+static
+void protocol_writeMessageBegin(zval* transport, zend_string* method_name, int32_t msgtype, int32_t seqID) {
+ zval args[3];
+ zval ret;
+ zval writeMessagefn;
+
+ ZVAL_STR_COPY(&args[0], method_name);
+ ZVAL_LONG(&args[1], msgtype);
+ ZVAL_LONG(&args[2], seqID);
+ ZVAL_NULL(&ret);
+ ZVAL_STRING(&writeMessagefn, "writeMessageBegin");
+
+ call_user_function(EG(function_table), transport, &writeMessagefn, &ret, 3, args);
+
+ zval_dtor(&writeMessagefn);
+ zval_dtor(&args[2]); zval_dtor(&args[1]); zval_dtor(&args[0]);
+ zval_dtor(&ret);
+ if (EG(exception)) {
+ zend_object *ex = EG(exception);
+ EG(exception) = nullptr;
+ throw PHPExceptionWrapper(ex);
+ }
+}
+
+static inline
+bool ttype_is_int(int8_t t) {
+ return ((t == T_BYTE) || ((t >= T_I16) && (t <= T_I64)));
+}
+static inline
+bool ttype_is_scalar(int8_t t) {
+ return !((t == T_STRUCT) || ( t== T_MAP) || (t == T_SET) || (t == T_LIST));
+}
+static inline
+bool ttypes_are_compatible(int8_t t1, int8_t t2) {
+ // Integer types of different widths are considered compatible;
+ // otherwise the typeID must match.
+ return ((t1 == t2) || (ttype_is_int(t1) && ttype_is_int(t2)));
+}
+
+//is used to validate objects before serialization and after deserialization. For now, only required fields are validated.
+static
+void validate_thrift_object(zval* object) {
+ zend_class_entry* object_class_entry = Z_OBJCE_P(object);
+ zval* is_validate = zend_read_static_property(object_class_entry, "isValidate", sizeof("isValidate")-1, true);
+ zval* spec = zend_read_static_property(object_class_entry, "_TSPEC", sizeof("_TSPEC")-1, true);
+ HashPosition key_ptr;
+ zval* val_ptr;
+
+ if (is_validate && Z_TYPE_INFO_P(is_validate) == IS_TRUE) {
+ for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(spec), &key_ptr);
+ (val_ptr = zend_hash_get_current_data_ex(Z_ARRVAL_P(spec), &key_ptr)) != nullptr;
+ zend_hash_move_forward_ex(Z_ARRVAL_P(spec), &key_ptr)) {
+
+ zend_ulong fieldno;
+ if (zend_hash_get_current_key_ex(Z_ARRVAL_P(spec), nullptr, &fieldno, &key_ptr) != HASH_KEY_IS_LONG) {
+ throw_tprotocolexception("Bad keytype in TSPEC (expected 'long')", INVALID_DATA);
+ return;
+ }
+ HashTable* fieldspec = Z_ARRVAL_P(val_ptr);
+
+ // field name
+ zval* zvarname = zend_hash_str_find(fieldspec, "var", sizeof("var")-1);
+ char* varname = Z_STRVAL_P(zvarname);
+
+ zval* is_required = zend_hash_str_find(fieldspec, "isRequired", sizeof("isRequired")-1);
+ zval rv;
+ zval* prop = zend_read_property(object_class_entry, object, varname, strlen(varname), false, &rv);
+
+ if (Z_TYPE_INFO_P(is_required) == IS_TRUE && Z_TYPE_P(prop) == IS_NULL) {
+ char errbuf[128];
+ snprintf(errbuf, 128, "Required field %s.%s is unset!", ZSTR_VAL(object_class_entry->name), varname);
+ throw_tprotocolexception(errbuf, INVALID_DATA);
+ }
+ }
+ }
+}
+
+static
+void binary_deserialize_spec(zval* zthis, PHPInputTransport& transport, HashTable* spec) {
+ // SET and LIST have 'elem' => array('type', [optional] 'class')
+ // MAP has 'val' => array('type', [optiona] 'class')
+ zend_class_entry* ce = Z_OBJCE_P(zthis);
+ while (true) {
+ int8_t ttype = transport.readI8();
+ if (ttype == T_STOP) {
+ validate_thrift_object(zthis);
+ return;
+ }
+
+ int16_t fieldno = transport.readI16();
+ zval* val_ptr = zend_hash_index_find(spec, fieldno);
+ if (val_ptr != nullptr) {
+ HashTable* fieldspec = Z_ARRVAL_P(val_ptr);
+ // pull the field name
+ val_ptr = zend_hash_str_find(fieldspec, "var", sizeof("var")-1);
+ char* varname = Z_STRVAL_P(val_ptr);
+
+ // and the type
+ val_ptr = zend_hash_str_find(fieldspec, "type", sizeof("type")-1);
+ if (Z_TYPE_P(val_ptr) != IS_LONG) convert_to_long(val_ptr);
+ int8_t expected_ttype = Z_LVAL_P(val_ptr);
+
+ if (ttypes_are_compatible(ttype, expected_ttype)) {
+ zval rv;
+ ZVAL_UNDEF(&rv);
+
+ binary_deserialize(ttype, transport, &rv, fieldspec);
+ zend_update_property(ce, zthis, varname, strlen(varname), &rv);
+
+ zval_ptr_dtor(&rv);
+ } else {
+ skip_element(ttype, transport);
+ }
+ } else {
+ skip_element(ttype, transport);
+ }
+ }
+}
+
+static
void binary_serialize_spec(zval* zthis, PHPOutputTransport& transport, HashTable* spec) {
validate_thrift_object(zthis);
HashPosition key_ptr;
- zval** val_ptr;
+ zval* val_ptr;
- TSRMLS_FETCH();
- zend_class_entry* ce = zend_get_class_entry(zthis TSRMLS_CC);
+ for (zend_hash_internal_pointer_reset_ex(spec, &key_ptr);
+ (val_ptr = zend_hash_get_current_data_ex(spec, &key_ptr)) != nullptr;
+ zend_hash_move_forward_ex(spec, &key_ptr)) {
- for (zend_hash_internal_pointer_reset_ex(spec, &key_ptr); zend_hash_get_current_data_ex(spec, (void**)&val_ptr, &key_ptr) == SUCCESS; zend_hash_move_forward_ex(spec, &key_ptr)) {
- ulong fieldno;
- if (zend_hash_get_current_key_ex(spec, NULL, NULL, &fieldno, 0, &key_ptr) != HASH_KEY_IS_LONG) {
+ zend_ulong fieldno;
+ if (zend_hash_get_current_key_ex(spec, nullptr, &fieldno, &key_ptr) != HASH_KEY_IS_LONG) {
throw_tprotocolexception("Bad keytype in TSPEC (expected 'long')", INVALID_DATA);
return;
}
- HashTable* fieldspec = Z_ARRVAL_PP(val_ptr);
+ HashTable* fieldspec = Z_ARRVAL_P(val_ptr);
// field name
- zend_hash_find(fieldspec, "var", 4, (void**)&val_ptr);
- char* varname = Z_STRVAL_PP(val_ptr);
+ val_ptr = zend_hash_str_find(fieldspec, "var", sizeof("var")-1);
+ char* varname = Z_STRVAL_P(val_ptr);
// thrift type
- zend_hash_find(fieldspec, "type", 5, (void**)&val_ptr);
- if (Z_TYPE_PP(val_ptr) != IS_LONG) convert_to_long(*val_ptr);
- int8_t ttype = Z_LVAL_PP(val_ptr);
+ val_ptr = zend_hash_str_find(fieldspec, "type", sizeof("type")-1);
+ if (Z_TYPE_P(val_ptr) != IS_LONG) convert_to_long(val_ptr);
+ int8_t ttype = Z_LVAL_P(val_ptr);
+
+ zval rv;
+ zval* prop = zend_read_property(Z_OBJCE_P(zthis), zthis, varname, strlen(varname), false, &rv);
- zval* prop = zend_read_property(ce, zthis, varname, strlen(varname), false TSRMLS_CC);
+ if (Z_TYPE_P(prop) == IS_REFERENCE){
+ ZVAL_UNREF(prop);
+ }
if (Z_TYPE_P(prop) != IS_NULL) {
transport.writeI8(ttype);
transport.writeI16(fieldno);
- binary_serialize(ttype, transport, &prop, fieldspec);
+ binary_serialize(ttype, transport, prop, fieldspec);
}
}
transport.writeI8(T_STOP); // struct end
@@ -981,104 +1013,56 @@ void binary_serialize_spec(zval* zthis, PHPOutputTransport& transport, HashTable
// 6 params: $transport $method_name $ttype $request_struct $seqID $strict_write
PHP_FUNCTION(thrift_protocol_write_binary) {
- int argc = ZEND_NUM_ARGS();
- if (argc < 6) {
- WRONG_PARAM_COUNT;
- }
-
- zval ***args = (zval***) emalloc(argc * sizeof(zval**));
- zend_get_parameters_array_ex(argc, args);
-
- if (Z_TYPE_PP(args[0]) != IS_OBJECT) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "1st parameter is not an object (transport)");
- efree(args);
- RETURN_NULL();
- }
-
- if (Z_TYPE_PP(args[1]) != IS_STRING) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "2nd parameter is not a string (method name)");
- efree(args);
- RETURN_NULL();
- }
-
- if (Z_TYPE_PP(args[3]) != IS_OBJECT) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "4th parameter is not an object (request struct)");
- efree(args);
- RETURN_NULL();
+ zval *protocol;
+ zval *request_struct;
+ zend_string *method_name;
+ long msgtype, seqID;
+ zend_bool strict_write;
+
+ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "oSlolb",
+ &protocol, &method_name, &msgtype,
+ &request_struct, &seqID, &strict_write) == FAILURE) {
+ return;
}
-
try {
- PHPOutputTransport transport(*args[0]);
- zval *protocol = *args[0];
- const char* method_name = Z_STRVAL_PP(args[1]);
- convert_to_long(*args[2]);
- int32_t msgtype = Z_LVAL_PP(args[2]);
- zval* request_struct = *args[3];
- convert_to_long(*args[4]);
- int32_t seqID = Z_LVAL_PP(args[4]);
- convert_to_boolean(*args[5]);
- bool strictWrite = Z_BVAL_PP(args[5]);
- efree(args);
- args = NULL;
- protocol_writeMessageBegin(protocol, method_name, msgtype, seqID);
- zval* spec = zend_read_static_property(zend_get_class_entry(request_struct TSRMLS_CC), "_TSPEC", 6, false TSRMLS_CC);
- if (Z_TYPE_P(spec) != IS_ARRAY) {
- throw_tprotocolexception("Attempt to send non-Thrift object", INVALID_DATA);
+ zval* spec = zend_read_static_property(Z_OBJCE_P(request_struct), "_TSPEC", sizeof("_TSPEC")-1, true);
+
+ if (!spec || Z_TYPE_P(spec) != IS_ARRAY) {
+ throw_tprotocolexception("Attempt serialize from non-Thrift object", INVALID_DATA);
}
+
+ PHPOutputTransport transport(protocol);
+ protocol_writeMessageBegin(protocol, method_name, (int32_t) msgtype, (int32_t) seqID);
binary_serialize_spec(request_struct, transport, Z_ARRVAL_P(spec));
transport.flush();
+
} catch (const PHPExceptionWrapper& ex) {
- zend_throw_exception_object(ex TSRMLS_CC);
+ // ex will be destructed, so copy to a zval that zend_throw_exception_object can take ownership of
+ zval myex;
+ ZVAL_COPY(&myex, ex);
+ zend_throw_exception_object(&myex);
RETURN_NULL();
} catch (const std::exception& ex) {
- throw_zend_exception_from_std_exception(ex TSRMLS_CC);
+ throw_zend_exception_from_std_exception(ex);
RETURN_NULL();
}
}
+
// 4 params: $transport $response_Typename $strict_read $buffer_size
PHP_FUNCTION(thrift_protocol_read_binary) {
- int argc = ZEND_NUM_ARGS();
-
- if (argc < 3) {
- WRONG_PARAM_COUNT;
- }
-
- zval ***args = (zval***) emalloc(argc * sizeof(zval**));
- zend_get_parameters_array_ex(argc, args);
+ zval *protocol;
+ zend_string *obj_typename;
+ zend_bool strict_read;
+ size_t buffer_size = 8192;
- if (Z_TYPE_PP(args[0]) != IS_OBJECT) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "1st parameter is not an object (transport)");
- efree(args);
- RETURN_NULL();
- }
-
- if (Z_TYPE_PP(args[1]) != IS_STRING) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "2nd parameter is not a string (typename of expected response struct)");
- efree(args);
- RETURN_NULL();
- }
-
- if (argc == 4 && Z_TYPE_PP(args[3]) != IS_LONG) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "4nd parameter is not an integer (typename of expected buffer size)");
- efree(args);
- RETURN_NULL();
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "oSb|l", &protocol, &obj_typename, &strict_read, &buffer_size) == FAILURE) {
+ return;
}
try {
- size_t buffer_size = 8192;
- if (argc == 4) {
- buffer_size = Z_LVAL_PP(args[3]);
- }
-
- PHPInputTransport transport(*args[0], buffer_size);
- char* obj_typename = Z_STRVAL_PP(args[1]);
- convert_to_boolean(*args[2]);
- bool strict_read = Z_BVAL_PP(args[2]);
- efree(args);
- args = NULL;
-
+ PHPInputTransport transport(protocol, buffer_size);
int8_t messageType = 0;
int32_t sz = transport.readI32();
@@ -1104,81 +1088,64 @@ PHP_FUNCTION(thrift_protocol_read_binary) {
}
if (messageType == T_EXCEPTION) {
- zval* ex;
- MAKE_STD_ZVAL(ex);
- createObject("\\Thrift\\Exception\\TApplicationException", ex);
- zval* spec = zend_read_static_property(zend_get_class_entry(ex TSRMLS_CC), "_TSPEC", 6, false TSRMLS_CC);
- binary_deserialize_spec(ex, transport, Z_ARRVAL_P(spec));
- throw PHPExceptionWrapper(ex);
+ zval ex;
+ createObject("\\Thrift\\Exception\\TApplicationException", &ex);
+ zval* spec = zend_read_static_property(Z_OBJCE(ex), "_TSPEC", sizeof("_TPSEC")-1, false);
+ if (EG(exception)) {
+ zend_object *ex = EG(exception);
+ EG(exception) = nullptr;
+ throw PHPExceptionWrapper(ex);
+ }
+ binary_deserialize_spec(&ex, transport, Z_ARRVAL_P(spec));
+ throw PHPExceptionWrapper(&ex);
}
- createObject(obj_typename, return_value);
- zval* spec = zend_read_static_property(zend_get_class_entry(return_value TSRMLS_CC), "_TSPEC", 6, false TSRMLS_CC);
+ createObject(ZSTR_VAL(obj_typename), return_value);
+ zval* spec = zend_read_static_property(Z_OBJCE_P(return_value), "_TSPEC", sizeof("_TSPEC")-1, true);
+ if (!spec || Z_TYPE_P(spec) != IS_ARRAY) {
+ throw_tprotocolexception("Attempt deserialize to non-Thrift object", INVALID_DATA);
+ }
binary_deserialize_spec(return_value, transport, Z_ARRVAL_P(spec));
} catch (const PHPExceptionWrapper& ex) {
- zend_throw_exception_object(ex TSRMLS_CC);
+ // ex will be destructed, so copy to a zval that zend_throw_exception_object can ownership of
+ zval myex;
+ ZVAL_COPY(&myex, ex);
+ zval_dtor(return_value);
+ zend_throw_exception_object(&myex);
RETURN_NULL();
} catch (const std::exception& ex) {
- throw_zend_exception_from_std_exception(ex TSRMLS_CC);
+ throw_zend_exception_from_std_exception(ex);
RETURN_NULL();
}
}
-
// 4 params: $transport $response_Typename $strict_read $buffer_size
PHP_FUNCTION(thrift_protocol_read_binary_after_message_begin) {
- int argc = ZEND_NUM_ARGS();
-
- if (argc < 3) {
- WRONG_PARAM_COUNT;
- }
-
- zval ***args = (zval***) emalloc(argc * sizeof(zval**));
- zend_get_parameters_array_ex(argc, args);
+ zval *protocol;
+ zend_string *obj_typename;
+ zend_bool strict_read;
+ size_t buffer_size = 8192;
- if (Z_TYPE_PP(args[0]) != IS_OBJECT) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "1st parameter is not an object (transport)");
- efree(args);
- RETURN_NULL();
- }
-
- if (Z_TYPE_PP(args[1]) != IS_STRING) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "2nd parameter is not a string (typename of expected response struct)");
- efree(args);
- RETURN_NULL();
- }
-
- if (argc == 4 && Z_TYPE_PP(args[3]) != IS_LONG) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "4nd parameter is not an integer (typename of expected buffer size)");
- efree(args);
- RETURN_NULL();
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "oSb|l", &protocol, &obj_typename, &strict_read, &buffer_size) == FAILURE) {
+ return;
}
try {
- size_t buffer_size = 8192;
- if (argc == 4) {
- buffer_size = Z_LVAL_PP(args[3]);
- }
-
- PHPInputTransport transport(*args[0], buffer_size);
- char* obj_typename = Z_STRVAL_PP(args[1]);
- convert_to_boolean(*args[2]);
- bool strict_read = Z_BVAL_PP(args[2]);
- efree(args);
- args = NULL;
+ PHPInputTransport transport(protocol, buffer_size);
- createObject(obj_typename, return_value);
- zval* spec = zend_read_static_property(zend_get_class_entry(return_value TSRMLS_CC), "_TSPEC", 6, false TSRMLS_CC);
+ createObject(ZSTR_VAL(obj_typename), return_value);
+ zval* spec = zend_read_static_property(Z_OBJCE_P(return_value), "_TSPEC", sizeof("_TSPEC")-1, false);
binary_deserialize_spec(return_value, transport, Z_ARRVAL_P(spec));
} catch (const PHPExceptionWrapper& ex) {
- zend_throw_exception_object(ex TSRMLS_CC);
+ // ex will be destructed, so copy to a zval that zend_throw_exception_object can take ownership of
+ zval myex;
+ ZVAL_COPY(&myex, ex);
+ zend_throw_exception_object(&myex);
RETURN_NULL();
} catch (const std::exception& ex) {
- throw_zend_exception_from_std_exception(ex TSRMLS_CC);
+ throw_zend_exception_from_std_exception(ex);
RETURN_NULL();
}
}
-
-
-#endif /* PHP_VERSION_ID < 70000 && PHP_VERSION_ID > 50000 */
+#endif /* PHP_VERSION_ID >= 70000 */
[23/50] [abbrv] thrift git commit: THRIFT-4376: fix more high impact
coverity defects Led to the discovery of incorrect lua socket error handling.
Posted by je...@apache.org.
THRIFT-4376: fix more high impact coverity defects
Led to the discovery of incorrect lua socket error handling.
This closes #1405
Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/533405e3
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/533405e3
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/533405e3
Branch: refs/heads/0.11.0
Commit: 533405e3f85f2925aa1028fc3534e988e5debd32
Parents: 375bfee
Author: James E. King, III <jk...@apache.org>
Authored: Sat Oct 28 18:25:45 2017 -0400
Committer: James E. King, III <jk...@apache.org>
Committed: Sun Oct 29 07:05:47 2017 -0400
----------------------------------------------------------------------
.../cpp/src/thrift/generate/t_erl_generator.cc | 3 +
.../cpp/src/thrift/generate/t_java_generator.cc | 2 -
.../cpp/src/thrift/generate/t_st_generator.cc | 1 +
compiler/cpp/src/thrift/parse/t_const_value.h | 10 +--
compiler/cpp/src/thrift/platform.h | 7 +-
lib/cpp/src/thrift/transport/TSocket.cpp | 6 +-
lib/cpp/test/SecurityTest.cpp | 5 +-
lib/cpp/test/TBufferBaseTest.cpp | 4 +-
lib/cpp/test/TMemoryBufferTest.cpp | 11 +--
lib/cpp/test/TServerIntegrationTest.cpp | 1 +
.../apache/thrift/server/ServerTestBase.java | 74 ++++++++++----------
lib/lua/src/socket.h | 4 +-
lib/lua/src/usocket.c | 44 +++++++-----
lib/rs/src/server/threaded.rs | 2 +-
14 files changed, 92 insertions(+), 82 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/thrift/blob/533405e3/compiler/cpp/src/thrift/generate/t_erl_generator.cc
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/thrift/generate/t_erl_generator.cc b/compiler/cpp/src/thrift/generate/t_erl_generator.cc
index ccd43b7..372c78b 100644
--- a/compiler/cpp/src/thrift/generate/t_erl_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_erl_generator.cc
@@ -57,6 +57,9 @@ public:
legacy_names_ = false;
maps_ = false;
otp16_ = false;
+ export_lines_first_ = true;
+ export_types_lines_first_ = true;
+
for( iter = parsed_options.begin(); iter != parsed_options.end(); ++iter) {
if( iter->first.compare("legacynames") == 0) {
legacy_names_ = true;
http://git-wip-us.apache.org/repos/asf/thrift/blob/533405e3/compiler/cpp/src/thrift/generate/t_java_generator.cc
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/thrift/generate/t_java_generator.cc b/compiler/cpp/src/thrift/generate/t_java_generator.cc
index a5fb0e5..ebc8350 100644
--- a/compiler/cpp/src/thrift/generate/t_java_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_java_generator.cc
@@ -2716,8 +2716,6 @@ std::string t_java_generator::get_java_type_string(t_type* type) {
} else {
throw std::runtime_error("Unknown thrift type \"" + type->get_name()
+ "\" passed to t_java_generator::get_java_type_string!");
- return "Unknown thrift type \"" + type->get_name()
- + "\" passed to t_java_generator::get_java_type_string!";
// This should never happen!
}
}
http://git-wip-us.apache.org/repos/asf/thrift/blob/533405e3/compiler/cpp/src/thrift/generate/t_st_generator.cc
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/thrift/generate/t_st_generator.cc b/compiler/cpp/src/thrift/generate/t_st_generator.cc
index ffd7318..69ed776 100644
--- a/compiler/cpp/src/thrift/generate/t_st_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_st_generator.cc
@@ -56,6 +56,7 @@ public:
const std::string& option_string)
: t_oop_generator(program) {
(void)option_string;
+ temporary_var = 0;
std::map<std::string, std::string>::const_iterator iter;
/* no options yet */
http://git-wip-us.apache.org/repos/asf/thrift/blob/533405e3/compiler/cpp/src/thrift/parse/t_const_value.h
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/thrift/parse/t_const_value.h b/compiler/cpp/src/thrift/parse/t_const_value.h
index 5507803..fc2f648 100644
--- a/compiler/cpp/src/thrift/parse/t_const_value.h
+++ b/compiler/cpp/src/thrift/parse/t_const_value.h
@@ -38,13 +38,13 @@ void convert(From*, To&);
*/
class t_const_value {
public:
- enum t_const_value_type { CV_INTEGER, CV_DOUBLE, CV_STRING, CV_MAP, CV_LIST, CV_IDENTIFIER };
+ enum t_const_value_type { CV_INTEGER, CV_DOUBLE, CV_STRING, CV_MAP, CV_LIST, CV_IDENTIFIER, CV_UNKNOWN };
- t_const_value() {}
+ t_const_value() : intVal_(0), doubleVal_(0.0f), enum_((t_enum*)0), valType_(CV_UNKNOWN) {}
- t_const_value(int64_t val) { set_integer(val); }
+ t_const_value(int64_t val) : doubleVal_(0.0f), enum_((t_enum*)0), valType_(CV_UNKNOWN) { set_integer(val); }
- t_const_value(std::string val) { set_string(val); }
+ t_const_value(std::string val) : intVal_(0), doubleVal_(0.0f), enum_((t_enum*)0), valType_(CV_UNKNOWN) { set_string(val); }
void set_string(std::string val) {
valType_ = CV_STRING;
@@ -134,7 +134,7 @@ public:
void set_enum(t_enum* tenum) { enum_ = tenum; }
- t_const_value_type get_type() const { return valType_; }
+ t_const_value_type get_type() const { if (valType_ == CV_UNKNOWN) { throw std::string("unknown t_const_value"); } return valType_; }
private:
std::map<t_const_value*, t_const_value*> mapVal_;
http://git-wip-us.apache.org/repos/asf/thrift/blob/533405e3/compiler/cpp/src/thrift/platform.h
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/thrift/platform.h b/compiler/cpp/src/thrift/platform.h
index 7a8edae..f49adb9 100644
--- a/compiler/cpp/src/thrift/platform.h
+++ b/compiler/cpp/src/thrift/platform.h
@@ -34,10 +34,13 @@
#include <sys/stat.h>
#endif
+#include <cerrno>
+
+// ignore EEXIST, throw on any other error
#ifdef _WIN32
-#define MKDIR(x) mkdir(x)
+#define MKDIR(x) { int r = _mkdir(x); if (r == -1 && errno != EEXIST) { throw (std::string(x) + ": ") + strerror(errno); } }
#else
-#define MKDIR(x) mkdir(x, S_IRWXU | S_IRWXG | S_IRWXO)
+#define MKDIR(x) { int r = mkdir(x, S_IRWXU | S_IRWXG | S_IRWXO); if (r == -1 && errno != EEXIST) { throw (std::string(x) + ": ") + strerror(errno); } }
#endif
#ifdef PATH_MAX
http://git-wip-us.apache.org/repos/asf/thrift/blob/533405e3/lib/cpp/src/thrift/transport/TSocket.cpp
----------------------------------------------------------------------
diff --git a/lib/cpp/src/thrift/transport/TSocket.cpp b/lib/cpp/src/thrift/transport/TSocket.cpp
index 7f8d7af..d93d0ff 100644
--- a/lib/cpp/src/thrift/transport/TSocket.cpp
+++ b/lib/cpp/src/thrift/transport/TSocket.cpp
@@ -385,7 +385,11 @@ void TSocket::openConnection(struct addrinfo* res) {
done:
// Set socket back to normal mode (blocking)
- THRIFT_FCNTL(socket_, THRIFT_F_SETFL, flags);
+ if (-1 == THRIFT_FCNTL(socket_, THRIFT_F_SETFL, flags)) {
+ int errno_copy = THRIFT_GET_SOCKET_ERROR;
+ GlobalOutput.perror("TSocket::open() THRIFT_FCNTL " + getSocketInfo(), errno_copy);
+ throw TTransportException(TTransportException::NOT_OPEN, "THRIFT_FCNTL() failed", errno_copy);
+ }
if (path_.empty()) {
setCachedAddress(res->ai_addr, static_cast<socklen_t>(res->ai_addrlen));
http://git-wip-us.apache.org/repos/asf/thrift/blob/533405e3/lib/cpp/test/SecurityTest.cpp
----------------------------------------------------------------------
diff --git a/lib/cpp/test/SecurityTest.cpp b/lib/cpp/test/SecurityTest.cpp
index 6eb1fe3..51ee427 100644
--- a/lib/cpp/test/SecurityTest.cpp
+++ b/lib/cpp/test/SecurityTest.cpp
@@ -255,11 +255,12 @@ BOOST_AUTO_TEST_CASE(ssl_security_matrix)
% protocol2str(si) % protocol2str(ci));
mConnected = false;
+ // thread_group manages the thread lifetime - ignore the return value of create_thread
boost::thread_group threads;
- threads.create_thread(bind(&SecurityFixture::server, this, static_cast<apache::thrift::transport::SSLProtocol>(si)));
+ (void)threads.create_thread(bind(&SecurityFixture::server, this, static_cast<apache::thrift::transport::SSLProtocol>(si)));
mCVar.wait(lock); // wait for listen() to succeed
lock.unlock();
- threads.create_thread(bind(&SecurityFixture::client, this, static_cast<apache::thrift::transport::SSLProtocol>(ci)));
+ (void)threads.create_thread(bind(&SecurityFixture::client, this, static_cast<apache::thrift::transport::SSLProtocol>(ci)));
threads.join_all();
BOOST_CHECK_MESSAGE(mConnected == matrix[ci][si],
http://git-wip-us.apache.org/repos/asf/thrift/blob/533405e3/lib/cpp/test/TBufferBaseTest.cpp
----------------------------------------------------------------------
diff --git a/lib/cpp/test/TBufferBaseTest.cpp b/lib/cpp/test/TBufferBaseTest.cpp
index 4e3509e..4201ddb 100644
--- a/lib/cpp/test/TBufferBaseTest.cpp
+++ b/lib/cpp/test/TBufferBaseTest.cpp
@@ -567,7 +567,7 @@ BOOST_AUTO_TEST_CASE( test_FramedTransport_Write_Read ) {
for (int d1 = 0; d1 < 3; d1++) {
shared_ptr<TMemoryBuffer> buffer(new TMemoryBuffer(16));
TFramedTransport trans(buffer, size);
- uint8_t data_out[1<<15];
+ std::vector<uint8_t> data_out(1<<17, 0);
std::vector<int> flush_sizes;
int write_offset = 0;
@@ -605,7 +605,7 @@ BOOST_AUTO_TEST_CASE( test_FramedTransport_Write_Read ) {
}
BOOST_CHECK_EQUAL((unsigned int)read_offset, sizeof(data));
- BOOST_CHECK(!memcmp(data, data_out, sizeof(data)));
+ BOOST_CHECK(!memcmp(data, &data_out[0], sizeof(data)));
}
}
}
http://git-wip-us.apache.org/repos/asf/thrift/blob/533405e3/lib/cpp/test/TMemoryBufferTest.cpp
----------------------------------------------------------------------
diff --git a/lib/cpp/test/TMemoryBufferTest.cpp b/lib/cpp/test/TMemoryBufferTest.cpp
index 4384187..9492f69 100644
--- a/lib/cpp/test/TMemoryBufferTest.cpp
+++ b/lib/cpp/test/TMemoryBufferTest.cpp
@@ -80,20 +80,11 @@ BOOST_AUTO_TEST_CASE(test_roundtrip) {
BOOST_CHECK(a == a2);
}
-BOOST_AUTO_TEST_CASE(test_copy) {
+BOOST_AUTO_TEST_CASE(test_readAppendToString) {
string* str1 = new string("abcd1234");
- ptrdiff_t str1addr = reinterpret_cast<ptrdiff_t>(str1);
- const char* data1 = str1->data();
TMemoryBuffer buf((uint8_t*)str1->data(),
static_cast<uint32_t>(str1->length()),
TMemoryBuffer::COPY);
- delete str1;
- string* str2 = new string("plsreuse");
- bool obj_reuse = (str1addr == reinterpret_cast<ptrdiff_t>(str2));
- bool dat_reuse = (data1 == str2->data());
- BOOST_TEST_MESSAGE("Object reuse: " << obj_reuse << " Data reuse: " << dat_reuse
- << ((obj_reuse && dat_reuse) ? " YAY!" : ""));
- delete str2;
string str3 = "wxyz", str4 = "6789";
buf.readAppendToString(str3, 4);
http://git-wip-us.apache.org/repos/asf/thrift/blob/533405e3/lib/cpp/test/TServerIntegrationTest.cpp
----------------------------------------------------------------------
diff --git a/lib/cpp/test/TServerIntegrationTest.cpp b/lib/cpp/test/TServerIntegrationTest.cpp
index 12657d4..5f7b2e8 100644
--- a/lib/cpp/test/TServerIntegrationTest.cpp
+++ b/lib/cpp/test/TServerIntegrationTest.cpp
@@ -265,6 +265,7 @@ public:
*/
int getServerPort() {
TServerSocket* pSock = dynamic_cast<TServerSocket*>(pServer->getServerTransport().get());
+ if (!pSock) { throw std::logic_error("how come?"); }
return pSock->getPort();
}
http://git-wip-us.apache.org/repos/asf/thrift/blob/533405e3/lib/java/test/org/apache/thrift/server/ServerTestBase.java
----------------------------------------------------------------------
diff --git a/lib/java/test/org/apache/thrift/server/ServerTestBase.java b/lib/java/test/org/apache/thrift/server/ServerTestBase.java
index c2d2952..e3e4288 100644
--- a/lib/java/test/org/apache/thrift/server/ServerTestBase.java
+++ b/lib/java/test/org/apache/thrift/server/ServerTestBase.java
@@ -54,13 +54,13 @@ import thrift.test.Xtruct2;
public abstract class ServerTestBase extends TestCase {
public static class TestHandler implements ThriftTest.Iface {
-
+
public TestHandler() {}
-
+
public void testVoid() {
System.out.print("testVoid()\n");
}
-
+
public String testString(String thing) {
System.out.print("testString(\"" + thing + "\")\n");
return thing;
@@ -70,22 +70,22 @@ public abstract class ServerTestBase extends TestCase {
System.out.print("testBool(" + thing + ")\n");
return thing;
}
-
+
public byte testByte(byte thing) {
System.out.print("testByte(" + thing + ")\n");
return thing;
}
-
+
public int testI32(int thing) {
System.out.print("testI32(" + thing + ")\n");
return thing;
}
-
+
public long testI64(long thing) {
System.out.print("testI64(" + thing + ")\n");
return thing;
}
-
+
public double testDouble(double thing) {
System.out.print("testDouble(" + thing + ")\n");
return thing;
@@ -110,7 +110,7 @@ public abstract class ServerTestBase extends TestCase {
thing.i64_thing + "})\n");
return thing;
}
-
+
public Xtruct2 testNest(Xtruct2 nest) {
Xtruct thing = nest.struct_thing;
System.out.print("testNest({" +
@@ -122,7 +122,7 @@ public abstract class ServerTestBase extends TestCase {
nest.i32_thing + "})\n");
return nest;
}
-
+
public Map<Integer,Integer> testMap(Map<Integer,Integer> thing) {
System.out.print("testMap({");
System.out.print(thing);
@@ -136,7 +136,7 @@ public abstract class ServerTestBase extends TestCase {
System.out.print("})\n");
return thing;
}
-
+
public Set<Integer> testSet(Set<Integer> thing) {
System.out.print("testSet({");
boolean first = true;
@@ -151,7 +151,7 @@ public abstract class ServerTestBase extends TestCase {
System.out.print("})\n");
return thing;
}
-
+
public List<Integer> testList(List<Integer> thing) {
System.out.print("testList({");
boolean first = true;
@@ -166,58 +166,58 @@ public abstract class ServerTestBase extends TestCase {
System.out.print("})\n");
return thing;
}
-
+
public Numberz testEnum(Numberz thing) {
System.out.print("testEnum(" + thing + ")\n");
return thing;
}
-
+
public long testTypedef(long thing) {
System.out.print("testTypedef(" + thing + ")\n");
return thing;
}
-
+
public Map<Integer,Map<Integer,Integer>> testMapMap(int hello) {
System.out.print("testMapMap(" + hello + ")\n");
Map<Integer,Map<Integer,Integer>> mapmap =
new HashMap<Integer,Map<Integer,Integer>>();
-
+
HashMap<Integer,Integer> pos = new HashMap<Integer,Integer>();
HashMap<Integer,Integer> neg = new HashMap<Integer,Integer>();
for (int i = 1; i < 5; i++) {
pos.put(i, i);
neg.put(-i, -i);
}
-
+
mapmap.put(4, pos);
mapmap.put(-4, neg);
-
+
return mapmap;
}
-
+
public Map<Long, Map<Numberz,Insanity>> testInsanity(Insanity argument) {
System.out.print("testInsanity()\n");
-
+
HashMap<Numberz,Insanity> first_map = new HashMap<Numberz, Insanity>();
HashMap<Numberz,Insanity> second_map = new HashMap<Numberz, Insanity>();;
-
+
first_map.put(Numberz.TWO, argument);
first_map.put(Numberz.THREE, argument);
-
+
Insanity looney = new Insanity();
second_map.put(Numberz.SIX, looney);
-
+
Map<Long,Map<Numberz,Insanity>> insane =
new HashMap<Long, Map<Numberz,Insanity>>();
insane.put((long)1, first_map);
insane.put((long)2, second_map);
-
+
return insane;
}
-
+
public Xtruct testMulti(byte arg0, int arg1, long arg2, Map<Short,String> arg3, Numberz arg4, long arg5) {
System.out.print("testMulti()\n");
-
+
Xtruct hello = new Xtruct();;
hello.string_thing = "Hello2";
hello.byte_thing = arg0;
@@ -225,7 +225,7 @@ public abstract class ServerTestBase extends TestCase {
hello.i64_thing = arg2;
return hello;
}
-
+
public void testException(String arg) throws Xception, TException {
System.out.print("testException("+arg+")\n");
if ("Xception".equals(arg)) {
@@ -241,7 +241,7 @@ public abstract class ServerTestBase extends TestCase {
}
return;
}
-
+
public Xtruct testMultiException(String arg0, String arg1) throws Xception, Xception2 {
System.out.print("testMultiException(" + arg0 + ", " + arg1 + ")\n");
if (arg0.equals("Xception")) {
@@ -256,12 +256,12 @@ public abstract class ServerTestBase extends TestCase {
x.struct_thing.string_thing = "This is an Xception2";
throw x;
}
-
+
Xtruct result = new Xtruct();
result.string_thing = arg1;
return result;
}
-
+
public void testOneway(int sleepFor) {
System.out.println("testOneway(" + Integer.toString(sleepFor) +
") => sleeping...");
@@ -333,7 +333,7 @@ public abstract class ServerTestBase extends TestCase {
// todo: add assertions
private void testInsanity(ThriftTest.Client testClient) throws TException {
Insanity insane;
-
+
insane = new Insanity();
insane.userMap = new HashMap<Numberz, Long>();
insane.userMap.put(Numberz.FIVE, (long)5000);
@@ -351,7 +351,7 @@ public abstract class ServerTestBase extends TestCase {
for (long key : whoa.keySet()) {
Map<Numberz,Insanity> val = whoa.get(key);
System.out.print(key + " => {");
-
+
for (Numberz k2 : val.keySet()) {
Insanity v2 = val.get(k2);
System.out.print(k2 + " => {");
@@ -363,7 +363,7 @@ public abstract class ServerTestBase extends TestCase {
}
}
System.out.print("}, ");
-
+
List<Xtruct> xtructs = v2.xtructs;
System.out.print("{");
if (xtructs != null) {
@@ -372,7 +372,7 @@ public abstract class ServerTestBase extends TestCase {
}
}
System.out.print("}");
-
+
System.out.print("}, ");
}
System.out.print("}, ");
@@ -420,6 +420,7 @@ public abstract class ServerTestBase extends TestCase {
testOneway(testClient);
testI32(testClient);
transport.close();
+ socket.close();
stopServer();
}
@@ -430,7 +431,7 @@ public abstract class ServerTestBase extends TestCase {
}
public List<TProtocolFactory> getProtocols() {
- return PROTOCOLS;
+ return PROTOCOLS;
}
private void testList(ThriftTest.Client testClient) throws TException {
@@ -466,14 +467,14 @@ public abstract class ServerTestBase extends TestCase {
testClient.testMapMap(1);
Map<Integer,Map<Integer,Integer>> mapmap =
new HashMap<Integer,Map<Integer,Integer>>();
-
+
HashMap<Integer,Integer> pos = new HashMap<Integer,Integer>();
HashMap<Integer,Integer> neg = new HashMap<Integer,Integer>();
for (int i = 1; i < 5; i++) {
pos.put(i, i);
neg.put(-i, -i);
}
-
+
mapmap.put(4, pos);
mapmap.put(-4, neg);
assertEquals(mapmap, mm);
@@ -551,6 +552,7 @@ public abstract class ServerTestBase extends TestCase {
ThriftTest.Client testClient = new ThriftTest.Client(protocol);
assertEquals(0, testClient.testByte((byte) 0));
assertEquals(2, factory.count);
+ socket.close();
stopServer();
}
}
http://git-wip-us.apache.org/repos/asf/thrift/blob/533405e3/lib/lua/src/socket.h
----------------------------------------------------------------------
diff --git a/lib/lua/src/socket.h b/lib/lua/src/socket.h
index 8019ffe..afb827e 100644
--- a/lib/lua/src/socket.h
+++ b/lib/lua/src/socket.h
@@ -51,8 +51,8 @@ T_ERRCODE socket_send(p_socket sock, const char *data, size_t len, int timeout);
T_ERRCODE socket_recv(p_socket sock, char *data, size_t len, int timeout,
int *received);
-void socket_setblocking(p_socket sock);
-void socket_setnonblocking(p_socket sock);
+T_ERRCODE socket_setblocking(p_socket sock);
+T_ERRCODE socket_setnonblocking(p_socket sock);
T_ERRCODE socket_accept(p_socket sock, p_socket sibling,
p_sa addr, socklen_t *addr_len, int timeout);
http://git-wip-us.apache.org/repos/asf/thrift/blob/533405e3/lib/lua/src/usocket.c
----------------------------------------------------------------------
diff --git a/lib/lua/src/usocket.c b/lib/lua/src/usocket.c
index 864fa36..1a1b549 100644
--- a/lib/lua/src/usocket.c
+++ b/lib/lua/src/usocket.c
@@ -113,7 +113,7 @@ T_ERRCODE socket_create(p_socket sock, int domain, int type, int protocol) {
T_ERRCODE socket_destroy(p_socket sock) {
// TODO Figure out if I should be free-ing this
if (*sock > 0) {
- socket_setblocking(sock);
+ (void)socket_setblocking(sock);
close(*sock);
*sock = -1;
}
@@ -121,13 +121,15 @@ T_ERRCODE socket_destroy(p_socket sock) {
}
T_ERRCODE socket_bind(p_socket sock, p_sa addr, int addr_len) {
- int ret = SUCCESS;
- socket_setblocking(sock);
+ int ret = socket_setblocking(sock);
+ if (ret != SUCCESS) {
+ return ret;
+ }
if (bind(*sock, addr, addr_len)) {
ret = errno;
}
- socket_setnonblocking(sock);
- return ret;
+ int ret2 = socket_setnonblocking(sock);
+ return ret == SUCCESS ? ret2 : ret;
}
T_ERRCODE socket_get_info(p_socket sock, short *port, char *buf, size_t len) {
@@ -168,22 +170,25 @@ T_ERRCODE socket_accept(p_socket sock, p_socket client,
if (*client > 0) {
return SUCCESS;
}
- err = errno;
- } while (err != EINTR);
+ } while ((err = errno) == EINTR);
+
if (err == EAGAIN || err == ECONNABORTED) {
return socket_wait(sock, WAIT_MODE_R, timeout);
}
+
return err;
}
T_ERRCODE socket_listen(p_socket sock, int backlog) {
- int ret = SUCCESS;
- socket_setblocking(sock);
+ int ret = socket_setblocking(sock);
+ if (ret != SUCCESS) {
+ return ret;
+ }
if (listen(*sock, backlog)) {
ret = errno;
}
- socket_setnonblocking(sock);
- return ret;
+ int ret2 = socket_setnonblocking(sock);
+ return ret == SUCCESS ? ret2 : ret;
}
////////////////////////////////////////////////////////////////////////////////
@@ -217,12 +222,12 @@ T_ERRCODE socket_send(
if (put > 0) {
return SUCCESS;
}
- err = errno;
- } while (err != EINTR);
+ } while ((err = errno) == EINTR);
if (err == EAGAIN) {
return socket_wait(sock, WAIT_MODE_W, timeout);
}
+
return err;
}
@@ -232,8 +237,8 @@ T_ERRCODE socket_recv(
if (*sock < 0) {
return CLOSED;
}
+ *received = 0;
- int flags = fcntl(*sock, F_GETFL, 0);
do {
got = recv(*sock, data, len, 0);
if (got > 0) {
@@ -246,27 +251,28 @@ T_ERRCODE socket_recv(
if (got == 0) {
return CLOSED;
}
- } while (err != EINTR);
+ } while (err == EINTR);
if (err == EAGAIN) {
return socket_wait(sock, WAIT_MODE_R, timeout);
}
+
return err;
}
////////////////////////////////////////////////////////////////////////////////
// Util
-void socket_setnonblocking(p_socket sock) {
+T_ERRCODE socket_setnonblocking(p_socket sock) {
int flags = fcntl(*sock, F_GETFL, 0);
flags |= O_NONBLOCK;
- fcntl(*sock, F_SETFL, flags);
+ return fcntl(*sock, F_SETFL, flags) != -1 ? SUCCESS : errno;
}
-void socket_setblocking(p_socket sock) {
+T_ERRCODE socket_setblocking(p_socket sock) {
int flags = fcntl(*sock, F_GETFL, 0);
flags &= (~(O_NONBLOCK));
- fcntl(*sock, F_SETFL, flags);
+ return fcntl(*sock, F_SETFL, flags) != -1 ? SUCCESS : errno;
}
////////////////////////////////////////////////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/thrift/blob/533405e3/lib/rs/src/server/threaded.rs
----------------------------------------------------------------------
diff --git a/lib/rs/src/server/threaded.rs b/lib/rs/src/server/threaded.rs
index 66680b1..515b20d 100644
--- a/lib/rs/src/server/threaded.rs
+++ b/lib/rs/src/server/threaded.rs
@@ -155,7 +155,7 @@ impl<PRC, RTF, IPF, WTF, OPF> TServer<PRC, RTF, IPF, WTF, OPF>
w_trans_factory: write_transport_factory,
o_proto_factory: output_protocol_factory,
processor: Arc::new(processor),
- worker_pool: ThreadPool::new_with_name(
+ worker_pool: ThreadPool::with_name(
"Thrift service processor".to_owned(),
num_workers,
),
[22/50] [abbrv] thrift git commit: THRIFT-2998: enable cross test for
nodejs http transport,
fix missing apache license headers in nodejs Client: nodejs
Posted by je...@apache.org.
THRIFT-2998: enable cross test for nodejs http transport,
fix missing apache license headers in nodejs
Client: nodejs
This closes #1403
Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/375bfee7
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/375bfee7
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/375bfee7
Branch: refs/heads/0.11.0
Commit: 375bfee701d3caa74074f8afb3d6940e52c45c88
Parents: 5a4f738
Author: James E. King, III <jk...@apache.org>
Authored: Thu Oct 26 00:09:34 2017 -0400
Committer: James E. King, III <jk...@apache.org>
Committed: Sat Oct 28 17:54:58 2017 -0400
----------------------------------------------------------------------
lib/d/src/thrift/internal/ssl_bio.d | 2 +-
lib/nodejs/test/browser_client.js | 18 +++++++
lib/nodejs/test/client.js | 12 +++--
lib/nodejs/test/deep-constructor.test.js | 21 +++++++-
lib/nodejs/test/exceptions.js | 19 +++++++
lib/nodejs/test/helpers.js | 19 +++++++
lib/nodejs/test/server.js | 11 ++--
lib/nodejs/test/test-cases.js | 19 +++++++
test/crossrunner/report.py | 4 +-
test/known_failures_Linux.json | 76 +++++++++++++++++++++++++++
test/tests.json | 3 +-
11 files changed, 193 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/thrift/blob/375bfee7/lib/d/src/thrift/internal/ssl_bio.d
----------------------------------------------------------------------
diff --git a/lib/d/src/thrift/internal/ssl_bio.d b/lib/d/src/thrift/internal/ssl_bio.d
index 796be91..ae85027 100644
--- a/lib/d/src/thrift/internal/ssl_bio.d
+++ b/lib/d/src/thrift/internal/ssl_bio.d
@@ -73,7 +73,7 @@ private {
void setError(Exception e) nothrow {
ERR_put_error(ERR_LIB_D_EXCEPTION, ERR_F_D_EXCEPTION, ERR_R_D_EXCEPTION,
ERR_FILE_D_EXCEPTION, ERR_LINE_D_EXCEPTION);
- try { GC.addRoot(cast(void*)e); } catch {}
+ try { GC.addRoot(cast(void*)e); } catch (Throwable) {}
ERR_set_error_data(cast(char*)e, ERR_FLAGS_D_EXCEPTION);
}
http://git-wip-us.apache.org/repos/asf/thrift/blob/375bfee7/lib/nodejs/test/browser_client.js
----------------------------------------------------------------------
diff --git a/lib/nodejs/test/browser_client.js b/lib/nodejs/test/browser_client.js
index 27db543..72fd837 100644
--- a/lib/nodejs/test/browser_client.js
+++ b/lib/nodejs/test/browser_client.js
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
var assert = require('assert');
var thrift = require('thrift');
http://git-wip-us.apache.org/repos/asf/thrift/blob/375bfee7/lib/nodejs/test/client.js
----------------------------------------------------------------------
diff --git a/lib/nodejs/test/client.js b/lib/nodejs/test/client.js
index a38a66b..9609518 100644
--- a/lib/nodejs/test/client.js
+++ b/lib/nodejs/test/client.js
@@ -32,13 +32,13 @@ var ttypes = require('./gen-nodejs/ThriftTest_types');
var program = require('commander');
program
- .option('-p, --protocol <protocol>', 'Set thrift protocol (binary|json) [protocol]')
- .option('-t, --transport <transport>', 'Set thrift transport (buffered|framed) [transport]')
+ .option('-p, --protocol <protocol>', 'Set thrift protocol (binary|compact|json) [protocol]')
+ .option('-t, --transport <transport>', 'Set thrift transport (buffered|framed|http) [transport]')
.option('--port <port>', 'Set thrift server port number to connect', 9090)
.option('--host <host>', 'Set thrift server host to connect', 'localhost')
.option('--ssl', 'use SSL transport')
.option('--promise', 'test with promise style functions')
- .option('-t, --type <type>', 'Select server type (tcp|multiplex|http)', 'tcp')
+ .option('-t, --type <type>', 'Select server type (http|multiplex|tcp|websocket)', 'tcp')
.parse(process.argv);
var host = program.host;
@@ -47,6 +47,12 @@ var type = program.type;
var ssl = program.ssl;
var promise = program.promise;
+/* for compatibility with cross test invocation for http transport testing */
+if (program.transport === 'http') {
+ program.transport = 'buffered';
+ type = 'http';
+}
+
var options = {
transport: helpers.transports[program.transport],
protocol: helpers.protocols[program.protocol]
http://git-wip-us.apache.org/repos/asf/thrift/blob/375bfee7/lib/nodejs/test/deep-constructor.test.js
----------------------------------------------------------------------
diff --git a/lib/nodejs/test/deep-constructor.test.js b/lib/nodejs/test/deep-constructor.test.js
index 2caeb82..145b668 100644
--- a/lib/nodejs/test/deep-constructor.test.js
+++ b/lib/nodejs/test/deep-constructor.test.js
@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
var ttypes = require('./gen-nodejs/JsDeepConstructorTest_types');
var thrift = require('thrift');
var test = require('tape');
@@ -286,7 +305,7 @@ function createTestCases(serialize, deserialize) {
"Can make list with objects": function(assert) {
var tObj = new ttypes.ComplexList({
- "struct_list_field": [new ttypes.Complex({})]
+ "struct_list_field": [new ttypes.Complex({})]
});
var innerObj = tObj.struct_list_field[0];
assert.ok(innerObj instanceof ttypes.Complex)
http://git-wip-us.apache.org/repos/asf/thrift/blob/375bfee7/lib/nodejs/test/exceptions.js
----------------------------------------------------------------------
diff --git a/lib/nodejs/test/exceptions.js b/lib/nodejs/test/exceptions.js
index c6f2e4d..0a75770 100644
--- a/lib/nodejs/test/exceptions.js
+++ b/lib/nodejs/test/exceptions.js
@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
'use strict';
var test = require('tape');
var thrift = require('../lib/thrift/thrift.js');
http://git-wip-us.apache.org/repos/asf/thrift/blob/375bfee7/lib/nodejs/test/helpers.js
----------------------------------------------------------------------
diff --git a/lib/nodejs/test/helpers.js b/lib/nodejs/test/helpers.js
index c850c46..5f828b3 100644
--- a/lib/nodejs/test/helpers.js
+++ b/lib/nodejs/test/helpers.js
@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
'use strict';
var thrift = require('../lib/thrift');
http://git-wip-us.apache.org/repos/asf/thrift/blob/375bfee7/lib/nodejs/test/server.js
----------------------------------------------------------------------
diff --git a/lib/nodejs/test/server.js b/lib/nodejs/test/server.js
index 6e5cdfa..bad3b17 100644
--- a/lib/nodejs/test/server.js
+++ b/lib/nodejs/test/server.js
@@ -32,12 +32,12 @@ var ThriftTestHandlerPromise = require('./test_handler').SyncThriftTestHandler;
var ttypes = require('./gen-nodejs/ThriftTest_types');
program
- .option('-p, --protocol <protocol>', 'Set thrift protocol (binary|json|compact)', 'binary')
- .option('-t, --transport <transport>', 'Set thrift transport (buffered|framed)', 'buffered')
+ .option('-p, --protocol <protocol>', 'Set thrift protocol (binary|compact|json)', 'binary')
+ .option('-t, --transport <transport>', 'Set thrift transport (buffered|framed|http)', 'buffered')
.option('--ssl', 'use ssl transport')
.option('--port <port>', 'Set thrift server port', 9090)
.option('--promise', 'test with promise style functions')
- .option('-t, --type <type>', 'Select server type (tcp|multiplex|http)', 'tcp')
+ .option('-t, --type <type>', 'Select server type (http|multiplex|tcp|websocket)', 'tcp')
.parse(process.argv);
var port = program.port;
@@ -47,6 +47,11 @@ var promise = program.promise;
var handler = program.promise ? ThriftTestHandler : ThriftTestHandlerPromise;
+if (program.transport === 'http') {
+ program.transport = 'buffered';
+ type = 'http';
+}
+
var options = {
transport: helpers.transports[program.transport],
protocol: helpers.protocols[program.protocol]
http://git-wip-us.apache.org/repos/asf/thrift/blob/375bfee7/lib/nodejs/test/test-cases.js
----------------------------------------------------------------------
diff --git a/lib/nodejs/test/test-cases.js b/lib/nodejs/test/test-cases.js
index 13722be..bd66dc4 100644
--- a/lib/nodejs/test/test-cases.js
+++ b/lib/nodejs/test/test-cases.js
@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
'use strict';
var ttypes = require('./gen-nodejs/ThriftTest_types');
http://git-wip-us.apache.org/repos/asf/thrift/blob/375bfee7/test/crossrunner/report.py
----------------------------------------------------------------------
diff --git a/test/crossrunner/report.py b/test/crossrunner/report.py
index 26f7d9e..76324ed 100644
--- a/test/crossrunner/report.py
+++ b/test/crossrunner/report.py
@@ -332,8 +332,8 @@ class SummaryReporter(TestReporter):
'# then browse:\n',
'# \thttp://localhost:%d/%s/\n' % (8001, self._testdir_rel),
'Full log for each test is here:\n',
- '\ttest/log/client_server_protocol_transport_client.log\n',
- '\ttest/log/client_server_protocol_transport_server.log\n',
+ '\ttest/log/server_client_protocol_transport_client.log\n',
+ '\ttest/log/server_client_protocol_transport_server.log\n',
'%d failed of %d tests in total.\n' % (fail_count, len(self._tests)),
])
self._print_exec_time()
http://git-wip-us.apache.org/repos/asf/thrift/blob/375bfee7/test/known_failures_Linux.json
----------------------------------------------------------------------
diff --git a/test/known_failures_Linux.json b/test/known_failures_Linux.json
index 3b835f3..eda5df0 100644
--- a/test/known_failures_Linux.json
+++ b/test/known_failures_Linux.json
@@ -27,6 +27,12 @@
"cpp-java_compact_http-ip-ssl",
"cpp-java_json_http-ip",
"cpp-java_json_http-ip-ssl",
+ "cpp-nodejs_binary_http-ip",
+ "cpp-nodejs_binary_http-ip-ssl",
+ "cpp-nodejs_compact_http-ip",
+ "cpp-nodejs_compact_http-ip-ssl",
+ "cpp-nodejs_json_http-ip",
+ "cpp-nodejs_json_http-ip-ssl",
"csharp-d_binary_buffered-ip-ssl",
"csharp-d_binary_framed-ip-ssl",
"csharp-d_compact_buffered-ip-ssl",
@@ -83,14 +89,20 @@
"d-nodejs_binary_buffered-ip-ssl",
"d-nodejs_binary_framed-ip",
"d-nodejs_binary_framed-ip-ssl",
+ "d-nodejs_binary_http-ip",
+ "d-nodejs_binary_http-ip-ssl",
"d-nodejs_compact_buffered-ip",
"d-nodejs_compact_buffered-ip-ssl",
"d-nodejs_compact_framed-ip",
"d-nodejs_compact_framed-ip-ssl",
+ "d-nodejs_compact_http-ip",
+ "d-nodejs_compact_http-ip-ssl",
"d-nodejs_json_buffered-ip",
"d-nodejs_json_buffered-ip-ssl",
"d-nodejs_json_framed-ip",
"d-nodejs_json_framed-ip-ssl",
+ "d-nodejs_json_http-ip",
+ "d-nodejs_json_http-ip-ssl",
"d-py3_binary-accel_buffered-ip",
"d-py3_binary-accel_buffered-ip-ssl",
"d-py3_binary-accel_framed-ip",
@@ -169,6 +181,70 @@
"java-d_compact_buffered-ip",
"java-d_compact_buffered-ip-ssl",
"java-d_compact_framed-ip",
+ "nodejs-cpp_binary_http-ip",
+ "nodejs-cpp_binary_http-ip-ssl",
+ "nodejs-cpp_compact_http-ip",
+ "nodejs-cpp_compact_http-ip-ssl",
+ "nodejs-cpp_json_http-ip",
+ "nodejs-cpp_json_http-ip-ssl",
+ "nodejs-d_binary_buffered-ip",
+ "nodejs-d_binary_buffered-ip-ssl",
+ "nodejs-d_binary_framed-ip",
+ "nodejs-d_binary_framed-ip-ssl",
+ "nodejs-d_binary_http-ip",
+ "nodejs-d_binary_http-ip-ssl",
+ "nodejs-d_compact_buffered-ip",
+ "nodejs-d_compact_buffered-ip-ssl",
+ "nodejs-d_compact_framed-ip",
+ "nodejs-d_compact_framed-ip-ssl",
+ "nodejs-d_compact_http-ip",
+ "nodejs-d_compact_http-ip-ssl",
+ "nodejs-d_json_buffered-ip",
+ "nodejs-d_json_buffered-ip-ssl",
+ "nodejs-d_json_framed-ip",
+ "nodejs-d_json_framed-ip-ssl",
+ "nodejs-d_json_http-ip",
+ "nodejs-d_json_http-ip-ssl",
+ "nodejs-dart_binary_buffered-ip",
+ "nodejs-dart_binary_framed-ip",
+ "nodejs-dart_binary_http-ip",
+ "nodejs-dart_compact_buffered-ip",
+ "nodejs-dart_compact_framed-ip",
+ "nodejs-dart_compact_http-ip",
+ "nodejs-dart_json_buffered-ip",
+ "nodejs-dart_json_framed-ip",
+ "nodejs-dart_json_http-ip",
+ "nodejs-go_binary_http-ip",
+ "nodejs-go_binary_http-ip-ssl",
+ "nodejs-go_compact_http-ip",
+ "nodejs-go_compact_http-ip-ssl",
+ "nodejs-go_json_http-ip",
+ "nodejs-go_json_http-ip-ssl",
+ "nodejs-hs_binary_http-ip",
+ "nodejs-hs_compact_http-ip",
+ "nodejs-hs_json_http-ip",
+ "nodejs-java_binary_http-ip",
+ "nodejs-java_binary_http-ip-ssl",
+ "nodejs-java_compact_http-ip",
+ "nodejs-java_compact_http-ip-ssl",
+ "nodejs-java_json_http-ip",
+ "nodejs-java_json_http-ip-ssl",
+ "nodejs-js_json_http-ip",
+ "nodejs-lua_binary_http-ip",
+ "nodejs-lua_compact_http-ip",
+ "nodejs-lua_json_http-ip",
+ "nodejs-netcore_binary_buffered-ip",
+ "nodejs-netcore_binary_buffered-ip-ssl",
+ "nodejs-netcore_binary_framed-ip",
+ "nodejs-netcore_binary_framed-ip-ssl",
+ "nodejs-netcore_compact_buffered-ip",
+ "nodejs-netcore_compact_buffered-ip-ssl",
+ "nodejs-netcore_compact_framed-ip",
+ "nodejs-netcore_compact_framed-ip-ssl",
+ "nodejs-netcore_json_buffered-ip",
+ "nodejs-netcore_json_buffered-ip-ssl",
+ "nodejs-netcore_json_framed-ip",
+ "nodejs-netcore_json_framed-ip-ssl",
"rs-csharp_binary_buffered-ip",
"rs-csharp_compact_buffered-ip",
"rs-csharp_binary_framed-ip",
http://git-wip-us.apache.org/repos/asf/thrift/blob/375bfee7/test/tests.json
----------------------------------------------------------------------
diff --git a/test/tests.json b/test/tests.json
index fdd725c..e62af24 100644
--- a/test/tests.json
+++ b/test/tests.json
@@ -169,7 +169,8 @@
},
"transports": [
"buffered",
- "framed"
+ "framed",
+ "http"
],
"sockets": [
"ip",
[09/50] [abbrv] thrift git commit: THRIFT-4367: Fix missing
positional argument in python TProcessor.process Client: py Patch: Qyetfu
Posted by je...@apache.org.
THRIFT-4367: Fix missing positional argument in python
TProcessor.process
Client: py
Patch: Qyetfu
This closes #1392
Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/e7611d0f
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/e7611d0f
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/e7611d0f
Branch: refs/heads/0.11.0
Commit: e7611d0f3ed1704711f58ff45f331db6748dfbb5
Parents: ba5e065
Author: James E. King, III <jk...@apache.org>
Authored: Mon Oct 23 16:44:45 2017 -0400
Committer: James E. King, III <jk...@apache.org>
Committed: Mon Oct 23 16:44:45 2017 -0400
----------------------------------------------------------------------
lib/py/src/Thrift.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/thrift/blob/e7611d0f/lib/py/src/Thrift.py
----------------------------------------------------------------------
diff --git a/lib/py/src/Thrift.py b/lib/py/src/Thrift.py
index c4dabdc..00941d8 100644
--- a/lib/py/src/Thrift.py
+++ b/lib/py/src/Thrift.py
@@ -69,9 +69,9 @@ class TMessageType(object):
class TProcessor(object):
- """Base class for procsessor, which works on two streams."""
+ """Base class for processor, which works on two streams."""
- def process(iprot, oprot):
+ def process(self, iprot, oprot):
pass
[36/50] [abbrv] thrift git commit: THRIFT-4085: refresh docker for
dotnet 2.0.3, add dart 1.24.2 to artful image
Posted by je...@apache.org.
THRIFT-4085: refresh docker for dotnet 2.0.3, add dart 1.24.2 to artful image
This closes #1415
Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/6e883f9d
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/6e883f9d
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/6e883f9d
Branch: refs/heads/0.11.0
Commit: 6e883f9d2307b00ca76aa28c286f28d8741a8197
Parents: 58402ff
Author: James E. King, III <jk...@apache.org>
Authored: Sat Nov 18 21:18:05 2017 -0500
Committer: James E. King, III <jk...@apache.org>
Committed: Mon Nov 20 07:26:52 2017 -0500
----------------------------------------------------------------------
build/docker/README.md | 4 ++--
build/docker/ubuntu-artful/Dockerfile | 24 +++++++++++++-----------
build/docker/ubuntu-xenial/Dockerfile | 4 ++--
3 files changed, 17 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/thrift/blob/6e883f9d/build/docker/README.md
----------------------------------------------------------------------
diff --git a/build/docker/README.md b/build/docker/README.md
index dd0b178..10a7a76 100644
--- a/build/docker/README.md
+++ b/build/docker/README.md
@@ -145,9 +145,9 @@ Last updated: October 1, 2017
| c_glib | 2.40.2 | 2.48.2 | 2.54.0 | |
| cocoa | | | | Not in CI |
| d | 2.070.2 | 2.073.2 | 2.076.0 | |
-| dart | 1.20.1 | 1.24.2 | | artful: apt repo not compatible with apt 1.4? |
+| dart | 1.20.1 | 1.24.2 | 1.24.2 | |
| delphi | | | | Not in CI |
-| dotnet | | 2.0.0 | | Needs to be added to artful |
+| dotnet | | 2.0.3 | | Needs to be added to artful |
| erlang | R16B03 | 18.3 | 20.0.4 | |
| go | 1.2.1 | 1.6.2 | 1.8.3 | |
| haskell | 7.6.3 | 7.10.3 | 8.0.2 | |
http://git-wip-us.apache.org/repos/asf/thrift/blob/6e883f9d/build/docker/ubuntu-artful/Dockerfile
----------------------------------------------------------------------
diff --git a/build/docker/ubuntu-artful/Dockerfile b/build/docker/ubuntu-artful/Dockerfile
index 523fc36..756209d 100644
--- a/build/docker/ubuntu-artful/Dockerfile
+++ b/build/docker/ubuntu-artful/Dockerfile
@@ -16,8 +16,6 @@
# - cpp: stock boost 1.62 in artful has a nasty bug so we use stock boost 1.63
# - d: does not come with Ubuntu so we're installing the latest
# - d: deimos for libevent and openssl omitted - not compatible / build errors
-# - dart: dart repository doesn't work with apt 1.4 in artful
-# - dotnetcore, because netcore is for 1.0.0-preview and 2.0.0 is out
# - haxe: see THRIFT-4352, but test/haxe cores during testing
# and hxcpp 3.4.64 is not compatible with artful
#
@@ -41,9 +39,9 @@ RUN apt-get update && \
# RUN echo "deb http://download.mono-project.com/repo/debian xenial main" | tee /etc/apt/sources.list.d/mono.list && \
# apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A6A19B38D3D831EF
-# dotnet (core) 2.0.0 - project isn't ready for this yet:
-# RUN curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > /etc/apt/trusted.gpg.d/microsoft.gpg && \
-# echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-xenial-prod xenial main" > /etc/apt/sources.list.d/dotnetdev.list
+# dotnet (core)
+RUN curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > /etc/apt/trusted.gpg.d/microsoft.gpg && \
+ echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-artful-prod artful main" > /etc/apt/sources.list.d/dotnetdev.list
# node.js (this step runs apt-get update internally) - if we ever want a later version
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -
@@ -106,19 +104,23 @@ RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EBCF975E5BA24D5E &&
# mv openssl-master/C/* /usr/include/dmd/druntime/import/C/ && \
# rm -rf openssl-master
-# dart is disabled because the repository won't sync properly with apt 1.4
+# dart cannot be downloaded by aptitude because of
+# https://github.com/dart-lang/sdk/issues/30512
# RUN curl https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
# curl https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list && \
# apt-get update && \
# apt-get install -y --no-install-recommends \
# `# Dart dependencies` \
# dart
-# ENV PATH /usr/lib/dart/bin:$PATH
+# so instead we do:
+RUN wget https://storage.googleapis.com/dart-archive/channels/stable/release/latest/linux_packages/dart_1.24.2-1_amd64.deb && \
+ dpkg -i dart_1.24.2-1_amd64.deb && \
+ rm dart_1.24.2-1_amd64.deb
+ENV PATH /usr/lib/dart/bin:$PATH
-# project isn't ready for this quite yet:
-# RUN apt-get install -y --no-install-recommends \
-# `# dotnet core dependencies` \
-# dotnet-sdk-2.0.0
+RUN apt-get install -y --no-install-recommends \
+`# dotnet core dependencies` \
+ dotnet-sdk-2.0.3
RUN apt-get install -y --no-install-recommends \
`# Erlang dependencies` \
http://git-wip-us.apache.org/repos/asf/thrift/blob/6e883f9d/build/docker/ubuntu-xenial/Dockerfile
----------------------------------------------------------------------
diff --git a/build/docker/ubuntu-xenial/Dockerfile b/build/docker/ubuntu-xenial/Dockerfile
index 255b6e8..c640bd9 100644
--- a/build/docker/ubuntu-xenial/Dockerfile
+++ b/build/docker/ubuntu-xenial/Dockerfile
@@ -45,7 +45,7 @@ RUN curl https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - &
# since ubuntu-artful can't run dart, we'll run 1.240 on xenial for now
ENV DART_VERSION 1.24.2-1
-# dotnet (core) 2.0.0
+# dotnet (core)
RUN curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > /etc/apt/trusted.gpg.d/microsoft.gpg && \
echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-xenial-prod xenial main" > /etc/apt/sources.list.d/dotnetdev.list
@@ -121,7 +121,7 @@ ENV PATH /usr/lib/dart/bin:$PATH
RUN apt-get install -y --no-install-recommends \
`# dotnet core dependencies` \
- dotnet-sdk-2.0.0
+ dotnet-sdk-2.0.3
RUN apt-get install -y --no-install-recommends \
`# Erlang dependencies` \
[03/50] [abbrv] thrift git commit: THRIFT-4351: use travis build
stages to optimize build, avoiding duplicate rebuilds of the same image,
and also allow personal docker hub repositories for private fork builds to be
optimized. Move ubsan build to artful
Posted by je...@apache.org.
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/build/docker/README.md
----------------------------------------------------------------------
diff --git a/build/docker/README.md b/build/docker/README.md
index 2de7d68..81a4935 100644
--- a/build/docker/README.md
+++ b/build/docker/README.md
@@ -1,15 +1,40 @@
-# Apache Thrift Docker containers
+# Docker Integration #
-Docker containers used to build and test Apache Thrift for a variety of platforms.
+Due to the large number of language requirements to build Apache Thrift, docker containers are used to build and test the project on a variety of platforms to provide maximum test coverage.
-## Available Containers
+## Travis CI Integration ##
-The Travis CI (continuous integration) builds use the Ubuntu Trusty and Xenial images to maximize
-language level coverage. The other images may or may not work for all languages.
+The Travis CI scripts use the following environment variables and logic to determine their behavior.
+
+### Environment Variables ###
+
+| Variable | Default | Usage |
+| -------- | ----- | ------- |
+| `DISTRO` | `ubuntu-xenial` | Set by various build jobs in `.travis.yml` to run builds in different containers. Not intended to be set externally.|
+| `DOCKER_REPO` | `thrift` | The name of the Docker Hub repository to obtain and store docker images. |
+| `DOCKER_USER` | `apache` | The Docker Hub account name containing the repository. |
+| `DOCKER_PASS` | `<none>` | The Docker Hub account password to use when pushing new tags. |
+
+For example, the default docker image that is used in builds if no overrides are specified would be: `apache/thrift:ubuntu-xenial`
+
+If you have forked the Apache Thrift repository and you would like to use your own Docker Hub account to store thrift build images, you can use the Travis CI web interface to set the `DOCKER_USER`, `DOCKER_PASS`, and `DOCKER_REPO` variables in a secure manner.
+
+### Logic ###
+
+The Travis CI build runs in two phases - first the docker images are rebuilt for each of the three supported containers if they do not match the Dockerfile that was used to build the most recent tag. If a `DOCKER_PASS` environment variable is specified, the docker stage builds will attempt to log into Docker Hub and push the resulting tags.
+
+## Supported Containers ##
+
+The Travis CI (continuous integration) builds use the Ubuntu Trusty, Xenial, and Artful images to maximize language level coverage.
### Ubuntu
-* trusty
-* xenial (current)
+* trusty (legacy)
+* xenial (stable)
+* artful (latest)
+
+## Unsupported Containers
+
+These containers may be in various states, and may not build everything.
### CentOS
* 7.3
@@ -20,9 +45,6 @@ language level coverage. The other images may or may not work for all languages
* stretch
* make check in lib/cpp fails due to https://svn.boost.org/trac10/ticket/12507
-## Dependencies
-* A working Docker environment. A Vagrantfile is provided which will setup an Ubuntu host and working Docker environment as well as build the Apache Thrift Docker container for testing and development.
-
## Usage
From the Apache Thrift code base root:
@@ -30,58 +52,56 @@ From the Apache Thrift code base root:
docker build -t thrift build/docker/ubuntu-xenial
- or
-
- docker build -t thrift build/docker/centos-7.3
-
* Run
docker run -v $(pwd):/thrift/src -it thrift /bin/bash
## Core Tool Versions per Dockerfile
-| Tool | centos-7.3 | debian-stretch | ubuntu-trusty | ubuntu-xenial | Notes |
-| :-------- | :--------- | :------------- | :------------ | :------------ | :---- |
-| ant | 1.9.2 | 1.9.9 | 1.9.3 | 1.9.6 | |
-| autoconf | 2.69 | 2.69 | 2.69 | 2.69 | |
-| automake | 1.13.4 | 1.15 | 1.14.1 | 1.15 | |
-| bison | 2.7 | 3.0.4 | 3.0.2 | 3.0.4 | |
-| boost | 1.53.0 | 1.62.0 | 1.54.0 | 1.58.0 | |
-| cmake | 3.6.3 | 3.7.2 | 3.2.2 | 3.5.1 | |
-| flex | 2.5.37 | 2.6.1 | 2.5.35 | 2.6.0 | |
-| glibc | 2.17 | 2.24 | 2.19 | 2.23 | |
-| libevent | 2.0.21 | 2.0.21 | 2.0.21 | 2.0.21 | |
-| libstdc++ | 4.8.5 | 6.3.0 | 4.8.4 | 5.4.0 | |
-| make | 3.82 | 4.1 | 3.81 | 4.1 | |
-| openssl | 1.0.1e | 1.1.0f | 1.0.1f | 1.0.2g | |
-
-## Language Versions per Dockerfile
-| Language | centos-7.3 | debian-stretch | ubuntu-trusty | ubuntu-xenial | Notes |
-| :-------- | :--------- | :------------- | :------------ | :------------ | :---- |
-| as3 | | | | | Not in CI |
-| C++-gcc | 4.8.5 | 6.3.0 | 4.8.4 | 5.4.0 | |
-| C++-clang | 3.4.2 | 3.8.1 | 3.4 | 3.8 | |
-| C# (mono) | 4.6.2 | 4.6.2.7 | 5.2.0.224 | 5.2.0.215 | |
-| c_glib | 2.46.2 | 2.50.3 | 2.40.2 | 2.48.2 | |
-| cocoa | | | | | Not in CI |
-| d | 2.076.0 | 2.076.0 | 2.070.0 | 2.075.1 | |
-| dart | 1.24.2 | 1.24.2 | 1.24.2 | 1.24.2 | |
-| delphi | | | | | Not in CI |
-| dotnet | | | | | Not in CI |
-| erlang | 20 | 19.2 | 20 | 18.3 | |
-| go | 1.9 | 1.7.4 | 1.4.3 | 1.6.2 | |
-| haskell | 7.6.3 | 8.0.1 | 7.6.3 | 7.10.3 | |
-| haxe | | 3.2.1 | 3.2.1 | 3.2.1 | |
-| java | 1.8.0_141 | 1.8.0_141 | 1.7.0_151 | 1.8.0_131 | |
-| js | | | | | Unsure how to look for version info |
-| lua | 5.3.4 | 5.2.4 | 5.2.3 | 5.2.4 | |
-| nodejs | 6.11.1 | 8.4.0 | 4.8.4 | 7.10.1 | Node 8.5 broke copyFile and jsdoc |
-| ocaml | 4.01.0 | 4.02.3 | 4.02.3 | 4.02.3 | |
-| perl | 5.16.3 | 5.24.1 | 5.18.2 | 5.22.1 | |
-| php | 5.4.16 | 7.0.19 | 5.5.9 | 7.0.22 | |
-| python | 2.7.5 | 2.7.13 | 2.7.6 | 2.7.12 | |
-| python3 | 3.4.5 | 3.5.3 | 3.4.3 | 3.5.2 | |
-| ruby | 2.0.0p648 | 2.3.3p222 | 1.9.3p484 | 2.3.1p112 | |
-| rust | 1.17.0 | 1.14.0 | 1.17.0 | 1.15.1 | Rust is too old on stretch |
-| smalltalk | | | | | Not in CI |
-| swift | | | | | Not in CI |
+| Tool | ubuntu-trusty | ubuntu-xenial | ubuntu-artful | Notes |
+| :-------- | :------------ | :------------ | :------------ | :---- |
+| ant | 1.9.3 | 1.9.6 | 1.9.9 | |
+| autoconf | 2.69 | 2.69 | 2.69 | |
+| automake | 1.14.1 | 1.15 | 1.15 | |
+| bison | 3.0.2 | 3.0.4 | 3.0.4 | |
+| boost | 1.54.0 | 1.58.0 | 1.63.0 | artful: stock boost 1.62.0 has problems running unit tests |
+| cmake | 3.2.2 | 3.5.1 | 3.9.1 | |
+| cppcheck | 1.61 | 1.72 | 1.80 | |
+| flex | 2.5.35 | 2.6.0 | 2.6.1 | |
+| glibc | 2.19 | 2.23 | 2.26 | |
+| libevent | 2.0.21 | 2.0.21 | 2.1 | |
+| libstdc++ | 4.8.4 | 5.4.0 | 7.2.0 | |
+| make | 3.81 | 4.1 | 4.1 | |
+| openssl | 1.0.1f | 1.0.2g | 1.0.2g | |
+| qt5 | 5.2.1 | 5.5.1 | 5.9.1 | |
+
+## Compiler/Language Versions per Dockerfile
+| Language | ubuntu-trusty | ubuntu-xenial | ubuntu-artful | Notes |
+| :-------- | :------------ | :------------ | :------------ | :---- |
+| as3 | | | | Not in CI |
+| C++ gcc | 4.8.4 | 5.4.0 | 7.2.0 | |
+| C++ clang | 3.4 | 3.8 | 4.0 | |
+| C# (mono) | 3.2.8.0 | 4.2.1 | 4.6.2.7 | |
+| c_glib | 2.40.2 | 2.48.2 | 2.54.0 | |
+| cocoa | | | | Not in CI |
+| d | 2.070.2 | 2.073.2 | 2.076.0 | |
+| dart | 1.20.1 | 1.24.2 | | artful: apt repo not compatible with apt 1.4? |
+| delphi | | | | Not in CI |
+| dotnet | | 2.0.0 | | Needs to be added to artful |
+| erlang | R16B03 | 18.3 | 20.0.4 | |
+| go | 1.2.1 | 1.6.2 | 1.8.3 | |
+| haskell | 7.6.3 | 7.10.3 | 8.0.2 | |
+| haxe | | 3.2.1 | 3.4.2 | disabled in trusty builds - cores on install v3.0.0, disabled in artful builds - see THRIFT-4352 |
+| java | 1.7.0_151 | 1.8.0_131 | 1.8.0_144 | |
+| js | | | | Unsure how to look for version info? |
+| lua | 5.1.5 | 5.2.4 | 5.3.3 | |
+| nodejs | | 4.2.6 | 6.11.2 | trusty has node.js 0.10.0 which is too old |
+| ocaml | | 4.02.3 | 4.04.0 | |
+| perl | 5.18.2 | 5.22.1 | 5.26.0 | |
+| php | 5.5.9 | 7.0.22 | 7.1.8 | |
+| python | 2.7.6 | 2.7.12 | 2.7.14 | |
+| python3 | 3.4.3 | 3.5.2 | 3.6.3 | |
+| ruby | 1.9.3p484 | 2.3.1p112 | 2.3.3p222 | |
+| rust | 1.15.1 | 1.15.1 | 1.18.0 | |
+| smalltalk | | | | Not in CI |
+| swift | | | | Not in CI |
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/build/docker/check_unmodified.sh
----------------------------------------------------------------------
diff --git a/build/docker/check_unmodified.sh b/build/docker/check_unmodified.sh
deleted file mode 100755
index 9d5fa26..0000000
--- a/build/docker/check_unmodified.sh
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/bin/bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-# Download prebuilt docker image and compare Dockerfile hash values
-
-set -ex
-
-SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
-DISTRO=$1
-SRC_IMG=thrift/thrift-build:$DISTRO
-
-function try_pull {
- docker pull $SRC_IMG
- cd ${SCRIPT_DIR}/$DISTRO
- docker run $SRC_IMG bash -c 'cd .. && sha512sum Dockerfile' > .Dockerfile.sha512
- sha512sum -c .Dockerfile.sha512
-}
-
-if try_pull; then
- echo Dockerfile seems identical. No need to rebuild from scratch.
- docker tag thrift/thrift-build:$DISTRO thrift-build:$DISTRO
-else
- echo Either Dockerfile has changed or pull failure. Need to build brand new one.
- exit 1
-fi
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/build/docker/refresh.sh
----------------------------------------------------------------------
diff --git a/build/docker/refresh.sh b/build/docker/refresh.sh
new file mode 100755
index 0000000..20a443b
--- /dev/null
+++ b/build/docker/refresh.sh
@@ -0,0 +1,77 @@
+#!/bin/bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+#
+# The build has two stages: "docker" and "test"
+# The "docker" stage is meant to rebuild the docker images
+# if needed. If we cannot push that result however then
+# there is no reason to do anything.
+# The "test" stage is an actual test job. Even if the docker
+# image doesn't match what's in the repo, we still build
+# the image so the build job can run properly.
+#
+
+set -e
+
+SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+. $SCRIPT_DIR/vars.sh
+
+function dockerfile_changed {
+ # image may not exist yet, so we have to let it fail silently:
+ docker pull $DOCKER_TAG || true
+ docker run $DOCKER_TAG bash -c 'cd .. && sha512sum Dockerfile' > .Dockerfile.sha512
+ sha512sum -c .Dockerfile.sha512
+}
+
+#
+# If this build has no DOCKER_PASS and it is in the docker stage
+# then there's no reason to do any processing because we cannot
+# push the result if the Dockerfile changed.
+#
+
+if [[ "$TRAVIS_BUILD_STAGE" == "docker" ]] && [[ -z "$DOCKER_PASS" ]]; then
+ echo Detected docker stage build and no defined DOCKER_PASS, this build job will be skipped.
+ echo Subsequent jobs in the test stage may each rebuild the docker image.
+ exit 0
+fi
+
+
+pushd ${SCRIPT_DIR}/$DISTRO
+if dockerfile_changed; then
+ echo Dockerfile has not changed. No need to rebuild.
+ exit 0
+else
+ echo Dockerfile has changed.
+fi
+popd
+
+#
+# Dockerfile has changed
+#
+
+echo Rebuilding docker image $DISTRO
+docker build --tag $DOCKER_TAG build/docker/$DISTRO
+
+if [[ ! -z "$DOCKER_PASS" ]]; then
+ echo Pushing docker image $DOCKER_TAG
+ docker login -u $DOCKER_USER -p $DOCKER_PASS
+ docker push $DOCKER_TAG
+fi
+
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/build/docker/run.sh
----------------------------------------------------------------------
diff --git a/build/docker/run.sh b/build/docker/run.sh
new file mode 100755
index 0000000..b54924b
--- /dev/null
+++ b/build/docker/run.sh
@@ -0,0 +1,30 @@
+#!/bin/bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+set -e
+
+SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+. $SCRIPT_DIR/vars.sh
+
+printenv | sort
+
+docker run --net=host -e BUILD_LIBS="$BUILD_LIBS" $BUILD_ENV -v $(pwd):/thrift/src \
+ -it $DOCKER_TAG build/docker/scripts/$SCRIPT $BUILD_ARG
+
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/build/docker/scripts/sca.sh
----------------------------------------------------------------------
diff --git a/build/docker/scripts/sca.sh b/build/docker/scripts/sca.sh
new file mode 100755
index 0000000..2f2fb68
--- /dev/null
+++ b/build/docker/scripts/sca.sh
@@ -0,0 +1,48 @@
+#!/bin/sh
+set -ev
+
+#
+# C/C++ static code analysis with cppcheck
+# add --error-exitcode=1 to --enable=all as soon as everything is fixed
+#
+# Python code style check with flake8
+#
+# search for TODO etc within source tree
+# some statistics about the code base
+# some info about the build machine
+
+# Compiler cppcheck (All)
+cppcheck --force --quiet --inline-suppr --enable=all -j2 compiler/cpp/src
+
+# C++ cppcheck (All)
+cppcheck --force --quiet --inline-suppr --enable=all -j2 lib/cpp/src lib/cpp/test test/cpp tutorial/cpp
+
+# C Glib cppcheck (All)
+cppcheck --force --quiet --inline-suppr --enable=all -j2 lib/c_glib/src lib/c_glib/test test/c_glib/src tutorial/c_glib
+
+# Silent error checks
+cppcheck --force --quiet --inline-suppr --error-exitcode=1 -j2 compiler/cpp/src
+cppcheck --force --quiet --inline-suppr --error-exitcode=1 -j2 lib/cpp/src lib/cpp/test test/cpp tutorial/cpp
+cppcheck --force --quiet --inline-suppr --error-exitcode=1 -j2 lib/c_glib/src lib/c_glib/test test/c_glib/src tutorial/c_glib
+
+# Python code style
+flake8 --ignore=E501 lib/py
+flake8 tutorial/py
+flake8 --ignore=E501 test/py
+flake8 test/py.twisted
+flake8 test/py.tornado
+flake8 --ignore=E501 test/test.py
+flake8 --ignore=E501 test/crossrunner
+flake8 test/features
+
+# TODO etc
+echo FIXMEs: `grep -r FIXME * | wc -l`
+echo HACKs: `grep -r HACK * | wc -l`
+echo TODOs: `grep -r TODO * | wc -l`
+
+# LoC
+sloccount .
+
+# System Info
+dpkg -l
+uname -a
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/build/docker/scripts/ubsan.sh
----------------------------------------------------------------------
diff --git a/build/docker/scripts/ubsan.sh b/build/docker/scripts/ubsan.sh
index e1e82c9..650dba0 100755
--- a/build/docker/scripts/ubsan.sh
+++ b/build/docker/scripts/ubsan.sh
@@ -1,27 +1,28 @@
#!/bin/sh
-set -ex
-
-# Wraps autotools.sh, but each binary crashes if it exhibits undefined behavior. See
-# http://releases.llvm.org/3.8.0/tools/clang/docs/UndefinedBehaviorSanitizer.html
+set -e
+# Wraps autotools.sh, but each binary crashes if it exhibits undefined behavior.
# Set the undefined behavior flags. This crashes on all undefined behavior except for
# undefined casting, aka "vptr".
-#
# TODO: fix undefined vptr behavior and turn this option back on.
-export CFLAGS="-fsanitize=undefined -fno-sanitize-recover=undefined"
-# Builds without optimization and with debugging symbols for making crash reports more
-# readable.
-export CFLAGS="${CFLAGS} -O0 -ggdb3"
+
+export CFLAGS="-fsanitize=undefined -fno-sanitize-recover=undefined -O0 -ggdb3 -fno-omit-frame-pointer"
export CXXFLAGS="${CFLAGS}"
+export LDFLAGS="-lubsan"
export UBSAN_OPTIONS=print_stacktrace=1
-# llvm-symbolizer must be on PATH, but the above installation instals a binary called
-# "llvm-symbolizer-3.8", not "llvm-symbolizer". This fixes that with a softlink in a new
-# directory.
+#
+# work around https://svn.boost.org/trac10/ticket/11632 if present
+#
+
+sed -i 's/, stream_t(rdbuf()) /, stream_t(pbase_type::member.get())/g' /usr/include/boost/format/alt_sstream.hpp
+
+# llvm-symbolizer must be on PATH to get a stack trace on error
+
CLANG_PATH="$(mktemp -d)"
trap "rm -rf ${CLANG_PATH}" EXIT
-ln -s "$(whereis llvm-symbolizer-3.8 | rev | cut -d ' ' -f 1 | rev)" \
+ln -s "$(whereis llvm-symbolizer-4.0 | rev | cut -d ' ' -f 1 | rev)" \
"${CLANG_PATH}/llvm-symbolizer"
export PATH="${CLANG_PATH}:${PATH}"
llvm-symbolizer -version
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/build/docker/ubuntu-artful/Dockerfile
----------------------------------------------------------------------
diff --git a/build/docker/ubuntu-artful/Dockerfile b/build/docker/ubuntu-artful/Dockerfile
new file mode 100644
index 0000000..1c8f963
--- /dev/null
+++ b/build/docker/ubuntu-artful/Dockerfile
@@ -0,0 +1,255 @@
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#
+# Apache Thrift Docker build environment for Ubuntu Artful
+# Using all stock Ubuntu Artful packaging except for:
+# - cpp: stock boost 1.62 in artful has a nasty bug so we use stock boost 1.63
+# - d: does not come with Ubuntu so we're installing the latest
+# - d: deimos for libevent and openssl omitted - not compatible / build errors
+# - dart: dart repository doesn't work with apt 1.4 in artful
+# - dotnetcore, because netcore is for 1.0.0-preview and 2.0.0 is out
+# - haxe: see THRIFT-4352, but test/haxe cores during testing
+# and hxcpp 3.4.64 is not compatible with artful
+#
+
+FROM buildpack-deps:artful-scm
+MAINTAINER Apache Thrift <de...@thrift.apache.org>
+ENV DEBIAN_FRONTEND noninteractive
+
+RUN apt-get update && \
+ apt-get dist-upgrade -y && \
+ apt-get install -y --no-install-recommends \
+ apt \
+ apt-transport-https \
+ apt-utils \
+ curl \
+ dirmngr \
+ software-properties-common \
+ wget
+
+# csharp (mono) - if we ever want a later version
+# RUN echo "deb http://download.mono-project.com/repo/debian xenial main" | tee /etc/apt/sources.list.d/mono.list && \
+# apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A6A19B38D3D831EF
+
+# dotnet (core) 2.0.0 - project isn't ready for this yet:
+# RUN curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > /etc/apt/trusted.gpg.d/microsoft.gpg && \
+# echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-xenial-prod xenial main" > /etc/apt/sources.list.d/dotnetdev.list
+
+# node.js (this step runs apt-get update internally) - if we ever want a later version
+# note: node 8.5 introduced some issues with directory handling / jsdoc / something... using 7.x for now
+# RUN curl -sL https://deb.nodesource.com/setup_7.x | bash
+
+### install general dependencies
+RUN apt-get install -y --no-install-recommends \
+`# General dependencies` \
+ bash-completion \
+ bison \
+ build-essential \
+ clang \
+ cmake \
+ debhelper \
+ flex \
+ gdb \
+ llvm \
+ ninja-build \
+ pkg-config \
+ valgrind \
+ vim
+ENV PATH /usr/lib/llvm-3.8/bin:$PATH
+
+# boost-1.62 has a terrible bug in boost::test, see https://svn.boost.org/trac10/ticket/12507
+RUN apt-get install -y --no-install-recommends \
+`# C++ dependencies` \
+ libboost1.63-all-dev \
+ libevent-dev \
+ libssl-dev \
+ qt5-default \
+ qtbase5-dev \
+ qtbase5-dev-tools
+
+RUN apt-get install -y --no-install-recommends \
+`# csharp (mono) dependencies` \
+ mono-devel
+
+RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EBCF975E5BA24D5E && \
+ wget http://master.dl.sourceforge.net/project/d-apt/files/d-apt.list -O /etc/apt/sources.list.d/d-apt.list && \
+ wget -qO - https://dlang.org/d-keyring.gpg | apt-key add - && \
+ apt-get update && \
+ apt-get install -y --no-install-recommends \
+ `# D dependencies` \
+ dmd-bin \
+ libphobos2-dev \
+ dub \
+ dfmt \
+ dscanner \
+ libevent-dev \
+ libssl-dev \
+ xdg-utils
+# libevent deimos doesn't seem to work so not enabling it:
+# RUN mkdir -p /usr/include/dmd/druntime/import/deimos /usr/include/dmd/druntime/import/C && \
+# curl -sSL https://github.com/D-Programming-Deimos/libevent/archive/master.tar.gz| tar xz && \
+# mv libevent-master/deimos/* /usr/include/dmd/druntime/import/deimos/ && \
+# mv libevent-master/C/* /usr/include/dmd/druntime/import/C/ && \
+# rm -rf libevent-master
+# openssl deimos doesn't work with openssl-1.0.2 so not enabling it:
+# RUN curl -sSL https://github.com/D-Programming-Deimos/openssl/archive/master.tar.gz| tar xz && \
+# mv openssl-master/deimos/* /usr/include/dmd/druntime/import/deimos/ && \
+# mv openssl-master/C/* /usr/include/dmd/druntime/import/C/ && \
+# rm -rf openssl-master
+
+# dart is disabled because the repository won't sync properly with apt 1.4
+# RUN curl https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
+# curl https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list && \
+# apt-get update && \
+# apt-get install -y --no-install-recommends \
+# `# Dart dependencies` \
+# dart
+# ENV PATH /usr/lib/dart/bin:$PATH
+
+# project isn't ready for this quite yet:
+# RUN apt-get install -y --no-install-recommends \
+# `# dotnet core dependencies` \
+# dotnet-sdk-2.0.0
+
+RUN apt-get install -y --no-install-recommends \
+`# Erlang dependencies` \
+ erlang-base \
+ erlang-eunit \
+ erlang-dev \
+ erlang-tools \
+ rebar
+
+RUN apt-get install -y --no-install-recommends \
+`# GlibC dependencies` \
+ libglib2.0-dev
+
+RUN apt-get install -y --no-install-recommends \
+`# golang (go) dependencies` \
+ golang-go \
+ golang-race-detector-runtime
+
+RUN apt-get install -y --no-install-recommends \
+`# Haskell dependencies` \
+ ghc \
+ cabal-install
+
+# see THRIFT-4352, test/haxe cores on artful
+# RUN apt-get install -y --no-install-recommends \
+# `# Haxe dependencies` \
+# haxe \
+# neko \
+# neko-dev
+# RUN haxelib setup --always /usr/share/haxe/lib && \
+# haxelib install --always hxcpp
+
+RUN apt-get install -y --no-install-recommends \
+`# Java dependencies` \
+ ant \
+ ant-optional \
+ openjdk-8-jdk \
+ maven
+
+RUN apt-get install -y --no-install-recommends \
+`# Lua dependencies` \
+ lua5.3 \
+ lua5.3-dev && \
+ ln -s /usr/bin/lua5.3 /usr/bin/lua && \
+ ln -s /usr/bin/luac5.3 /usr/bin/luac
+# https://bugs.launchpad.net/ubuntu/+source/lua5.3/+bug/1707212
+# lua5.3 does not install alternatives!
+
+RUN apt-get install -y --no-install-recommends \
+`# Node.js dependencies` \
+ nodejs \
+ npm
+
+RUN apt-get install -y --no-install-recommends \
+`# OCaml dependencies` \
+ ocaml \
+ opam && \
+ opam init --yes && \
+ opam install --yes oasis
+
+RUN apt-get install -y --no-install-recommends \
+`# Perl dependencies` \
+ libbit-vector-perl \
+ libclass-accessor-class-perl \
+ libcrypt-ssleay-perl \
+ libio-socket-ssl-perl \
+ libnet-ssleay-perl
+
+RUN apt-get install -y --no-install-recommends \
+`# Php dependencies` \
+ php \
+ php-cli \
+ php-dev \
+ php-pear \
+ re2c \
+ phpunit
+
+RUN apt-get install -y --no-install-recommends \
+`# Python dependencies` \
+ python-all \
+ python-all-dbg \
+ python-all-dev \
+ python-ipaddress \
+ python-pip \
+ python-setuptools \
+ python-six \
+ python-tornado \
+ python-twisted \
+ python-wheel \
+ python-zope.interface && \
+ pip install --upgrade backports.ssl_match_hostname
+
+RUN apt-get install -y --no-install-recommends \
+`# Python3 dependencies` \
+ python3-all \
+ python3-all-dbg \
+ python3-all-dev \
+ python3-pip \
+ python3-setuptools \
+ python3-six \
+ python3-tornado \
+ python3-twisted \
+ python3-wheel \
+ python3-zope.interface
+
+RUN apt-get install -y --no-install-recommends \
+`# Ruby dependencies` \
+ ruby \
+ ruby-dev \
+ ruby-bundler
+RUN gem install bundler --no-ri --no-rdoc
+
+RUN apt-get install -y --no-install-recommends \
+`# Rust dependencies` \
+ cargo \
+ rustc
+
+RUN apt-get install -y --no-install-recommends \
+`# Static Code Analysis dependencies` \
+ cppcheck \
+ sloccount && \
+ pip install flake8
+
+# Clean up
+RUN rm -rf /var/cache/apt/* && \
+ rm -rf /var/lib/apt/lists/* && \
+ rm -rf /tmp/* && \
+ rm -rf /var/tmp/*
+
+ENV THRIFT_ROOT /thrift
+RUN mkdir -p $THRIFT_ROOT/src
+COPY Dockerfile $THRIFT_ROOT/
+WORKDIR $THRIFT_ROOT/src
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/build/docker/ubuntu-trusty/Dockerfile
----------------------------------------------------------------------
diff --git a/build/docker/ubuntu-trusty/Dockerfile b/build/docker/ubuntu-trusty/Dockerfile
index 857384b..db2041a 100644
--- a/build/docker/ubuntu-trusty/Dockerfile
+++ b/build/docker/ubuntu-trusty/Dockerfile
@@ -10,62 +10,52 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-# Apache Thrift Docker build environment for Ubuntu
#
-# Known missing client libraries:
-# - dotnetcore
+# Apache Thrift Docker build environment for Ubuntu Trusty
+# Using all stock Ubuntu Trusty packaging except for:
+# - d: does not come with Ubuntu so we're installing 2.070.0
+# - dart: does not come with Ubuntu so we're installing 1.20.1
+# - dotnetcore, disabled because netcore is for 1.0.0-preview and 2.0.0 is out
+# - haxe, disabled because the distro comes with 3.0.0 and it cores while installing
+# - node.js, disabled because it is at 0.10.0 in the distro which is too old (need 4+)
+# - ocaml, disabled because it fails to install properly
+#
FROM buildpack-deps:trusty-scm
MAINTAINER Apache Thrift <de...@thrift.apache.org>
-
ENV DEBIAN_FRONTEND noninteractive
-# Add apt sources
-# CMAKE
-RUN apt-get update && \
- apt-get install -y --no-install-recommends software-properties-common && \
- add-apt-repository -y ppa:george-edison55/cmake-3.x
-
-# Erlang
-RUN echo 'deb http://packages.erlang-solutions.com/debian trusty contrib' > /etc/apt/sources.list.d/erlang_solutions.list && \
- curl -sSL https://packages.erlang-solutions.com/debian/erlang_solutions.asc | apt-key add -
-
-# Dart
-RUN curl https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
- curl https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list && \
- sed -i /etc/apt/sources.list.d/dart_stable.list -e 's/https:/http:/g'
-
-# Consider using mirror nearby when building locally
-# TODO: Provide option via --build-arg=...
-# RUN sed -i /etc/apt/sources.list -e 's!http://archive.ubuntu.com/ubuntu/!http://your/mirror/!g'
+RUN apt-get update && \
+ apt-get dist-upgrade -y && \
+ apt-get install -y --no-install-recommends \
+ apt \
+ apt-transport-https \
+ apt-utils \
+ curl \
+ dirmngr \
+ software-properties-common \
+ wget
RUN apt-get update && apt-get install -y --no-install-recommends \
`# General dependencies` \
+ bash-completion \
bison \
build-essential \
clang \
cmake \
debhelper \
flex \
+ gdb \
+ llvm \
ninja-build \
pkg-config \
-`# Included in buildpack-deps` \
-`# autoconf` \
-`# automake` \
-`# g++` \
-`# git` \
-`# libtool` \
-`# make`
+ valgrind \
+ vim
+ENV PATH /usr/lib/llvm-3.8/bin:$PATH
RUN apt-get install -y --no-install-recommends \
`# C++ dependencies` \
-`# libevent and OpenSSL are needed by D too` \
- libboost-dev \
- libboost-filesystem-dev \
- libboost-program-options-dev \
- libboost-system-dev \
- libboost-test-dev \
- libboost-thread-dev \
+ libboost-all-dev \
libevent-dev \
libssl-dev \
qt5-default \
@@ -73,6 +63,70 @@ RUN apt-get install -y --no-install-recommends \
qtbase5-dev-tools
RUN apt-get install -y --no-install-recommends \
+`# csharp (mono) dependencies` \
+ mono-devel
+
+RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EBCF975E5BA24D5E && \
+ wget http://master.dl.sourceforge.net/project/d-apt/files/d-apt.list -O /etc/apt/sources.list.d/d-apt.list && \
+ wget -qO - https://dlang.org/d-keyring.gpg | apt-key add - && \
+ apt-get update && \
+ apt-get install -y --no-install-recommends \
+`# D dependencies` \
+ dmd-bin=2.070.2-0 \
+ libphobos2-dev=2.070.2-0 \
+ dub \
+ dfmt \
+ dscanner \
+ xdg-utils
+# RUN mkdir -p /usr/include/dmd/druntime/import/deimos /usr/include/dmd/druntime/import/C && \
+# curl -sSL https://github.com/D-Programming-Deimos/libevent/archive/master.tar.gz| tar xz && \
+# mv libevent-master/deimos/* /usr/include/dmd/druntime/import/deimos/ && \
+# mv libevent-master/C/* /usr/include/dmd/druntime/import/C/ && \
+# rm -rf libevent-master
+# RUN curl -sSL https://github.com/D-Programming-Deimos/openssl/archive/master.tar.gz| tar xz && \
+# mv openssl-master/deimos/* /usr/include/dmd/druntime/import/deimos/ && \
+# mv openssl-master/C/* /usr/include/dmd/druntime/import/C/ && \
+# rm -rf openssl-master
+
+RUN curl https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
+ curl https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list && \
+ apt-get update && \
+ apt-get install -y --no-install-recommends \
+`# Dart dependencies` \
+ dart=1.20.1-1
+ENV PATH /usr/lib/dart/bin:$PATH
+
+RUN apt-get install -y --no-install-recommends \
+`# Erlang dependencies` \
+ erlang-base \
+ erlang-eunit \
+ erlang-dev \
+ erlang-tools \
+ rebar
+
+RUN apt-get install -y --no-install-recommends \
+`# GlibC dependencies` \
+ libglib2.0-dev
+
+RUN apt-get install -y --no-install-recommends \
+`# golang (go) dependencies` \
+ golang-go
+
+RUN apt-get install -y --no-install-recommends \
+`# Haskell dependencies` \
+ ghc \
+ cabal-install
+
+# disabled because it cores while installing
+# RUN apt-get install -y --no-install-recommends \
+# `# Haxe dependencies` \
+# haxe \
+# neko \
+# neko-dev && \
+# haxelib setup /usr/share/haxe/lib && \
+# haxelib install hxcpp 3.2.102
+
+RUN apt-get install -y --no-install-recommends \
`# Java dependencies` \
ant \
ant-optional \
@@ -80,151 +134,89 @@ RUN apt-get install -y --no-install-recommends \
maven
RUN apt-get install -y --no-install-recommends \
+`# Lua dependencies` \
+ lua5.1 \
+ lua5.1-dev
+
+# disabled because it is too old
+# RUN apt-get install -y --no-install-recommends \
+# `# Node.js dependencies` \
+# nodejs \
+# npm
+
+# disabled because it fails to install properly
+# RUN apt-get install -y --no-install-recommends \
+# `# OCaml dependencies` \
+# ocaml \
+# opam && \
+# opam init --yes && \
+# opam install --yes oasis
+
+RUN apt-get install -y --no-install-recommends \
+`# Perl dependencies` \
+ libbit-vector-perl \
+ libclass-accessor-class-perl \
+ libcrypt-ssleay-perl \
+ libio-socket-ssl-perl \
+ libnet-ssleay-perl
+
+RUN apt-get install -y --no-install-recommends \
+`# Php dependencies` \
+ php5 \
+ php5-cli \
+ php5-dev \
+ php-pear \
+ re2c \
+ phpunit
+
+RUN apt-get install -y --no-install-recommends \
`# Python dependencies` \
-`# TODO:` \
-`# Install twisted and zope.interface via pip. we need twisted at ./configure time, otherwise` \
-`# py.twisted tests are skipped.` \
python-all \
python-all-dbg \
python-all-dev \
python-pip \
python-setuptools \
+ python-six \
python-twisted \
+ python-wheel \
python-zope.interface \
python3-all \
python3-all-dbg \
python3-all-dev \
+ python3-pip \
python3-setuptools \
- python3-pip
+ python3-six \
+ python3-wheel \
+ python3-zope.interface && \
+ pip install -U ipaddress backports.ssl_match_hostname tornado && \
+ pip3 install -U backports.ssl_match_hostname tornado
+# installing tornado by pip/pip3 instead of debian package
+# if we install the debian package, the build fails in py2
RUN apt-get install -y --no-install-recommends \
`# Ruby dependencies` \
ruby \
ruby-dev \
- ruby-bundler \
-`# Perl dependencies` \
- libbit-vector-perl \
- libclass-accessor-class-perl \
- libcrypt-ssleay-perl \
- libio-socket-ssl-perl \
- libnet-ssleay-perl
+ ruby-bundler
+RUN gem install bundler --no-ri --no-rdoc
RUN apt-get install -y --no-install-recommends \
-`# Php dependencies` \
- php5 \
- php5-dev \
- php5-cli \
- php-pear \
- re2c \
- phpunit \
-`# GlibC dependencies` \
- libglib2.0-dev
-
-RUN apt-get update && apt-get install -y --no-install-recommends \
-`# Erlang dependencies` \
- erlang-base \
- erlang-eunit \
- erlang-dev \
- erlang-tools \
- rebar
+`# Rust dependencies` \
+ cargo \
+ rustc
RUN apt-get install -y --no-install-recommends \
-`# Haskell dependencies` \
- ghc \
- cabal-install \
-`# Haxe dependencies` \
- neko \
- neko-dev \
- libneko0
-
-# Newer release of nodejs
-RUN curl -sL https://deb.nodesource.com/setup_4.x | bash
-RUN apt-get install -y --no-install-recommends \
-`# Node.js dependencies` \
- nodejs
-
-# Add mono package repository url to get latest version of mono
-RUN echo "deb http://download.mono-project.com/repo/debian trusty main" | tee /etc/apt/sources.list.d/mono.list
-RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A6A19B38D3D831EF
-RUN apt-get update && apt-get install -y --no-install-recommends \
-`# CSharp dependencies` \
- mono-devel
+`# Static Code Analysis dependencies` \
+ cppcheck \
+ sloccount && \
+ pip install flake8
-RUN apt-get install -y --no-install-recommends \
-`# D dependencies` \
- xdg-utils \
-`# Dart dependencies` \
- dart \
-`# Lua dependencies` \
- lua5.2 \
- lua5.2-dev \
-`# MinGW dependencies` \
- mingw32 \
- mingw32-binutils \
- mingw32-runtime \
- nsis \
-`# Clean up` \
- && rm -rf /var/cache/apt/* && \
+# Clean up
+RUN rm -rf /var/cache/apt/* && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /tmp/* && \
rm -rf /var/tmp/*
-# Ruby
-RUN gem install bundler --no-ri --no-rdoc
-
-# Python optional dependencies
-RUN pip2 install -U ipaddress backports.ssl_match_hostname tornado
-RUN pip3 install -U backports.ssl_match_hostname tornado
-
-# Go
-RUN curl -sSL https://storage.googleapis.com/golang/go1.4.3.linux-amd64.tar.gz | tar -C /usr/local/ -xz
-ENV PATH /usr/local/go/bin:$PATH
-
-# Haxe
-RUN mkdir -p /usr/lib/haxe && \
- wget -O - https://github.com/HaxeFoundation/haxe/releases/download/3.2.1/haxe-3.2.1-linux64.tar.gz | \
- tar -C /usr/lib/haxe --strip-components=1 -xz && \
- ln -s /usr/lib/haxe/haxe /usr/bin/haxe && \
- ln -s /usr/lib/haxe/haxelib /usr/bin/haxelib && \
- mkdir -p /usr/lib/haxe/lib && \
- chmod -R 777 /usr/lib/haxe/lib && \
- haxelib setup --always /usr/lib/haxe/lib && \
- haxelib install --always hxcpp 3.4.64
-
-# Node.js
-# temporarily removed since this breaks the build (and is not needed to test C# code)
-# RUN curl -sSL https://www.npmjs.com/install.sh | sh
-
-# D
-RUN curl -sSL http://downloads.dlang.org/releases/2.x/2.070.0/dmd_2.070.0-0_amd64.deb -o /tmp/dmd_2.070.0-0_amd64.deb && \
- dpkg -i /tmp/dmd_2.070.0-0_amd64.deb && \
- rm /tmp/dmd_2.070.0-0_amd64.deb && \
- curl -sSL https://github.com/D-Programming-Deimos/openssl/archive/master.tar.gz| tar xz && \
- curl -sSL https://github.com/D-Programming-Deimos/libevent/archive/master.tar.gz| tar xz && \
- mkdir -p /usr/include/dmd/druntime/import/deimos /usr/include/dmd/druntime/import/C && \
- mv libevent-master/deimos/* openssl-master/deimos/* /usr/include/dmd/druntime/import/deimos/ && \
- mv libevent-master/C/* openssl-master/C/* /usr/include/dmd/druntime/import/C/ && \
- rm -rf libevent-master openssl-master && \
- echo 'gcc -Wl,--no-as-needed $*' > /usr/local/bin/gcc-dmd && \
- chmod 755 /usr/local/bin/gcc-dmd && \
- echo 'CC=/usr/local/bin/gcc-dmd' >> /etc/dmd.conf
-
-# Dart
-ENV PATH /usr/lib/dart/bin:$PATH
-
-# OCaml
-RUN echo 'deb http://ppa.launchpad.net/avsm/ppa/ubuntu trusty main' > /etc/apt/sources.list.d/avsm-official-ocaml.list && \
- gpg --keyserver keyserver.ubuntu.com --recv 61707B09 && \
- gpg --export --armor 61707B09 | apt-key add - && \
- apt-get update && \
- apt-get install -y ocaml opam && \
- opam init && \
- opam install oasis
-
-# Rust
-RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain 1.17.0
-ENV PATH /root/.cargo/bin:$PATH
-
ENV THRIFT_ROOT /thrift
RUN mkdir -p $THRIFT_ROOT/src
COPY Dockerfile $THRIFT_ROOT/
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/build/docker/ubuntu-trusty/Dockerfile.orig
----------------------------------------------------------------------
diff --git a/build/docker/ubuntu-trusty/Dockerfile.orig b/build/docker/ubuntu-trusty/Dockerfile.orig
new file mode 100644
index 0000000..857384b
--- /dev/null
+++ b/build/docker/ubuntu-trusty/Dockerfile.orig
@@ -0,0 +1,231 @@
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Apache Thrift Docker build environment for Ubuntu
+#
+# Known missing client libraries:
+# - dotnetcore
+
+FROM buildpack-deps:trusty-scm
+MAINTAINER Apache Thrift <de...@thrift.apache.org>
+
+ENV DEBIAN_FRONTEND noninteractive
+
+# Add apt sources
+# CMAKE
+RUN apt-get update && \
+ apt-get install -y --no-install-recommends software-properties-common && \
+ add-apt-repository -y ppa:george-edison55/cmake-3.x
+
+# Erlang
+RUN echo 'deb http://packages.erlang-solutions.com/debian trusty contrib' > /etc/apt/sources.list.d/erlang_solutions.list && \
+ curl -sSL https://packages.erlang-solutions.com/debian/erlang_solutions.asc | apt-key add -
+
+# Dart
+RUN curl https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
+ curl https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list && \
+ sed -i /etc/apt/sources.list.d/dart_stable.list -e 's/https:/http:/g'
+
+# Consider using mirror nearby when building locally
+# TODO: Provide option via --build-arg=...
+# RUN sed -i /etc/apt/sources.list -e 's!http://archive.ubuntu.com/ubuntu/!http://your/mirror/!g'
+
+RUN apt-get update && apt-get install -y --no-install-recommends \
+`# General dependencies` \
+ bison \
+ build-essential \
+ clang \
+ cmake \
+ debhelper \
+ flex \
+ ninja-build \
+ pkg-config \
+`# Included in buildpack-deps` \
+`# autoconf` \
+`# automake` \
+`# g++` \
+`# git` \
+`# libtool` \
+`# make`
+
+RUN apt-get install -y --no-install-recommends \
+`# C++ dependencies` \
+`# libevent and OpenSSL are needed by D too` \
+ libboost-dev \
+ libboost-filesystem-dev \
+ libboost-program-options-dev \
+ libboost-system-dev \
+ libboost-test-dev \
+ libboost-thread-dev \
+ libevent-dev \
+ libssl-dev \
+ qt5-default \
+ qtbase5-dev \
+ qtbase5-dev-tools
+
+RUN apt-get install -y --no-install-recommends \
+`# Java dependencies` \
+ ant \
+ ant-optional \
+ openjdk-7-jdk \
+ maven
+
+RUN apt-get install -y --no-install-recommends \
+`# Python dependencies` \
+`# TODO:` \
+`# Install twisted and zope.interface via pip. we need twisted at ./configure time, otherwise` \
+`# py.twisted tests are skipped.` \
+ python-all \
+ python-all-dbg \
+ python-all-dev \
+ python-pip \
+ python-setuptools \
+ python-twisted \
+ python-zope.interface \
+ python3-all \
+ python3-all-dbg \
+ python3-all-dev \
+ python3-setuptools \
+ python3-pip
+
+RUN apt-get install -y --no-install-recommends \
+`# Ruby dependencies` \
+ ruby \
+ ruby-dev \
+ ruby-bundler \
+`# Perl dependencies` \
+ libbit-vector-perl \
+ libclass-accessor-class-perl \
+ libcrypt-ssleay-perl \
+ libio-socket-ssl-perl \
+ libnet-ssleay-perl
+
+RUN apt-get install -y --no-install-recommends \
+`# Php dependencies` \
+ php5 \
+ php5-dev \
+ php5-cli \
+ php-pear \
+ re2c \
+ phpunit \
+`# GlibC dependencies` \
+ libglib2.0-dev
+
+RUN apt-get update && apt-get install -y --no-install-recommends \
+`# Erlang dependencies` \
+ erlang-base \
+ erlang-eunit \
+ erlang-dev \
+ erlang-tools \
+ rebar
+
+RUN apt-get install -y --no-install-recommends \
+`# Haskell dependencies` \
+ ghc \
+ cabal-install \
+`# Haxe dependencies` \
+ neko \
+ neko-dev \
+ libneko0
+
+# Newer release of nodejs
+RUN curl -sL https://deb.nodesource.com/setup_4.x | bash
+RUN apt-get install -y --no-install-recommends \
+`# Node.js dependencies` \
+ nodejs
+
+# Add mono package repository url to get latest version of mono
+RUN echo "deb http://download.mono-project.com/repo/debian trusty main" | tee /etc/apt/sources.list.d/mono.list
+RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A6A19B38D3D831EF
+RUN apt-get update && apt-get install -y --no-install-recommends \
+`# CSharp dependencies` \
+ mono-devel
+
+RUN apt-get install -y --no-install-recommends \
+`# D dependencies` \
+ xdg-utils \
+`# Dart dependencies` \
+ dart \
+`# Lua dependencies` \
+ lua5.2 \
+ lua5.2-dev \
+`# MinGW dependencies` \
+ mingw32 \
+ mingw32-binutils \
+ mingw32-runtime \
+ nsis \
+`# Clean up` \
+ && rm -rf /var/cache/apt/* && \
+ rm -rf /var/lib/apt/lists/* && \
+ rm -rf /tmp/* && \
+ rm -rf /var/tmp/*
+
+# Ruby
+RUN gem install bundler --no-ri --no-rdoc
+
+# Python optional dependencies
+RUN pip2 install -U ipaddress backports.ssl_match_hostname tornado
+RUN pip3 install -U backports.ssl_match_hostname tornado
+
+# Go
+RUN curl -sSL https://storage.googleapis.com/golang/go1.4.3.linux-amd64.tar.gz | tar -C /usr/local/ -xz
+ENV PATH /usr/local/go/bin:$PATH
+
+# Haxe
+RUN mkdir -p /usr/lib/haxe && \
+ wget -O - https://github.com/HaxeFoundation/haxe/releases/download/3.2.1/haxe-3.2.1-linux64.tar.gz | \
+ tar -C /usr/lib/haxe --strip-components=1 -xz && \
+ ln -s /usr/lib/haxe/haxe /usr/bin/haxe && \
+ ln -s /usr/lib/haxe/haxelib /usr/bin/haxelib && \
+ mkdir -p /usr/lib/haxe/lib && \
+ chmod -R 777 /usr/lib/haxe/lib && \
+ haxelib setup --always /usr/lib/haxe/lib && \
+ haxelib install --always hxcpp 3.4.64
+
+# Node.js
+# temporarily removed since this breaks the build (and is not needed to test C# code)
+# RUN curl -sSL https://www.npmjs.com/install.sh | sh
+
+# D
+RUN curl -sSL http://downloads.dlang.org/releases/2.x/2.070.0/dmd_2.070.0-0_amd64.deb -o /tmp/dmd_2.070.0-0_amd64.deb && \
+ dpkg -i /tmp/dmd_2.070.0-0_amd64.deb && \
+ rm /tmp/dmd_2.070.0-0_amd64.deb && \
+ curl -sSL https://github.com/D-Programming-Deimos/openssl/archive/master.tar.gz| tar xz && \
+ curl -sSL https://github.com/D-Programming-Deimos/libevent/archive/master.tar.gz| tar xz && \
+ mkdir -p /usr/include/dmd/druntime/import/deimos /usr/include/dmd/druntime/import/C && \
+ mv libevent-master/deimos/* openssl-master/deimos/* /usr/include/dmd/druntime/import/deimos/ && \
+ mv libevent-master/C/* openssl-master/C/* /usr/include/dmd/druntime/import/C/ && \
+ rm -rf libevent-master openssl-master && \
+ echo 'gcc -Wl,--no-as-needed $*' > /usr/local/bin/gcc-dmd && \
+ chmod 755 /usr/local/bin/gcc-dmd && \
+ echo 'CC=/usr/local/bin/gcc-dmd' >> /etc/dmd.conf
+
+# Dart
+ENV PATH /usr/lib/dart/bin:$PATH
+
+# OCaml
+RUN echo 'deb http://ppa.launchpad.net/avsm/ppa/ubuntu trusty main' > /etc/apt/sources.list.d/avsm-official-ocaml.list && \
+ gpg --keyserver keyserver.ubuntu.com --recv 61707B09 && \
+ gpg --export --armor 61707B09 | apt-key add - && \
+ apt-get update && \
+ apt-get install -y ocaml opam && \
+ opam init && \
+ opam install oasis
+
+# Rust
+RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain 1.17.0
+ENV PATH /root/.cargo/bin:$PATH
+
+ENV THRIFT_ROOT /thrift
+RUN mkdir -p $THRIFT_ROOT/src
+COPY Dockerfile $THRIFT_ROOT/
+WORKDIR $THRIFT_ROOT/src
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/build/docker/ubuntu-xenial/Dockerfile
----------------------------------------------------------------------
diff --git a/build/docker/ubuntu-xenial/Dockerfile b/build/docker/ubuntu-xenial/Dockerfile
index 560cf87..255b6e8 100644
--- a/build/docker/ubuntu-xenial/Dockerfile
+++ b/build/docker/ubuntu-xenial/Dockerfile
@@ -10,32 +10,40 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+#
# Apache Thrift Docker build environment for Ubuntu Xenial
+# Using all stock Ubuntu Xenial packaging except for:
+# - d: does not come with Ubuntu so we're installing 2.073.2 for coverage
+# - dart: does not come with Ubuntu so we're installing 1.22.1 for coverage
+#
+
#
# Known missing or disabled libraries:
# - d: deimos for libevent and openssl omitted - not compatible / build errors
FROM buildpack-deps:xenial-scm
MAINTAINER Apache Thrift <de...@thrift.apache.org>
-
ENV DEBIAN_FRONTEND noninteractive
### Add apt repos
-RUN apt-get update && apt-get install -y --no-install-recommends apt apt-transport-https curl wget apt-utils
+RUN apt-get update && apt-get dist-upgrade -y && apt-get install -y --no-install-recommends apt apt-transport-https curl wget apt-utils
# csharp (mono)
-RUN echo "deb http://download.mono-project.com/repo/debian xenial main" | tee /etc/apt/sources.list.d/mono.list && \
- apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A6A19B38D3D831EF
+# RUN echo "deb http://download.mono-project.com/repo/debian xenial main" | tee /etc/apt/sources.list.d/mono.list && \
+# apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A6A19B38D3D831EF
# D
RUN wget http://master.dl.sourceforge.net/project/d-apt/files/d-apt.list -O /etc/apt/sources.list.d/d-apt.list && \
- apt-get update && apt-get -y --allow-unauthenticated install --reinstall d-apt-keyring
+ wget -qO - https://dlang.org/d-keyring.gpg | apt-key add -
+ENV D_VERSION 2.073.2-0
# Dart
RUN curl https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
curl https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list && \
sed -i /etc/apt/sources.list.d/dart_stable.list -e 's/https:/http:/g'
+# since ubuntu-artful can't run dart, we'll run 1.240 on xenial for now
+ENV DART_VERSION 1.24.2-1
# dotnet (core) 2.0.0
RUN curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > /etc/apt/trusted.gpg.d/microsoft.gpg && \
@@ -43,11 +51,11 @@ RUN curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > /et
# node.js (this step runs apt-get update internally)
# note: node 8.5 introduced some issues with directory handling / jsdoc / something... using 7.x for now
-RUN curl -sL https://deb.nodesource.com/setup_7.x | bash
+# RUN curl -sL https://deb.nodesource.com/setup_7.x | bash
### install general dependencies
-RUN apt-get install -y --no-install-recommends \
+RUN apt-get update && apt-get install -y --no-install-recommends \
`# General dependencies` \
bash-completion \
bison \
@@ -84,19 +92,23 @@ RUN apt-get install -y --no-install-recommends \
`# csharp (mono) dependencies` \
mono-devel
-RUN apt-get install -y --no-install-recommends \
+RUN apt-get install -y --allow-unauthenticated --no-install-recommends \
`# D dependencies` \
- dmd-bin \
+ dmd-bin=$D_VERSION \
+ libphobos2-dev=$D_VERSION \
+ dub \
+ dfmt \
+ dscanner \
libevent-dev \
libssl-dev \
xdg-utils
-# libevent deimos doesn't seem to work so disabling it:
+# libevent deimos doesn't seem to work so not enabling it:
# RUN mkdir -p /usr/include/dmd/druntime/import/deimos /usr/include/dmd/druntime/import/C && \
# curl -sSL https://github.com/D-Programming-Deimos/libevent/archive/master.tar.gz| tar xz && \
# mv libevent-master/deimos/* /usr/include/dmd/druntime/import/deimos/ && \
# mv libevent-master/C/* /usr/include/dmd/druntime/import/C/ && \
# rm -rf libevent-master
-# openssl deimos doesn't work with openssl-1.0.2 so disabling it:
+# openssl deimos doesn't work with openssl-1.0.2 so not enabling it:
# RUN curl -sSL https://github.com/D-Programming-Deimos/openssl/archive/master.tar.gz| tar xz && \
# mv openssl-master/deimos/* /usr/include/dmd/druntime/import/deimos/ && \
# mv openssl-master/C/* /usr/include/dmd/druntime/import/C/ && \
@@ -104,7 +116,7 @@ RUN apt-get install -y --no-install-recommends \
RUN apt-get install -y --no-install-recommends \
`# Dart dependencies` \
- dart
+ dart=$DART_VERSION
ENV PATH /usr/lib/dart/bin:$PATH
RUN apt-get install -y --no-install-recommends \
@@ -159,7 +171,9 @@ RUN apt-get install -y --no-install-recommends \
RUN apt-get install -y --no-install-recommends \
`# Node.js dependencies` \
- nodejs
+ nodejs \
+ npm && \
+ ln -s /usr/bin/nodejs /usr/bin/node
RUN apt-get install -y --no-install-recommends \
`# OCaml dependencies` \
@@ -222,9 +236,6 @@ RUN apt-get install -y --no-install-recommends \
cargo \
rustc
-# Update anything else left hanging
-RUN apt-get dist-upgrade -y
-
# Clean up
RUN rm -rf /var/cache/apt/* && \
rm -rf /var/lib/apt/lists/* && \
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/build/docker/vars.sh
----------------------------------------------------------------------
diff --git a/build/docker/vars.sh b/build/docker/vars.sh
new file mode 100755
index 0000000..752e282
--- /dev/null
+++ b/build/docker/vars.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+[[ ! -z "$DOCKER_USER" ]] || export DOCKER_USER=$DEFAULT_DOCKER_USER
+[[ ! -z "$DOCKER_REPO" ]] || export DOCKER_REPO=$DEFAULT_DOCKER_REPO
+[[ ! -z "$DOCKER_TAG" ]] || export DOCKER_TAG=$DOCKER_USER/$DOCKER_REPO:$DISTRO
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/compiler/cpp/Makefile.am
----------------------------------------------------------------------
diff --git a/compiler/cpp/Makefile.am b/compiler/cpp/Makefile.am
index 5082033..482a89a 100644
--- a/compiler/cpp/Makefile.am
+++ b/compiler/cpp/Makefile.am
@@ -111,7 +111,7 @@ thrift_SOURCES += src/thrift/generate/t_c_glib_generator.cc \
src/thrift/generate/t_rs_generator.cc
thrift_CPPFLAGS = -I$(srcdir)/src
-thrift_CXXFLAGS = -Wall -Wextra -pedantic
+thrift_CXXFLAGS = -Wall -Wextra -pedantic -Werror
thrift_LDADD = @LEXLIB@ src/thrift/libparse.a
if !WITH_PLUGIN
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/compiler/cpp/src/thrift/generate/t_csharp_generator.cc
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/thrift/generate/t_csharp_generator.cc b/compiler/cpp/src/thrift/generate/t_csharp_generator.cc
index 10d28b2..a6cb09d 100644
--- a/compiler/cpp/src/thrift/generate/t_csharp_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_csharp_generator.cc
@@ -2909,6 +2909,7 @@ void t_csharp_generator::prepare_member_name_mapping(void* scope,
const string& structname) {
// begin new scope
member_mapping_scope dummy;
+ dummy.scope_member = 0;
member_mapping_scopes.push_back(dummy);
member_mapping_scope& active = member_mapping_scopes.back();
active.scope_member = scope;
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/compiler/cpp/src/thrift/generate/t_haxe_generator.cc
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/thrift/generate/t_haxe_generator.cc b/compiler/cpp/src/thrift/generate/t_haxe_generator.cc
index 4de4307..97c7d19 100644
--- a/compiler/cpp/src/thrift/generate/t_haxe_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_haxe_generator.cc
@@ -2556,6 +2556,7 @@ string t_haxe_generator::type_name(t_type* ttype, bool in_container, bool in_ini
if (!(tkey->is_binary())) {
return "StringMap< " + type_name(tval) + ">";
}
+ break; // default to ObjectMap<>
case t_base_type::TYPE_I8:
case t_base_type::TYPE_I16:
case t_base_type::TYPE_I32:
@@ -2581,6 +2582,7 @@ string t_haxe_generator::type_name(t_type* ttype, bool in_container, bool in_ini
if (!(tkey->is_binary())) {
return "StringSet";
}
+ break; // default to ObjectSet
case t_base_type::TYPE_I8:
case t_base_type::TYPE_I16:
case t_base_type::TYPE_I32:
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/compiler/cpp/src/thrift/generate/t_hs_generator.cc
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/thrift/generate/t_hs_generator.cc b/compiler/cpp/src/thrift/generate/t_hs_generator.cc
index 29c0816..30eb8fa 100644
--- a/compiler/cpp/src/thrift/generate/t_hs_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_hs_generator.cc
@@ -1415,12 +1415,12 @@ void t_hs_generator::generate_deserialize_container(ofstream& out, t_type* ttype
} else if (ttype->is_set()) {
out << "(Set.fromList $ P.map (\\" << val << " -> ";
- generate_deserialize_type(out, ((t_map*)ttype)->get_key_type(), val);
+ generate_deserialize_type(out, ((t_set*)ttype)->get_elem_type(), val);
out << ") " << arg << ")";
} else if (ttype->is_list()) {
out << "(Vector.fromList $ P.map (\\" << val << " -> ";
- generate_deserialize_type(out, ((t_map*)ttype)->get_key_type(), val);
+ generate_deserialize_type(out, ((t_list*)ttype)->get_elem_type(), val);
out << ") " << arg << ")";
}
}
@@ -1488,9 +1488,9 @@ void t_hs_generator::generate_serialize_container(ofstream& out, t_type* ttype,
out << ")) $ Map.toList " << prefix;
} else if (ttype->is_set()) {
- out << "T.TSet " << type_to_enum(((t_list*)ttype)->get_elem_type());
+ out << "T.TSet " << type_to_enum(((t_set*)ttype)->get_elem_type());
out << " $ P.map (\\" << v << " -> ";
- generate_serialize_type(out, ((t_list*)ttype)->get_elem_type(), v);
+ generate_serialize_type(out, ((t_set*)ttype)->get_elem_type(), v);
out << ") $ Set.toList " << prefix;
} else if (ttype->is_list()) {
@@ -1577,7 +1577,7 @@ string t_hs_generator::type_to_enum(t_type* type) {
return "(T.T_MAP " + ktype + " " + vtype + ")";
} else if (type->is_set()) {
- return "(T.T_SET " + type_to_enum(((t_list*)type)->get_elem_type()) + ")";
+ return "(T.T_SET " + type_to_enum(((t_set*)type)->get_elem_type()) + ")";
} else if (type->is_list()) {
return "(T.T_LIST " + type_to_enum(((t_list*)type)->get_elem_type()) + ")";
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/compiler/cpp/src/thrift/generate/t_netcore_generator.cc
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/thrift/generate/t_netcore_generator.cc b/compiler/cpp/src/thrift/generate/t_netcore_generator.cc
index 71e4236..8d157a9 100644
--- a/compiler/cpp/src/thrift/generate/t_netcore_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_netcore_generator.cc
@@ -2789,6 +2789,7 @@ void t_netcore_generator::prepare_member_name_mapping(void* scope, const vector<
{
// begin new scope
member_mapping_scope dummy;
+ dummy.scope_member = 0;
member_mapping_scopes.push_back(dummy);
member_mapping_scope& active = member_mapping_scopes.back();
active.scope_member = scope;
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/compiler/cpp/src/thrift/parse/t_typedef.h
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/thrift/parse/t_typedef.h b/compiler/cpp/src/thrift/parse/t_typedef.h
index 0cccc26..aad3a50 100644
--- a/compiler/cpp/src/thrift/parse/t_typedef.h
+++ b/compiler/cpp/src/thrift/parse/t_typedef.h
@@ -33,7 +33,7 @@
class t_typedef : public t_type {
public:
t_typedef(t_program* program, t_type* type, const std::string& symbolic)
- : t_type(program, symbolic), type_(type), symbolic_(symbolic), forward_(false), seen_(false) {}
+ : t_type(program, symbolic), type_(type), symbolic_(symbolic), forward_(false) {}
/**
* This constructor is used to refer to a type that is lazily
@@ -44,8 +44,8 @@ public:
: t_type(program, symbolic),
type_(NULL),
symbolic_(symbolic),
- forward_(forward),
- seen_(false) {}
+ forward_(forward)
+ {}
~t_typedef() {}
@@ -61,7 +61,6 @@ private:
t_type* type_;
std::string symbolic_;
bool forward_;
- mutable bool seen_;
};
#endif
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/configure.ac
----------------------------------------------------------------------
diff --git a/configure.ac b/configure.ac
index 236c4c2..073ad8d 100755
--- a/configure.ac
+++ b/configure.ac
@@ -106,7 +106,6 @@ AX_CXX_COMPILE_STDCXX_11([noext], [optional])
if test "$ac_success" = "no"; then
CXXFLAGS="$CXXFLAGS -Wno-variadic-macros -Wno-long-long -Wno-c++11-long-long"
fi
-CXXFLAGS="$CXXFLAGS -Wno-deprecated-register"
AM_EXTRA_RECURSIVE_TARGETS([style])
AC_SUBST(CPPSTYLE_CMD, 'find . -type f \( -iname "*.h" -or -iname "*.cpp" -or -iname "*.cc" -or -iname "*.tcc" \) -printf "Reformatting: %h/%f\n" -exec clang-format -i {} \;')
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/doc/images/cgrn.png
----------------------------------------------------------------------
diff --git a/doc/images/cgrn.png b/doc/images/cgrn.png
new file mode 100644
index 0000000..dc0964e
Binary files /dev/null and b/doc/images/cgrn.png differ
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/doc/images/cred.png
----------------------------------------------------------------------
diff --git a/doc/images/cred.png b/doc/images/cred.png
new file mode 100644
index 0000000..086a5fb
Binary files /dev/null and b/doc/images/cred.png differ
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/doc/images/credfull.png
----------------------------------------------------------------------
diff --git a/doc/images/credfull.png b/doc/images/credfull.png
new file mode 100644
index 0000000..ff66404
Binary files /dev/null and b/doc/images/credfull.png differ
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/doc/images/cyel.png
----------------------------------------------------------------------
diff --git a/doc/images/cyel.png b/doc/images/cyel.png
new file mode 100644
index 0000000..7c1dfc7
Binary files /dev/null and b/doc/images/cyel.png differ
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/doc/images/thrift-layers.png
----------------------------------------------------------------------
diff --git a/doc/images/thrift-layers.png b/doc/images/thrift-layers.png
new file mode 100644
index 0000000..c1accf4
Binary files /dev/null and b/doc/images/thrift-layers.png differ
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/lib/cpp/test/TMemoryBufferTest.cpp
----------------------------------------------------------------------
diff --git a/lib/cpp/test/TMemoryBufferTest.cpp b/lib/cpp/test/TMemoryBufferTest.cpp
index 0d1d14d..4384187 100644
--- a/lib/cpp/test/TMemoryBufferTest.cpp
+++ b/lib/cpp/test/TMemoryBufferTest.cpp
@@ -82,13 +82,14 @@ BOOST_AUTO_TEST_CASE(test_roundtrip) {
BOOST_AUTO_TEST_CASE(test_copy) {
string* str1 = new string("abcd1234");
+ ptrdiff_t str1addr = reinterpret_cast<ptrdiff_t>(str1);
const char* data1 = str1->data();
TMemoryBuffer buf((uint8_t*)str1->data(),
static_cast<uint32_t>(str1->length()),
TMemoryBuffer::COPY);
delete str1;
string* str2 = new string("plsreuse");
- bool obj_reuse = (str1 == str2);
+ bool obj_reuse = (str1addr == reinterpret_cast<ptrdiff_t>(str2));
bool dat_reuse = (data1 == str2->data());
BOOST_TEST_MESSAGE("Object reuse: " << obj_reuse << " Data reuse: " << dat_reuse
<< ((obj_reuse && dat_reuse) ? " YAY!" : ""));
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/lib/cpp/test/concurrency/ThreadFactoryTests.h
----------------------------------------------------------------------
diff --git a/lib/cpp/test/concurrency/ThreadFactoryTests.h b/lib/cpp/test/concurrency/ThreadFactoryTests.h
index 6ac9aa5..48330f3 100644
--- a/lib/cpp/test/concurrency/ThreadFactoryTests.h
+++ b/lib/cpp/test/concurrency/ThreadFactoryTests.h
@@ -54,39 +54,33 @@ public:
void run() {
Synchronized s(_monitor);
-
- _count--;
-
- // std::cout << "\t\t\tthread count: " << _count << std::endl;
-
- if (_count == 0) {
+
+ if (--_count == 0) {
_monitor.notify();
}
}
Monitor& _monitor;
-
int& _count;
};
bool reapNThreads(int loop = 1, int count = 10) {
PlatformThreadFactory threadFactory = PlatformThreadFactory();
-
shared_ptr<Monitor> monitor(new Monitor);
for (int lix = 0; lix < loop; lix++) {
- int* activeCount = new int(count);
+ int activeCount = 0;
std::vector<shared_ptr<Thread> > threads;
-
int tix;
for (tix = 0; tix < count; tix++) {
try {
+ ++activeCount;
threads.push_back(
- threadFactory.newThread(shared_ptr<Runnable>(new ReapNTask(*monitor, *activeCount))));
+ threadFactory.newThread(shared_ptr<Runnable>(new ReapNTask(*monitor, activeCount))));
} catch (SystemResourceException& e) {
std::cout << "\t\t\tfailed to create " << lix* count + tix << " thread " << e.what()
<< std::endl;
@@ -110,17 +104,15 @@ public:
{
Synchronized s(*monitor);
- while (*activeCount > 0) {
+ while (activeCount > 0) {
monitor->wait(1000);
}
}
- delete activeCount;
std::cout << "\t\t\treaped " << lix* count << " threads" << std::endl;
}
std::cout << "\t\t\tSuccess!" << std::endl;
-
return true;
}
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/lib/d/src/thrift/base.d
----------------------------------------------------------------------
diff --git a/lib/d/src/thrift/base.d b/lib/d/src/thrift/base.d
index 57aec18..38034a7 100644
--- a/lib/d/src/thrift/base.d
+++ b/lib/d/src/thrift/base.d
@@ -50,7 +50,7 @@ class TCompoundOperationException : TException {
/// The Thrift version string, used for informative purposes.
// Note: This is currently hardcoded, but will likely be filled in by the build
// system in future versions.
-enum VERSION = "0.9.0 dev";
+enum VERSION = "1.0.0 dev";
/**
* Functions used for logging inside Thrift.
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/lib/go/test/Makefile.am
----------------------------------------------------------------------
diff --git a/lib/go/test/Makefile.am b/lib/go/test/Makefile.am
index 5531e07..842f2de 100644
--- a/lib/go/test/Makefile.am
+++ b/lib/go/test/Makefile.am
@@ -59,8 +59,10 @@ gopath: $(THRIFT) $(THRIFTTEST) \
$(THRIFT) $(THRIFTARGS) InitialismsTest.thrift
$(THRIFT) $(THRIFTARGS),read_write_private DontExportRWTest.thrift
$(THRIFT) $(THRIFTARGS),ignore_initialisms IgnoreInitialismsTest.thrift
- GOPATH=`pwd`/gopath $(GO) get github.com/golang/mock/gomock
GOPATH=`pwd`/gopath $(GO) get golang.org/x/net/context
+ GOPATH=`pwd`/gopath $(GO) get github.com/golang/mock/gomock || true
+ sed -i 's/\"context\"/\"golang.org\/x\/net\/context\"/g' gopath/src/github.com/golang/mock/gomock/controller.go || true
+ GOPATH=`pwd`/gopath $(GO) get github.com/golang/mock/gomock
ln -nfs ../../../thrift gopath/src/thrift
ln -nfs ../../tests gopath/src/tests
cp -r ./dontexportrwtest gopath/src
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/lib/js/Makefile.am
----------------------------------------------------------------------
diff --git a/lib/js/Makefile.am b/lib/js/Makefile.am
index 181e15e..9ea20a4 100644
--- a/lib/js/Makefile.am
+++ b/lib/js/Makefile.am
@@ -18,11 +18,13 @@
#
# Make sure this doesn't fail if ant is not configured.
-
+# We call install twice to work around npm issues
+#
+if HAVE_NPM
SUBDIRS = test
check-local: all
- npm install
- npm list
+ $(NPM) install || $(NPM) install
+ $(NPM) list
./node_modules/.bin/grunt
-
+endif
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/lib/nodejs/Makefile.am
----------------------------------------------------------------------
diff --git a/lib/nodejs/Makefile.am b/lib/nodejs/Makefile.am
index a3424d0..9a7b4eb 100755
--- a/lib/nodejs/Makefile.am
+++ b/lib/nodejs/Makefile.am
@@ -15,12 +15,13 @@
# specific language governing permissions and limitations
# under the License.
+# We call npm twice to work around npm issues
stubs: $(top_srcdir)/test/ThriftTest.thrift
$(THRIFT) --gen js:node -o test/ $(top_srcdir)/test/ThriftTest.thrift
deps: $(top_srcdir)/package.json
- $(NPM) install --no-bin-links $(top_srcdir)/
+ $(NPM) install $(top_srcdir)/ || $(NPM) install $(top_srcdir)/
all-local: deps
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/lib/py/setup.py
----------------------------------------------------------------------
diff --git a/lib/py/setup.py b/lib/py/setup.py
index d065573..3d14118 100644
--- a/lib/py/setup.py
+++ b/lib/py/setup.py
@@ -121,6 +121,7 @@ def run_setup(with_binary):
**extensions
)
+
try:
with_binary = True
run_setup(with_binary)
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/lib/py/src/ext/binary.h
----------------------------------------------------------------------
diff --git a/lib/py/src/ext/binary.h b/lib/py/src/ext/binary.h
index dedeec3..960b0d0 100644
--- a/lib/py/src/ext/binary.h
+++ b/lib/py/src/ext/binary.h
@@ -113,7 +113,8 @@ public:
if (!readBytes(&buf, sizeof(int16_t))) {
return false;
}
- val = static_cast<int16_t>(ntohs(*reinterpret_cast<int16_t*>(buf)));
+ memcpy(&val, buf, sizeof(int16_t));
+ val = ntohs(val);
return true;
}
@@ -122,7 +123,8 @@ public:
if (!readBytes(&buf, sizeof(int32_t))) {
return false;
}
- val = static_cast<int32_t>(ntohl(*reinterpret_cast<int32_t*>(buf)));
+ memcpy(&val, buf, sizeof(int32_t));
+ val = ntohl(val);
return true;
}
@@ -131,7 +133,8 @@ public:
if (!readBytes(&buf, sizeof(int64_t))) {
return false;
}
- val = static_cast<int64_t>(ntohll(*reinterpret_cast<int64_t*>(buf)));
+ memcpy(&val, buf, sizeof(int64_t));
+ val = ntohll(val);
return true;
}
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/lib/py/src/ext/compact.h
----------------------------------------------------------------------
diff --git a/lib/py/src/ext/compact.h b/lib/py/src/ext/compact.h
index 5bba237..a78d7a7 100644
--- a/lib/py/src/ext/compact.h
+++ b/lib/py/src/ext/compact.h
@@ -162,7 +162,8 @@ public:
if (!readBytes(&buf, 8)) {
return false;
}
- transfer.f = letohll(*reinterpret_cast<int64_t*>(buf));
+ memcpy(&transfer.f, buf, sizeof(int64_t));
+ transfer.f = letohll(transfer.f);
val = transfer.t;
return true;
}
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/lib/py/src/ext/protocol.tcc
----------------------------------------------------------------------
diff --git a/lib/py/src/ext/protocol.tcc b/lib/py/src/ext/protocol.tcc
index 6e978d7..c025d0c 100644
--- a/lib/py/src/ext/protocol.tcc
+++ b/lib/py/src/ext/protocol.tcc
@@ -102,7 +102,7 @@ inline bool ProtocolBase<Impl>::writeBuffer(char* data, size_t size) {
PyErr_SetString(PyExc_IOError, "failed to write to cStringIO object");
return false;
}
- if (len != size) {
+ if (static_cast<size_t>(len) != size) {
PyErr_Format(PyExc_EOFError, "write length mismatch: expected %lu got %d", size, len);
return false;
}
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/lib/py/src/protocol/TCompactProtocol.py
----------------------------------------------------------------------
diff --git a/lib/py/src/protocol/TCompactProtocol.py b/lib/py/src/protocol/TCompactProtocol.py
index 16fd9be..e485cff 100644
--- a/lib/py/src/protocol/TCompactProtocol.py
+++ b/lib/py/src/protocol/TCompactProtocol.py
@@ -42,6 +42,8 @@ def make_helper(v_from, container):
return func(self, *args, **kwargs)
return nested
return helper
+
+
writer = make_helper(VALUE_WRITE, CONTAINER_WRITE)
reader = make_helper(VALUE_READ, CONTAINER_READ)
@@ -94,6 +96,7 @@ class CompactType(object):
MAP = 0x0B
STRUCT = 0x0C
+
CTYPES = {
TType.STOP: CompactType.STOP,
TType.BOOL: CompactType.TRUE, # used for collection
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/lib/py/src/server/TNonblockingServer.py
----------------------------------------------------------------------
diff --git a/lib/py/src/server/TNonblockingServer.py b/lib/py/src/server/TNonblockingServer.py
index 67ee04e..26c0f7e 100644
--- a/lib/py/src/server/TNonblockingServer.py
+++ b/lib/py/src/server/TNonblockingServer.py
@@ -62,6 +62,7 @@ class Worker(threading.Thread):
logger.exception("Exception while processing request", exc_info=True)
callback(False, b'')
+
WAIT_LEN = 0
WAIT_MESSAGE = 1
WAIT_PROCESS = 2
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/lib/py/src/transport/sslcompat.py
----------------------------------------------------------------------
diff --git a/lib/py/src/transport/sslcompat.py b/lib/py/src/transport/sslcompat.py
index 8ad4ce4..ab00cb2 100644
--- a/lib/py/src/transport/sslcompat.py
+++ b/lib/py/src/transport/sslcompat.py
@@ -96,4 +96,5 @@ def _optional_dependencies():
match = legacy_validate_callback
return ipaddr, match
+
_match_has_ipaddress, _match_hostname = _optional_dependencies()
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/lib/py/test/test_sslsocket.py
----------------------------------------------------------------------
diff --git a/lib/py/test/test_sslsocket.py b/lib/py/test/test_sslsocket.py
index 8951618..3c4be9c 100644
--- a/lib/py/test/test_sslsocket.py
+++ b/lib/py/test/test_sslsocket.py
@@ -334,6 +334,7 @@ class TSSLSocketTest(unittest.TestCase):
self._assert_connection_success(server, ssl_context=client_context)
+
if __name__ == '__main__':
logging.basicConfig(level=logging.WARN)
from thrift.transport.TSSLSocket import TSSLSocket, TSSLServerSocket, _match_has_ipaddress
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/lib/py/test/thrift_json.py
----------------------------------------------------------------------
diff --git a/lib/py/test/thrift_json.py b/lib/py/test/thrift_json.py
index fc1e79c..40e7a47 100644
--- a/lib/py/test/thrift_json.py
+++ b/lib/py/test/thrift_json.py
@@ -46,5 +46,6 @@ class TestJSONString(unittest.TestCase):
unicode_text = unicode_text.encode('utf8')
self.assertEqual(protocol.readString(), unicode_text)
+
if __name__ == '__main__':
unittest.main()
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/test/features/string_limit.py
----------------------------------------------------------------------
diff --git a/test/features/string_limit.py b/test/features/string_limit.py
index 695d965..14f57d0 100644
--- a/test/features/string_limit.py
+++ b/test/features/string_limit.py
@@ -57,5 +57,6 @@ def main(argv):
print('[ERROR]: limit + 1')
assert False
+
if __name__ == '__main__':
main(sys.argv[1:])
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/test/go/Makefile.am
----------------------------------------------------------------------
diff --git a/test/go/Makefile.am b/test/go/Makefile.am
index 1438d44..db27258 100644
--- a/test/go/Makefile.am
+++ b/test/go/Makefile.am
@@ -35,9 +35,11 @@ gopath: $(THRIFT) ThriftTest.thrift
mkdir -p src/gen
$(THRIFTCMD) ThriftTest.thrift
$(THRIFTCMD) ../StressTest.thrift
- ln -nfs ../../../lib/go/thrift src/thrift
- GOPATH=`pwd` $(GO) get github.com/golang/mock/gomock
GOPATH=`pwd` $(GO) get golang.org/x/net/context
+ GOPATH=`pwd` $(GO) get github.com/golang/mock/gomock || true
+ sed -i 's/\"context\"/\"golang.org\/x\/net\/context\"/g' src/github.com/golang/mock/gomock/controller.go || true
+ GOPATH=`pwd` $(GO) get github.com/golang/mock/gomock
+ ln -nfs ../../../lib/go/thrift src/thrift
touch gopath
bin/testclient: gopath
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/test/py/FastbinaryTest.py
----------------------------------------------------------------------
diff --git a/test/py/FastbinaryTest.py b/test/py/FastbinaryTest.py
index d231abf..05c0bb6 100755
--- a/test/py/FastbinaryTest.py
+++ b/test/py/FastbinaryTest.py
@@ -50,6 +50,7 @@ class TDevNullTransport(TTransport.TTransportBase):
def isOpen(self):
return True
+
ooe1 = OneOfEach()
ooe1.im_true = True
ooe1.im_false = False
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/test/py/SerializationTest.py
----------------------------------------------------------------------
diff --git a/test/py/SerializationTest.py b/test/py/SerializationTest.py
index b080d87..ef79835 100755
--- a/test/py/SerializationTest.py
+++ b/test/py/SerializationTest.py
@@ -452,5 +452,6 @@ def suite():
suite.addTest(loader.loadTestsFromTestCase(SerializersTest))
return suite
+
if __name__ == "__main__":
unittest.main(defaultTest="suite", testRunner=unittest.TextTestRunner(verbosity=2))
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/test/py/TestClient.py
----------------------------------------------------------------------
diff --git a/test/py/TestClient.py b/test/py/TestClient.py
index 18ef66b..1ab8e78 100755
--- a/test/py/TestClient.py
+++ b/test/py/TestClient.py
@@ -301,6 +301,7 @@ class OwnArgsTestProgram(unittest.TestProgram):
self.testNames = ([self.defaultTest])
self.createTests()
+
if __name__ == "__main__":
parser = OptionParser()
parser.add_option('--libpydir', type='string', dest='libpydir',
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/test/py/TestEof.py
----------------------------------------------------------------------
diff --git a/test/py/TestEof.py b/test/py/TestEof.py
index cda1050..0b4a829 100755
--- a/test/py/TestEof.py
+++ b/test/py/TestEof.py
@@ -127,5 +127,6 @@ def suite():
suite.addTest(loader.loadTestsFromTestCase(TestEof))
return suite
+
if __name__ == "__main__":
unittest.main(defaultTest="suite", testRunner=unittest.TextTestRunner(verbosity=2))
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/test/py/TestFrozen.py
----------------------------------------------------------------------
diff --git a/test/py/TestFrozen.py b/test/py/TestFrozen.py
index e568e8c..6d2595c 100755
--- a/test/py/TestFrozen.py
+++ b/test/py/TestFrozen.py
@@ -118,5 +118,6 @@ def suite():
suite.addTest(loader.loadTestsFromTestCase(TestFrozenAcceleratedCompact))
return suite
+
if __name__ == "__main__":
unittest.main(defaultTest="suite", testRunner=unittest.TextTestRunner(verbosity=2))
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/test/py/TestServer.py
----------------------------------------------------------------------
diff --git a/test/py/TestServer.py b/test/py/TestServer.py
index 070560c..a7366a8 100755
--- a/test/py/TestServer.py
+++ b/test/py/TestServer.py
@@ -267,6 +267,7 @@ def main(options):
# enter server main loop
server.serve()
+
if __name__ == '__main__':
parser = OptionParser()
parser.add_option('--libpydir', type='string', dest='libpydir',
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/test/py/TestSocket.py
----------------------------------------------------------------------
diff --git a/test/py/TestSocket.py b/test/py/TestSocket.py
index a3c5ff0..ae3160f 100755
--- a/test/py/TestSocket.py
+++ b/test/py/TestSocket.py
@@ -67,6 +67,7 @@ class TimeoutTest(unittest.TestCase):
except:
self.assert_(time.time() - starttime < 5.0)
+
if __name__ == '__main__':
suite = unittest.TestSuite()
loader = unittest.TestLoader()
http://git-wip-us.apache.org/repos/asf/thrift/blob/0ad20bdb/test/test.py
----------------------------------------------------------------------
diff --git a/test/test.py b/test/test.py
index 9305967..5a015ea 100755
--- a/test/test.py
+++ b/test/test.py
@@ -166,5 +166,6 @@ def main(argv):
res = run_cross_tests(server_match, client_match, options.jobs, options.skip_known_failures, options.retry_count, options.regex)
return 0 if res else 1
+
if __name__ == '__main__':
sys.exit(main(sys.argv[1:]))
[40/50] [abbrv] thrift git commit: THRIFT-4395: fix rust build on
xenial Client: rs
Posted by je...@apache.org.
THRIFT-4395: fix rust build on xenial
Client: rs
This closes #1421
Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/44426c90
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/44426c90
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/44426c90
Branch: refs/heads/0.11.0
Commit: 44426c90955ee1324be58d228e654b309d7c5bba
Parents: 20e16bc
Author: James E. King, III <jk...@apache.org>
Authored: Wed Nov 29 13:01:16 2017 -0500
Committer: James E. King, III <jk...@apache.org>
Committed: Wed Nov 29 21:29:48 2017 -0500
----------------------------------------------------------------------
lib/rs/Cargo.toml | 10 +++++-----
lib/rs/test/Cargo.toml | 2 +-
test/rs/Cargo.toml | 2 +-
tutorial/rs/Cargo.toml | 2 +-
4 files changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/thrift/blob/44426c90/lib/rs/Cargo.toml
----------------------------------------------------------------------
diff --git a/lib/rs/Cargo.toml b/lib/rs/Cargo.toml
index be34785..5f8f5e8 100644
--- a/lib/rs/Cargo.toml
+++ b/lib/rs/Cargo.toml
@@ -11,9 +11,9 @@ exclude = ["Makefile*", "test/**"]
keywords = ["thrift"]
[dependencies]
-byteorder = "0.5.3"
-integer-encoding = "1.0.3"
-log = "~0.3.6"
-threadpool = "1.0"
-try_from = "0.2.0"
+byteorder = "~1.1.0"
+integer-encoding = "~1.0.4"
+log = "~0.3.8"
+threadpool = "~1.7.1"
+try_from = "~0.2.2"
http://git-wip-us.apache.org/repos/asf/thrift/blob/44426c90/lib/rs/test/Cargo.toml
----------------------------------------------------------------------
diff --git a/lib/rs/test/Cargo.toml b/lib/rs/test/Cargo.toml
index 8655a76..50dec19 100644
--- a/lib/rs/test/Cargo.toml
+++ b/lib/rs/test/Cargo.toml
@@ -6,7 +6,7 @@ authors = ["Apache Thrift Developers <de...@thrift.apache.org>"]
publish = false
[dependencies]
-clap = "2.18.0"
+clap = "<2.28.0"
ordered-float = "0.3.0"
try_from = "0.2.0"
http://git-wip-us.apache.org/repos/asf/thrift/blob/44426c90/test/rs/Cargo.toml
----------------------------------------------------------------------
diff --git a/test/rs/Cargo.toml b/test/rs/Cargo.toml
index df84504..9b35e3c 100644
--- a/test/rs/Cargo.toml
+++ b/test/rs/Cargo.toml
@@ -6,7 +6,7 @@ authors = ["Apache Thrift Developers <de...@thrift.apache.org>"]
publish = false
[dependencies]
-clap = "2.18.0"
+clap = "<2.28.0"
env_logger = "0.4.0"
log = "0.3.7"
ordered-float = "0.3.0"
http://git-wip-us.apache.org/repos/asf/thrift/blob/44426c90/tutorial/rs/Cargo.toml
----------------------------------------------------------------------
diff --git a/tutorial/rs/Cargo.toml b/tutorial/rs/Cargo.toml
index 9075db7..210a0da 100644
--- a/tutorial/rs/Cargo.toml
+++ b/tutorial/rs/Cargo.toml
@@ -7,7 +7,7 @@ exclude = ["Makefile*", "shared.rs", "tutorial.rs"]
publish = false
[dependencies]
-clap = "2.18.0"
+clap = "<2.28.0"
ordered-float = "0.3.0"
try_from = "0.2.0"
[27/50] [abbrv] thrift git commit: THRIFT-4378: add set method for
stopTimeoutUnit in TThreadPoolServer java lib modify timeout unit in
createDefaultExecutorService from hard coding to read from args Client: java
Posted by je...@apache.org.
THRIFT-4378: add set method for stopTimeoutUnit in TThreadPoolServer java lib
modify timeout unit in createDefaultExecutorService from hard coding to read from args
Client: java
This closes #1409
Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/847ecf3c
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/847ecf3c
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/847ecf3c
Branch: refs/heads/0.11.0
Commit: 847ecf3c1de8b297d6a29305b9f7871fcf609c36
Parents: a533ea1
Author: itegel <it...@gmail.com>
Authored: Mon Oct 30 19:09:21 2017 +0800
Committer: James E. King, III <jk...@apache.org>
Committed: Thu Nov 2 05:53:09 2017 -0700
----------------------------------------------------------------------
.../src/org/apache/thrift/server/TThreadPoolServer.java | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/thrift/blob/847ecf3c/lib/java/src/org/apache/thrift/server/TThreadPoolServer.java
----------------------------------------------------------------------
diff --git a/lib/java/src/org/apache/thrift/server/TThreadPoolServer.java b/lib/java/src/org/apache/thrift/server/TThreadPoolServer.java
index 0529d72..90d5e5b 100644
--- a/lib/java/src/org/apache/thrift/server/TThreadPoolServer.java
+++ b/lib/java/src/org/apache/thrift/server/TThreadPoolServer.java
@@ -75,6 +75,11 @@ public class TThreadPoolServer extends TServer {
return this;
}
+ public Args stopTimeoutUnit(TimeUnit tu) {
+ stopTimeoutUnit = tu;
+ return this;
+ }
+
public Args requestTimeout(int n) {
requestTimeout = n;
return this;
@@ -136,7 +141,7 @@ public class TThreadPoolServer extends TServer {
return new ThreadPoolExecutor(args.minWorkerThreads,
args.maxWorkerThreads,
args.stopTimeoutVal,
- TimeUnit.SECONDS,
+ args.stopTimeoutUnit,
executorQueue);
}
@@ -269,7 +274,7 @@ public class TThreadPoolServer extends TServer {
inputTransport = inputTransportFactory_.getTransport(client_);
outputTransport = outputTransportFactory_.getTransport(client_);
inputProtocol = inputProtocolFactory_.getProtocol(inputTransport);
- outputProtocol = outputProtocolFactory_.getProtocol(outputTransport);
+ outputProtocol = outputProtocolFactory_.getProtocol(outputTransport);
eventHandler = getEventHandler();
if (eventHandler != null) {
@@ -288,7 +293,7 @@ public class TThreadPoolServer extends TServer {
}
}
} catch (TSaslTransportException ttx) {
- // Something thats not SASL was in the stream, continue silently
+ // Something thats not SASL was in the stream, continue silently
} catch (TTransportException ttx) {
// Assume the client died and continue silently
} catch (TException tx) {
[25/50] [abbrv] thrift git commit: THRIFT-4377: close socket after
processing request Client: Haxe Patch: Oleksii Prudkyi
Posted by je...@apache.org.
THRIFT-4377: close socket after processing request
Client: Haxe
Patch: Oleksii Prudkyi <Ol...@gmail.com>
This closes #1407
Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/ac11cf88
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/ac11cf88
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/ac11cf88
Branch: refs/heads/0.11.0
Commit: ac11cf88f852789d699415ec0c2c0e26bfd71ec2
Parents: 619218c
Author: Oleksii Prudkyi <Ol...@gmail.com>
Authored: Sun Oct 29 18:01:14 2017 +0200
Committer: Jens Geyer <je...@apache.org>
Committed: Sun Oct 29 17:52:48 2017 +0100
----------------------------------------------------------------------
lib/haxe/src/org/apache/thrift/server/TSimpleServer.hx | 5 +++++
1 file changed, 5 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/thrift/blob/ac11cf88/lib/haxe/src/org/apache/thrift/server/TSimpleServer.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/server/TSimpleServer.hx b/lib/haxe/src/org/apache/thrift/server/TSimpleServer.hx
index c9856b4..655a629 100644
--- a/lib/haxe/src/org/apache/thrift/server/TSimpleServer.hx
+++ b/lib/haxe/src/org/apache/thrift/server/TSimpleServer.hx
@@ -121,6 +121,11 @@ class TSimpleServer extends TServer {
logDelegate(e); // Unexpected
}
+ if(client != null)
+ {
+ client.close();
+ }
+
// Fire deleteContext server event after client disconnects
if (serverEventHandler != null) {
serverEventHandler.deleteContext(connectionContext, inputProtocol, outputProtocol);
[14/50] [abbrv] thrift git commit: Close rejected or duplicate PRs
Posted by je...@apache.org.
Close rejected or duplicate PRs
This closes #387
This closes #480
This closes #562
This closes #657
This closes #701
This closes #784
This closes #794
This closes #896
This closes #947
This closes #1012
This closes #1015
Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/254e86b0
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/254e86b0
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/254e86b0
Branch: refs/heads/0.11.0
Commit: 254e86b0103be51c6af9cc50220ee8c144234239
Parents: 9dff0ef
Author: James E. King, III <jk...@apache.org>
Authored: Wed Oct 25 09:02:48 2017 -0400
Committer: James E. King, III <jk...@apache.org>
Committed: Wed Oct 25 09:02:51 2017 -0400
----------------------------------------------------------------------
README.md | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/thrift/blob/254e86b0/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 80d77ef..4230681 100644
--- a/README.md
+++ b/README.md
@@ -170,3 +170,4 @@ To run the cross-language test suite, please run:
This will run a set of tests that use different language clients and
servers.
+
[05/50] [abbrv] thrift git commit: THRIFT-4306 Thrift imports not
replicated to D service output Client: D language Patch: Neia Neutuladh
Posted by je...@apache.org.
THRIFT-4306 Thrift imports not replicated to D service output
Client: D language
Patch: Neia Neutuladh
Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/44701e82
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/44701e82
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/44701e82
Branch: refs/heads/0.11.0
Commit: 44701e82ad351d7472101ad81aa13e775ffb7384
Parents: 0ad20bd
Author: Jens Geyer <je...@apache.org>
Authored: Thu Oct 19 23:15:51 2017 +0200
Committer: Jens Geyer <je...@apache.org>
Committed: Thu Oct 19 23:16:32 2017 +0200
----------------------------------------------------------------------
compiler/cpp/src/thrift/generate/t_d_generator.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/thrift/blob/44701e82/compiler/cpp/src/thrift/generate/t_d_generator.cc
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/thrift/generate/t_d_generator.cc b/compiler/cpp/src/thrift/generate/t_d_generator.cc
index b602e0d..159d93a 100644
--- a/compiler/cpp/src/thrift/generate/t_d_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_d_generator.cc
@@ -103,7 +103,7 @@ protected:
// Include type modules from other imported programs.
const vector<t_program*>& includes = program_->get_includes();
for (size_t i = 0; i < includes.size(); ++i) {
- f_types_ << "import " << render_package(*(includes[i])) << includes[i]->get_name()
+ f_types_ << "public import " << render_package(*(includes[i])) << includes[i]->get_name()
<< "_types;" << endl;
}
if (!includes.empty())
[45/50] [abbrv] thrift git commit: THRIFT-3610 Streamline exception
handling in Python server handler Client: py
Posted by je...@apache.org.
THRIFT-3610 Streamline exception handling in Python server handler
Client: py
This closes #842
This closes #1426
Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/af562863
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/af562863
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/af562863
Branch: refs/heads/0.11.0
Commit: af562863781ee9a4e0f314470701f1ab2e3fbe33
Parents: 66c3dbf
Author: Nobuaki Sukegawa <ns...@apache.org>
Authored: Thu Feb 11 07:06:21 2016 +0900
Committer: James E. King, III <jk...@apache.org>
Committed: Thu Nov 30 12:36:52 2017 -0500
----------------------------------------------------------------------
.../cpp/src/thrift/generate/t_py_generator.cc | 50 +++++++++++---------
1 file changed, 27 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/thrift/blob/af562863/compiler/cpp/src/thrift/generate/t_py_generator.cc
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/thrift/generate/t_py_generator.cc b/compiler/cpp/src/thrift/generate/t_py_generator.cc
index 3b51714..9078da8 100644
--- a/compiler/cpp/src/thrift/generate/t_py_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_py_generator.cc
@@ -1513,12 +1513,13 @@ void t_py_generator::generate_service_client(t_service* tservice) {
const std::vector<t_field*>& xceptions = xs->get_members();
vector<t_field*>::const_iterator x_iter;
for (x_iter = xceptions.begin(); x_iter != xceptions.end(); ++x_iter) {
- f_service_ << indent() << "if result." << (*x_iter)->get_name() << " is not None:" << endl;
+ const string& xname = (*x_iter)->get_name();
+ f_service_ << indent() << "if result." << xname << " is not None:" << endl;
if (gen_twisted_) {
- f_service_ << indent() << indent_str() << "return d.errback(result." << (*x_iter)->get_name() << ")"
+ f_service_ << indent() << indent_str() << "return d.errback(result." << xname << ")"
<< endl;
} else {
- f_service_ << indent() << indent_str() << "raise result." << (*x_iter)->get_name() << "" << endl;
+ f_service_ << indent() << indent_str() << "raise result." << xname << "" << endl;
}
}
@@ -2090,43 +2091,46 @@ void t_py_generator::generate_process_function(t_service* tservice, t_function*
}
f_service_ << ")" << endl;
if (!tfunction->is_oneway()) {
- f_service_ << indent() << "msg_type = TMessageType.REPLY" << endl;
+ f_service_ << indent() << "msg_type = TMessageType.REPLY" << endl;
}
indent_down();
f_service_ << indent()
- << "except (TTransport.TTransportException, KeyboardInterrupt, SystemExit):" << endl
+ << "except TTransport.TTransportException:" << endl
<< indent() << indent_str() << "raise" << endl;
if (!tfunction->is_oneway()) {
for (x_iter = xceptions.begin(); x_iter != xceptions.end(); ++x_iter) {
- f_service_ << indent() << "except " << type_name((*x_iter)->get_type()) << " as "
- << (*x_iter)->get_name() << ":" << endl;
- if (!tfunction->is_oneway()) {
- indent_up();
- f_service_ << indent() << "msg_type = TMessageType.REPLY" << endl;
- f_service_ << indent() << "result." << (*x_iter)->get_name() << " = "
- << (*x_iter)->get_name() << endl;
- indent_down();
- } else {
- f_service_ << indent() << "pass" << endl;
- }
+ const string& xname = (*x_iter)->get_name();
+ f_service_ << indent() << "except " << type_name((*x_iter)->get_type()) << " as " << xname
+ << ":" << endl;
+ indent_up();
+ f_service_ << indent() << "msg_type = TMessageType.REPLY" << endl;
+ f_service_ << indent() << "result." << xname << " = " << xname << endl;
+ indent_down();
}
- f_service_ << indent() << "except Exception as ex:" << endl
+ f_service_ << indent() << "except TApplicationException as ex:" << endl
+ << indent() << indent_str()
+ << "logging.exception('TApplication exception in handler')" << endl
+ << indent() << indent_str() << "msg_type = TMessageType.EXCEPTION" << endl
+ << indent() << indent_str() << "result = ex" << endl
+ << indent() << "except Exception:" << endl
+ << indent() << indent_str()
+ << "logging.exception('Unexpected exception in handler')" << endl
<< indent() << indent_str() << "msg_type = TMessageType.EXCEPTION" << endl
- << indent() << indent_str() << "logging.exception(ex)" << endl
- << indent()
- << indent_str() << "result = TApplicationException(TApplicationException.INTERNAL_ERROR, "
- "'Internal error')" << endl
+ << indent() << indent_str()
+ << "result = TApplicationException(TApplicationException.INTERNAL_ERROR, "
+ "'Internal error')"
+ << endl
<< indent() << "oprot.writeMessageBegin(\"" << tfunction->get_name()
<< "\", msg_type, seqid)" << endl
<< indent() << "result.write(oprot)" << endl
<< indent() << "oprot.writeMessageEnd()" << endl
<< indent() << "oprot.trans.flush()" << endl;
} else {
- f_service_ << indent() << "except:" << endl
- << indent() << indent_str() << "pass" << endl;
+ f_service_ << indent() << "except Exception:" << endl
+ << indent() << indent_str() << "logging.exception('Exception in oneway handler')" << endl;
}
// Close function
[06/50] [abbrv] thrift git commit: THRIFT-4365: Replaced indirect
object syntax in perl compiler Client: perl Patch: Finn Isaac Norris Colman
Posted by je...@apache.org.
THRIFT-4365: Replaced indirect object syntax in perl compiler
Client: perl
Patch: Finn Isaac Norris Colman
This closes #1393
Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/54ce558b
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/54ce558b
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/54ce558b
Branch: refs/heads/0.11.0
Commit: 54ce558ba80905d124b82727d196f6d58964b74c
Parents: 44701e8
Author: James E. King, III <jk...@apache.org>
Authored: Fri Oct 20 08:33:38 2017 -0400
Committer: James E. King, III <jk...@apache.org>
Committed: Fri Oct 20 08:33:38 2017 -0400
----------------------------------------------------------------------
compiler/cpp/src/thrift/generate/t_perl_generator.cc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/thrift/blob/54ce558b/compiler/cpp/src/thrift/generate/t_perl_generator.cc
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/thrift/generate/t_perl_generator.cc b/compiler/cpp/src/thrift/generate/t_perl_generator.cc
index 0bdbb05..0c05cda 100644
--- a/compiler/cpp/src/thrift/generate/t_perl_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_perl_generator.cc
@@ -1259,8 +1259,8 @@ void t_perl_generator::generate_deserialize_field(ofstream& out,
void t_perl_generator::generate_deserialize_struct(ofstream& out,
t_struct* tstruct,
string prefix) {
- out << indent() << "$" << prefix << " = new " << perl_namespace(tstruct->get_program())
- << tstruct->get_name() << "();" << endl << indent() << "$xfer += $" << prefix
+ out << indent() << "$" << prefix << " = " << perl_namespace(tstruct->get_program())
+ << tstruct->get_name() << "->new();" << endl << indent() << "$xfer += $" << prefix
<< "->read($input);" << endl;
}
[19/50] [abbrv] thrift git commit: THRIFT-4376: fix a few high impact
coverity defects: 1458947: memory leak in compiler 1458787: resource leak in
c_glib led to discovery of assert() abuse 1459090: fix string.find result
check in JSON processor (unlikely
Posted by je...@apache.org.
http://git-wip-us.apache.org/repos/asf/thrift/blob/43f4bf2f/lib/c_glib/test/testcompactprotocol.c
----------------------------------------------------------------------
diff --git a/lib/c_glib/test/testcompactprotocol.c b/lib/c_glib/test/testcompactprotocol.c
index 03bc226..e5ad491 100755
--- a/lib/c_glib/test/testcompactprotocol.c
+++ b/lib/c_glib/test/testcompactprotocol.c
@@ -19,7 +19,7 @@
/* Disable string-function optimizations when glibc is used, as these produce
compiler warnings about string length when a string function is used inside
- a call to assert () */
+ a call to g_assert () */
#if !defined(__APPLE__) && !defined(__FreeBSD__) && \
!defined(__OpenBSD__) && !defined(__NetBSD__)
#include <features.h>
@@ -32,7 +32,6 @@
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
-#include <assert.h>
#include <netdb.h>
#include <string.h>
#include <sys/wait.h>
@@ -103,7 +102,7 @@ test_create_and_destroy (void)
/* create an object and then destroy it */
object = g_object_new (THRIFT_TYPE_COMPACT_PROTOCOL, NULL);
- assert (object != NULL);
+ g_assert (object != NULL);
g_object_unref (object);
}
@@ -117,11 +116,11 @@ test_initialize (void)
/* create a ThriftTransport */
tsocket = g_object_new (THRIFT_TYPE_SOCKET, "hostname", "localhost",
"port", 51188, NULL);
- assert (tsocket != NULL);
+ g_assert (tsocket != NULL);
/* create a ThriftCompactProtocol using the Transport */
protocol = g_object_new (THRIFT_TYPE_COMPACT_PROTOCOL, "transport",
tsocket, NULL);
- assert (protocol != NULL);
+ g_assert (protocol != NULL);
/* fetch the properties */
g_object_get (G_OBJECT (protocol), "transport", &temp, NULL);
g_object_unref (temp);
@@ -146,7 +145,7 @@ test_read_and_write_primitives (void)
/* fork a server from the client */
pid = fork ();
- assert (pid >= 0);
+ g_assert (pid >= 0);
if (pid == 0)
{
@@ -162,63 +161,63 @@ test_read_and_write_primitives (void)
"port", port, NULL);
transport = THRIFT_TRANSPORT (tsocket);
thrift_transport_open (transport, NULL);
- assert (thrift_transport_is_open (transport));
+ g_assert (thrift_transport_is_open (transport));
/* create a ThriftCompactTransport */
tc = g_object_new (THRIFT_TYPE_COMPACT_PROTOCOL, "transport",
tsocket, NULL);
protocol = THRIFT_PROTOCOL (tc);
- assert (protocol != NULL);
+ g_assert (protocol != NULL);
/* write a bunch of primitives */
- assert (thrift_compact_protocol_write_bool (protocol, TEST_BOOL, NULL) > 0);
- assert (thrift_compact_protocol_write_byte (protocol, TEST_BYTE, NULL) > 0);
- assert (thrift_compact_protocol_write_i16 (protocol, TEST_I16, NULL) > 0);
- assert (thrift_compact_protocol_write_i32 (protocol, TEST_I32, NULL) > 0);
- assert (thrift_compact_protocol_write_i64 (protocol, TEST_I64, NULL) > 0);
- assert (thrift_compact_protocol_write_i16 (protocol, TEST_NI16, NULL) > 0);
- assert (thrift_compact_protocol_write_i32 (protocol, TEST_NI32, NULL) > 0);
- assert (thrift_compact_protocol_write_i64 (protocol, TEST_NI64, NULL) > 0);
- assert (thrift_compact_protocol_write_i16 (protocol, 2, NULL) > 0);
- assert (thrift_compact_protocol_write_i32 (protocol, 2, NULL) > 0);
- assert (thrift_compact_protocol_write_i64 (protocol, 2, NULL) > 0);
- assert (thrift_compact_protocol_write_i16 (protocol, -2, NULL) > 0);
- assert (thrift_compact_protocol_write_i32 (protocol, -2, NULL) > 0);
- assert (thrift_compact_protocol_write_i64 (protocol, -2, NULL) > 0);
- assert (thrift_compact_protocol_write_double (protocol,
+ g_assert (thrift_compact_protocol_write_bool (protocol, TEST_BOOL, NULL) > 0);
+ g_assert (thrift_compact_protocol_write_byte (protocol, TEST_BYTE, NULL) > 0);
+ g_assert (thrift_compact_protocol_write_i16 (protocol, TEST_I16, NULL) > 0);
+ g_assert (thrift_compact_protocol_write_i32 (protocol, TEST_I32, NULL) > 0);
+ g_assert (thrift_compact_protocol_write_i64 (protocol, TEST_I64, NULL) > 0);
+ g_assert (thrift_compact_protocol_write_i16 (protocol, TEST_NI16, NULL) > 0);
+ g_assert (thrift_compact_protocol_write_i32 (protocol, TEST_NI32, NULL) > 0);
+ g_assert (thrift_compact_protocol_write_i64 (protocol, TEST_NI64, NULL) > 0);
+ g_assert (thrift_compact_protocol_write_i16 (protocol, 2, NULL) > 0);
+ g_assert (thrift_compact_protocol_write_i32 (protocol, 2, NULL) > 0);
+ g_assert (thrift_compact_protocol_write_i64 (protocol, 2, NULL) > 0);
+ g_assert (thrift_compact_protocol_write_i16 (protocol, -2, NULL) > 0);
+ g_assert (thrift_compact_protocol_write_i32 (protocol, -2, NULL) > 0);
+ g_assert (thrift_compact_protocol_write_i64 (protocol, -2, NULL) > 0);
+ g_assert (thrift_compact_protocol_write_double (protocol,
TEST_DOUBLE, NULL) > 0);
- assert (thrift_compact_protocol_write_string (protocol,
+ g_assert (thrift_compact_protocol_write_string (protocol,
TEST_STRING, NULL) > 0);
- assert (thrift_compact_protocol_write_string (protocol, "", NULL) > 0);
- assert (thrift_compact_protocol_write_binary (protocol, binary,
+ g_assert (thrift_compact_protocol_write_string (protocol, "", NULL) > 0);
+ g_assert (thrift_compact_protocol_write_binary (protocol, binary,
len, NULL) > 0);
- assert (thrift_compact_protocol_write_binary (protocol, NULL, 0, NULL) > 0);
- assert (thrift_compact_protocol_write_binary (protocol, binary,
+ g_assert (thrift_compact_protocol_write_binary (protocol, NULL, 0, NULL) > 0);
+ g_assert (thrift_compact_protocol_write_binary (protocol, binary,
len, NULL) > 0);
/* test write errors */
transport_write_error = 1;
- assert (thrift_compact_protocol_write_byte (protocol, TEST_BYTE,
+ g_assert (thrift_compact_protocol_write_byte (protocol, TEST_BYTE,
NULL) == -1);
- assert (thrift_compact_protocol_write_i16 (protocol, TEST_I16, NULL) == -1);
- assert (thrift_compact_protocol_write_i32 (protocol, TEST_I32, NULL) == -1);
- assert (thrift_compact_protocol_write_i64 (protocol, TEST_I64, NULL) == -1);
- assert (thrift_compact_protocol_write_i16 (protocol, TEST_NI16,
+ g_assert (thrift_compact_protocol_write_i16 (protocol, TEST_I16, NULL) == -1);
+ g_assert (thrift_compact_protocol_write_i32 (protocol, TEST_I32, NULL) == -1);
+ g_assert (thrift_compact_protocol_write_i64 (protocol, TEST_I64, NULL) == -1);
+ g_assert (thrift_compact_protocol_write_i16 (protocol, TEST_NI16,
NULL) == -1);
- assert (thrift_compact_protocol_write_i32 (protocol, TEST_NI32,
+ g_assert (thrift_compact_protocol_write_i32 (protocol, TEST_NI32,
NULL) == -1);
- assert (thrift_compact_protocol_write_i64 (protocol, TEST_NI64,
+ g_assert (thrift_compact_protocol_write_i64 (protocol, TEST_NI64,
NULL) == -1);
- assert (thrift_compact_protocol_write_double (protocol, TEST_DOUBLE,
+ g_assert (thrift_compact_protocol_write_double (protocol, TEST_DOUBLE,
NULL) == -1);
- assert (thrift_compact_protocol_write_binary (protocol, binary, len,
+ g_assert (thrift_compact_protocol_write_binary (protocol, binary, len,
NULL) == -1);
transport_write_error = 0;
/* test binary partial failure */
transport_write_count = 0;
transport_write_error_at = 1;
- assert (thrift_compact_protocol_write_binary (protocol, binary,
+ g_assert (thrift_compact_protocol_write_binary (protocol, binary,
len, NULL) == -1);
transport_write_error_at = -1;
@@ -226,8 +225,8 @@ test_read_and_write_primitives (void)
thrift_transport_close (transport, NULL);
g_object_unref (tsocket);
g_object_unref (protocol);
- assert (wait (&status) == pid);
- assert (status == 0);
+ g_assert (wait (&status) == pid);
+ g_assert (status == 0);
}
}
@@ -244,7 +243,7 @@ test_read_and_write_complex_types (void)
/* fork a server from the client */
pid = fork ();
- assert (pid >= 0);
+ g_assert (pid >= 0);
if (pid == 0)
{
@@ -260,144 +259,144 @@ test_read_and_write_complex_types (void)
"port", port, NULL);
transport = THRIFT_TRANSPORT (tsocket);
thrift_transport_open (transport, NULL);
- assert (thrift_transport_is_open (transport));
+ g_assert (thrift_transport_is_open (transport));
/* create a ThriftCompactTransport */
tc = g_object_new (THRIFT_TYPE_COMPACT_PROTOCOL, "transport",
tsocket, NULL);
protocol = THRIFT_PROTOCOL (tc);
- assert (protocol != NULL);
+ g_assert (protocol != NULL);
/* test structures */
- assert (thrift_compact_protocol_write_struct_begin (protocol,
+ g_assert (thrift_compact_protocol_write_struct_begin (protocol,
NULL, NULL) == 0);
- assert (thrift_compact_protocol_write_struct_end (protocol, NULL) == 0);
+ g_assert (thrift_compact_protocol_write_struct_end (protocol, NULL) == 0);
/* test field state w.r.t. deltas */
- assert (thrift_compact_protocol_write_field_begin (protocol, "test",
+ g_assert (thrift_compact_protocol_write_field_begin (protocol, "test",
T_DOUBLE, 1, NULL) == 1);
- assert (thrift_compact_protocol_write_field_begin (protocol, "test",
+ g_assert (thrift_compact_protocol_write_field_begin (protocol, "test",
T_DOUBLE,
16, NULL) == 1);
- assert (thrift_compact_protocol_write_field_begin (protocol, "test",
+ g_assert (thrift_compact_protocol_write_field_begin (protocol, "test",
T_DOUBLE,
17, NULL) == 1);
- assert (thrift_compact_protocol_write_field_begin (protocol, "test",
+ g_assert (thrift_compact_protocol_write_field_begin (protocol, "test",
T_DOUBLE,
15, NULL) > 1);
- assert (thrift_compact_protocol_write_field_begin (protocol, "test",
+ g_assert (thrift_compact_protocol_write_field_begin (protocol, "test",
T_DOUBLE,
30, NULL) == 1);
- assert (thrift_compact_protocol_write_field_begin (protocol, "test",
+ g_assert (thrift_compact_protocol_write_field_begin (protocol, "test",
T_DOUBLE,
46, NULL) > 1);
- assert (thrift_compact_protocol_write_field_begin (protocol, "test",
+ g_assert (thrift_compact_protocol_write_field_begin (protocol, "test",
T_DOUBLE,
47, NULL) == 1);
/* test fields */
- assert (thrift_compact_protocol_write_field_begin (protocol, "test",
+ g_assert (thrift_compact_protocol_write_field_begin (protocol, "test",
T_DOUBLE,
1, NULL) > 1);
- assert (thrift_compact_protocol_write_field_end (protocol, NULL) == 0);
+ g_assert (thrift_compact_protocol_write_field_end (protocol, NULL) == 0);
/* test field state w.r.t. structs */
- assert (thrift_compact_protocol_write_field_begin (protocol, "test",
+ g_assert (thrift_compact_protocol_write_field_begin (protocol, "test",
T_DOUBLE,
1, NULL) > 1);
- assert (thrift_compact_protocol_write_field_end (protocol, NULL) == 0);
- assert (thrift_compact_protocol_write_field_begin (protocol, "test",
+ g_assert (thrift_compact_protocol_write_field_end (protocol, NULL) == 0);
+ g_assert (thrift_compact_protocol_write_field_begin (protocol, "test",
T_DOUBLE,
16, NULL) == 1);
- assert (thrift_compact_protocol_write_field_end (protocol, NULL) == 0);
+ g_assert (thrift_compact_protocol_write_field_end (protocol, NULL) == 0);
- assert (thrift_compact_protocol_write_struct_begin (protocol,
+ g_assert (thrift_compact_protocol_write_struct_begin (protocol,
NULL, NULL) == 0);
- assert (thrift_compact_protocol_write_field_begin (protocol, "test",
+ g_assert (thrift_compact_protocol_write_field_begin (protocol, "test",
T_DOUBLE,
17, NULL) > 1);
- assert (thrift_compact_protocol_write_field_end (protocol, NULL) == 0);
+ g_assert (thrift_compact_protocol_write_field_end (protocol, NULL) == 0);
- assert (thrift_compact_protocol_write_struct_begin (protocol,
+ g_assert (thrift_compact_protocol_write_struct_begin (protocol,
NULL, NULL) == 0);
- assert (thrift_compact_protocol_write_field_begin (protocol, "test",
+ g_assert (thrift_compact_protocol_write_field_begin (protocol, "test",
T_DOUBLE,
18, NULL) > 1);
- assert (thrift_compact_protocol_write_field_end (protocol, NULL) == 0);
- assert (thrift_compact_protocol_write_field_begin (protocol, "test",
+ g_assert (thrift_compact_protocol_write_field_end (protocol, NULL) == 0);
+ g_assert (thrift_compact_protocol_write_field_begin (protocol, "test",
T_DOUBLE,
19, NULL) == 1);
- assert (thrift_compact_protocol_write_field_end (protocol, NULL) == 0);
- assert (thrift_compact_protocol_write_struct_end (protocol, NULL) == 0);
+ g_assert (thrift_compact_protocol_write_field_end (protocol, NULL) == 0);
+ g_assert (thrift_compact_protocol_write_struct_end (protocol, NULL) == 0);
- assert (thrift_compact_protocol_write_field_begin (protocol, "test",
+ g_assert (thrift_compact_protocol_write_field_begin (protocol, "test",
T_DOUBLE,
18, NULL) == 1);
- assert (thrift_compact_protocol_write_field_end (protocol, NULL) == 0);
- assert (thrift_compact_protocol_write_field_begin (protocol, "test",
+ g_assert (thrift_compact_protocol_write_field_end (protocol, NULL) == 0);
+ g_assert (thrift_compact_protocol_write_field_begin (protocol, "test",
T_DOUBLE,
25, NULL) == 1);
- assert (thrift_compact_protocol_write_field_end (protocol, NULL) == 0);
- assert (thrift_compact_protocol_write_struct_end (protocol, NULL) == 0);
+ g_assert (thrift_compact_protocol_write_field_end (protocol, NULL) == 0);
+ g_assert (thrift_compact_protocol_write_struct_end (protocol, NULL) == 0);
- assert (thrift_compact_protocol_write_field_begin (protocol, "test",
+ g_assert (thrift_compact_protocol_write_field_begin (protocol, "test",
T_DOUBLE,
17, NULL) == 1);
- assert (thrift_compact_protocol_write_field_end (protocol, NULL) == 0);
+ g_assert (thrift_compact_protocol_write_field_end (protocol, NULL) == 0);
/* test field state w.r.t. bools */
/* deltas */
/* non-bool field -> bool field -> non-bool field */
- assert (thrift_compact_protocol_write_field_begin (protocol, "test",
+ g_assert (thrift_compact_protocol_write_field_begin (protocol, "test",
T_DOUBLE,
18, NULL) == 1);
- assert (thrift_compact_protocol_write_field_end (protocol, NULL) == 0);
- assert (thrift_compact_protocol_write_field_begin (protocol, "test", T_BOOL,
+ g_assert (thrift_compact_protocol_write_field_end (protocol, NULL) == 0);
+ g_assert (thrift_compact_protocol_write_field_begin (protocol, "test", T_BOOL,
19, NULL) == 0);
- assert (thrift_compact_protocol_write_bool (protocol, TEST_BOOL,
+ g_assert (thrift_compact_protocol_write_bool (protocol, TEST_BOOL,
NULL) == 1);
- assert (thrift_compact_protocol_write_field_end (protocol, NULL) == 0);
- assert (thrift_compact_protocol_write_field_begin (protocol, "test",
+ g_assert (thrift_compact_protocol_write_field_end (protocol, NULL) == 0);
+ g_assert (thrift_compact_protocol_write_field_begin (protocol, "test",
T_DOUBLE,
20, NULL) == 1);
- assert (thrift_compact_protocol_write_field_end (protocol, NULL) == 0);
+ g_assert (thrift_compact_protocol_write_field_end (protocol, NULL) == 0);
/* bool -> bool field -> bool */
- assert (thrift_compact_protocol_write_bool (protocol, TEST_BOOL, NULL) > 0);
- assert (thrift_compact_protocol_write_field_begin (protocol, "test", T_BOOL,
+ g_assert (thrift_compact_protocol_write_bool (protocol, TEST_BOOL, NULL) > 0);
+ g_assert (thrift_compact_protocol_write_field_begin (protocol, "test", T_BOOL,
21, NULL) == 0);
- assert (thrift_compact_protocol_write_bool (protocol, TEST_BOOL,
+ g_assert (thrift_compact_protocol_write_bool (protocol, TEST_BOOL,
NULL) == 1);
- assert (thrift_compact_protocol_write_field_end (protocol, NULL) == 0);
- assert (thrift_compact_protocol_write_bool (protocol, TEST_BOOL, NULL) > 0);
+ g_assert (thrift_compact_protocol_write_field_end (protocol, NULL) == 0);
+ g_assert (thrift_compact_protocol_write_bool (protocol, TEST_BOOL, NULL) > 0);
/* no deltas */
/* non-bool field -> bool field -> non-bool field */
- assert (thrift_compact_protocol_write_field_begin (protocol, "test",
+ g_assert (thrift_compact_protocol_write_field_begin (protocol, "test",
T_DOUBLE,
1, NULL) > 1);
- assert (thrift_compact_protocol_write_field_end (protocol, NULL) == 0);
- assert (thrift_compact_protocol_write_field_begin (protocol, "test", T_BOOL,
+ g_assert (thrift_compact_protocol_write_field_end (protocol, NULL) == 0);
+ g_assert (thrift_compact_protocol_write_field_begin (protocol, "test", T_BOOL,
1, NULL) == 0);
- assert (thrift_compact_protocol_write_bool (protocol, TEST_BOOL, NULL) > 1);
- assert (thrift_compact_protocol_write_field_end (protocol, NULL) == 0);
- assert (thrift_compact_protocol_write_field_begin (protocol, "test",
+ g_assert (thrift_compact_protocol_write_bool (protocol, TEST_BOOL, NULL) > 1);
+ g_assert (thrift_compact_protocol_write_field_end (protocol, NULL) == 0);
+ g_assert (thrift_compact_protocol_write_field_begin (protocol, "test",
T_DOUBLE,
1, NULL) > 1);
- assert (thrift_compact_protocol_write_field_end (protocol, NULL) == 0);
+ g_assert (thrift_compact_protocol_write_field_end (protocol, NULL) == 0);
/* bool -> bool field -> bool */
- assert (thrift_compact_protocol_write_bool (protocol, TEST_BOOL, NULL) > 0);
- assert (thrift_compact_protocol_write_field_begin (protocol, "test", T_BOOL,
+ g_assert (thrift_compact_protocol_write_bool (protocol, TEST_BOOL, NULL) > 0);
+ g_assert (thrift_compact_protocol_write_field_begin (protocol, "test", T_BOOL,
1, NULL) == 0);
- assert (thrift_compact_protocol_write_bool (protocol, TEST_BOOL, NULL) > 1);
- assert (thrift_compact_protocol_write_field_end (protocol, NULL) == 0);
- assert (thrift_compact_protocol_write_bool (protocol, TEST_BOOL, NULL) > 0);
+ g_assert (thrift_compact_protocol_write_bool (protocol, TEST_BOOL, NULL) > 1);
+ g_assert (thrift_compact_protocol_write_field_end (protocol, NULL) == 0);
+ g_assert (thrift_compact_protocol_write_bool (protocol, TEST_BOOL, NULL) > 0);
/* test write error */
transport_write_error = 1;
- assert (thrift_compact_protocol_write_field_begin (protocol, "test",
+ g_assert (thrift_compact_protocol_write_field_begin (protocol, "test",
T_DOUBLE,
1, NULL) == -1);
transport_write_error = 0;
@@ -405,7 +404,7 @@ test_read_and_write_complex_types (void)
/* test 2nd write error */
transport_write_count = 0;
transport_write_error_at = 1;
- assert (thrift_compact_protocol_write_field_begin (protocol, "test",
+ g_assert (thrift_compact_protocol_write_field_begin (protocol, "test",
T_DOUBLE,
1, NULL) == -1);
transport_write_error_at = -1;
@@ -414,13 +413,13 @@ test_read_and_write_complex_types (void)
thrift_compact_protocol_write_byte (protocol, T_DOUBLE, NULL);
/* test write_field_stop */
- assert (thrift_compact_protocol_write_field_stop (protocol, NULL) > 0);
+ g_assert (thrift_compact_protocol_write_field_stop (protocol, NULL) > 0);
/* write a map */
- assert (thrift_compact_protocol_write_map_begin (protocol, T_DOUBLE,
+ g_assert (thrift_compact_protocol_write_map_begin (protocol, T_DOUBLE,
T_DOUBLE,
1, NULL) > 0);
- assert (thrift_compact_protocol_write_map_end (protocol, NULL) == 0);
+ g_assert (thrift_compact_protocol_write_map_end (protocol, NULL) == 0);
/* test 1st read failure on map---nothing to do on our side */
@@ -429,7 +428,7 @@ test_read_and_write_complex_types (void)
/* test 1st write failure on a map */
transport_write_error = 1;
- assert (thrift_compact_protocol_write_map_begin (protocol, T_DOUBLE,
+ g_assert (thrift_compact_protocol_write_map_begin (protocol, T_DOUBLE,
T_DOUBLE,
1, NULL) == -1);
transport_write_error = 0;
@@ -437,7 +436,7 @@ test_read_and_write_complex_types (void)
/* test 2nd write failure on a map */
transport_write_count = 0;
transport_write_error_at = 1;
- assert (thrift_compact_protocol_write_map_begin (protocol, T_DOUBLE,
+ g_assert (thrift_compact_protocol_write_map_begin (protocol, T_DOUBLE,
T_DOUBLE,
1, NULL) == -1);
transport_write_error_at = -1;
@@ -447,9 +446,9 @@ test_read_and_write_complex_types (void)
thrift_compact_protocol_write_byte (protocol, T_DOUBLE, NULL);
/* test list operations */
- assert (thrift_compact_protocol_write_list_begin (protocol, T_DOUBLE,
+ g_assert (thrift_compact_protocol_write_list_begin (protocol, T_DOUBLE,
15, NULL) > 0);
- assert (thrift_compact_protocol_write_list_end (protocol, NULL) == 0);
+ g_assert (thrift_compact_protocol_write_list_end (protocol, NULL) == 0);
/* test 1st read failure on a small list---nothing to do on our end */
@@ -464,40 +463,40 @@ test_read_and_write_complex_types (void)
/* test first write error on a small list */
transport_write_error = 1;
- assert (thrift_compact_protocol_write_list_begin (protocol, T_DOUBLE,
+ g_assert (thrift_compact_protocol_write_list_begin (protocol, T_DOUBLE,
14, NULL) == -1);
transport_write_error = 0;
/* test first write error on a big list */
transport_write_error = 1;
- assert (thrift_compact_protocol_write_list_begin (protocol, T_DOUBLE,
+ g_assert (thrift_compact_protocol_write_list_begin (protocol, T_DOUBLE,
15, NULL) == -1);
transport_write_error = 0;
/* test 2nd write error on a big list */
transport_write_count = 0;
transport_write_error_at = 1;
- assert (thrift_compact_protocol_write_list_begin (protocol, T_DOUBLE,
+ g_assert (thrift_compact_protocol_write_list_begin (protocol, T_DOUBLE,
15, NULL) == -1);
transport_write_error_at = -1;
/* test set operation s*/
- assert (thrift_compact_protocol_write_set_begin (protocol, T_DOUBLE,
+ g_assert (thrift_compact_protocol_write_set_begin (protocol, T_DOUBLE,
1, NULL) > 0);
- assert (thrift_compact_protocol_write_set_end (protocol, NULL) == 0);
+ g_assert (thrift_compact_protocol_write_set_end (protocol, NULL) == 0);
/* invalid protocol */
- assert (thrift_compact_protocol_write_byte (protocol, 0, NULL) > 0);
+ g_assert (thrift_compact_protocol_write_byte (protocol, 0, NULL) > 0);
/* invalid version */
- assert (thrift_compact_protocol_write_byte (protocol, (gint8) 0x82u,
+ g_assert (thrift_compact_protocol_write_byte (protocol, (gint8) 0x82u,
NULL) > 0);
- assert (thrift_compact_protocol_write_byte (protocol, 0, NULL) > 0);
+ g_assert (thrift_compact_protocol_write_byte (protocol, 0, NULL) > 0);
/* send a valid message */
- assert (thrift_compact_protocol_write_byte (protocol, (gint8) 0x82u,
+ g_assert (thrift_compact_protocol_write_byte (protocol, (gint8) 0x82u,
NULL) > 0);
- assert (thrift_compact_protocol_write_byte (protocol, 0x01u, NULL) > 0);
+ g_assert (thrift_compact_protocol_write_byte (protocol, 0x01u, NULL) > 0);
thrift_compact_protocol_write_varint32 (tc, 1, NULL);
thrift_compact_protocol_write_string (protocol, "test", NULL);
@@ -514,32 +513,32 @@ test_read_and_write_complex_types (void)
thrift_compact_protocol_write_varint32 (tc, 1, NULL);
/* send a valid message */
- assert (thrift_compact_protocol_write_message_begin (protocol, "test",
+ g_assert (thrift_compact_protocol_write_message_begin (protocol, "test",
T_CALL, 1, NULL) > 0);
- assert (thrift_compact_protocol_write_message_end (protocol, NULL) == 0);
+ g_assert (thrift_compact_protocol_write_message_end (protocol, NULL) == 0);
/* send broken writes */
transport_write_error = 1;
- assert (thrift_compact_protocol_write_message_begin (protocol, "test",
+ g_assert (thrift_compact_protocol_write_message_begin (protocol, "test",
T_CALL, 1, NULL) == -1);
transport_write_error = 0;
transport_write_count = 0;
transport_write_error_at = 1;
- assert (thrift_compact_protocol_write_message_begin (protocol, "test",
+ g_assert (thrift_compact_protocol_write_message_begin (protocol, "test",
T_CALL, 1, NULL) == -1);
transport_write_error_at = -1;
transport_write_count = 0;
transport_write_error_at = 2;
- assert (thrift_compact_protocol_write_message_begin (protocol, "test",
+ g_assert (thrift_compact_protocol_write_message_begin (protocol, "test",
T_CALL, 1, NULL) == -1);
transport_write_error_at = -1;
transport_write_count = 0;
transport_write_error_at = 3;
- assert (thrift_compact_protocol_write_message_begin (protocol, "test",
+ g_assert (thrift_compact_protocol_write_message_begin (protocol, "test",
T_CALL, 1, NULL) == -1);
transport_write_error_at = -1;
@@ -547,8 +546,8 @@ test_read_and_write_complex_types (void)
thrift_transport_close (transport, NULL);
g_object_unref (tsocket);
g_object_unref (protocol);
- assert (wait (&status) == pid);
- assert (status == 0);
+ g_assert (wait (&status) == pid);
+ g_assert (status == 0);
}
}
@@ -568,7 +567,7 @@ test_read_and_write_many_frames (void)
/* fork a server from the client */
pid = fork ();
- assert (pid >= 0);
+ g_assert (pid >= 0);
if (pid == 0)
{
@@ -582,70 +581,70 @@ test_read_and_write_many_frames (void)
/* create a ThriftSocket */
tsocket = g_object_new (THRIFT_TYPE_SOCKET, "hostname", "localhost",
"port", port, NULL);
- assert (tsocket != NULL);
+ g_assert (tsocket != NULL);
transport = THRIFT_TRANSPORT (tsocket);
/* wrap in a framed transport */
ft = g_object_new (THRIFT_TYPE_FRAMED_TRANSPORT, "transport", transport,
"w_buf_size", 1, NULL);
- assert (ft != NULL);
+ g_assert (ft != NULL);
transport = THRIFT_TRANSPORT (ft);
thrift_transport_open (transport, NULL);
- assert (thrift_transport_is_open (transport));
+ g_assert (thrift_transport_is_open (transport));
/* create a compact protocol */
tc = g_object_new (THRIFT_TYPE_COMPACT_PROTOCOL, "transport",
transport, NULL);
protocol = THRIFT_PROTOCOL (tc);
- assert (protocol != NULL);
+ g_assert (protocol != NULL);
/* write a bunch of primitives */
- assert (thrift_compact_protocol_write_bool (protocol, TEST_BOOL,
+ g_assert (thrift_compact_protocol_write_bool (protocol, TEST_BOOL,
NULL) > 0);
thrift_transport_flush (transport, NULL);
- assert (thrift_compact_protocol_write_byte (protocol, TEST_BYTE,
+ g_assert (thrift_compact_protocol_write_byte (protocol, TEST_BYTE,
NULL) > 0);
thrift_transport_flush (transport, NULL);
- assert (thrift_compact_protocol_write_i16 (protocol, TEST_I16, NULL) > 0);
+ g_assert (thrift_compact_protocol_write_i16 (protocol, TEST_I16, NULL) > 0);
thrift_transport_flush (transport, NULL);
- assert (thrift_compact_protocol_write_i32 (protocol, TEST_I32, NULL) > 0);
+ g_assert (thrift_compact_protocol_write_i32 (protocol, TEST_I32, NULL) > 0);
thrift_transport_flush (transport, NULL);
- assert (thrift_compact_protocol_write_i64 (protocol, TEST_I64, NULL) > 0);
+ g_assert (thrift_compact_protocol_write_i64 (protocol, TEST_I64, NULL) > 0);
thrift_transport_flush (transport, NULL);
- assert (thrift_compact_protocol_write_i16 (protocol, TEST_NI16, NULL) > 0);
+ g_assert (thrift_compact_protocol_write_i16 (protocol, TEST_NI16, NULL) > 0);
thrift_transport_flush (transport, NULL);
- assert (thrift_compact_protocol_write_i32 (protocol, TEST_NI32, NULL) > 0);
+ g_assert (thrift_compact_protocol_write_i32 (protocol, TEST_NI32, NULL) > 0);
thrift_transport_flush (transport, NULL);
- assert (thrift_compact_protocol_write_i64 (protocol, TEST_NI64, NULL) > 0);
+ g_assert (thrift_compact_protocol_write_i64 (protocol, TEST_NI64, NULL) > 0);
thrift_transport_flush (transport, NULL);
- assert (thrift_compact_protocol_write_i16 (protocol, 2, NULL) > 0);
+ g_assert (thrift_compact_protocol_write_i16 (protocol, 2, NULL) > 0);
thrift_transport_flush (transport, NULL);
- assert (thrift_compact_protocol_write_i32 (protocol, 2, NULL) > 0);
+ g_assert (thrift_compact_protocol_write_i32 (protocol, 2, NULL) > 0);
thrift_transport_flush (transport, NULL);
- assert (thrift_compact_protocol_write_i64 (protocol, 2, NULL) > 0);
+ g_assert (thrift_compact_protocol_write_i64 (protocol, 2, NULL) > 0);
thrift_transport_flush (transport, NULL);
- assert (thrift_compact_protocol_write_i16 (protocol, -2, NULL) > 0);
+ g_assert (thrift_compact_protocol_write_i16 (protocol, -2, NULL) > 0);
thrift_transport_flush (transport, NULL);
- assert (thrift_compact_protocol_write_i32 (protocol, -2, NULL) > 0);
+ g_assert (thrift_compact_protocol_write_i32 (protocol, -2, NULL) > 0);
thrift_transport_flush (transport, NULL);
- assert (thrift_compact_protocol_write_i64 (protocol, -2, NULL) > 0);
+ g_assert (thrift_compact_protocol_write_i64 (protocol, -2, NULL) > 0);
thrift_transport_flush (transport, NULL);
- assert (thrift_compact_protocol_write_double (protocol,
+ g_assert (thrift_compact_protocol_write_double (protocol,
TEST_DOUBLE, NULL) > 0);
thrift_transport_flush (transport, NULL);
- assert (thrift_compact_protocol_write_string (protocol,
+ g_assert (thrift_compact_protocol_write_string (protocol,
TEST_STRING, NULL) > 0);
thrift_transport_flush (transport, NULL);
- assert (thrift_compact_protocol_write_string (protocol, "", NULL) > 0);
+ g_assert (thrift_compact_protocol_write_string (protocol, "", NULL) > 0);
thrift_transport_flush (transport, NULL);
- assert (thrift_compact_protocol_write_binary (protocol, binary,
+ g_assert (thrift_compact_protocol_write_binary (protocol, binary,
len, NULL) > 0);
thrift_transport_flush (transport, NULL);
- assert (thrift_compact_protocol_write_binary (protocol, NULL,
+ g_assert (thrift_compact_protocol_write_binary (protocol, NULL,
0, NULL) > 0);
thrift_transport_flush (transport, NULL);
- assert (thrift_compact_protocol_write_binary (protocol, binary,
+ g_assert (thrift_compact_protocol_write_binary (protocol, binary,
len, NULL) > 0);
thrift_transport_flush (transport, NULL);
@@ -655,8 +654,8 @@ test_read_and_write_many_frames (void)
g_object_unref (ft);
g_object_unref (tsocket);
g_object_unref (tc);
- assert (wait (&status) == pid);
- assert (status == 0);
+ g_assert (wait (&status) == pid);
+ g_assert (status == 0);
}
}
@@ -690,90 +689,90 @@ thrift_server_primitives (const int port)
transport = THRIFT_SERVER_TRANSPORT (tsocket);
thrift_server_transport_listen (transport, NULL);
client = thrift_server_transport_accept (transport, NULL);
- assert (client != NULL);
+ g_assert (client != NULL);
tc = g_object_new (THRIFT_TYPE_COMPACT_PROTOCOL, "transport",
client, NULL);
protocol = THRIFT_PROTOCOL (tc);
- assert (thrift_compact_protocol_read_bool (protocol,
+ g_assert (thrift_compact_protocol_read_bool (protocol,
&value_boolean, NULL) > 0);
- assert (thrift_compact_protocol_read_byte (protocol, &value_byte, NULL) > 0);
- assert (thrift_compact_protocol_read_i16 (protocol, &value_16, NULL) > 0);
- assert (thrift_compact_protocol_read_i32 (protocol, &value_32, NULL) > 0);
- assert (thrift_compact_protocol_read_i64 (protocol, &value_64, NULL) > 0);
- assert (thrift_compact_protocol_read_i16 (protocol, &value_n16, NULL) > 0);
- assert (thrift_compact_protocol_read_i32 (protocol, &value_n32, NULL) > 0);
- assert (thrift_compact_protocol_read_i64 (protocol, &value_n64, NULL) > 0);
- assert (thrift_compact_protocol_read_byte (protocol, &zigzag_p16, NULL) > 0);
- assert (thrift_compact_protocol_read_byte (protocol, &zigzag_p32, NULL) > 0);
- assert (thrift_compact_protocol_read_byte (protocol, &zigzag_p64, NULL) > 0);
- assert (thrift_compact_protocol_read_byte (protocol, &zigzag_n16, NULL) > 0);
- assert (thrift_compact_protocol_read_byte (protocol, &zigzag_n32, NULL) > 0);
- assert (thrift_compact_protocol_read_byte (protocol, &zigzag_n64, NULL) > 0);
- assert (thrift_compact_protocol_read_double (protocol,
+ g_assert (thrift_compact_protocol_read_byte (protocol, &value_byte, NULL) > 0);
+ g_assert (thrift_compact_protocol_read_i16 (protocol, &value_16, NULL) > 0);
+ g_assert (thrift_compact_protocol_read_i32 (protocol, &value_32, NULL) > 0);
+ g_assert (thrift_compact_protocol_read_i64 (protocol, &value_64, NULL) > 0);
+ g_assert (thrift_compact_protocol_read_i16 (protocol, &value_n16, NULL) > 0);
+ g_assert (thrift_compact_protocol_read_i32 (protocol, &value_n32, NULL) > 0);
+ g_assert (thrift_compact_protocol_read_i64 (protocol, &value_n64, NULL) > 0);
+ g_assert (thrift_compact_protocol_read_byte (protocol, &zigzag_p16, NULL) > 0);
+ g_assert (thrift_compact_protocol_read_byte (protocol, &zigzag_p32, NULL) > 0);
+ g_assert (thrift_compact_protocol_read_byte (protocol, &zigzag_p64, NULL) > 0);
+ g_assert (thrift_compact_protocol_read_byte (protocol, &zigzag_n16, NULL) > 0);
+ g_assert (thrift_compact_protocol_read_byte (protocol, &zigzag_n32, NULL) > 0);
+ g_assert (thrift_compact_protocol_read_byte (protocol, &zigzag_n64, NULL) > 0);
+ g_assert (thrift_compact_protocol_read_double (protocol,
&value_double, NULL) > 0);
- assert (thrift_compact_protocol_read_string (protocol, &string, NULL) > 0);
- assert (thrift_compact_protocol_read_string (protocol, &empty_string,
+ g_assert (thrift_compact_protocol_read_string (protocol, &string, NULL) > 0);
+ g_assert (thrift_compact_protocol_read_string (protocol, &empty_string,
NULL) > 0);
- assert (thrift_compact_protocol_read_binary (protocol, &binary,
+ g_assert (thrift_compact_protocol_read_binary (protocol, &binary,
&len, NULL) > 0);
- assert (value_boolean == TEST_BOOL);
- assert (value_byte == TEST_BYTE);
- assert (value_16 == TEST_I16);
- assert (value_32 == TEST_I32);
- assert (value_64 == TEST_I64);
- assert (value_n16 == TEST_NI16);
- assert (value_n32 == TEST_NI32);
- assert (value_n64 == TEST_NI64);
- assert (zigzag_p16 == 4);
- assert (zigzag_p32 == 4);
- assert (zigzag_p64 == 4);
- assert (zigzag_n16 == 3);
- assert (zigzag_n32 == 3);
- assert (zigzag_n64 == 3);
- assert (value_double == TEST_DOUBLE);
- assert (strcmp (TEST_STRING, string) == 0);
- assert (strcmp ("", empty_string) == 0);
- assert (memcmp (comparator, binary, len) == 0);
+ g_assert (value_boolean == TEST_BOOL);
+ g_assert (value_byte == TEST_BYTE);
+ g_assert (value_16 == TEST_I16);
+ g_assert (value_32 == TEST_I32);
+ g_assert (value_64 == TEST_I64);
+ g_assert (value_n16 == TEST_NI16);
+ g_assert (value_n32 == TEST_NI32);
+ g_assert (value_n64 == TEST_NI64);
+ g_assert (zigzag_p16 == 4);
+ g_assert (zigzag_p32 == 4);
+ g_assert (zigzag_p64 == 4);
+ g_assert (zigzag_n16 == 3);
+ g_assert (zigzag_n32 == 3);
+ g_assert (zigzag_n64 == 3);
+ g_assert (value_double == TEST_DOUBLE);
+ g_assert (strcmp (TEST_STRING, string) == 0);
+ g_assert (strcmp ("", empty_string) == 0);
+ g_assert (memcmp (comparator, binary, len) == 0);
g_free (string);
g_free (empty_string);
g_free (binary);
- assert (thrift_compact_protocol_read_binary (protocol, &binary,
+ g_assert (thrift_compact_protocol_read_binary (protocol, &binary,
&len, NULL) > 0);
- assert (binary == NULL);
- assert (len == 0);
+ g_assert (binary == NULL);
+ g_assert (len == 0);
g_free (binary);
transport_read_count = 0;
transport_read_error_at = 0;
- assert (thrift_compact_protocol_read_binary (protocol, &binary,
+ g_assert (thrift_compact_protocol_read_binary (protocol, &binary,
&len, NULL) == -1);
transport_read_error_at = -1;
transport_read_count = 0;
transport_read_error_at = 1;
- assert (thrift_compact_protocol_read_binary (protocol, &binary,
+ g_assert (thrift_compact_protocol_read_binary (protocol, &binary,
&len, NULL) == -1);
transport_read_error_at = -1;
transport_read_error = 1;
- assert (thrift_compact_protocol_read_bool (protocol,
+ g_assert (thrift_compact_protocol_read_bool (protocol,
&value_boolean, NULL) == -1);
- assert (thrift_compact_protocol_read_byte (protocol,
+ g_assert (thrift_compact_protocol_read_byte (protocol,
&value_byte, NULL) == -1);
- assert (thrift_compact_protocol_read_i16 (protocol,
+ g_assert (thrift_compact_protocol_read_i16 (protocol,
&value_16, NULL) == -1);
- assert (thrift_compact_protocol_read_i32 (protocol, &value_32, NULL) == -1);
- assert (thrift_compact_protocol_read_i64 (protocol, &value_64, NULL) == -1);
- assert (thrift_compact_protocol_read_i16 (protocol,
+ g_assert (thrift_compact_protocol_read_i32 (protocol, &value_32, NULL) == -1);
+ g_assert (thrift_compact_protocol_read_i64 (protocol, &value_64, NULL) == -1);
+ g_assert (thrift_compact_protocol_read_i16 (protocol,
&value_n16, NULL) == -1);
- assert (thrift_compact_protocol_read_i32 (protocol, &value_n32, NULL) == -1);
- assert (thrift_compact_protocol_read_i64 (protocol, &value_n64, NULL) == -1);
- assert (thrift_compact_protocol_read_double (protocol,
+ g_assert (thrift_compact_protocol_read_i32 (protocol, &value_n32, NULL) == -1);
+ g_assert (thrift_compact_protocol_read_i64 (protocol, &value_n64, NULL) == -1);
+ g_assert (thrift_compact_protocol_read_double (protocol,
&value_double, NULL) == -1);
transport_read_error = 0;
@@ -813,7 +812,7 @@ thrift_server_complex_types (const int port)
transport = THRIFT_SERVER_TRANSPORT (tsocket);
thrift_server_transport_listen (transport, NULL);
client = thrift_server_transport_accept (transport, NULL);
- assert (client != NULL);
+ g_assert (client != NULL);
tc = g_object_new (THRIFT_TYPE_COMPACT_PROTOCOL, "transport",
client, NULL);
@@ -827,40 +826,40 @@ thrift_server_complex_types (const int port)
/* test field state w.r.t. deltas */
field_id = 0;
- assert (thrift_compact_protocol_read_field_begin (protocol, &field_name,
+ g_assert (thrift_compact_protocol_read_field_begin (protocol, &field_name,
&field_type,
&field_id, NULL) == 1);
- assert (field_id == 1);
+ g_assert (field_id == 1);
field_id = 0;
- assert (thrift_compact_protocol_read_field_begin (protocol, &field_name,
+ g_assert (thrift_compact_protocol_read_field_begin (protocol, &field_name,
&field_type,
&field_id, NULL) == 1);
- assert (field_id == 16);
+ g_assert (field_id == 16);
field_id = 0;
- assert (thrift_compact_protocol_read_field_begin (protocol, &field_name,
+ g_assert (thrift_compact_protocol_read_field_begin (protocol, &field_name,
&field_type,
&field_id, NULL) == 1);
- assert (field_id == 17);
+ g_assert (field_id == 17);
field_id = 0;
- assert (thrift_compact_protocol_read_field_begin (protocol, &field_name,
+ g_assert (thrift_compact_protocol_read_field_begin (protocol, &field_name,
&field_type,
&field_id, NULL) > 1);
- assert (field_id == 15);
+ g_assert (field_id == 15);
field_id = 0;
- assert (thrift_compact_protocol_read_field_begin (protocol, &field_name,
+ g_assert (thrift_compact_protocol_read_field_begin (protocol, &field_name,
&field_type,
&field_id, NULL) == 1);
- assert (field_id == 30);
+ g_assert (field_id == 30);
field_id = 0;
- assert (thrift_compact_protocol_read_field_begin (protocol, &field_name,
+ g_assert (thrift_compact_protocol_read_field_begin (protocol, &field_name,
&field_type,
&field_id, NULL) > 1);
- assert (field_id == 46);
+ g_assert (field_id == 46);
field_id = 0;
- assert (thrift_compact_protocol_read_field_begin (protocol, &field_name,
+ g_assert (thrift_compact_protocol_read_field_begin (protocol, &field_name,
&field_type,
&field_id, NULL) == 1);
- assert (field_id == 47);
+ g_assert (field_id == 47);
field_id = 0;
/* test field operations */
@@ -871,62 +870,62 @@ thrift_server_complex_types (const int port)
/* test field state w.r.t. structs */
- assert (thrift_compact_protocol_read_field_begin (protocol, &field_name,
+ g_assert (thrift_compact_protocol_read_field_begin (protocol, &field_name,
&field_type,
&field_id, NULL) > 1);
- assert (field_id == 1);
+ g_assert (field_id == 1);
field_id = 0;
thrift_compact_protocol_read_field_end (protocol, NULL);
- assert (thrift_compact_protocol_read_field_begin (protocol, &field_name,
+ g_assert (thrift_compact_protocol_read_field_begin (protocol, &field_name,
&field_type,
&field_id, NULL) == 1);
- assert (field_id == 16);
+ g_assert (field_id == 16);
field_id = 0;
thrift_compact_protocol_read_field_end (protocol, NULL);
- assert (thrift_compact_protocol_read_struct_begin (protocol,
+ g_assert (thrift_compact_protocol_read_struct_begin (protocol,
&struct_name, NULL) == 0);
- assert (thrift_compact_protocol_read_field_begin (protocol, &field_name,
+ g_assert (thrift_compact_protocol_read_field_begin (protocol, &field_name,
&field_type,
&field_id, NULL) > 1);
- assert (field_id == 17);
+ g_assert (field_id == 17);
field_id = 0;
thrift_compact_protocol_read_field_end (protocol, NULL);
- assert (thrift_compact_protocol_read_struct_begin (protocol,
+ g_assert (thrift_compact_protocol_read_struct_begin (protocol,
&struct_name, NULL) == 0);
- assert (thrift_compact_protocol_read_field_begin (protocol, &field_name,
+ g_assert (thrift_compact_protocol_read_field_begin (protocol, &field_name,
&field_type,
&field_id, NULL) > 1);
- assert (field_id == 18);
+ g_assert (field_id == 18);
field_id = 0;
thrift_compact_protocol_read_field_end (protocol, NULL);
- assert (thrift_compact_protocol_read_field_begin (protocol, &field_name,
+ g_assert (thrift_compact_protocol_read_field_begin (protocol, &field_name,
&field_type,
&field_id, NULL) == 1);
- assert (field_id == 19);
+ g_assert (field_id == 19);
field_id = 0;
thrift_compact_protocol_read_field_end (protocol, NULL);
- assert (thrift_compact_protocol_read_struct_end (protocol, NULL) == 0);
+ g_assert (thrift_compact_protocol_read_struct_end (protocol, NULL) == 0);
- assert (thrift_compact_protocol_read_field_begin (protocol, &field_name,
+ g_assert (thrift_compact_protocol_read_field_begin (protocol, &field_name,
&field_type,
&field_id, NULL) == 1);
- assert (field_id == 18);
+ g_assert (field_id == 18);
field_id = 0;
thrift_compact_protocol_read_field_end (protocol, NULL);
- assert (thrift_compact_protocol_read_field_begin (protocol, &field_name,
+ g_assert (thrift_compact_protocol_read_field_begin (protocol, &field_name,
&field_type,
&field_id, NULL) == 1);
- assert (field_id == 25);
+ g_assert (field_id == 25);
field_id = 0;
thrift_compact_protocol_read_field_end (protocol, NULL);
- assert (thrift_compact_protocol_read_struct_end (protocol, NULL) == 0);
+ g_assert (thrift_compact_protocol_read_struct_end (protocol, NULL) == 0);
- assert (thrift_compact_protocol_read_field_begin (protocol, &field_name,
+ g_assert (thrift_compact_protocol_read_field_begin (protocol, &field_name,
&field_type,
&field_id, NULL) == 1);
- assert (field_id == 17);
+ g_assert (field_id == 17);
field_id = 0;
thrift_compact_protocol_read_field_end (protocol, NULL);
@@ -934,83 +933,83 @@ thrift_server_complex_types (const int port)
/* deltas */
/* non-bool field -> bool field -> non-bool field */
- assert (thrift_compact_protocol_read_field_begin (protocol, &field_name,
+ g_assert (thrift_compact_protocol_read_field_begin (protocol, &field_name,
&field_type,
&field_id, NULL) == 1);
thrift_compact_protocol_read_field_end (protocol, NULL);
- assert (thrift_compact_protocol_read_field_begin (protocol, &field_name,
+ g_assert (thrift_compact_protocol_read_field_begin (protocol, &field_name,
&field_type,
&field_id, NULL) == 1);
- assert (field_type == T_BOOL);
- assert (thrift_compact_protocol_read_bool (protocol,
+ g_assert (field_type == T_BOOL);
+ g_assert (thrift_compact_protocol_read_bool (protocol,
&value_boolean, NULL) == 0);
- assert (value_boolean == TEST_BOOL);
+ g_assert (value_boolean == TEST_BOOL);
value_boolean = ! TEST_BOOL;
thrift_compact_protocol_read_field_end (protocol, NULL);
- assert (thrift_compact_protocol_read_field_begin (protocol, &field_name,
+ g_assert (thrift_compact_protocol_read_field_begin (protocol, &field_name,
&field_type,
&field_id, NULL) == 1);
thrift_compact_protocol_read_field_end (protocol, NULL);
/* bool -> bool field -> bool */
- assert (thrift_compact_protocol_read_bool (protocol,
+ g_assert (thrift_compact_protocol_read_bool (protocol,
&value_boolean, NULL) > 0);
- assert (value_boolean == TEST_BOOL);
+ g_assert (value_boolean == TEST_BOOL);
value_boolean = ! TEST_BOOL;
- assert (thrift_compact_protocol_read_field_begin (protocol, &field_name,
+ g_assert (thrift_compact_protocol_read_field_begin (protocol, &field_name,
&field_type,
&field_id, NULL) == 1);
- assert (field_type == T_BOOL);
- assert (thrift_compact_protocol_read_bool (protocol,
+ g_assert (field_type == T_BOOL);
+ g_assert (thrift_compact_protocol_read_bool (protocol,
&value_boolean, NULL) == 0);
- assert (value_boolean == TEST_BOOL);
+ g_assert (value_boolean == TEST_BOOL);
value_boolean = ! TEST_BOOL;
thrift_compact_protocol_read_field_end (protocol, NULL);
- assert (thrift_compact_protocol_read_bool (protocol,
+ g_assert (thrift_compact_protocol_read_bool (protocol,
&value_boolean, NULL) > 0);
- assert (value_boolean == TEST_BOOL);
+ g_assert (value_boolean == TEST_BOOL);
value_boolean = ! TEST_BOOL;
/* no deltas */
/* non-bool field -> bool field -> non-bool field */
- assert (thrift_compact_protocol_read_field_begin (protocol, &field_name,
+ g_assert (thrift_compact_protocol_read_field_begin (protocol, &field_name,
&field_type,
&field_id, NULL) > 1);
thrift_compact_protocol_read_field_end (protocol, NULL);
- assert (thrift_compact_protocol_read_field_begin (protocol, &field_name,
+ g_assert (thrift_compact_protocol_read_field_begin (protocol, &field_name,
&field_type,
&field_id, NULL) > 1);
- assert (field_type == T_BOOL);
- assert (thrift_compact_protocol_read_bool (protocol,
+ g_assert (field_type == T_BOOL);
+ g_assert (thrift_compact_protocol_read_bool (protocol,
&value_boolean, NULL) == 0);
- assert (value_boolean == TEST_BOOL);
+ g_assert (value_boolean == TEST_BOOL);
value_boolean = ! TEST_BOOL;
thrift_compact_protocol_read_field_end (protocol, NULL);
- assert (thrift_compact_protocol_read_field_begin (protocol, &field_name,
+ g_assert (thrift_compact_protocol_read_field_begin (protocol, &field_name,
&field_type,
&field_id, NULL) > 1);
thrift_compact_protocol_read_field_end (protocol, NULL);
/* bool -> bool field -> bool */
- assert (thrift_compact_protocol_read_bool (protocol,
+ g_assert (thrift_compact_protocol_read_bool (protocol,
&value_boolean, NULL) > 0);
- assert (value_boolean == TEST_BOOL);
+ g_assert (value_boolean == TEST_BOOL);
value_boolean = ! TEST_BOOL;
- assert (thrift_compact_protocol_read_field_begin (protocol, &field_name,
+ g_assert (thrift_compact_protocol_read_field_begin (protocol, &field_name,
&field_type,
&field_id, NULL) > 1);
- assert (field_type == T_BOOL);
- assert (thrift_compact_protocol_read_bool (protocol,
+ g_assert (field_type == T_BOOL);
+ g_assert (thrift_compact_protocol_read_bool (protocol,
&value_boolean, NULL) == 0);
- assert (value_boolean == TEST_BOOL);
+ g_assert (value_boolean == TEST_BOOL);
value_boolean = ! TEST_BOOL;
thrift_compact_protocol_read_field_end (protocol, NULL);
- assert (thrift_compact_protocol_read_bool (protocol,
+ g_assert (thrift_compact_protocol_read_bool (protocol,
&value_boolean, NULL) > 0);
- assert (value_boolean == TEST_BOOL);
+ g_assert (value_boolean == TEST_BOOL);
value_boolean = ! TEST_BOOL;
/* test first read error on a field */
transport_read_error = 1;
- assert (thrift_compact_protocol_read_field_begin (protocol,
+ g_assert (thrift_compact_protocol_read_field_begin (protocol,
&field_name, &field_type,
&field_id, NULL) == -1);
transport_read_error = 0;
@@ -1021,7 +1020,7 @@ thrift_server_complex_types (const int port)
/* test 2nd read failure on a field */
transport_read_count = 0;
transport_read_error_at = 1;
- assert (thrift_compact_protocol_read_field_begin (protocol,
+ g_assert (thrift_compact_protocol_read_field_begin (protocol,
&field_name, &field_type,
&field_id, NULL) == -1);
transport_read_error_at = -1;
@@ -1039,7 +1038,7 @@ thrift_server_complex_types (const int port)
/* test 1st read failure on a map */
transport_read_count = 0;
transport_read_error_at = 0;
- assert (thrift_compact_protocol_read_map_begin (protocol,
+ g_assert (thrift_compact_protocol_read_map_begin (protocol,
&key_type, &value_type,
&size, NULL) == -1);
transport_read_error_at = -1;
@@ -1047,7 +1046,7 @@ thrift_server_complex_types (const int port)
/* test 2nd read failure on a map */
transport_read_count = 0;
transport_read_error_at = 1;
- assert (thrift_compact_protocol_read_map_begin (protocol,
+ g_assert (thrift_compact_protocol_read_map_begin (protocol,
&key_type, &value_type,
&size, NULL) == -1);
transport_read_error_at = -1;
@@ -1058,7 +1057,7 @@ thrift_server_complex_types (const int port)
thrift_compact_protocol_read_byte (protocol, &value, NULL);
/* test negative map size */
- assert (thrift_compact_protocol_read_map_begin (protocol,
+ g_assert (thrift_compact_protocol_read_map_begin (protocol,
&key_type, &value_type,
&size, NULL) == -1);
@@ -1069,13 +1068,13 @@ thrift_server_complex_types (const int port)
/* test small list 1st read failure */
transport_read_error = 1;
- assert (thrift_compact_protocol_read_list_begin (protocol, &element_type,
+ g_assert (thrift_compact_protocol_read_list_begin (protocol, &element_type,
&size, NULL) == -1);
transport_read_error = 0;
/* test big list 1st read failure */
transport_read_error = 1;
- assert (thrift_compact_protocol_read_list_begin (protocol, &element_type,
+ g_assert (thrift_compact_protocol_read_list_begin (protocol, &element_type,
&size, NULL) == -1);
transport_read_error = 0;
@@ -1103,23 +1102,23 @@ thrift_server_complex_types (const int port)
/* broken read */
transport_read_error = 1;
- assert (thrift_compact_protocol_read_message_begin (protocol, &message_name,
+ g_assert (thrift_compact_protocol_read_message_begin (protocol, &message_name,
&message_type, &seqid,
NULL) == -1);
transport_read_error = 0;
/* invalid protocol */
- assert (thrift_compact_protocol_read_message_begin (protocol, &message_name,
+ g_assert (thrift_compact_protocol_read_message_begin (protocol, &message_name,
&message_type, &seqid,
NULL) == -1);
/* invalid version */
- assert (thrift_compact_protocol_read_message_begin (protocol, &message_name,
+ g_assert (thrift_compact_protocol_read_message_begin (protocol, &message_name,
&message_type, &seqid,
NULL) == -1);
/* read a valid message */
- assert (thrift_compact_protocol_read_message_begin (protocol, &message_name,
+ g_assert (thrift_compact_protocol_read_message_begin (protocol, &message_name,
&message_type, &seqid,
NULL) > 0);
g_free (message_name);
@@ -1127,7 +1126,7 @@ thrift_server_complex_types (const int port)
/* broken 2nd read on a message */
transport_read_count = 0;
transport_read_error_at = 1;
- assert (thrift_compact_protocol_read_message_begin (protocol, &message_name,
+ g_assert (thrift_compact_protocol_read_message_begin (protocol, &message_name,
&message_type, &seqid,
NULL) == -1);
transport_read_error_at = -1;
@@ -1135,7 +1134,7 @@ thrift_server_complex_types (const int port)
/* broken 3rd read on a message */
transport_read_count = 0;
transport_read_error_at = 2;
- assert (thrift_compact_protocol_read_message_begin (protocol, &message_name,
+ g_assert (thrift_compact_protocol_read_message_begin (protocol, &message_name,
&message_type, &seqid,
NULL) == -1);
transport_read_error_at = -1;
@@ -1143,18 +1142,18 @@ thrift_server_complex_types (const int port)
/* broken 4th read on a message */
transport_read_count = 0;
transport_read_error_at = 3;
- assert (thrift_compact_protocol_read_message_begin (protocol, &message_name,
+ g_assert (thrift_compact_protocol_read_message_begin (protocol, &message_name,
&message_type, &seqid,
NULL) == -1);
transport_read_error_at = -1;
/* read a valid message */
- assert (thrift_compact_protocol_read_message_begin (protocol, &message_name,
+ g_assert (thrift_compact_protocol_read_message_begin (protocol, &message_name,
&message_type, &seqid,
NULL) > 0);
g_free (message_name);
- assert (thrift_compact_protocol_read_message_end (protocol, NULL) == 0);
+ g_assert (thrift_compact_protocol_read_message_end (protocol, NULL) == 0);
/* handle 2nd write failure on a message */
thrift_compact_protocol_read_byte (protocol, &protocol_id, NULL);
@@ -1205,62 +1204,62 @@ thrift_server_many_frames (const int port)
client = g_object_new (THRIFT_TYPE_FRAMED_TRANSPORT, "transport",
thrift_server_transport_accept (transport, NULL),
"r_buf_size", 1, NULL);
- assert (client != NULL);
+ g_assert (client != NULL);
tcp = g_object_new (THRIFT_TYPE_COMPACT_PROTOCOL, "transport",
client, NULL);
protocol = THRIFT_PROTOCOL (tcp);
- assert (thrift_compact_protocol_read_bool (protocol,
+ g_assert (thrift_compact_protocol_read_bool (protocol,
&value_boolean, NULL) > 0);
- assert (thrift_compact_protocol_read_byte (protocol, &value_byte, NULL) > 0);
- assert (thrift_compact_protocol_read_i16 (protocol, &value_16, NULL) > 0);
- assert (thrift_compact_protocol_read_i32 (protocol, &value_32, NULL) > 0);
- assert (thrift_compact_protocol_read_i64 (protocol, &value_64, NULL) > 0);
- assert (thrift_compact_protocol_read_i16 (protocol, &value_n16, NULL) > 0);
- assert (thrift_compact_protocol_read_i32 (protocol, &value_n32, NULL) > 0);
- assert (thrift_compact_protocol_read_i64 (protocol, &value_n64, NULL) > 0);
- assert (thrift_compact_protocol_read_byte (protocol, &zigzag_p16, NULL) > 0);
- assert (thrift_compact_protocol_read_byte (protocol, &zigzag_p32, NULL) > 0);
- assert (thrift_compact_protocol_read_byte (protocol, &zigzag_p64, NULL) > 0);
- assert (thrift_compact_protocol_read_byte (protocol, &zigzag_n16, NULL) > 0);
- assert (thrift_compact_protocol_read_byte (protocol, &zigzag_n32, NULL) > 0);
- assert (thrift_compact_protocol_read_byte (protocol, &zigzag_n64, NULL) > 0);
- assert (thrift_compact_protocol_read_double (protocol,
+ g_assert (thrift_compact_protocol_read_byte (protocol, &value_byte, NULL) > 0);
+ g_assert (thrift_compact_protocol_read_i16 (protocol, &value_16, NULL) > 0);
+ g_assert (thrift_compact_protocol_read_i32 (protocol, &value_32, NULL) > 0);
+ g_assert (thrift_compact_protocol_read_i64 (protocol, &value_64, NULL) > 0);
+ g_assert (thrift_compact_protocol_read_i16 (protocol, &value_n16, NULL) > 0);
+ g_assert (thrift_compact_protocol_read_i32 (protocol, &value_n32, NULL) > 0);
+ g_assert (thrift_compact_protocol_read_i64 (protocol, &value_n64, NULL) > 0);
+ g_assert (thrift_compact_protocol_read_byte (protocol, &zigzag_p16, NULL) > 0);
+ g_assert (thrift_compact_protocol_read_byte (protocol, &zigzag_p32, NULL) > 0);
+ g_assert (thrift_compact_protocol_read_byte (protocol, &zigzag_p64, NULL) > 0);
+ g_assert (thrift_compact_protocol_read_byte (protocol, &zigzag_n16, NULL) > 0);
+ g_assert (thrift_compact_protocol_read_byte (protocol, &zigzag_n32, NULL) > 0);
+ g_assert (thrift_compact_protocol_read_byte (protocol, &zigzag_n64, NULL) > 0);
+ g_assert (thrift_compact_protocol_read_double (protocol,
&value_double, NULL) > 0);
- assert (thrift_compact_protocol_read_string (protocol, &string, NULL) > 0);
- assert (thrift_compact_protocol_read_string (protocol, &empty_string,
+ g_assert (thrift_compact_protocol_read_string (protocol, &string, NULL) > 0);
+ g_assert (thrift_compact_protocol_read_string (protocol, &empty_string,
NULL) > 0);
- assert (thrift_compact_protocol_read_binary (protocol, &binary,
+ g_assert (thrift_compact_protocol_read_binary (protocol, &binary,
&len, NULL) > 0);
- assert (value_boolean == TEST_BOOL);
- assert (value_byte == TEST_BYTE);
- assert (value_16 == TEST_I16);
- assert (value_32 == TEST_I32);
- assert (value_64 == TEST_I64);
- assert (value_n16 == TEST_NI16);
- assert (value_n32 == TEST_NI32);
- assert (value_n64 == TEST_NI64);
- assert (zigzag_p16 == 4);
- assert (zigzag_p32 == 4);
- assert (zigzag_p64 == 4);
- assert (zigzag_n16 == 3);
- assert (zigzag_n32 == 3);
- assert (zigzag_n64 == 3);
- assert (value_double == TEST_DOUBLE);
- assert (strcmp (TEST_STRING, string) == 0);
- assert (strcmp ("", empty_string) == 0);
- assert (memcmp (comparator, binary, len) == 0);
+ g_assert (value_boolean == TEST_BOOL);
+ g_assert (value_byte == TEST_BYTE);
+ g_assert (value_16 == TEST_I16);
+ g_assert (value_32 == TEST_I32);
+ g_assert (value_64 == TEST_I64);
+ g_assert (value_n16 == TEST_NI16);
+ g_assert (value_n32 == TEST_NI32);
+ g_assert (value_n64 == TEST_NI64);
+ g_assert (zigzag_p16 == 4);
+ g_assert (zigzag_p32 == 4);
+ g_assert (zigzag_p64 == 4);
+ g_assert (zigzag_n16 == 3);
+ g_assert (zigzag_n32 == 3);
+ g_assert (zigzag_n64 == 3);
+ g_assert (value_double == TEST_DOUBLE);
+ g_assert (strcmp (TEST_STRING, string) == 0);
+ g_assert (strcmp ("", empty_string) == 0);
+ g_assert (memcmp (comparator, binary, len) == 0);
g_free (string);
g_free (empty_string);
g_free (binary);
- assert (thrift_compact_protocol_read_binary (protocol, &binary,
+ g_assert (thrift_compact_protocol_read_binary (protocol, &binary,
&len, NULL) > 0);
- assert (binary == NULL);
- assert (len == 0);
+ g_assert (binary == NULL);
+ g_assert (len == 0);
g_free (binary);
thrift_transport_read_end (client, NULL);
http://git-wip-us.apache.org/repos/asf/thrift/blob/43f4bf2f/lib/c_glib/test/testdebugproto.c
----------------------------------------------------------------------
diff --git a/lib/c_glib/test/testdebugproto.c b/lib/c_glib/test/testdebugproto.c
index 47ac588..109a48b 100644
--- a/lib/c_glib/test/testdebugproto.c
+++ b/lib/c_glib/test/testdebugproto.c
@@ -17,7 +17,6 @@
* under the License.
*/
-#include <assert.h>
#include <math.h>
#include <string.h>
#include <glib-object.h>
@@ -838,11 +837,11 @@ test_services_inherited (void)
NULL);
/* TTestInheritedClient inherits from TTestSrvClient */
- assert (g_type_is_a (T_TEST_TYPE_INHERITED_CLIENT,
+ g_assert (g_type_is_a (T_TEST_TYPE_INHERITED_CLIENT,
T_TEST_TYPE_SRV_CLIENT));
/* TTestInheritedClient implements TTestSrvClient's interface */
- assert (g_type_is_a (T_TEST_TYPE_INHERITED_CLIENT,
+ g_assert (g_type_is_a (T_TEST_TYPE_INHERITED_CLIENT,
T_TEST_TYPE_SRV_IF));
/* TTestInheritedClient's inherited properties can be set and retrieved */
@@ -856,8 +855,8 @@ test_services_inherited (void)
"output_protocol", &output_protocol,
NULL);
- assert (input_protocol == G_OBJECT(protocol));
- assert (output_protocol == G_OBJECT(protocol));
+ g_assert (input_protocol == G_OBJECT(protocol));
+ g_assert (output_protocol == G_OBJECT(protocol));
g_object_unref (output_protocol);
g_object_unref (input_protocol);
http://git-wip-us.apache.org/repos/asf/thrift/blob/43f4bf2f/lib/c_glib/test/testfdtransport.c
----------------------------------------------------------------------
diff --git a/lib/c_glib/test/testfdtransport.c b/lib/c_glib/test/testfdtransport.c
index 40c1acf..1ea89be 100755
--- a/lib/c_glib/test/testfdtransport.c
+++ b/lib/c_glib/test/testfdtransport.c
@@ -17,7 +17,6 @@
* under the License.
*/
-#include <assert.h>
#include <string.h>
#include <fcntl.h>
@@ -37,7 +36,7 @@ test_create_and_destroy (void)
{
GObject *object;
object = g_object_new (THRIFT_TYPE_FD_TRANSPORT, "fd", -1, NULL);
- assert (object != NULL);
+ g_assert (object != NULL);
g_object_unref (object);
}
@@ -54,7 +53,7 @@ test_open_and_close (void)
filename = NULL;
fd = g_file_open_tmp (NULL, &filename, &error);
- assert (fd >= 0);
+ g_assert (fd >= 0);
transport = THRIFT_TRANSPORT (g_object_new (THRIFT_TYPE_FD_TRANSPORT,
"fd", fd,
@@ -62,20 +61,20 @@ test_open_and_close (void)
klass = THRIFT_TRANSPORT_GET_CLASS (transport);
/* open is no-op */
- assert (klass->is_open (transport));
- assert (klass->peek (transport, &error));
- assert (klass->open (transport, &error));
- assert (klass->is_open (transport));
- assert (klass->peek (transport, &error));
+ g_assert (klass->is_open (transport));
+ g_assert (klass->peek (transport, &error));
+ g_assert (klass->open (transport, &error));
+ g_assert (klass->is_open (transport));
+ g_assert (klass->peek (transport, &error));
- assert (klass->close (transport, &error));
- assert (! klass->open (transport, &error));
- assert (! klass->is_open (transport));
- assert (! klass->peek (transport, &error));
+ g_assert (klass->close (transport, &error));
+ g_assert (! klass->open (transport, &error));
+ g_assert (! klass->is_open (transport));
+ g_assert (! klass->peek (transport, &error));
/* already closed */
- assert (close (fd) != 0);
- assert (errno == EBADF);
+ g_assert (close (fd) != 0);
+ g_assert (errno == EBADF);
g_object_unref (transport);
@@ -88,13 +87,13 @@ test_open_and_close (void)
NULL));
klass = THRIFT_TRANSPORT_GET_CLASS (transport);
- assert (! klass->is_open (transport));
+ g_assert (! klass->is_open (transport));
error = NULL;
- assert (! klass->peek (transport, &error));
+ g_assert (! klass->peek (transport, &error));
error = NULL;
- assert (! klass->open (transport, &error));
+ g_assert (! klass->open (transport, &error));
error = NULL;
- assert (! klass->close (transport, &error));
+ g_assert (! klass->close (transport, &error));
g_object_unref (transport);
}
@@ -115,22 +114,22 @@ test_read_and_write (void)
filename = NULL;
fd = g_file_open_tmp (NULL, &filename, &error);
- assert (fd >= 0);
+ g_assert (fd >= 0);
/* write */
transport = THRIFT_TRANSPORT (g_object_new (THRIFT_TYPE_FD_TRANSPORT,
"fd", fd,
NULL));
klass = THRIFT_TRANSPORT_GET_CLASS (transport);
- assert (klass->is_open (transport));
- assert (klass->write (transport, (gpointer) TEST_DATA, 11, &error));
- assert (klass->flush (transport, &error));
- assert (klass->close (transport, &error));
+ g_assert (klass->is_open (transport));
+ g_assert (klass->write (transport, (gpointer) TEST_DATA, 11, &error));
+ g_assert (klass->flush (transport, &error));
+ g_assert (klass->close (transport, &error));
g_object_unref (transport);
/* read */
fd = open(filename, O_RDONLY, S_IRUSR | S_IWUSR);
- assert (fd >= 0);
+ g_assert (fd >= 0);
transport = THRIFT_TRANSPORT (g_object_new (THRIFT_TYPE_FD_TRANSPORT,
"fd", fd,
@@ -142,24 +141,24 @@ test_read_and_write (void)
want = 7;
while (want > 0) {
got = klass->read (transport, (gpointer) b, want, &error);
- assert (got > 0 && got <= want);
+ g_assert (got > 0 && got <= want);
b += got;
want -= got;
}
- assert (memcmp (out_buf, TEST_DATA, 7) == 0);
+ g_assert (memcmp (out_buf, TEST_DATA, 7) == 0);
memset(out_buf, 0, 8);
b = out_buf;
want = 4;
while (want > 0) {
got = klass->read (transport, (gpointer) b, want, &error);
- assert (got > 0 && got <= want);
+ g_assert (got > 0 && got <= want);
b += got;
want -= got;
}
- assert (memcmp (out_buf, TEST_DATA + 7, 4) == 0);
+ g_assert (memcmp (out_buf, TEST_DATA + 7, 4) == 0);
- assert (klass->close (transport, &error));
+ g_assert (klass->close (transport, &error));
g_object_unref (transport);
/* clean up */
http://git-wip-us.apache.org/repos/asf/thrift/blob/43f4bf2f/lib/c_glib/test/testframedtransport.c
----------------------------------------------------------------------
diff --git a/lib/c_glib/test/testframedtransport.c b/lib/c_glib/test/testframedtransport.c
index d50ff23..0328737 100755
--- a/lib/c_glib/test/testframedtransport.c
+++ b/lib/c_glib/test/testframedtransport.c
@@ -17,7 +17,6 @@
* under the License.
*/
-#include <assert.h>
#include <netdb.h>
#include <sys/wait.h>
@@ -42,7 +41,7 @@ test_create_and_destroy(void)
GObject *object = NULL;
object = g_object_new (THRIFT_TYPE_FRAMED_TRANSPORT, NULL);
- assert (object != NULL);
+ g_assert (object != NULL);
g_object_get (G_OBJECT (object), "transport", &transport,
"r_buf_size", &r_buf_size,
"w_buf_size", &w_buf_size, NULL);
@@ -65,9 +64,9 @@ test_open_and_close(void)
"transport", THRIFT_TRANSPORT (tsocket), NULL);
/* this shouldn't work */
- assert (thrift_framed_transport_open (transport, NULL) == FALSE);
- assert (thrift_framed_transport_is_open (transport) == TRUE);
- assert (thrift_framed_transport_close (transport, NULL) == TRUE);
+ g_assert (thrift_framed_transport_open (transport, NULL) == FALSE);
+ g_assert (thrift_framed_transport_is_open (transport) == TRUE);
+ g_assert (thrift_framed_transport_close (transport, NULL) == TRUE);
g_object_unref (transport);
g_object_unref (tsocket);
@@ -79,7 +78,7 @@ test_open_and_close(void)
transport = g_object_new (THRIFT_TYPE_FRAMED_TRANSPORT,
"transport", THRIFT_TRANSPORT (tsocket), NULL);
- assert (thrift_framed_transport_open (transport, &err) == FALSE);
+ g_assert (thrift_framed_transport_open (transport, &err) == FALSE);
g_object_unref (transport);
g_object_unref (tsocket);
g_error_free (err);
@@ -97,7 +96,7 @@ test_read_and_write(void)
guchar buf[10] = TEST_DATA; /* a buffer */
pid = fork ();
- assert ( pid >= 0 );
+ g_assert ( pid >= 0 );
if ( pid == 0 )
{
@@ -114,8 +113,8 @@ test_read_and_write(void)
"transport", THRIFT_TRANSPORT (tsocket),
"w_buf_size", 4, NULL);
- assert (thrift_framed_transport_open (transport, NULL) == TRUE);
- assert (thrift_framed_transport_is_open (transport));
+ g_assert (thrift_framed_transport_open (transport, NULL) == TRUE);
+ g_assert (thrift_framed_transport_is_open (transport));
/* write 10 bytes */
thrift_framed_transport_write (transport, buf, 10, NULL);
@@ -137,8 +136,8 @@ test_read_and_write(void)
g_object_unref (transport);
g_object_unref (tsocket);
- assert ( wait (&status) == pid );
- assert ( status == 0 );
+ g_assert ( wait (&status) == pid );
+ g_assert ( status == 0 );
}
}
@@ -247,12 +246,12 @@ thrift_server (const int port)
client = g_object_new (THRIFT_TYPE_FRAMED_TRANSPORT, "transport",
thrift_server_transport_accept (transport, NULL),
"r_buf_size", 5, NULL);
- assert (client != NULL);
+ g_assert (client != NULL);
/* read 10 bytes */
bytes = thrift_framed_transport_read (client, buf, 10, NULL);
- assert (bytes == 10); /* make sure we've read 10 bytes */
- assert ( memcmp (buf, match, 10) == 0 ); /* make sure what we got matches */
+ g_assert (bytes == 10); /* make sure we've read 10 bytes */
+ g_assert ( memcmp (buf, match, 10) == 0 ); /* make sure what we got matches */
bytes = thrift_framed_transport_read (client, buf, 6, NULL);
bytes = thrift_framed_transport_read (client, buf, 5, NULL);
http://git-wip-us.apache.org/repos/asf/thrift/blob/43f4bf2f/lib/c_glib/test/testmemorybuffer.c
----------------------------------------------------------------------
diff --git a/lib/c_glib/test/testmemorybuffer.c b/lib/c_glib/test/testmemorybuffer.c
index 2ad8c0f..9fb68b9 100755
--- a/lib/c_glib/test/testmemorybuffer.c
+++ b/lib/c_glib/test/testmemorybuffer.c
@@ -17,7 +17,6 @@
* under the License.
*/
-#include <assert.h>
#include <netdb.h>
#include <thrift/c_glib/transport/thrift_transport.h>
@@ -37,7 +36,7 @@ test_create_and_destroy (void)
object = g_object_new (THRIFT_TYPE_MEMORY_BUFFER,
"buf_size", 10,
NULL);
- assert (object != NULL);
+ g_assert (object != NULL);
g_object_unref (object);
}
@@ -48,7 +47,7 @@ test_create_and_destroy_large (void)
object = g_object_new (THRIFT_TYPE_MEMORY_BUFFER,
"buf_size", 10 * 1024 * 1024,
NULL);
- assert (object != NULL);
+ g_assert (object != NULL);
g_object_unref (object);
}
@@ -57,7 +56,7 @@ test_create_and_destroy_default (void)
{
GObject *object = NULL;
object = g_object_new (THRIFT_TYPE_MEMORY_BUFFER, NULL);
- assert (object != NULL);
+ g_assert (object != NULL);
g_object_unref (object);
}
@@ -66,11 +65,11 @@ test_create_and_destroy_external (void)
{
GObject *object = NULL;
GByteArray *buf = g_byte_array_new ();
- assert (buf != NULL);
+ g_assert (buf != NULL);
object = g_object_new (THRIFT_TYPE_MEMORY_BUFFER,
"buf", buf,
NULL);
- assert (object != NULL);
+ g_assert (object != NULL);
g_object_unref (object);
}
@@ -84,12 +83,12 @@ test_create_and_destroy_unowned (void)
object = g_object_new (THRIFT_TYPE_MEMORY_BUFFER,
"owner", FALSE,
NULL);
- assert (object != NULL);
+ g_assert (object != NULL);
g_value_init (&val, G_TYPE_POINTER);
g_object_get_property (object, "buf", &val);
buf = (GByteArray*) g_value_get_pointer (&val);
- assert (buf != NULL);
+ g_assert (buf != NULL);
g_byte_array_unref (buf);
g_value_unset (&val);
@@ -105,9 +104,9 @@ test_open_and_close (void)
tbuffer = g_object_new (THRIFT_TYPE_MEMORY_BUFFER, NULL);
/* no-ops */
- assert (thrift_memory_buffer_open (THRIFT_TRANSPORT (tbuffer), NULL) == TRUE);
- assert (thrift_memory_buffer_is_open (THRIFT_TRANSPORT (tbuffer)) == TRUE);
- assert (thrift_memory_buffer_close (THRIFT_TRANSPORT (tbuffer), NULL) == TRUE);
+ g_assert (thrift_memory_buffer_open (THRIFT_TRANSPORT (tbuffer), NULL) == TRUE);
+ g_assert (thrift_memory_buffer_is_open (THRIFT_TRANSPORT (tbuffer)) == TRUE);
+ g_assert (thrift_memory_buffer_close (THRIFT_TRANSPORT (tbuffer), NULL) == TRUE);
g_object_unref (tbuffer);
}
@@ -122,18 +121,18 @@ test_read_and_write (void)
GError *error = NULL;
tbuffer = g_object_new (THRIFT_TYPE_MEMORY_BUFFER, "buf_size", 5, NULL);
- assert (thrift_memory_buffer_write (THRIFT_TRANSPORT (tbuffer),
+ g_assert (thrift_memory_buffer_write (THRIFT_TRANSPORT (tbuffer),
(gpointer) TEST_DATA,
10, &error) == FALSE);
- assert (error != NULL);
+ g_assert (error != NULL);
g_error_free (error);
error = NULL;
g_object_unref (tbuffer);
tbuffer = g_object_new (THRIFT_TYPE_MEMORY_BUFFER, "buf_size", 15, NULL);
- assert (thrift_memory_buffer_write (THRIFT_TRANSPORT (tbuffer),
+ g_assert (thrift_memory_buffer_write (THRIFT_TRANSPORT (tbuffer),
(gpointer) TEST_DATA, 10, &error) == TRUE);
- assert (error == NULL);
+ g_assert (error == NULL);
memset(read, 0, 10);
b = read;
@@ -141,12 +140,12 @@ test_read_and_write (void)
while (want > 0) {
got = thrift_memory_buffer_read (THRIFT_TRANSPORT (tbuffer),
(gpointer) b, want, &error);
- assert (got > 0 && got <= want);
- assert (error == NULL);
+ g_assert (got > 0 && got <= want);
+ g_assert (error == NULL);
b += got;
want -= got;
}
- assert (memcmp (read, TEST_DATA, 10) == 0);
+ g_assert (memcmp (read, TEST_DATA, 10) == 0);
g_object_unref (tbuffer);
}
@@ -161,9 +160,9 @@ test_read_and_write_default (void)
tbuffer = g_object_new (THRIFT_TYPE_MEMORY_BUFFER, NULL);
for (i = 0; i < 100; ++i) {
- assert (thrift_memory_buffer_write (THRIFT_TRANSPORT (tbuffer),
+ g_assert (thrift_memory_buffer_write (THRIFT_TRANSPORT (tbuffer),
(gpointer) TEST_DATA, 10, &error) == TRUE);
- assert (error == NULL);
+ g_assert (error == NULL);
}
for (i = 0; i < 100; ++i) {
@@ -173,12 +172,12 @@ test_read_and_write_default (void)
while (want > 0) {
got = thrift_memory_buffer_read (THRIFT_TRANSPORT (tbuffer),
(gpointer) b, want, &error);
- assert (got > 0 && got <= want);
- assert (error == NULL);
+ g_assert (got > 0 && got <= want);
+ g_assert (error == NULL);
b += got;
want -= got;
}
- assert (memcmp (read, TEST_DATA, 10) == 0);
+ g_assert (memcmp (read, TEST_DATA, 10) == 0);
}
g_object_unref (tbuffer);
}
@@ -190,14 +189,14 @@ test_read_and_write_external (void)
gchar *b;
GError *error = NULL;
GByteArray *buf = g_byte_array_new ();
- assert (buf != NULL);
+ g_assert (buf != NULL);
tbuffer = g_object_new (THRIFT_TYPE_MEMORY_BUFFER, "buf", buf, NULL);
- assert (thrift_memory_buffer_write (THRIFT_TRANSPORT (tbuffer),
+ g_assert (thrift_memory_buffer_write (THRIFT_TRANSPORT (tbuffer),
(gpointer) TEST_DATA, 10, &error) == TRUE);
- assert (error == NULL);
+ g_assert (error == NULL);
- assert (memcmp (buf->data, TEST_DATA, 10) == 0);
+ g_assert (memcmp (buf->data, TEST_DATA, 10) == 0);
g_object_unref (tbuffer);
}
http://git-wip-us.apache.org/repos/asf/thrift/blob/43f4bf2f/lib/c_glib/test/testoptionalrequired.c
----------------------------------------------------------------------
diff --git a/lib/c_glib/test/testoptionalrequired.c b/lib/c_glib/test/testoptionalrequired.c
index 818343c..636c36d 100755
--- a/lib/c_glib/test/testoptionalrequired.c
+++ b/lib/c_glib/test/testoptionalrequired.c
@@ -17,7 +17,6 @@
* under the License.
*/
-#include <assert.h>
#include <glib.h>
#include <thrift/c_glib/thrift_struct.h>
@@ -76,18 +75,18 @@ test_simple (void)
/* write-to-read with optional fields */
s1->im_optional = 10;
- assert (s1->__isset_im_default == FALSE);
- assert (s1->__isset_im_optional == FALSE);
+ g_assert (s1->__isset_im_default == FALSE);
+ g_assert (s1->__isset_im_optional == FALSE);
write_to_read (THRIFT_STRUCT (s1), THRIFT_STRUCT (s2), NULL, NULL);
- assert (s2->__isset_im_default == TRUE);
- assert (s2->__isset_im_optional == FALSE);
- assert (s2->im_optional == 0);
+ g_assert (s2->__isset_im_default == TRUE);
+ g_assert (s2->__isset_im_optional == FALSE);
+ g_assert (s2->im_optional == 0);
s1->__isset_im_optional = TRUE;
write_to_read (THRIFT_STRUCT (s1), THRIFT_STRUCT (s3), NULL, NULL);
- assert (s3->__isset_im_default == TRUE);
- assert (s3->__isset_im_optional == TRUE);
- assert (s3->im_optional == 10);
+ g_assert (s3->__isset_im_default == TRUE);
+ g_assert (s3->__isset_im_optional == TRUE);
+ g_assert (s3->im_optional == 10);
g_object_unref (s1);
g_object_unref (s2);
@@ -109,10 +108,10 @@ test_tricky1 (void)
write_to_read (THRIFT_STRUCT (t2), THRIFT_STRUCT (t1), NULL, NULL);
write_to_read (THRIFT_STRUCT (t1), THRIFT_STRUCT (t2), NULL, NULL);
- assert (t1->__isset_im_default == FALSE);
- assert (t2->__isset_im_optional == TRUE);
- assert (t1->im_default == t2->im_optional);
- assert (t1->im_default == 0);
+ g_assert (t1->__isset_im_default == FALSE);
+ g_assert (t2->__isset_im_optional == TRUE);
+ g_assert (t1->im_default == t2->im_optional);
+ g_assert (t1->im_default == 0);
g_object_unref (t1);
g_object_unref (t2);
@@ -133,7 +132,7 @@ test_tricky2 (void)
write_to_read (THRIFT_STRUCT (t1), THRIFT_STRUCT (t3), NULL, NULL);
write_to_read (THRIFT_STRUCT (t3), THRIFT_STRUCT (t1), NULL, NULL);
- assert (t1->__isset_im_default == TRUE);
+ g_assert (t1->__isset_im_default == TRUE);
g_object_unref (t1);
g_object_unref (t3);
@@ -176,12 +175,12 @@ test_tricky4 (void)
/* throws protocol exception */
write_to_read (THRIFT_STRUCT (t2), THRIFT_STRUCT (t3), NULL, &read_error);
- assert (read_error != NULL);
+ g_assert (read_error != NULL);
g_error_free (read_error);
write_to_read (THRIFT_STRUCT (t3), THRIFT_STRUCT (t2), NULL, NULL);
- assert (t2->__isset_im_optional);
+ g_assert (t2->__isset_im_optional);
g_object_unref (t2);
g_object_unref (t3);
http://git-wip-us.apache.org/repos/asf/thrift/blob/43f4bf2f/lib/c_glib/test/testsimpleserver.c
----------------------------------------------------------------------
diff --git a/lib/c_glib/test/testsimpleserver.c b/lib/c_glib/test/testsimpleserver.c
index 3af2eeb..3c6f2e8 100755
--- a/lib/c_glib/test/testsimpleserver.c
+++ b/lib/c_glib/test/testsimpleserver.c
@@ -17,7 +17,6 @@
* under the License.
*/
-#include <assert.h>
#include <glib.h>
#include <stdlib.h>
#include <unistd.h>
@@ -89,7 +88,7 @@ test_server (void)
/* run the server in a child process */
pid = fork ();
- assert (pid >= 0);
+ g_assert (pid >= 0);
if (pid == 0)
{
@@ -103,8 +102,8 @@ test_server (void)
g_object_unref (ss);
g_object_unref (tss);
g_object_unref (p);
- assert (wait (&status) == pid);
- assert (status == SIGINT);
+ g_assert (wait (&status) == pid);
+ g_assert (status == SIGINT);
}
}
http://git-wip-us.apache.org/repos/asf/thrift/blob/43f4bf2f/lib/c_glib/test/teststruct.c
----------------------------------------------------------------------
diff --git a/lib/c_glib/test/teststruct.c b/lib/c_glib/test/teststruct.c
index 5d4baf3..d120cbc 100755
--- a/lib/c_glib/test/teststruct.c
+++ b/lib/c_glib/test/teststruct.c
@@ -17,7 +17,6 @@
* under the License.
*/
-#include <assert.h>
#include <glib-object.h>
#include "../src/thrift/c_glib/thrift_struct.c"
@@ -89,7 +88,7 @@ test_initialize_object (void)
ThriftTestStruct *t = NULL;
t = g_object_new (THRIFT_TYPE_TEST_STRUCT, NULL);
- assert ( THRIFT_IS_STRUCT (t));
+ g_assert ( THRIFT_IS_STRUCT (t));
thrift_struct_read (THRIFT_STRUCT (t), NULL, NULL);
thrift_struct_write (THRIFT_STRUCT (t), NULL, NULL);
thrift_test_struct_read (THRIFT_STRUCT (t), NULL, NULL);
http://git-wip-us.apache.org/repos/asf/thrift/blob/43f4bf2f/lib/c_glib/test/testthrifttest.c
----------------------------------------------------------------------
diff --git a/lib/c_glib/test/testthrifttest.c b/lib/c_glib/test/testthrifttest.c
index 0211f53..23a934d 100755
--- a/lib/c_glib/test/testthrifttest.c
+++ b/lib/c_glib/test/testthrifttest.c
@@ -1,4 +1,3 @@
-#include <assert.h>
#include <netdb.h>
#include <thrift/c_glib/thrift.h>
@@ -87,14 +86,14 @@ test_thrift_handler (void)
g_object_weak_ref (G_OBJECT (argument), set_indicator, (gpointer) &indicator);
- assert (thrift_test_handler_test_insanity (NULL, &_return, argument, &error));
- assert (! indicator);
+ g_assert (thrift_test_handler_test_insanity (NULL, &_return, argument, &error));
+ g_assert (! indicator);
g_hash_table_unref (_return);
- assert (! indicator);
+ g_assert (! indicator);
g_object_unref (argument);
- assert (indicator);
+ g_assert (indicator);
}
int
[32/50] [abbrv] thrift git commit: update the CONTRIBUTING readme to
point to build instructions (third time is a charm)
Posted by je...@apache.org.
update the CONTRIBUTING readme to point to build instructions (third time is a charm)
Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/95d5fb3a
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/95d5fb3a
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/95d5fb3a
Branch: refs/heads/0.11.0
Commit: 95d5fb3a1e38125b9eabcbe9cda1a6c7bbe3e93d
Parents: ad2ea3d
Author: James E. King, III <jk...@apache.org>
Authored: Sat Nov 11 09:51:14 2017 -0500
Committer: James E. King, III <jk...@apache.org>
Committed: Sat Nov 11 09:51:14 2017 -0500
----------------------------------------------------------------------
CONTRIBUTING.md | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/thrift/blob/95d5fb3a/CONTRIBUTING.md
----------------------------------------------------------------------
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index d8b0a4c..0460359 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -8,11 +8,11 @@ Thank you for your interest in contributing to the Apache Thrift project! Infor
## If you want to build the project locally ##
-For Windows systems, see our detailed instructions on the [CMake README](build/cmake/README.md).
+For Windows systems, see our detailed instructions on the [CMake README](/build/cmake/README.md).
-For Windows Native C++ builds, see our detailed instructions on the [WinCPP README](build/wincpp/README.md).
+For Windows Native C++ builds, see our detailed instructions on the [WinCPP README](/build/wincpp/README.md).
-For unix systems, see our detailed instructions on the [Docker README](build/docker/README.md).
+For unix systems, see our detailed instructions on the [Docker README](/build/docker/README.md).
## If you want to review open issues... ##
[17/50] [abbrv] thrift git commit: THRIFT-4372 Pipe write operations
across a network are limited to 65, 535 bytes per write Client: Delphi,
C# Patch: Jens Geyer
Posted by je...@apache.org.
THRIFT-4372 Pipe write operations across a network are limited to 65,535 bytes per write
Client: Delphi, C#
Patch: Jens Geyer
This closes #1402
Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/d4df9170
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/d4df9170
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/d4df9170
Branch: refs/heads/0.11.0
Commit: d4df91709b724174aaf8a957f3edac3573be354e
Parents: e549455
Author: Jens Geyer <je...@apache.org>
Authored: Wed Oct 25 22:30:23 2017 +0200
Committer: Jens Geyer <je...@apache.org>
Committed: Thu Oct 26 20:36:28 2017 +0200
----------------------------------------------------------------------
.../src/Transport/TNamedPipeClientTransport.cs | 14 +-
.../src/Transport/TNamedPipeServerTransport.cs | 67 +++++----
lib/delphi/src/Thrift.Transport.Pipes.pas | 136 ++++++++++++-------
lib/delphi/test/TestClient.pas | 38 ++++--
test/csharp/TestClient.cs | 45 +++---
test/csharp/TestServer.cs | 43 +++---
6 files changed, 207 insertions(+), 136 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/thrift/blob/d4df9170/lib/csharp/src/Transport/TNamedPipeClientTransport.cs
----------------------------------------------------------------------
diff --git a/lib/csharp/src/Transport/TNamedPipeClientTransport.cs b/lib/csharp/src/Transport/TNamedPipeClientTransport.cs
index f87d1ec..ea2e862 100644
--- a/lib/csharp/src/Transport/TNamedPipeClientTransport.cs
+++ b/lib/csharp/src/Transport/TNamedPipeClientTransport.cs
@@ -21,6 +21,7 @@
* details.
*/
+using System;
using System.IO.Pipes;
using System.Threading;
@@ -88,7 +89,18 @@ namespace Thrift.Transport
throw new TTransportException(TTransportException.ExceptionType.NotOpen);
}
- client.Write(buf, off, len);
+ // if necessary, send the data in chunks
+ // there's a system limit around 0x10000 bytes that we hit otherwise
+ // MSDN: "Pipe write operations across a network are limited to 65,535 bytes per write. For more information regarding pipes, see the Remarks section."
+ var nBytes = Math.Min(len, 15 * 4096); // 16 would exceed the limit
+ while (nBytes > 0)
+ {
+ client.Write(buf, off, nBytes);
+
+ off += nBytes;
+ len -= nBytes;
+ nBytes = Math.Min(len, nBytes);
+ }
}
protected override void Dispose(bool disposing)
http://git-wip-us.apache.org/repos/asf/thrift/blob/d4df9170/lib/csharp/src/Transport/TNamedPipeServerTransport.cs
----------------------------------------------------------------------
diff --git a/lib/csharp/src/Transport/TNamedPipeServerTransport.cs b/lib/csharp/src/Transport/TNamedPipeServerTransport.cs
index 240f0df..a6cfb2e 100644
--- a/lib/csharp/src/Transport/TNamedPipeServerTransport.cs
+++ b/lib/csharp/src/Transport/TNamedPipeServerTransport.cs
@@ -239,40 +239,51 @@ namespace Thrift.Transport
throw new TTransportException(TTransportException.ExceptionType.NotOpen);
}
- if (asyncMode)
+ // if necessary, send the data in chunks
+ // there's a system limit around 0x10000 bytes that we hit otherwise
+ // MSDN: "Pipe write operations across a network are limited to 65,535 bytes per write. For more information regarding pipes, see the Remarks section."
+ var nBytes = Math.Min(len, 15 * 4096); // 16 would exceed the limit
+ while (nBytes > 0)
{
- Exception eOuter = null;
- var evt = new ManualResetEvent(false);
- stream.BeginWrite(buf, off, len, asyncResult =>
+ if (asyncMode)
{
- try
- {
- if (stream != null)
- stream.EndWrite(asyncResult);
- else
- eOuter = new TTransportException(TTransportException.ExceptionType.Interrupted);
- }
- catch (Exception e)
- {
- if (stream != null)
- eOuter = e;
- else
- eOuter = new TTransportException(TTransportException.ExceptionType.Interrupted, e.Message);
- }
- evt.Set();
- }, null);
+ Exception eOuter = null;
+ var evt = new ManualResetEvent(false);
- evt.WaitOne();
+ stream.BeginWrite(buf, off, nBytes, asyncResult =>
+ {
+ try
+ {
+ if (stream != null)
+ stream.EndWrite(asyncResult);
+ else
+ eOuter = new TTransportException(TTransportException.ExceptionType.Interrupted);
+ }
+ catch (Exception e)
+ {
+ if (stream != null)
+ eOuter = e;
+ else
+ eOuter = new TTransportException(TTransportException.ExceptionType.Interrupted, e.Message);
+ }
+ evt.Set();
+ }, null);
+
+ evt.WaitOne();
+
+ if (eOuter != null)
+ throw eOuter; // rethrow exception
+ }
+ else
+ {
+ stream.Write(buf, off, nBytes);
+ }
- if (eOuter != null)
- throw eOuter; // rethrow exception
+ off += nBytes;
+ len -= nBytes;
+ nBytes = Math.Min(len, nBytes);
}
- else
- {
- stream.Write(buf, off, len);
- }
-
}
protected override void Dispose(bool disposing)
http://git-wip-us.apache.org/repos/asf/thrift/blob/d4df9170/lib/delphi/src/Thrift.Transport.Pipes.pas
----------------------------------------------------------------------
diff --git a/lib/delphi/src/Thrift.Transport.Pipes.pas b/lib/delphi/src/Thrift.Transport.Pipes.pas
index 9b7f842..aace4bb 100644
--- a/lib/delphi/src/Thrift.Transport.Pipes.pas
+++ b/lib/delphi/src/Thrift.Transport.Pipes.pas
@@ -327,51 +327,70 @@ end;
procedure TPipeStreamBase.WriteDirect( const pBuf : Pointer; offset: Integer; count: Integer);
-var cbWritten : DWORD;
+var cbWritten, nBytes : DWORD;
begin
if not IsOpen
then raise TTransportExceptionNotOpen.Create('Called write on non-open pipe');
- if not WriteFile( FPipe, PByteArray(pBuf)^[offset], count, cbWritten, nil)
- then raise TTransportExceptionNotOpen.Create('Write to pipe failed');
+ // if necessary, send the data in chunks
+ // there's a system limit around 0x10000 bytes that we hit otherwise
+ // MSDN: "Pipe write operations across a network are limited to 65,535 bytes per write. For more information regarding pipes, see the Remarks section."
+ nBytes := Min( 15*4096, count); // 16 would exceed the limit
+ while nBytes > 0 do begin
+ if not WriteFile( FPipe, PByteArray(pBuf)^[offset], nBytes, cbWritten, nil)
+ then raise TTransportExceptionNotOpen.Create('Write to pipe failed');
+
+ Inc( offset, cbWritten);
+ Dec( count, cbWritten);
+ nBytes := Min( nBytes, count);
+ end;
end;
procedure TPipeStreamBase.WriteOverlapped( const pBuf : Pointer; offset: Integer; count: Integer);
-var cbWritten, dwWait, dwError : DWORD;
+var cbWritten, dwWait, dwError, nBytes : DWORD;
overlapped : IOverlappedHelper;
begin
if not IsOpen
then raise TTransportExceptionNotOpen.Create('Called write on non-open pipe');
- overlapped := TOverlappedHelperImpl.Create;
-
- if not WriteFile( FPipe, PByteArray(pBuf)^[offset], count, cbWritten, overlapped.OverlappedPtr)
- then begin
- dwError := GetLastError;
- case dwError of
- ERROR_IO_PENDING : begin
- dwWait := overlapped.WaitFor(FTimeout);
-
- if (dwWait = WAIT_TIMEOUT)
- then raise TTransportExceptionTimedOut.Create('Pipe write timed out');
+ // if necessary, send the data in chunks
+ // there's a system limit around 0x10000 bytes that we hit otherwise
+ // MSDN: "Pipe write operations across a network are limited to 65,535 bytes per write. For more information regarding pipes, see the Remarks section."
+ nBytes := Min( 15*4096, count); // 16 would exceed the limit
+ while nBytes > 0 do begin
+ overlapped := TOverlappedHelperImpl.Create;
+ if not WriteFile( FPipe, PByteArray(pBuf)^[offset], nBytes, cbWritten, overlapped.OverlappedPtr)
+ then begin
+ dwError := GetLastError;
+ case dwError of
+ ERROR_IO_PENDING : begin
+ dwWait := overlapped.WaitFor(FTimeout);
+
+ if (dwWait = WAIT_TIMEOUT)
+ then raise TTransportExceptionTimedOut.Create('Pipe write timed out');
+
+ if (dwWait <> WAIT_OBJECT_0)
+ or not GetOverlappedResult( FPipe, overlapped.Overlapped, cbWritten, TRUE)
+ then raise TTransportExceptionUnknown.Create('Pipe write error');
+ end;
- if (dwWait <> WAIT_OBJECT_0)
- or not GetOverlappedResult( FPipe, overlapped.Overlapped, cbWritten, TRUE)
- then raise TTransportExceptionUnknown.Create('Pipe write error');
+ else
+ raise TTransportExceptionUnknown.Create(SysErrorMessage(dwError));
end;
-
- else
- raise TTransportExceptionUnknown.Create(SysErrorMessage(dwError));
end;
- end;
- ASSERT( DWORD(count) = cbWritten);
+ ASSERT( DWORD(nBytes) = cbWritten);
+
+ Inc( offset, cbWritten);
+ Dec( count, cbWritten);
+ nBytes := Min( nBytes, count);
+ end;
end;
function TPipeStreamBase.ReadDirect( const pBuf : Pointer; const buflen : Integer; offset: Integer; count: Integer): Integer;
-var cbRead, dwErr : DWORD;
+var cbRead, dwErr, nRemaining : DWORD;
bytes, retries : LongInt;
bOk : Boolean;
const INTERVAL = 10; // ms
@@ -406,48 +425,61 @@ begin
end;
end;
- // read the data (or block INFINITE-ly)
- bOk := ReadFile( FPipe, PByteArray(pBuf)^[offset], count, cbRead, nil);
- if (not bOk) and (GetLastError() <> ERROR_MORE_DATA)
- then result := 0 // No more data, possibly because client disconnected.
- else result := cbRead;
+ result := 0;
+ nRemaining := count;
+ while nRemaining > 0 do begin
+ // read the data (or block INFINITE-ly)
+ bOk := ReadFile( FPipe, PByteArray(pBuf)^[offset], nRemaining, cbRead, nil);
+ if (not bOk) and (GetLastError() <> ERROR_MORE_DATA)
+ then Break; // No more data, possibly because client disconnected.
+
+ Dec( nRemaining, cbRead);
+ Inc( offset, cbRead);
+ Inc( result, cbRead);
+ end;
end;
function TPipeStreamBase.ReadOverlapped( const pBuf : Pointer; const buflen : Integer; offset: Integer; count: Integer): Integer;
-var cbRead, dwWait, dwError : DWORD;
+var cbRead, dwWait, dwError, nRemaining : DWORD;
bOk : Boolean;
overlapped : IOverlappedHelper;
begin
if not IsOpen
then raise TTransportExceptionNotOpen.Create('Called read on non-open pipe');
- overlapped := TOverlappedHelperImpl.Create;
-
- // read the data
- bOk := ReadFile( FPipe, PByteArray(pBuf)^[offset], count, cbRead, overlapped.OverlappedPtr);
- if not bOk then begin
- dwError := GetLastError;
- case dwError of
- ERROR_IO_PENDING : begin
- dwWait := overlapped.WaitFor(FTimeout);
-
- if (dwWait = WAIT_TIMEOUT)
- then raise TTransportExceptionTimedOut.Create('Pipe read timed out');
+ result := 0;
+ nRemaining := count;
+ while nRemaining > 0 do begin
+ overlapped := TOverlappedHelperImpl.Create;
+
+ // read the data
+ bOk := ReadFile( FPipe, PByteArray(pBuf)^[offset], nRemaining, cbRead, overlapped.OverlappedPtr);
+ if not bOk then begin
+ dwError := GetLastError;
+ case dwError of
+ ERROR_IO_PENDING : begin
+ dwWait := overlapped.WaitFor(FTimeout);
+
+ if (dwWait = WAIT_TIMEOUT)
+ then raise TTransportExceptionTimedOut.Create('Pipe read timed out');
+
+ if (dwWait <> WAIT_OBJECT_0)
+ or not GetOverlappedResult( FPipe, overlapped.Overlapped, cbRead, TRUE)
+ then raise TTransportExceptionUnknown.Create('Pipe read error');
+ end;
- if (dwWait <> WAIT_OBJECT_0)
- or not GetOverlappedResult( FPipe, overlapped.Overlapped, cbRead, TRUE)
- then raise TTransportExceptionUnknown.Create('Pipe read error');
+ else
+ raise TTransportExceptionUnknown.Create(SysErrorMessage(dwError));
end;
-
- else
- raise TTransportExceptionUnknown.Create(SysErrorMessage(dwError));
end;
- end;
- ASSERT( cbRead > 0); // see TTransportImpl.ReadAll()
- ASSERT( cbRead = DWORD(count));
- result := cbRead;
+ ASSERT( cbRead > 0); // see TTransportImpl.ReadAll()
+ ASSERT( cbRead <= DWORD(nRemaining));
+ Dec( nRemaining, cbRead);
+ Inc( offset, cbRead);
+ Inc( result, cbRead);
+ end;
end;
http://git-wip-us.apache.org/repos/asf/thrift/blob/d4df9170/lib/delphi/test/TestClient.pas
----------------------------------------------------------------------
diff --git a/lib/delphi/test/TestClient.pas b/lib/delphi/test/TestClient.pas
index 37d8546..59b2a66 100644
--- a/lib/delphi/test/TestClient.pas
+++ b/lib/delphi/test/TestClient.pas
@@ -86,7 +86,7 @@ type
procedure ClientTest;
procedure JSONProtocolReadWriteTest;
- function PrepareBinaryData( aRandomDist : Boolean = FALSE) : TBytes;
+ function PrepareBinaryData( aRandomDist, aHuge : Boolean) : TBytes;
{$IFDEF StressTest}
procedure StressTest(const client : TThriftTest.Iface);
{$ENDIF}
@@ -546,8 +546,21 @@ begin
i64 := client.testI64(-34359738368);
Expect( i64 = -34359738368, 'testI64(-34359738368) = ' + IntToStr( i64));
- // random binary
- binOut := PrepareBinaryData( TRUE);
+ // random binary small
+ binOut := PrepareBinaryData( TRUE, FALSE);
+ Console.WriteLine('testBinary('+BytesToHex(binOut)+')');
+ try
+ binIn := client.testBinary(binOut);
+ Expect( Length(binOut) = Length(binIn), 'testBinary(): length '+IntToStr(Length(binOut))+' = '+IntToStr(Length(binIn)));
+ i32 := Min( Length(binOut), Length(binIn));
+ Expect( CompareMem( binOut, binIn, i32), 'testBinary('+BytesToHex(binOut)+') = '+BytesToHex(binIn));
+ except
+ on e:TApplicationException do Console.WriteLine('testBinary(): '+e.Message);
+ on e:Exception do Expect( FALSE, 'testBinary(): Unexpected exception "'+e.ClassName+'": '+e.Message);
+ end;
+
+ // random binary huge
+ binOut := PrepareBinaryData( TRUE, TRUE);
Console.WriteLine('testBinary('+BytesToHex(binOut)+')');
try
binIn := client.testBinary(binOut);
@@ -1011,10 +1024,12 @@ end;
{$ENDIF}
-function TClientThread.PrepareBinaryData( aRandomDist : Boolean = FALSE) : TBytes;
-var i, nextPos : Integer;
+function TClientThread.PrepareBinaryData( aRandomDist, aHuge : Boolean) : TBytes;
+var i : Integer;
begin
- SetLength( result, $100);
+ if aHuge
+ then SetLength( result, $12345) // tests for THRIFT-4372
+ else SetLength( result, $100);
ASSERT( Low(result) = 0);
// linear distribution, unless random is requested
@@ -1027,13 +1042,8 @@ begin
// random distribution of all 256 values
FillChar( result[0], Length(result) * SizeOf(result[0]), $0);
- i := 1;
- while i < Length(result) do begin
- nextPos := Byte( Random($100));
- if result[nextPos] = 0 then begin // unused?
- result[nextPos] := i;
- Inc(i);
- end;
+ for i := Low(result) to High(result) do begin
+ result[i] := Byte( Random($100));
end;
end;
@@ -1080,7 +1090,7 @@ begin
StartTestGroup( 'JsonProtocolTest', test_Unknown);
// prepare binary data
- binary := PrepareBinaryData( FALSE);
+ binary := PrepareBinaryData( FALSE, FALSE);
SetLength( emptyBinary, 0); // empty binary data block
// output setup
http://git-wip-us.apache.org/repos/asf/thrift/blob/d4df9170/test/csharp/TestClient.cs
----------------------------------------------------------------------
diff --git a/test/csharp/TestClient.cs b/test/csharp/TestClient.cs
index 67673ec..fad1057 100644
--- a/test/csharp/TestClient.cs
+++ b/test/csharp/TestClient.cs
@@ -265,10 +265,11 @@ namespace Test
return BitConverter.ToString(data).Replace("-", string.Empty);
}
- public static byte[] PrepareTestData(bool randomDist)
+ public static byte[] PrepareTestData(bool randomDist, bool huge)
{
- byte[] retval = new byte[0x100];
- int initLen = Math.Min(0x100,retval.Length);
+ // huge = true tests for THRIFT-4372
+ byte[] retval = new byte[huge ? 0x12345 : 0x100];
+ int initLen = retval.Length;
// linear distribution, unless random is requested
if (!randomDist) {
@@ -374,29 +375,33 @@ namespace Test
returnCode |= ErrorBaseTypes;
}
- byte[] binOut = PrepareTestData(true);
- Console.Write("testBinary(" + BytesToHex(binOut) + ")");
- try
+ for (i32 = 0; i32 < 2; ++i32)
{
- byte[] binIn = client.testBinary(binOut);
- Console.WriteLine(" = " + BytesToHex(binIn));
- if (binIn.Length != binOut.Length)
+ var huge = (i32 > 0);
+ byte[] binOut = PrepareTestData(false,huge);
+ Console.Write("testBinary(" + BytesToHex(binOut) + ")");
+ try
{
- Console.WriteLine("*** FAILED ***");
- returnCode |= ErrorBaseTypes;
- }
- for (int ofs = 0; ofs < Math.Min(binIn.Length, binOut.Length); ++ofs)
- if (binIn[ofs] != binOut[ofs])
+ byte[] binIn = client.testBinary(binOut);
+ Console.WriteLine(" = " + BytesToHex(binIn));
+ if (binIn.Length != binOut.Length)
{
Console.WriteLine("*** FAILED ***");
returnCode |= ErrorBaseTypes;
}
- }
- catch (Thrift.TApplicationException ex)
- {
- Console.WriteLine("*** FAILED ***");
- returnCode |= ErrorBaseTypes;
- Console.WriteLine(ex.Message + " ST: " + ex.StackTrace);
+ for (int ofs = 0; ofs < Math.Min(binIn.Length, binOut.Length); ++ofs)
+ if (binIn[ofs] != binOut[ofs])
+ {
+ Console.WriteLine("*** FAILED ***");
+ returnCode |= ErrorBaseTypes;
+ }
+ }
+ catch (Thrift.TApplicationException ex)
+ {
+ Console.WriteLine("*** FAILED ***");
+ returnCode |= ErrorBaseTypes;
+ Console.WriteLine(ex.Message + " ST: " + ex.StackTrace);
+ }
}
// binary equals? only with hashcode option enabled ...
http://git-wip-us.apache.org/repos/asf/thrift/blob/d4df9170/test/csharp/TestServer.cs
----------------------------------------------------------------------
diff --git a/test/csharp/TestServer.cs b/test/csharp/TestServer.cs
index 7404ca2..e9c7168 100644
--- a/test/csharp/TestServer.cs
+++ b/test/csharp/TestServer.cs
@@ -41,27 +41,28 @@ namespace Test
public static int _clientID = -1;
public delegate void TestLogDelegate(string msg, params object[] values);
- public class TradeServerEventHandler : TServerEventHandler
- {
- public int callCount = 0;
- public void preServe()
- {
- callCount++;
- }
- public Object createContext(Thrift.Protocol.TProtocol input, Thrift.Protocol.TProtocol output)
- {
- callCount++;
- return null;
- }
- public void deleteContext(Object serverContext, Thrift.Protocol.TProtocol input, Thrift.Protocol.TProtocol output)
- {
- callCount++;
- }
- public void processContext(Object serverContext, Thrift.Transport.TTransport transport)
- {
- callCount++;
- }
- };
+ public class TradeServerEventHandler : TServerEventHandler
+ {
+ public int callCount = 0;
+ public void preServe()
+ {
+ callCount++;
+ }
+ public Object createContext(Thrift.Protocol.TProtocol input, Thrift.Protocol.TProtocol output)
+ {
+ callCount++;
+ return null;
+ }
+ public void deleteContext(Object serverContext, Thrift.Protocol.TProtocol input, Thrift.Protocol.TProtocol output)
+ {
+ callCount++;
+ }
+ public void processContext(Object serverContext, Thrift.Transport.TTransport transport)
+ {
+ callCount++;
+ }
+ };
+
public class TestHandler : ThriftTest.Iface, Thrift.TControllingHandler
{
[08/50] [abbrv] thrift git commit: THRIFT-4305 Doc comments in dlang
output Client: d Patch: Neia Neutuladh
Posted by je...@apache.org.
THRIFT-4305 Doc comments in dlang output
Client: d
Patch: Neia Neutuladh
This closes #1396
This closes #1395
Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/ba5e065a
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/ba5e065a
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/ba5e065a
Branch: refs/heads/0.11.0
Commit: ba5e065aaa0e1f9a3d0174a5c287fff09ad2f3a7
Parents: cd5be7b
Author: dhasenan <dh...@gmail.com>
Authored: Sat Oct 21 08:25:14 2017 -0700
Committer: James E. King, III <jk...@apache.org>
Committed: Mon Oct 23 14:49:13 2017 -0400
----------------------------------------------------------------------
.../cpp/src/thrift/generate/t_d_generator.cc | 28 +++++++++++++++-----
1 file changed, 21 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/thrift/blob/ba5e065a/compiler/cpp/src/thrift/generate/t_d_generator.cc
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/thrift/generate/t_d_generator.cc b/compiler/cpp/src/thrift/generate/t_d_generator.cc
index 159d93a..35f611d 100644
--- a/compiler/cpp/src/thrift/generate/t_d_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_d_generator.cc
@@ -131,6 +131,7 @@ protected:
vector<t_const*>::iterator c_iter;
for (c_iter = consts.begin(); c_iter != consts.end(); ++c_iter) {
+ this->emit_doc(*c_iter, f_consts);
string name = (*c_iter)->get_name();
t_type* type = (*c_iter)->get_type();
indent(f_consts) << "immutable(" << render_type_name(type) << ") " << name << ";" << endl;
@@ -159,6 +160,7 @@ protected:
}
virtual void generate_typedef(t_typedef* ttypedef) {
+ this->emit_doc(ttypedef, f_types_);
f_types_ << indent() << "alias " << render_type_name(ttypedef->get_type()) << " "
<< ttypedef->get_symbolic() << ";" << endl << endl;
}
@@ -166,21 +168,17 @@ protected:
virtual void generate_enum(t_enum* tenum) {
vector<t_enum_value*> constants = tenum->get_constants();
+ this->emit_doc(tenum, f_types_);
string enum_name = tenum->get_name();
f_types_ << indent() << "enum " << enum_name << " {" << endl;
indent_up();
vector<t_enum_value*>::const_iterator c_iter;
- bool first = true;
for (c_iter = constants.begin(); c_iter != constants.end(); ++c_iter) {
- if (first) {
- first = false;
- } else {
- f_types_ << "," << endl;
- }
+ this->emit_doc(*c_iter, f_types_);
indent(f_types_) << (*c_iter)->get_name();
- f_types_ << " = " << (*c_iter)->get_value();
+ f_types_ << " = " << (*c_iter)->get_value() << ",";
}
f_types_ << endl;
@@ -225,6 +223,7 @@ protected:
extends = " : " + render_type_name(tservice->get_extends());
}
+ this->emit_doc(tservice, f_service);
f_service << indent() << "interface " << svc_name << extends << " {" << endl;
indent_up();
@@ -236,6 +235,7 @@ protected:
vector<t_function*> functions = tservice->get_functions();
vector<t_function*>::iterator fn_iter;
for (fn_iter = functions.begin(); fn_iter != functions.end(); ++fn_iter) {
+ this->emit_doc(*fn_iter, f_service);
f_service << indent();
print_function_signature(f_service, *fn_iter);
f_service << ";" << endl;
@@ -345,6 +345,20 @@ protected:
f_skeleton.close();
}
+ void emit_doc(t_doc *doc, std::ofstream& out) {
+ if (!doc->has_doc()) {
+ return;
+ }
+ indent(out) << "/**" << std::endl;
+ indent_up();
+ // No endl -- comments reliably have a newline at the end.
+ // This is true even for stuff like:
+ // /** method infos */ void foo(/** huh?*/ 1: i64 stuff)
+ indent(out) << doc->get_doc();
+ indent_down();
+ indent(out) << "*/" << std::endl;
+ }
+
private:
/**
* Writes a server skeleton for the passed service to out.
[24/50] [abbrv] thrift git commit: THRIFT-4343: enable nodejs-8.x on
ubuntu-artful image and update grunt-jsdoc also fix a perl failure as we were
using a deprecated language feature in the cross test server for perl.
Client: nodejs, perl
Posted by je...@apache.org.
THRIFT-4343: enable nodejs-8.x on ubuntu-artful image and update grunt-jsdoc
also fix a perl failure as we were using a deprecated language feature
in the cross test server for perl.
Client: nodejs, perl
This closes #1406
Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/619218cd
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/619218cd
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/619218cd
Branch: refs/heads/0.11.0
Commit: 619218cd7f3e7c5e433aed4734f3108bc8492b00
Parents: 533405e
Author: James E. King, III <jk...@apache.org>
Authored: Sun Oct 29 06:55:00 2017 -0400
Committer: James E. King, III <jk...@apache.org>
Committed: Sun Oct 29 10:15:10 2017 -0400
----------------------------------------------------------------------
LANGUAGES.md | 206 ++++++++++++++---------------
build/docker/README.md | 2 +-
build/docker/ubuntu-artful/Dockerfile | 6 +-
lib/js/package.json | 4 +-
test/perl/TestServer.pl | 2 +-
5 files changed, 109 insertions(+), 111 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/thrift/blob/619218cd/LANGUAGES.md
----------------------------------------------------------------------
diff --git a/LANGUAGES.md b/LANGUAGES.md
index e34cce3..d1a21e2 100644
--- a/LANGUAGES.md
+++ b/LANGUAGES.md
@@ -33,22 +33,22 @@ The Language/Library Levels indicate the minimum and maximum versions that are u
<tbody>
<tr align=center>
<td align=left><a href="lib/as3/README.md">ActionScript</a></td>
-<!-- Build Systems ---------><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Build Systems ---------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Language Levels -------><td colspan=2>ActionScript 3</td>
-<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
-<!-- Transport Wrappers ----><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
-<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
-<!-- Servers ---------------><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
+<!-- Transport Wrappers ----><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
+<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
+<!-- Servers ---------------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12313722">ActionScript</a></td>
</tr>
<tr align=center>
<td align=left><a href="lib/c_glib/README.md">C (glib)</a></td>
<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Language Levels -------><td>2.40.2</td><td>2.54.0</td>
-<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
-<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
-<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
-<!-- Servers ---------------><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
+<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Servers ---------------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12313854">C (glib)</a></td>
</tr>
<tr align=center>
@@ -58,227 +58,227 @@ The Language/Library Levels indicate the minimum and maximum versions that are u
<!-- Low-Level Transports --><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
-<!-- Servers ---------------><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Servers ---------------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12312313">C++</a></td>
</tr>
<tr align=center>
<td align=left><a href="lib/csharp/README.md">C#</a></td>
-<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Language Levels -------><td>.NET 3.5 / mono 3.2.8.0</td><td>.NET 4.6.1 / mono 4.6.2.7</td>
-<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
-<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
-<!-- Servers ---------------><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Servers ---------------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12312362">C# (.NET)</a></td>
</tr>
<tr align=center>
<td align=left><a href="lib/cocoa/README.md">Cocoa</a></td>
-<!-- Build Systems ---------><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Build Systems ---------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Language Levels -------><td colspan=2>unknown</td>
-<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
-<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
-<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
-<!-- Servers ---------------><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
+<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Servers ---------------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12312398">Cocoa</a></td>
</tr>
<tr align=center>
<td align=left><a href="lib/d/README.md">D</a></td>
-<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Language Levels -------><td>2.070.2</td><td>2.076.0</td>
-<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
-<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
-<!-- Servers ---------------><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
+<!-- Servers ---------------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12317904">D</a></td>
</tr>
<tr align=center>
<td align=left><a href="lib/dart/README.md">Dart</a></td>
-<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Language Levels -------><td>1.20.1</td><td>1.24.2</td>
-<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
-<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
+<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
-<!-- Servers ---------------><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Servers ---------------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12328006">Dart</a></td>
</tr>
<tr align=center>
<td align=left><a href="lib/delphi/README.md">Delphi</a></td>
-<!-- Build Systems ---------><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Build Systems ---------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Language Levels -------><td>2010</td><td>unknown</td>
-<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
-<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
+<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
-<!-- Servers ---------------><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Servers ---------------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12316601">Delphi</a></td>
</tr>
<tr align=center>
<td align=left><a href="lib/netcore/README.md">.NET Core</a></td>
-<!-- Build Systems ---------><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Build Systems ---------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Language Levels -------><td colspan=2>2.0.0</td>
-<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
-<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
-<!-- Servers ---------------><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Servers ---------------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12331176">.NET Core</a></td>
</tr>
<tr align=center>
<td align=left><a href="lib/erl/README.md">Erlang</a></td>
-<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Language Levels -------><td>R16B03</td><td>20.0.4</td>
-<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
-<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
-<!-- Servers ---------------><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Servers ---------------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12312390">Erlang</a></td>
</tr>
<tr align=center>
<td align=left><a href="lib/go/README.md">Go</a></td>
-<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Language Levels -------><td>1.2.1</td><td>1.8.3</td>
-<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
-<!-- Servers ---------------><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Servers ---------------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12314307">Go</a></td>
</tr>
<tr align=center>
<td align=left><a href="lib/hs/README.md">Haskell</a></td>
<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Language Levels -------><td>7.6.3</td><td>8.0.2</td>
-<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
-<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
-<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
-<!-- Servers ---------------><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
+<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
+<!-- Servers ---------------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12312704">Haskell</a></td>
</tr>
<tr align=center>
<td align=left><a href="lib/haxe/README.md">Haxe</a></td>
-<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Language Levels -------><td colspan=2>3.2.1</td>
-<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
-<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
+<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
-<!-- Servers ---------------><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Servers ---------------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12324347">Haxe</a></td>
</tr>
<tr align=center>
<td align=left><a href="lib/java/README.md">Java (SE)</a></td>
<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Language Levels -------><td>1.7.0_151</td><td>1.8.0_144</td>
-<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
-<!-- Servers ---------------><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Servers ---------------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12312314">Java SE</a></td>
</tr>
<tr align=center>
<td align=left><a href="lib/javame/README.md">Java (ME)</a></td>
-<!-- Build Systems ---------><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Build Systems ---------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Language Levels -------><td colspan=2>unknown</td>
-<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
-<!-- Transport Wrappers ----><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
-<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
-<!-- Servers ---------------><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Transport Wrappers ----><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
+<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
+<!-- Servers ---------------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12313759">Java ME</a></td>
</tr>
<tr align=center>
<td align=left><a href="lib/js/README.md">Javascript</a></td>
-<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Language Levels -------><td colspan=2>unknown</td>
-<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
-<!-- Transport Wrappers ----><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
-<!-- Protocols -------------><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
-<!-- Servers ---------------><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Transport Wrappers ----><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
+<!-- Protocols -------------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Servers ---------------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12313418">Javascript</a></td>
</tr>
<tr align=center>
<td align=left><a href="lib/lua/README.md">Lua</a></td>
-<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Language Levels -------><td>5.1.5</td><td>5.3.3</td>
-<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
-<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
-<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
-<!-- Servers ---------------><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
+<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
+<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
+<!-- Servers ---------------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12322659">Lua</a></td>
</tr>
<tr align=center>
<td align=left><a href="lib/nodejs/README.md">node.js</a></td>
-<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
-<!-- Language Levels -------><td>4.2.6</td><td>6.11.2</td>
-<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
-<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
+<!-- Language Levels -------><td>4.2.6</td><td>8.8.1</td>
+<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
-<!-- Servers ---------------><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Servers ---------------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12314320">node.js</a></td>
</tr>
<tr align=center>
<td align=left><a href="lib/ocaml/README.md">OCaml</a></td>
-<!-- Build Systems ---------><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Build Systems ---------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Language Levels -------><td>4.02.3</td><td>4.04.0</td>
-<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
-<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
-<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
-<!-- Servers ---------------><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
+<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
+<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
+<!-- Servers ---------------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12313660">OCaml</a></td>
</tr>
<tr align=center>
<td align=left><a href="lib/perl/README.md">Perl</a></td>
-<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Language Levels -------><td>5.18.2</td><td>5.26.0</td>
-<!-- Low-Level Transports --><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
-<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
-<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
-<!-- Servers ---------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Low-Level Transports --><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
+<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Servers ---------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12312312">Perl</a></td>
</tr>
<tr align=center>
<td align=left><a href="lib/php/README.md">PHP</a></td>
-<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Language Levels -------><td>5.5.9</td><td>7.1.8</td>
-<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
-<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
-<!-- Servers ---------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Servers ---------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12312431">PHP</a></td>
</tr>
<tr align=center>
<td align=left><a href="lib/py/README.md">Python</a></td>
<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Language Levels -------><td>2.7.6, 3.4.3</td><td>2.7.14, 3.6.3</td>
-<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
-<!-- Transport Wrappers ----><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Transport Wrappers ----><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
-<!-- Servers ---------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Servers ---------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12312315">Python</a></td>
</tr>
<tr align=center>
<td align=left><a href="lib/rb/README.md">Ruby</a></td>
-<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Language Levels -------><td>1.9.3p484</td><td>2.3.3p222</td>
-<!-- Low-Level Transports --><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
-<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Low-Level Transports --><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
-<!-- Servers ---------------><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Servers ---------------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12312316">Ruby</a></td>
</tr>
<tr align=center>
<td align=left><a href="lib/rs/README.md">Rust</a></td>
-<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Language Levels -------><td>1.15.1</td><td>1.18.0</td>
-<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
-<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
-<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
-<!-- Servers ---------------><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
+<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
+<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
+<!-- Servers ---------------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12331420">Rust</a></td>
</tr>
<tr align=center>
<td align=left><a href="lib/st/README.md">Smalltalk</a></td>
-<!-- Build Systems ---------><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Build Systems ---------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Language Levels -------><td colspan=2>unknown</td>
-<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
-<!-- Transport Wrappers ----><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
-<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
-<!-- Servers ---------------><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td><td><img src="doc/images/cred.png" alt="No"/></td>
+<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
+<!-- Transport Wrappers ----><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
+<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
+<!-- Servers ---------------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12313861">Smalltalk</a></td>
</tr>
</tbody>
http://git-wip-us.apache.org/repos/asf/thrift/blob/619218cd/build/docker/README.md
----------------------------------------------------------------------
diff --git a/build/docker/README.md b/build/docker/README.md
index 32fad92..4cada36 100644
--- a/build/docker/README.md
+++ b/build/docker/README.md
@@ -105,7 +105,7 @@ Last updated: October 1, 2017
| java | 1.7.0_151 | 1.8.0_131 | 1.8.0_144 | |
| js | | | | Unsure how to look for version info? |
| lua | 5.1.5 | 5.2.4 | 5.3.3 | |
-| nodejs | | 4.2.6 | 6.11.2 | trusty has node.js 0.10.0 which is too old |
+| nodejs | | 4.2.6 | 8.8.1 | trusty has node.js 0.10.0 which is too old |
| ocaml | | 4.02.3 | 4.04.0 | |
| perl | 5.18.2 | 5.22.1 | 5.26.0 | |
| php | 5.5.9 | 7.0.22 | 7.1.8 | |
http://git-wip-us.apache.org/repos/asf/thrift/blob/619218cd/build/docker/ubuntu-artful/Dockerfile
----------------------------------------------------------------------
diff --git a/build/docker/ubuntu-artful/Dockerfile b/build/docker/ubuntu-artful/Dockerfile
index 1c8f963..523fc36 100644
--- a/build/docker/ubuntu-artful/Dockerfile
+++ b/build/docker/ubuntu-artful/Dockerfile
@@ -46,8 +46,7 @@ RUN apt-get update && \
# echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-xenial-prod xenial main" > /etc/apt/sources.list.d/dotnetdev.list
# node.js (this step runs apt-get update internally) - if we ever want a later version
-# note: node 8.5 introduced some issues with directory handling / jsdoc / something... using 7.x for now
-# RUN curl -sL https://deb.nodesource.com/setup_7.x | bash
+RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -
### install general dependencies
RUN apt-get install -y --no-install-recommends \
@@ -170,8 +169,7 @@ RUN apt-get install -y --no-install-recommends \
RUN apt-get install -y --no-install-recommends \
`# Node.js dependencies` \
- nodejs \
- npm
+ nodejs
RUN apt-get install -y --no-install-recommends \
`# OCaml dependencies` \
http://git-wip-us.apache.org/repos/asf/thrift/blob/619218cd/lib/js/package.json
----------------------------------------------------------------------
diff --git a/lib/js/package.json b/lib/js/package.json
index edb2ba6..526528d 100644
--- a/lib/js/package.json
+++ b/lib/js/package.json
@@ -9,11 +9,11 @@
"grunt-contrib-qunit": "^1.2.0",
"grunt-contrib-uglify": "^1.0.1",
"grunt-external-daemon": "^1.1.0",
- "grunt-jsdoc": ">= 2.1.1",
+ "grunt-jsdoc": "^2.2.0",
"grunt-shell": "^1.3.0"
},
"dependencies": {
- "jsdoc": "<3.5.0",
+ "jsdoc": "^3.5.5",
"nopt": "^4.0.1"
}
}
http://git-wip-us.apache.org/repos/asf/thrift/blob/619218cd/test/perl/TestServer.pl
----------------------------------------------------------------------
diff --git a/test/perl/TestServer.pl b/test/perl/TestServer.pl
index c97067e..1e23ce8 100644
--- a/test/perl/TestServer.pl
+++ b/test/perl/TestServer.pl
@@ -282,7 +282,7 @@ sub testSet() {
print(", ");
}
print("$key");
- push($result, $key);
+ push(@arr, $key);
}
print("})\n");
return $result;
[12/50] [abbrv] thrift git commit: THRIFT-4356: fix segment fault for
thrift_protocol NOTE: drops php5 support for PHP extension (thrift_protocol)
however library still can support PHP5 as evidenced by CI build Client: php
Posted by je...@apache.org.
http://git-wip-us.apache.org/repos/asf/thrift/blob/9dff0efc/lib/php/src/ext/thrift_protocol/php_thrift_protocol7.cpp
----------------------------------------------------------------------
diff --git a/lib/php/src/ext/thrift_protocol/php_thrift_protocol7.cpp b/lib/php/src/ext/thrift_protocol/php_thrift_protocol7.cpp
deleted file mode 100644
index dafc185..0000000
--- a/lib/php/src/ext/thrift_protocol/php_thrift_protocol7.cpp
+++ /dev/null
@@ -1,1102 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "php.h"
-#include "zend_interfaces.h"
-#include "zend_exceptions.h"
-#include "php_thrift_protocol.h"
-
-#if PHP_VERSION_ID >= 70000
-
-#include <sys/types.h>
-#include <arpa/inet.h>
-
-#include <cstdint>
-#include <stdexcept>
-#include <algorithm>
-
-#ifndef bswap_64
-#define bswap_64(x) (((uint64_t)(x) << 56) | \
- (((uint64_t)(x) << 40) & 0xff000000000000ULL) | \
- (((uint64_t)(x) << 24) & 0xff0000000000ULL) | \
- (((uint64_t)(x) << 8) & 0xff00000000ULL) | \
- (((uint64_t)(x) >> 8) & 0xff000000ULL) | \
- (((uint64_t)(x) >> 24) & 0xff0000ULL) | \
- (((uint64_t)(x) >> 40) & 0xff00ULL) | \
- ((uint64_t)(x) >> 56))
-#endif
-
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-#define htonll(x) bswap_64(x)
-#define ntohll(x) bswap_64(x)
-#elif __BYTE_ORDER == __BIG_ENDIAN
-#define htonll(x) x
-#define ntohll(x) x
-#else
-#error Unknown __BYTE_ORDER
-#endif
-
-enum TType {
- T_STOP = 0,
- T_VOID = 1,
- T_BOOL = 2,
- T_BYTE = 3,
- T_I08 = 3,
- T_I16 = 6,
- T_I32 = 8,
- T_U64 = 9,
- T_I64 = 10,
- T_DOUBLE = 4,
- T_STRING = 11,
- T_UTF7 = 11,
- T_STRUCT = 12,
- T_MAP = 13,
- T_SET = 14,
- T_LIST = 15,
- T_UTF8 = 16,
- T_UTF16 = 17
-};
-
-const int32_t VERSION_MASK = 0xffff0000;
-const int32_t VERSION_1 = 0x80010000;
-const int8_t T_CALL = 1;
-const int8_t T_REPLY = 2;
-const int8_t T_EXCEPTION = 3;
-// tprotocolexception
-const int INVALID_DATA = 1;
-const int BAD_VERSION = 4;
-
-static zend_function_entry thrift_protocol_functions[] = {
- PHP_FE(thrift_protocol_write_binary, nullptr)
- PHP_FE(thrift_protocol_read_binary, nullptr)
- PHP_FE(thrift_protocol_read_binary_after_message_begin, nullptr)
- {nullptr, nullptr, nullptr}
-};
-
-zend_module_entry thrift_protocol_module_entry = {
- STANDARD_MODULE_HEADER,
- "thrift_protocol",
- thrift_protocol_functions,
- nullptr,
- nullptr,
- nullptr,
- nullptr,
- nullptr,
- "1.0",
- STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_THRIFT_PROTOCOL
-ZEND_GET_MODULE(thrift_protocol)
-#endif
-
-class PHPExceptionWrapper : public std::exception {
-public:
- PHPExceptionWrapper(zval* _ex) throw() {
- ZVAL_COPY(&ex, _ex);
- snprintf(_what, 40, "PHP exception zval=%p", _ex);
- }
-
- PHPExceptionWrapper(zend_object* _exobj) throw() {
- ZVAL_OBJ(&ex, _exobj);
- snprintf(_what, 40, "PHP exception zval=%p", _exobj);
- }
- ~PHPExceptionWrapper() throw() {
- zval_dtor(&ex);
- }
-
- const char* what() const throw() {
- return _what;
- }
- operator zval*() const throw() {
- return const_cast<zval*>(&ex);
- } // Zend API doesn't do 'const'...
-protected:
- zval ex;
- char _what[40];
-} ;
-
-class PHPTransport {
-protected:
- PHPTransport(zval* _p, size_t _buffer_size) {
- assert(Z_TYPE_P(_p) == IS_OBJECT);
-
- ZVAL_UNDEF(&t);
-
- buffer = reinterpret_cast<char*>(emalloc(_buffer_size));
- buffer_ptr = buffer;
- buffer_used = 0;
- buffer_size = _buffer_size;
-
- // Get the transport for the passed protocol
- zval gettransport;
- ZVAL_STRING(&gettransport, "getTransport");
- call_user_function(nullptr, _p, &gettransport, &t, 0, nullptr);
-
- zval_dtor(&gettransport);
-
- assert(Z_TYPE(t) == IS_OBJECT);
- }
-
- ~PHPTransport() {
- efree(buffer);
- zval_dtor(&t);
- }
-
- char* buffer;
- char* buffer_ptr;
- size_t buffer_used;
- size_t buffer_size;
-
- zval t;
-};
-
-
-class PHPOutputTransport : public PHPTransport {
-public:
- PHPOutputTransport(zval* _p, size_t _buffer_size = 8192) : PHPTransport(_p, _buffer_size) { }
- ~PHPOutputTransport() { }
-
- void write(const char* data, size_t len) {
- if ((len + buffer_used) > buffer_size) {
- internalFlush();
- }
- if (len > buffer_size) {
- directWrite(data, len);
- } else {
- memcpy(buffer_ptr, data, len);
- buffer_used += len;
- buffer_ptr += len;
- }
- }
-
- void writeI64(int64_t i) {
- i = htonll(i);
- write((const char*)&i, 8);
- }
-
- void writeU32(uint32_t i) {
- i = htonl(i);
- write((const char*)&i, 4);
- }
-
- void writeI32(int32_t i) {
- i = htonl(i);
- write((const char*)&i, 4);
- }
-
- void writeI16(int16_t i) {
- i = htons(i);
- write((const char*)&i, 2);
- }
-
- void writeI8(int8_t i) {
- write((const char*)&i, 1);
- }
-
- void writeString(const char* str, size_t len) {
- writeU32(len);
- write(str, len);
- }
-
- void flush() {
- internalFlush();
- directFlush();
- }
-
-protected:
- void internalFlush() {
- if (buffer_used) {
- directWrite(buffer, buffer_used);
- buffer_ptr = buffer;
- buffer_used = 0;
- }
- }
- void directFlush() {
- zval ret, flushfn;
- ZVAL_NULL(&ret);
- ZVAL_STRING(&flushfn, "flush");
-
- call_user_function(EG(function_table), &(this->t), &flushfn, &ret, 0, nullptr);
- zval_dtor(&flushfn);
- zval_dtor(&ret);
- }
- void directWrite(const char* data, size_t len) {
- zval args[1], ret, writefn;
-
- ZVAL_STRING(&writefn, "write");
- ZVAL_STRINGL(&args[0], data, len);
-
- ZVAL_NULL(&ret);
- call_user_function(EG(function_table), &(this->t), &writefn, &ret, 1, args);
-
- zval_dtor(&writefn);
- zval_dtor(&ret);
- zval_dtor(&args[0]);
-
- if (EG(exception)) {
- zend_object *ex = EG(exception);
- EG(exception) = nullptr;
- throw PHPExceptionWrapper(ex);
- }
- }
-};
-
-class PHPInputTransport : public PHPTransport {
-public:
- PHPInputTransport(zval* _p, size_t _buffer_size = 8192) : PHPTransport(_p, _buffer_size) {
- }
-
- ~PHPInputTransport() {
- put_back();
- }
-
- void put_back() {
- if (buffer_used) {
- zval args[1], ret, putbackfn;
- ZVAL_STRINGL(&args[0], buffer_ptr, buffer_used);
- ZVAL_STRING(&putbackfn, "putBack");
- ZVAL_NULL(&ret);
-
- call_user_function(EG(function_table), &(this->t), &putbackfn, &ret, 1, args);
-
- zval_dtor(&putbackfn);
- zval_dtor(&ret);
- zval_dtor(&args[0]);
- }
- buffer_used = 0;
- buffer_ptr = buffer;
- }
-
- void skip(size_t len) {
- while (len) {
- size_t chunk_size = std::min(len, buffer_used);
- if (chunk_size) {
- buffer_ptr = reinterpret_cast<char*>(buffer_ptr) + chunk_size;
- buffer_used -= chunk_size;
- len -= chunk_size;
- }
- if (! len) break;
- refill();
- }
- }
-
- void readBytes(void* buf, size_t len) {
- while (len) {
- size_t chunk_size = std::min(len, buffer_used);
- if (chunk_size) {
- memcpy(buf, buffer_ptr, chunk_size);
- buffer_ptr = reinterpret_cast<char*>(buffer_ptr) + chunk_size;
- buffer_used -= chunk_size;
- buf = reinterpret_cast<char*>(buf) + chunk_size;
- len -= chunk_size;
- }
- if (! len) break;
- refill();
- }
- }
-
- int8_t readI8() {
- int8_t c;
- readBytes(&c, 1);
- return c;
- }
-
- int16_t readI16() {
- int16_t c;
- readBytes(&c, 2);
- return (int16_t)ntohs(c);
- }
-
- uint32_t readU32() {
- uint32_t c;
- readBytes(&c, 4);
- return (uint32_t)ntohl(c);
- }
-
- int32_t readI32() {
- int32_t c;
- readBytes(&c, 4);
- return (int32_t)ntohl(c);
- }
-
-protected:
- void refill() {
- assert(buffer_used == 0);
- zval retval;
- zval args[1];
- zval funcname;
-
- ZVAL_NULL(&retval);
- ZVAL_LONG(&args[0], buffer_size);
-
- ZVAL_STRING(&funcname, "read");
-
- call_user_function(EG(function_table), &(this->t), &funcname, &retval, 1, args);
- zval_dtor(&args[0]);
- zval_dtor(&funcname);
-
- if (EG(exception)) {
- zval_dtor(&retval);
-
- zend_object *ex = EG(exception);
- EG(exception) = nullptr;
- throw PHPExceptionWrapper(ex);
- }
-
- buffer_used = Z_STRLEN(retval);
- memcpy(buffer, Z_STRVAL(retval), buffer_used);
-
- zval_dtor(&retval);
-
- buffer_ptr = buffer;
- }
-
-};
-
-static
-void binary_deserialize_spec(zval* zthis, PHPInputTransport& transport, HashTable* spec);
-static
-void binary_serialize_spec(zval* zthis, PHPOutputTransport& transport, HashTable* spec);
-static
-void binary_serialize(int8_t thrift_typeID, PHPOutputTransport& transport, zval* value, HashTable* fieldspec);
-
-// Create a PHP object given a typename and call the ctor, optionally passing up to 2 arguments
-static
-void createObject(const char* obj_typename, zval* return_value, int nargs = 0, zval* arg1 = nullptr, zval* arg2 = nullptr) {
- /* is there a better way to do that on the stack ? */
- zend_string *obj_name = zend_string_init(obj_typename, strlen(obj_typename), 0);
- zend_class_entry* ce = zend_fetch_class(obj_name, ZEND_FETCH_CLASS_DEFAULT);
- zend_string_release(obj_name);
-
- if (! ce) {
- php_error_docref(nullptr, E_ERROR, "Class %s does not exist", obj_typename);
- RETURN_NULL();
- }
-
- object_and_properties_init(return_value, ce, nullptr);
- zend_function* constructor = zend_std_get_constructor(Z_OBJ_P(return_value));
- zval ctor_rv;
- zend_call_method(return_value, ce, &constructor, NULL, 0, &ctor_rv, nargs, arg1, arg2);
- zval_dtor(&ctor_rv);
-}
-
-static
-void throw_tprotocolexception(const char* what, long errorcode) {
- zval zwhat, zerrorcode;
-
- ZVAL_STRING(&zwhat, what);
- ZVAL_LONG(&zerrorcode, errorcode);
-
- zval ex;
- createObject("\\Thrift\\Exception\\TProtocolException", &ex, 2, &zwhat, &zerrorcode);
-
- zval_dtor(&zwhat);
- zval_dtor(&zerrorcode);
-
- throw PHPExceptionWrapper(&ex);
-}
-
-// Sets EG(exception), call this and then RETURN_NULL();
-static
-void throw_zend_exception_from_std_exception(const std::exception& ex) {
- zend_throw_exception(zend_exception_get_default(), const_cast<char*>(ex.what()), 0);
-}
-
-static
-void skip_element(long thrift_typeID, PHPInputTransport& transport) {
- switch (thrift_typeID) {
- case T_STOP:
- case T_VOID:
- return;
- case T_STRUCT:
- while (true) {
- int8_t ttype = transport.readI8(); // get field type
- if (ttype == T_STOP) break;
- transport.skip(2); // skip field number, I16
- skip_element(ttype, transport); // skip field payload
- }
- return;
- case T_BOOL:
- case T_BYTE:
- transport.skip(1);
- return;
- case T_I16:
- transport.skip(2);
- return;
- case T_I32:
- transport.skip(4);
- return;
- case T_U64:
- case T_I64:
- case T_DOUBLE:
- transport.skip(8);
- return;
- //case T_UTF7: // aliases T_STRING
- case T_UTF8:
- case T_UTF16:
- case T_STRING: {
- uint32_t len = transport.readU32();
- transport.skip(len);
- } return;
- case T_MAP: {
- int8_t keytype = transport.readI8();
- int8_t valtype = transport.readI8();
- uint32_t size = transport.readU32();
- for (uint32_t i = 0; i < size; ++i) {
- skip_element(keytype, transport);
- skip_element(valtype, transport);
- }
- } return;
- case T_LIST:
- case T_SET: {
- int8_t valtype = transport.readI8();
- uint32_t size = transport.readU32();
- for (uint32_t i = 0; i < size; ++i) {
- skip_element(valtype, transport);
- }
- } return;
- };
-
- char errbuf[128];
- sprintf(errbuf, "Unknown thrift typeID %ld", thrift_typeID);
- throw_tprotocolexception(errbuf, INVALID_DATA);
-}
-
-static inline
-bool zval_is_bool(zval* v) {
- return Z_TYPE_P(v) == IS_TRUE || Z_TYPE_P(v) == IS_FALSE;
-}
-
-static
-void binary_deserialize(int8_t thrift_typeID, PHPInputTransport& transport, zval* return_value, HashTable* fieldspec) {
- ZVAL_NULL(return_value);
-
- switch (thrift_typeID) {
- case T_STOP:
- case T_VOID:
- RETURN_NULL();
- return;
- case T_STRUCT: {
- zval* val_ptr = zend_hash_str_find(fieldspec, "class", sizeof("class")-1);
- if (val_ptr == nullptr) {
- throw_tprotocolexception("no class type in spec", INVALID_DATA);
- skip_element(T_STRUCT, transport);
- RETURN_NULL();
- }
-
- char* structType = Z_STRVAL_P(val_ptr);
- // Create an object in PHP userland based on our spec
- createObject(structType, return_value);
- if (Z_TYPE_P(return_value) == IS_NULL) {
- // unable to create class entry
- skip_element(T_STRUCT, transport);
- RETURN_NULL();
- }
-
- zval* spec = zend_read_static_property(Z_OBJCE_P(return_value), "_TSPEC", sizeof("_TSPEC")-1, false);
- if (Z_TYPE_P(spec) != IS_ARRAY) {
- char errbuf[128];
- snprintf(errbuf, 128, "spec for %s is wrong type: %d\n", structType, Z_TYPE_P(spec));
- throw_tprotocolexception(errbuf, INVALID_DATA);
- RETURN_NULL();
- }
- binary_deserialize_spec(return_value, transport, Z_ARRVAL_P(spec));
- return;
- } break;
- case T_BOOL: {
- uint8_t c;
- transport.readBytes(&c, 1);
- RETURN_BOOL(c != 0);
- }
- //case T_I08: // same numeric value as T_BYTE
- case T_BYTE: {
- uint8_t c;
- transport.readBytes(&c, 1);
- RETURN_LONG((int8_t)c);
- }
- case T_I16: {
- uint16_t c;
- transport.readBytes(&c, 2);
- RETURN_LONG((int16_t)ntohs(c));
- }
- case T_I32: {
- uint32_t c;
- transport.readBytes(&c, 4);
- RETURN_LONG((int32_t)ntohl(c));
- }
- case T_U64:
- case T_I64: {
- uint64_t c;
- transport.readBytes(&c, 8);
- RETURN_LONG((int64_t)ntohll(c));
- }
- case T_DOUBLE: {
- union {
- uint64_t c;
- double d;
- } a;
- transport.readBytes(&(a.c), 8);
- a.c = ntohll(a.c);
- RETURN_DOUBLE(a.d);
- }
- //case T_UTF7: // aliases T_STRING
- case T_UTF8:
- case T_UTF16:
- case T_STRING: {
- uint32_t size = transport.readU32();
- if (size) {
- char strbuf[size+1];
- transport.readBytes(strbuf, size);
- strbuf[size] = '\0';
- ZVAL_STRINGL(return_value, strbuf, size);
- } else {
- ZVAL_EMPTY_STRING(return_value);
- }
- return;
- }
- case T_MAP: { // array of key -> value
- uint8_t types[2];
- transport.readBytes(types, 2);
- uint32_t size = transport.readU32();
- array_init(return_value);
-
- zval *val_ptr;
- val_ptr = zend_hash_str_find(fieldspec, "key", sizeof("key")-1);
- HashTable* keyspec = Z_ARRVAL_P(val_ptr);
- val_ptr = zend_hash_str_find(fieldspec, "val", sizeof("val")-1);
- HashTable* valspec = Z_ARRVAL_P(val_ptr);
-
- for (uint32_t s = 0; s < size; ++s) {
- zval key, value;
-
- binary_deserialize(types[0], transport, &key, keyspec);
- binary_deserialize(types[1], transport, &value, valspec);
- if (Z_TYPE(key) == IS_LONG) {
- zend_hash_index_update(Z_ARR_P(return_value), Z_LVAL(key), &value);
- } else {
- if (Z_TYPE(key) != IS_STRING) convert_to_string(&key);
- zend_symtable_update(Z_ARR_P(return_value), Z_STR(key), &value);
- }
- zval_dtor(&key);
- }
- return; // return_value already populated
- }
- case T_LIST: { // array with autogenerated numeric keys
- int8_t type = transport.readI8();
- uint32_t size = transport.readU32();
- zval *val_ptr = zend_hash_str_find(fieldspec, "elem", sizeof("elem")-1);
- HashTable* elemspec = Z_ARRVAL_P(val_ptr);
-
- array_init(return_value);
- for (uint32_t s = 0; s < size; ++s) {
- zval value;
- binary_deserialize(type, transport, &value, elemspec);
- zend_hash_next_index_insert(Z_ARR_P(return_value), &value);
- }
- return;
- }
- case T_SET: { // array of key -> TRUE
- uint8_t type;
- uint32_t size;
- transport.readBytes(&type, 1);
- transport.readBytes(&size, 4);
- size = ntohl(size);
- zval *val_ptr = zend_hash_str_find(fieldspec, "elem", sizeof("elem")-1);
- HashTable* elemspec = Z_ARRVAL_P(val_ptr);
-
- array_init(return_value);
-
- for (uint32_t s = 0; s < size; ++s) {
- zval key, value;
- ZVAL_TRUE(&value);
-
- binary_deserialize(type, transport, &key, elemspec);
-
- if (Z_TYPE(key) == IS_LONG) {
- zend_hash_index_update(Z_ARR_P(return_value), Z_LVAL(key), &value);
- } else {
- if (Z_TYPE(key) != IS_STRING) convert_to_string(&key);
- zend_symtable_update(Z_ARR_P(return_value), Z_STR(key), &value);
- }
- zval_dtor(&key);
- }
- return;
- }
- };
-
- char errbuf[128];
- sprintf(errbuf, "Unknown thrift typeID %d", thrift_typeID);
- throw_tprotocolexception(errbuf, INVALID_DATA);
-}
-
-static
-void binary_serialize_hashtable_key(int8_t keytype, PHPOutputTransport& transport, HashTable* ht, HashPosition& ht_pos) {
- bool keytype_is_numeric = (!((keytype == T_STRING) || (keytype == T_UTF8) || (keytype == T_UTF16)));
-
- zend_string* key;
- uint key_len;
- long index = 0;
-
- zval z;
-
- int res = zend_hash_get_current_key_ex(ht, &key, (zend_ulong*)&index, &ht_pos);
- if (keytype_is_numeric) {
- if (res == HASH_KEY_IS_STRING) {
- index = strtol(ZSTR_VAL(key), nullptr, 10);
- }
- ZVAL_LONG(&z, index);
- } else {
- char buf[64];
- if (res == HASH_KEY_IS_STRING) {
- ZVAL_STR_COPY(&z, key);
- } else {
- snprintf(buf, 64, "%ld", index);
- ZVAL_STRING(&z, buf);
- }
- }
- binary_serialize(keytype, transport, &z, nullptr);
- zval_dtor(&z);
-}
-
-static
-void binary_serialize(int8_t thrift_typeID, PHPOutputTransport& transport, zval* value, HashTable* fieldspec) {
- // At this point the typeID (and field num, if applicable) should've already been written to the output so all we need to do is write the payload.
- switch (thrift_typeID) {
- case T_STOP:
- case T_VOID:
- return;
- case T_STRUCT: {
- if (Z_TYPE_P(value) != IS_OBJECT) {
- throw_tprotocolexception("Attempt to send non-object type as a T_STRUCT", INVALID_DATA);
- }
- zval* spec = zend_read_static_property(Z_OBJCE_P(value), "_TSPEC", sizeof("_TSPEC")-1, false);
- if (Z_TYPE_P(spec) != IS_ARRAY) {
- throw_tprotocolexception("Attempt to send non-Thrift object as a T_STRUCT", INVALID_DATA);
- }
- binary_serialize_spec(value, transport, Z_ARRVAL_P(spec));
- } return;
- case T_BOOL:
- if (!zval_is_bool(value)) convert_to_boolean(value);
- transport.writeI8(Z_TYPE_INFO_P(value) == IS_TRUE ? 1 : 0);
- return;
- case T_BYTE:
- if (Z_TYPE_P(value) != IS_LONG) convert_to_long(value);
- transport.writeI8(Z_LVAL_P(value));
- return;
- case T_I16:
- if (Z_TYPE_P(value) != IS_LONG) convert_to_long(value);
- transport.writeI16(Z_LVAL_P(value));
- return;
- case T_I32:
- if (Z_TYPE_P(value) != IS_LONG) convert_to_long(value);
- transport.writeI32(Z_LVAL_P(value));
- return;
- case T_I64:
- case T_U64: {
- int64_t l_data;
-#if defined(_LP64) || defined(_WIN64)
- if (Z_TYPE_P(value) != IS_LONG) convert_to_long(value);
- l_data = Z_LVAL_P(value);
-#else
- if (Z_TYPE_P(value) != IS_DOUBLE) convert_to_double(value);
- l_data = (int64_t)Z_DVAL_P(value);
-#endif
- transport.writeI64(l_data);
- } return;
- case T_DOUBLE: {
- union {
- int64_t c;
- double d;
- } a;
- if (Z_TYPE_P(value) != IS_DOUBLE) convert_to_double(value);
- a.d = Z_DVAL_P(value);
- transport.writeI64(a.c);
- } return;
- case T_UTF8:
- case T_UTF16:
- case T_STRING:
- if (Z_TYPE_P(value) != IS_STRING) convert_to_string(value);
- transport.writeString(Z_STRVAL_P(value), Z_STRLEN_P(value));
- return;
- case T_MAP: {
- if (Z_TYPE_P(value) != IS_ARRAY) convert_to_array(value);
- if (Z_TYPE_P(value) != IS_ARRAY) {
- throw_tprotocolexception("Attempt to send an incompatible type as an array (T_MAP)", INVALID_DATA);
- }
- HashTable* ht = Z_ARRVAL_P(value);
- zval* val_ptr;
-
- val_ptr = zend_hash_str_find(fieldspec, "ktype", sizeof("ktype")-1);
- if (Z_TYPE_P(val_ptr) != IS_LONG) convert_to_long(val_ptr);
- uint8_t keytype = Z_LVAL_P(val_ptr);
- transport.writeI8(keytype);
- val_ptr = zend_hash_str_find(fieldspec, "vtype", sizeof("vtype")-1);
- if (Z_TYPE_P(val_ptr) != IS_LONG) convert_to_long(val_ptr);
- uint8_t valtype = Z_LVAL_P(val_ptr);
- transport.writeI8(valtype);
-
- val_ptr = zend_hash_str_find(fieldspec, "val", sizeof("val")-1);
- HashTable* valspec = Z_ARRVAL_P(val_ptr);
-
- transport.writeI32(zend_hash_num_elements(ht));
- HashPosition key_ptr;
- for (zend_hash_internal_pointer_reset_ex(ht, &key_ptr);
- (val_ptr = zend_hash_get_current_data_ex(ht, &key_ptr)) != nullptr;
- zend_hash_move_forward_ex(ht, &key_ptr)) {
- binary_serialize_hashtable_key(keytype, transport, ht, key_ptr);
- binary_serialize(valtype, transport, val_ptr, valspec);
- }
- } return;
- case T_LIST: {
- if (Z_TYPE_P(value) != IS_ARRAY) convert_to_array(value);
- if (Z_TYPE_P(value) != IS_ARRAY) {
- throw_tprotocolexception("Attempt to send an incompatible type as an array (T_LIST)", INVALID_DATA);
- }
- HashTable* ht = Z_ARRVAL_P(value);
- zval* val_ptr;
-
- val_ptr = zend_hash_str_find(fieldspec, "etype", sizeof("etype")-1);
- if (Z_TYPE_P(val_ptr) != IS_LONG) convert_to_long(val_ptr);
- uint8_t valtype = Z_LVAL_P(val_ptr);
- transport.writeI8(valtype);
-
- val_ptr = zend_hash_str_find(fieldspec, "elem", sizeof("elem")-1);
- HashTable* valspec = Z_ARRVAL_P(val_ptr);
-
- transport.writeI32(zend_hash_num_elements(ht));
- HashPosition key_ptr;
- for (zend_hash_internal_pointer_reset_ex(ht, &key_ptr);
- (val_ptr = zend_hash_get_current_data_ex(ht, &key_ptr)) != nullptr;
- zend_hash_move_forward_ex(ht, &key_ptr)) {
- binary_serialize(valtype, transport, val_ptr, valspec);
- }
- } return;
- case T_SET: {
- if (Z_TYPE_P(value) != IS_ARRAY) convert_to_array(value);
- if (Z_TYPE_P(value) != IS_ARRAY) {
- throw_tprotocolexception("Attempt to send an incompatible type as an array (T_SET)", INVALID_DATA);
- }
- HashTable* ht = Z_ARRVAL_P(value);
- zval* val_ptr;
-
- val_ptr = zend_hash_str_find(fieldspec, "etype", sizeof("etype")-1);
- if (Z_TYPE_P(val_ptr) != IS_LONG) convert_to_long(val_ptr);
- uint8_t keytype = Z_LVAL_P(val_ptr);
- transport.writeI8(keytype);
-
- transport.writeI32(zend_hash_num_elements(ht));
- HashPosition key_ptr;
- for (zend_hash_internal_pointer_reset_ex(ht, &key_ptr);
- (val_ptr = zend_hash_get_current_data_ex(ht, &key_ptr)) != nullptr;
- zend_hash_move_forward_ex(ht, &key_ptr)) {
- binary_serialize_hashtable_key(keytype, transport, ht, key_ptr);
- }
- } return;
- };
-
- char errbuf[128];
- snprintf(errbuf, 128, "Unknown thrift typeID %d", thrift_typeID);
- throw_tprotocolexception(errbuf, INVALID_DATA);
-}
-
-static
-void protocol_writeMessageBegin(zval* transport, zend_string* method_name, int32_t msgtype, int32_t seqID) {
- zval args[3];
- zval ret;
- zval writeMessagefn;
-
- ZVAL_STR_COPY(&args[0], method_name);
- ZVAL_LONG(&args[1], msgtype);
- ZVAL_LONG(&args[2], seqID);
- ZVAL_NULL(&ret);
- ZVAL_STRING(&writeMessagefn, "writeMessageBegin");
-
- call_user_function(EG(function_table), transport, &writeMessagefn, &ret, 3, args);
-
- zval_dtor(&writeMessagefn);
- zval_dtor(&args[2]); zval_dtor(&args[1]); zval_dtor(&args[0]);
- zval_dtor(&ret);
-}
-
-static inline
-bool ttype_is_int(int8_t t) {
- return ((t == T_BYTE) || ((t >= T_I16) && (t <= T_I64)));
-}
-
-static inline
-bool ttypes_are_compatible(int8_t t1, int8_t t2) {
- // Integer types of different widths are considered compatible;
- // otherwise the typeID must match.
- return ((t1 == t2) || (ttype_is_int(t1) && ttype_is_int(t2)));
-}
-
-//is used to validate objects before serialization and after deserialization. For now, only required fields are validated.
-static
-void validate_thrift_object(zval* object) {
- zend_class_entry* object_class_entry = Z_OBJCE_P(object);
- zval* is_validate = zend_read_static_property(object_class_entry, "isValidate", sizeof("isValidate")-1, false);
- zval* spec = zend_read_static_property(object_class_entry, "_TSPEC", sizeof("_TSPEC")-1, false);
- HashPosition key_ptr;
- zval* val_ptr;
-
- if (Z_TYPE_INFO_P(is_validate) == IS_TRUE) {
- for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(spec), &key_ptr);
- (val_ptr = zend_hash_get_current_data_ex(Z_ARRVAL_P(spec), &key_ptr)) != nullptr;
- zend_hash_move_forward_ex(Z_ARRVAL_P(spec), &key_ptr)) {
-
- zend_ulong fieldno;
- if (zend_hash_get_current_key_ex(Z_ARRVAL_P(spec), nullptr, &fieldno, &key_ptr) != HASH_KEY_IS_LONG) {
- throw_tprotocolexception("Bad keytype in TSPEC (expected 'long')", INVALID_DATA);
- return;
- }
- HashTable* fieldspec = Z_ARRVAL_P(val_ptr);
-
- // field name
- zval* zvarname = zend_hash_str_find(fieldspec, "var", sizeof("var")-1);
- char* varname = Z_STRVAL_P(zvarname);
-
- zval* is_required = zend_hash_str_find(fieldspec, "isRequired", sizeof("isRequired")-1);
- zval rv;
- zval* prop = zend_read_property(object_class_entry, object, varname, strlen(varname), false, &rv);
-
- if (Z_TYPE_INFO_P(is_required) == IS_TRUE && Z_TYPE_P(prop) == IS_NULL) {
- char errbuf[128];
- snprintf(errbuf, 128, "Required field %s.%s is unset!", ZSTR_VAL(object_class_entry->name), varname);
- throw_tprotocolexception(errbuf, INVALID_DATA);
- }
- }
- }
-}
-
-static
-void binary_deserialize_spec(zval* zthis, PHPInputTransport& transport, HashTable* spec) {
- // SET and LIST have 'elem' => array('type', [optional] 'class')
- // MAP has 'val' => array('type', [optiona] 'class')
- zend_class_entry* ce = Z_OBJCE_P(zthis);
- while (true) {
- int8_t ttype = transport.readI8();
- if (ttype == T_STOP) {
- validate_thrift_object(zthis);
- return;
- }
-
- int16_t fieldno = transport.readI16();
- zval* val_ptr = zend_hash_index_find(spec, fieldno);
- if (val_ptr != nullptr) {
- HashTable* fieldspec = Z_ARRVAL_P(val_ptr);
- // pull the field name
- val_ptr = zend_hash_str_find(fieldspec, "var", sizeof("var")-1);
- char* varname = Z_STRVAL_P(val_ptr);
-
- // and the type
- val_ptr = zend_hash_str_find(fieldspec, "type", sizeof("type")-1);
- if (Z_TYPE_P(val_ptr) != IS_LONG) convert_to_long(val_ptr);
- int8_t expected_ttype = Z_LVAL_P(val_ptr);
-
- if (ttypes_are_compatible(ttype, expected_ttype)) {
- zval rv;
- ZVAL_UNDEF(&rv);
-
- binary_deserialize(ttype, transport, &rv, fieldspec);
- zend_update_property(ce, zthis, varname, strlen(varname), &rv);
-
- zval_ptr_dtor(&rv);
- } else {
- skip_element(ttype, transport);
- }
- } else {
- skip_element(ttype, transport);
- }
- }
-}
-
-static
-void binary_serialize_spec(zval* zthis, PHPOutputTransport& transport, HashTable* spec) {
-
- validate_thrift_object(zthis);
-
- HashPosition key_ptr;
- zval* val_ptr;
-
- for (zend_hash_internal_pointer_reset_ex(spec, &key_ptr);
- (val_ptr = zend_hash_get_current_data_ex(spec, &key_ptr)) != nullptr;
- zend_hash_move_forward_ex(spec, &key_ptr)) {
-
- zend_ulong fieldno;
- if (zend_hash_get_current_key_ex(spec, nullptr, &fieldno, &key_ptr) != HASH_KEY_IS_LONG) {
- throw_tprotocolexception("Bad keytype in TSPEC (expected 'long')", INVALID_DATA);
- return;
- }
- HashTable* fieldspec = Z_ARRVAL_P(val_ptr);
-
- // field name
- val_ptr = zend_hash_str_find(fieldspec, "var", sizeof("var")-1);
- char* varname = Z_STRVAL_P(val_ptr);
-
- // thrift type
- val_ptr = zend_hash_str_find(fieldspec, "type", sizeof("type")-1);
- if (Z_TYPE_P(val_ptr) != IS_LONG) convert_to_long(val_ptr);
- int8_t ttype = Z_LVAL_P(val_ptr);
-
- zval rv;
- zval* prop = zend_read_property(Z_OBJCE_P(zthis), zthis, varname, strlen(varname), false, &rv);
-
- if (Z_TYPE_P(prop) == IS_REFERENCE){
- ZVAL_UNREF(prop);
- }
- if (Z_TYPE_P(prop) != IS_NULL) {
- transport.writeI8(ttype);
- transport.writeI16(fieldno);
- binary_serialize(ttype, transport, prop, fieldspec);
- }
- }
- transport.writeI8(T_STOP); // struct end
-}
-
-// 6 params: $transport $method_name $ttype $request_struct $seqID $strict_write
-PHP_FUNCTION(thrift_protocol_write_binary) {
- zval *protocol;
- zval *request_struct;
- zend_string *method_name;
- long msgtype, seqID;
- zend_bool strict_write;
-
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "oSlolb",
- &protocol, &method_name, &msgtype,
- &request_struct, &seqID, &strict_write) == FAILURE) {
- return;
- }
-
- try {
- zval* spec = zend_read_static_property(Z_OBJCE_P(request_struct), "_TSPEC", sizeof("_TSPEC")-1, false);
-
- if (Z_TYPE_P(spec) != IS_ARRAY) {
- throw_tprotocolexception("Attempt to send non-Thrift object", INVALID_DATA);
- }
-
- PHPOutputTransport transport(protocol);
- protocol_writeMessageBegin(protocol, method_name, (int32_t) msgtype, (int32_t) seqID);
- binary_serialize_spec(request_struct, transport, Z_ARRVAL_P(spec));
- transport.flush();
-
- } catch (const PHPExceptionWrapper& ex) {
- // ex will be destructed, so copy to a zval that zend_throw_exception_object can take ownership of
- zval myex;
- ZVAL_COPY(&myex, ex);
- zend_throw_exception_object(&myex);
- RETURN_NULL();
- } catch (const std::exception& ex) {
- throw_zend_exception_from_std_exception(ex);
- RETURN_NULL();
- }
-}
-
-
-// 4 params: $transport $response_Typename $strict_read $buffer_size
-PHP_FUNCTION(thrift_protocol_read_binary) {
- zval *protocol;
- zend_string *obj_typename;
- zend_bool strict_read;
- size_t buffer_size = 8192;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "oSb|l", &protocol, &obj_typename, &strict_read, &buffer_size) == FAILURE) {
- return;
- }
-
- try {
- PHPInputTransport transport(protocol, buffer_size);
- int8_t messageType = 0;
- int32_t sz = transport.readI32();
-
- if (sz < 0) {
- // Check for correct version number
- int32_t version = sz & VERSION_MASK;
- if (version != VERSION_1) {
- throw_tprotocolexception("Bad version identifier", BAD_VERSION);
- }
- messageType = (sz & 0x000000ff);
- int32_t namelen = transport.readI32();
- // skip the name string and the sequence ID, we don't care about those
- transport.skip(namelen + 4);
- } else {
- if (strict_read) {
- throw_tprotocolexception("No version identifier... old protocol client in strict mode?", BAD_VERSION);
- } else {
- // Handle pre-versioned input
- transport.skip(sz); // skip string body
- messageType = transport.readI8();
- transport.skip(4); // skip sequence number
- }
- }
-
- if (messageType == T_EXCEPTION) {
- zval ex;
- createObject("\\Thrift\\Exception\\TApplicationException", &ex);
- zval* spec = zend_read_static_property(Z_OBJCE(ex), "_TSPEC", sizeof("_TPSEC")-1, false);
- binary_deserialize_spec(&ex, transport, Z_ARRVAL_P(spec));
- throw PHPExceptionWrapper(&ex);
- }
-
- createObject(ZSTR_VAL(obj_typename), return_value);
- zval* spec = zend_read_static_property(Z_OBJCE_P(return_value), "_TSPEC", sizeof("_TSPEC")-1, false);
- binary_deserialize_spec(return_value, transport, Z_ARRVAL_P(spec));
- } catch (const PHPExceptionWrapper& ex) {
- // ex will be destructed, so copy to a zval that zend_throw_exception_object can ownership of
- zval myex;
- ZVAL_COPY(&myex, ex);
- zval_dtor(return_value);
- zend_throw_exception_object(&myex);
- RETURN_NULL();
- } catch (const std::exception& ex) {
- throw_zend_exception_from_std_exception(ex);
- RETURN_NULL();
- }
-}
-
-// 4 params: $transport $response_Typename $strict_read $buffer_size
-PHP_FUNCTION(thrift_protocol_read_binary_after_message_begin) {
- zval *protocol;
- zend_string *obj_typename;
- zend_bool strict_read;
- size_t buffer_size = 8192;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "oSb|l", &protocol, &obj_typename, &strict_read, &buffer_size) == FAILURE) {
- return;
- }
-
- try {
- PHPInputTransport transport(protocol, buffer_size);
-
- createObject(ZSTR_VAL(obj_typename), return_value);
- zval* spec = zend_read_static_property(Z_OBJCE_P(return_value), "_TSPEC", sizeof("_TSPEC")-1, false);
- binary_deserialize_spec(return_value, transport, Z_ARRVAL_P(spec));
- } catch (const PHPExceptionWrapper& ex) {
- zend_throw_exception_object(ex);
- RETURN_NULL();
- } catch (const std::exception& ex) {
- throw_zend_exception_from_std_exception(ex);
- RETURN_NULL();
- }
-}
-
-#endif /* PHP_VERSION_ID >= 70000 */
[39/50] [abbrv] thrift git commit: THRIFT-2013: add perl crosstest
multiplexed client and server logic Client: perl
Posted by je...@apache.org.
THRIFT-2013: add perl crosstest multiplexed client and server logic
Client: perl
This closes #1416
Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/20e16bc6
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/20e16bc6
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/20e16bc6
Branch: refs/heads/0.11.0
Commit: 20e16bc6a41c6faead040aed7f3c00b9d2e7f842
Parents: cde4d41
Author: James E. King, III <jk...@apache.org>
Authored: Sat Nov 18 22:37:54 2017 -0500
Committer: James E. King, III <jk...@apache.org>
Committed: Tue Nov 21 14:20:26 2017 -0500
----------------------------------------------------------------------
lib/perl/lib/Thrift/MultiplexedProcessor.pm | 26 +++++++++++----
test/known_failures_Linux.json | 4 ++-
test/perl/TestClient.pl | 38 ++++++++++++++++++++--
test/perl/TestServer.pl | 40 +++++++++++++++++++++---
test/rs/src/bin/test_client.rs | 4 +++
test/rs/src/bin/test_server.rs | 2 +-
test/tests.json | 9 +++++-
7 files changed, 107 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/thrift/blob/20e16bc6/lib/perl/lib/Thrift/MultiplexedProcessor.pm
----------------------------------------------------------------------
diff --git a/lib/perl/lib/Thrift/MultiplexedProcessor.pm b/lib/perl/lib/Thrift/MultiplexedProcessor.pm
index 6629c0b..05c4ead 100644
--- a/lib/perl/lib/Thrift/MultiplexedProcessor.pm
+++ b/lib/perl/lib/Thrift/MultiplexedProcessor.pm
@@ -66,10 +66,18 @@ sub new {
my $self = {};
$self->{serviceProcessorMap} = {};
+ $self->{defaultProcessor} = undef;
return bless($self,$classname);
}
+sub defaultProcessor {
+ my $self = shift;
+ my $processor = shift;
+
+ $self->{defaultProcessor} = $processor;
+}
+
sub registerProcessor {
my $self = shift;
my $serviceName = shift;
@@ -98,8 +106,14 @@ sub process {
# Extract the service name and the new Message name.
if (index($fname, Thrift::MultiplexedProtocol::SEPARATOR) == -1) {
- die new Thrift::TException("Service name not found in message name: {$fname}. Did you " .
- "forget to use a MultiplexProtocol in your client?");
+ if (defined $self->{defaultProcessor}) {
+ return $self->{defaultProcessor}->process(
+ new Thrift::StoredMessageProtocol($input, $fname, $mtype, $rseqid), $output
+ );
+ } else {
+ die new Thrift::TException("Service name not found in message name: {$fname} and no default processor defined. Did you " .
+ "forget to use a MultiplexProtocol in your client?");
+ }
}
(my $serviceName, my $messageName) = split(':', $fname, 2);
@@ -109,11 +123,11 @@ sub process {
"to call registerProcessor()?");
}
- # Dispatch processing to the stored processor
- my $processor = $self->{serviceProcessorMap}->{$serviceName};
- return $processor->process(
+ # Dispatch processing to the stored processor
+ my $processor = $self->{serviceProcessorMap}->{$serviceName};
+ return $processor->process(
new Thrift::StoredMessageProtocol($input, $messageName, $mtype, $rseqid), $output
- );
+ );
}
1;
http://git-wip-us.apache.org/repos/asf/thrift/blob/20e16bc6/test/known_failures_Linux.json
----------------------------------------------------------------------
diff --git a/test/known_failures_Linux.json b/test/known_failures_Linux.json
index ae9b370..c961988 100644
--- a/test/known_failures_Linux.json
+++ b/test/known_failures_Linux.json
@@ -299,6 +299,8 @@
"nodejs-netcore_json_buffered-ip-ssl",
"nodejs-netcore_json_framed-ip",
"nodejs-netcore_json_framed-ip-ssl",
+ "perl-rs_multi_buffered-ip",
+ "perl-rs_multi_framed-ip",
"rb-cpp_json_buffered-ip",
"rb-cpp_json_framed-ip",
"rs-cpp_binary_buffered-ip",
@@ -329,4 +331,4 @@
"rs-dart_compact_framed-ip",
"rs-dart_multi-binary_framed-ip",
"rs-dart_multic-compact_framed-ip"
-]
+]
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/thrift/blob/20e16bc6/test/perl/TestClient.pl
----------------------------------------------------------------------
diff --git a/test/perl/TestClient.pl b/test/perl/TestClient.pl
index 6f3cbc9..990274c 100755
--- a/test/perl/TestClient.pl
+++ b/test/perl/TestClient.pl
@@ -33,10 +33,12 @@ use Thrift;
use Thrift::BinaryProtocol;
use Thrift::BufferedTransport;
use Thrift::FramedTransport;
+use Thrift::MultiplexedProtocol;
use Thrift::SSLSocket;
use Thrift::Socket;
use Thrift::UnixSocket;
+use ThriftTest::SecondService;
use ThriftTest::ThriftTest;
use ThriftTest::Types;
@@ -108,13 +110,21 @@ if ($opts{transport} eq 'buffered') {
}
my $protocol;
-if ($opts{protocol} eq 'binary') {
+my $protocol2;
+if ($opts{protocol} eq 'binary' || $opts{protocol} eq 'multi') {
$protocol = new Thrift::BinaryProtocol($transport);
} else {
usage();
exit 1;
}
+my $secondService = undef;
+if (index($opts{protocol}, 'multi') == 0) {
+ $protocol2 = new Thrift::MultiplexedProtocol($protocol, "SecondService");
+ $protocol = new Thrift::MultiplexedProtocol($protocol, "ThriftTest");
+ $secondService = new ThriftTest::SecondServiceClient($protocol2);
+}
+
my $testClient = new ThriftTest::ThriftTestClient($protocol);
eval {
@@ -123,6 +133,14 @@ eval {
if($@){
die(Dumper($@));
}
+
+use constant ERR_BASETYPES => 1;
+use constant ERR_STRUCTS => 2;
+use constant ERR_CONTAINERS => 4;
+use constant ERR_EXCEPTIONS => 8;
+use constant ERR_PROTOCOL => 16;
+use constant ERR_UNKNOWN => 64;
+
my $start = gettimeofday();
#
@@ -138,6 +156,17 @@ print(" = void\n");
print("testString(\"Test\")");
my $s = $testClient->testString("Test");
print(" = \"$s\"\n");
+exit(ERR_BASETYPES) if ($s ne 'Test');
+
+#
+# MULTIPLEXED TEST
+#
+if (index($opts{protocol}, 'multi') == 0) {
+ print("secondtestString(\"Test2\")");
+ $s = $secondService->secondtestString("Test2");
+ print(" = \"$s\"\n");
+ exit(ERR_PROTOCOL) if ($s ne 'testString("Test2")');
+}
#
# BOOL TEST
@@ -145,9 +174,11 @@ print(" = \"$s\"\n");
print("testBool(1)");
my $t = $testClient->testBool(1);
print(" = $t\n");
+exit(ERR_BASETYPES) if ($t ne 1);
print("testBool(0)");
my $f = $testClient->testBool(0);
print(" = $f\n");
+exit(ERR_BASETYPES) if ($f ne "");
#
@@ -163,13 +194,15 @@ print(" = $u8\n");
print("testI32(-1)");
my $i32 = $testClient->testI32(-1);
print(" = $i32\n");
+exit(ERR_BASETYPES) if ($i32 ne -1);
#
-#I64 TEST
+# I64 TEST
#
print("testI64(-34359738368)");
my $i64 = $testClient->testI64(-34359738368);
print(" = $i64\n");
+exit(ERR_BASETYPES) if ($i64 ne -34359738368);
#
# DOUBLE TEST
@@ -177,6 +210,7 @@ print(" = $i64\n");
print("testDouble(-852.234234234)");
my $dub = $testClient->testDouble(-852.234234234);
print(" = $dub\n");
+exit(ERR_BASETYPES) if ($dub ne -852.234234234);
#
# BINARY TEST --- TODO
http://git-wip-us.apache.org/repos/asf/thrift/blob/20e16bc6/test/perl/TestServer.pl
----------------------------------------------------------------------
diff --git a/test/perl/TestServer.pl b/test/perl/TestServer.pl
index 1e23ce8..7d8f929 100644
--- a/test/perl/TestServer.pl
+++ b/test/perl/TestServer.pl
@@ -33,11 +33,13 @@ use Thrift;
use Thrift::BinaryProtocol;
use Thrift::BufferedTransport;
use Thrift::FramedTransport;
+use Thrift::MultiplexedProcessor;
use Thrift::SSLServerSocket;
use Thrift::ServerSocket;
use Thrift::Server;
use Thrift::UnixServerSocket;
+use ThriftTest::SecondService;
use ThriftTest::ThriftTest;
use ThriftTest::Types;
@@ -96,7 +98,9 @@ if ($opts{ssl} and not defined $opts{cert}) {
}
my $handler = new ThriftTestHandler();
+my $handler2 = new SecondServiceHandler();
my $processor = new ThriftTest::ThriftTestProcessor($handler);
+my $processor2 = new ThriftTest::SecondServiceProcessor($handler2);
my $serversocket;
if ($opts{"domain-socket"}) {
unlink($opts{"domain-socket"});
@@ -116,13 +120,21 @@ if ($opts{transport} eq 'buffered') {
exit 1;
}
my $protocol;
-if ($opts{protocol} eq 'binary') {
+if ($opts{protocol} eq 'binary' || $opts{protocol} eq 'multi') {
$protocol = new Thrift::BinaryProtocolFactory();
} else {
usage();
exit 1;
}
+if (index($opts{protocol}, 'multi') == 0) {
+ my $newProcessor = new Thrift::MultiplexedProcessor($protocol);
+ $newProcessor->defaultProcessor($processor);
+ $newProcessor->registerProcessor("ThriftTest", $processor);
+ $newProcessor->registerProcessor("SecondService", $processor2);
+ $processor = $newProcessor;
+}
+
my $ssltag = '';
if ($opts{ssl}) {
$ssltag = "(SSL)";
@@ -390,11 +402,29 @@ sub testMultiException() {
sub testOneway() {
my $self = shift;
- my $sleepFor = shift;
- print("testOneway($sleepFor): Sleeping...\n");
- sleep $sleepFor;
- print("testOneway($sleepFor): done sleeping!\n");
+ my $num = shift;
+ print("testOneway($num): received\n");
+}
+
+###
+### Test server implementation
+###
+
+package SecondServiceHandler;
+
+use base qw( ThriftTest::SecondServiceIf );
+
+sub new {
+ my $classname = shift;
+ my $self = {};
+ return bless($self, $classname);
}
+sub secondtestString() {
+ my $self = shift;
+ my $thing = shift;
+ print("testString($thing)\n");
+ return "testString(\"" . $thing . "\")";
+}
1;
http://git-wip-us.apache.org/repos/asf/thrift/blob/20e16bc6/test/rs/src/bin/test_client.rs
----------------------------------------------------------------------
diff --git a/test/rs/src/bin/test_client.rs b/test/rs/src/bin/test_client.rs
index 0df2f00..297faf9 100644
--- a/test/rs/src/bin/test_client.rs
+++ b/test/rs/src/bin/test_client.rs
@@ -588,11 +588,15 @@ fn verify_expected_result<T: Debug + PartialEq + Sized>(
actual: Result<T, thrift::Error>,
expected: T,
) -> Result<(), thrift::Error> {
+ info!("*** EXPECTED: Ok({:?})", expected);
+ info!("*** ACTUAL : {:?}", actual);
match actual {
Ok(v) => {
if v == expected {
+ info!("*** OK ***");
Ok(())
} else {
+ info!("*** FAILED ***");
Err(thrift::Error::User(format!("expected {:?} but got {:?}", &expected, &v).into()),)
}
}
http://git-wip-us.apache.org/repos/asf/thrift/blob/20e16bc6/test/rs/src/bin/test_server.rs
----------------------------------------------------------------------
diff --git a/test/rs/src/bin/test_server.rs b/test/rs/src/bin/test_server.rs
index 81a2ad8..1976bf4 100644
--- a/test/rs/src/bin/test_server.rs
+++ b/test/rs/src/bin/test_server.rs
@@ -391,7 +391,7 @@ impl ThriftTestSyncHandler for ThriftTestSyncHandlerImpl {
struct SecondServiceSyncHandlerImpl;
impl SecondServiceSyncHandler for SecondServiceSyncHandlerImpl {
fn handle_secondtest_string(&self, thing: String) -> thrift::Result<String> {
- info!("testString({})", &thing);
+ info!("(second)testString({})", &thing);
let ret = format!("testString(\"{}\")", &thing);
Ok(ret)
}
http://git-wip-us.apache.org/repos/asf/thrift/blob/20e16bc6/test/tests.json
----------------------------------------------------------------------
diff --git a/test/tests.json b/test/tests.json
index bde9014..35d0a6c 100644
--- a/test/tests.json
+++ b/test/tests.json
@@ -464,7 +464,8 @@
"domain"
],
"protocols": [
- "binary"
+ "binary",
+ "multi"
],
"client": {
"command": [
@@ -475,6 +476,9 @@
"--ca=../keys/CA.pem",
"--cert=../keys/client.crt",
"--key=../keys/client.key"
+ ],
+ "protocols": [
+ "multi:binary"
]
},
"server": {
@@ -485,6 +489,9 @@
"TestServer.pl",
"--cert=../keys/server.crt",
"--key=../keys/server.key"
+ ],
+ "protocols": [
+ "binary:multi"
]
},
"workdir": "perl"
[30/50] [abbrv] thrift git commit: update the CONTRIBUTING readme to
point to build instructions
Posted by je...@apache.org.
update the CONTRIBUTING readme to point to build instructions
Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/388738d3
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/388738d3
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/388738d3
Branch: refs/heads/0.11.0
Commit: 388738d3317797b6856c40a0c46768bd2f831967
Parents: cfb0130
Author: James E. King, III <jk...@apache.org>
Authored: Sat Nov 11 09:47:01 2017 -0500
Committer: James E. King, III <jk...@apache.org>
Committed: Sat Nov 11 09:47:01 2017 -0500
----------------------------------------------------------------------
CONTRIBUTING.md | 6 ++++++
1 file changed, 6 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/thrift/blob/388738d3/CONTRIBUTING.md
----------------------------------------------------------------------
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 6268dcf..b552ddf 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -6,6 +6,12 @@ Thank you for your interest in contributing to the Apache Thrift project! Infor
* [Get involved!](http://www.apache.org/foundation/getinvolved.html)
* [Legal aspects on Submission of Contributions (Patches)](http://www.apache.org/licenses/LICENSE-2.0.html#contributions)
+## If you want to build the project locally ##
+
+For Windows systems, see our detailed instructions on the [CMake README](build/cmake/README.md).
+For Windows Native C++ builds, see our detailed instructions on the [WinCPP
+For unix systems, see our detailed instructions on the [Docker README](build/docker/README.md).
+
## If you want to review open issues... ##
1. Review the [GitHub Pull Request Backlog](https://github.com/apache/thrift/pulls). Code reviews are open to all.
[37/50] [abbrv] thrift git commit: THRIFT-2013: update docker for
artful (go back to lua 5.2) and enhance cpp client to send 0, 1, 2, 4, 8, ...,
131072 size binary tests,
this exposed problems in the erl and rs servers and those tests have been
disabled for no
Posted by je...@apache.org.
THRIFT-2013: update docker for artful (go back to lua 5.2) and enhance
cpp client to send 0,1,2,4,8,...,131072 size binary tests, this exposed
problems in the erl and rs servers and those tests have been disabled for now.
Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/39eaae66
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/39eaae66
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/39eaae66
Branch: refs/heads/0.11.0
Commit: 39eaae6675f01ff844b35c04ebd50090dc413624
Parents: 6e883f9
Author: James E. King, III <jk...@apache.org>
Authored: Sun Nov 19 20:17:33 2017 -0500
Committer: James E. King, III <jk...@apache.org>
Committed: Mon Nov 20 07:27:03 2017 -0500
----------------------------------------------------------------------
LANGUAGES.md | 6 +-
build/docker/README.md | 8 +-
build/docker/ubuntu-artful/Dockerfile | 7 +-
lib/netcore/Thrift/Thrift.csproj | 1 +
lib/rs/src/transport/socket.rs | 2 +-
test/cpp/src/TestClient.cpp | 188 +++++++++++++++--------------
test/cpp/src/TestServer.cpp | 12 +-
test/known_failures_Linux.json | 18 ++-
test/rs/src/bin/test_client.rs | 4 +-
9 files changed, 133 insertions(+), 113 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/thrift/blob/39eaae66/LANGUAGES.md
----------------------------------------------------------------------
diff --git a/LANGUAGES.md b/LANGUAGES.md
index d1a21e2..79fcf28 100644
--- a/LANGUAGES.md
+++ b/LANGUAGES.md
@@ -114,7 +114,7 @@ The Language/Library Levels indicate the minimum and maximum versions that are u
<tr align=center>
<td align=left><a href="lib/netcore/README.md">.NET Core</a></td>
<!-- Build Systems ---------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
-<!-- Language Levels -------><td colspan=2>2.0.0</td>
+<!-- Language Levels -------><td>2.0.0</td><td>2.0.3</td>
<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
@@ -194,7 +194,7 @@ The Language/Library Levels indicate the minimum and maximum versions that are u
<tr align=center>
<td align=left><a href="lib/lua/README.md">Lua</a></td>
<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
-<!-- Language Levels -------><td>5.1.5</td><td>5.3.3</td>
+<!-- Language Levels -------><td>5.1.5</td><td>5.2.4</td>
<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
@@ -204,7 +204,7 @@ The Language/Library Levels indicate the minimum and maximum versions that are u
<tr align=center>
<td align=left><a href="lib/nodejs/README.md">node.js</a></td>
<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
-<!-- Language Levels -------><td>4.2.6</td><td>8.8.1</td>
+<!-- Language Levels -------><td>4.2.6</td><td>8.9.1</td>
<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
<!-- Transport Wrappers ----><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
http://git-wip-us.apache.org/repos/asf/thrift/blob/39eaae66/build/docker/README.md
----------------------------------------------------------------------
diff --git a/build/docker/README.md b/build/docker/README.md
index 10a7a76..a8d9501 100644
--- a/build/docker/README.md
+++ b/build/docker/README.md
@@ -147,15 +147,15 @@ Last updated: October 1, 2017
| d | 2.070.2 | 2.073.2 | 2.076.0 | |
| dart | 1.20.1 | 1.24.2 | 1.24.2 | |
| delphi | | | | Not in CI |
-| dotnet | | 2.0.3 | | Needs to be added to artful |
+| dotnet | | 2.0.3 | 2.0.3 | |
| erlang | R16B03 | 18.3 | 20.0.4 | |
| go | 1.2.1 | 1.6.2 | 1.8.3 | |
| haskell | 7.6.3 | 7.10.3 | 8.0.2 | |
| haxe | | 3.2.1 | 3.4.2 | disabled in trusty builds - cores on install v3.0.0, disabled in artful builds - see THRIFT-4352 |
-| java | 1.7.0_151 | 1.8.0_131 | 1.8.0_144 | |
+| java | 1.7.0_151 | 1.8.0_131 | 1.8.0_151 | |
| js | | | | Unsure how to look for version info? |
-| lua | 5.1.5 | 5.2.4 | 5.3.3 | |
-| nodejs | | 4.2.6 | 8.8.1 | trusty has node.js 0.10.0 which is too old |
+| lua | 5.1.5 | 5.2.4 | 5.2.4 | Lua 5.3: see THRIFT-4386 |
+| nodejs | | 4.2.6 | 8.9.1 | trusty has node.js 0.10.0 which is too old |
| ocaml | | 4.02.3 | 4.04.0 | |
| perl | 5.18.2 | 5.22.1 | 5.26.0 | |
| php | 5.5.9 | 7.0.22 | 7.1.8 | |
http://git-wip-us.apache.org/repos/asf/thrift/blob/39eaae66/build/docker/ubuntu-artful/Dockerfile
----------------------------------------------------------------------
diff --git a/build/docker/ubuntu-artful/Dockerfile b/build/docker/ubuntu-artful/Dockerfile
index 756209d..cba2902 100644
--- a/build/docker/ubuntu-artful/Dockerfile
+++ b/build/docker/ubuntu-artful/Dockerfile
@@ -162,12 +162,11 @@ RUN apt-get install -y --no-install-recommends \
RUN apt-get install -y --no-install-recommends \
`# Lua dependencies` \
- lua5.3 \
- lua5.3-dev && \
- ln -s /usr/bin/lua5.3 /usr/bin/lua && \
- ln -s /usr/bin/luac5.3 /usr/bin/luac
+ lua5.2 \
+ lua5.2-dev
# https://bugs.launchpad.net/ubuntu/+source/lua5.3/+bug/1707212
# lua5.3 does not install alternatives!
+# need to update our luasocket code, lua doesn't have luaL_openlib any more
RUN apt-get install -y --no-install-recommends \
`# Node.js dependencies` \
http://git-wip-us.apache.org/repos/asf/thrift/blob/39eaae66/lib/netcore/Thrift/Thrift.csproj
----------------------------------------------------------------------
diff --git a/lib/netcore/Thrift/Thrift.csproj b/lib/netcore/Thrift/Thrift.csproj
index 3725d7b..e806fed 100644
--- a/lib/netcore/Thrift/Thrift.csproj
+++ b/lib/netcore/Thrift/Thrift.csproj
@@ -22,6 +22,7 @@
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="[2.0,)" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="[2.0,)" />
<PackageReference Include="System.IO.Pipes" Version="[4.3,)" />
+ <PackageReference Include="System.Net.Http.WinHttpHandler" Version="4.4.0" />
<PackageReference Include="System.Net.NameResolution" Version="[4.3,)" />
<PackageReference Include="System.Net.Requests" Version="[4.3,)" />
<PackageReference Include="System.Net.Security" Version="[4.3,)" />
http://git-wip-us.apache.org/repos/asf/thrift/blob/39eaae66/lib/rs/src/transport/socket.rs
----------------------------------------------------------------------
diff --git a/lib/rs/src/transport/socket.rs b/lib/rs/src/transport/socket.rs
index a6f780a..727bba3 100644
--- a/lib/rs/src/transport/socket.rs
+++ b/lib/rs/src/transport/socket.rs
@@ -156,7 +156,7 @@ impl Read for TTcpChannel {
impl Write for TTcpChannel {
fn write(&mut self, b: &[u8]) -> io::Result<usize> {
- self.if_set(|s| s.write(b))
+ self.if_set(|s| s.write_all(b)).map(|_| b.len())
}
fn flush(&mut self) -> io::Result<()> {
http://git-wip-us.apache.org/repos/asf/thrift/blob/39eaae66/test/cpp/src/TestClient.cpp
----------------------------------------------------------------------
diff --git a/test/cpp/src/TestClient.cpp b/test/cpp/src/TestClient.cpp
index 6e7ff8e..9544a4a 100644
--- a/test/cpp/src/TestClient.cpp
+++ b/test/cpp/src/TestClient.cpp
@@ -44,6 +44,7 @@
#include <boost/algorithm/string.hpp>
#include <boost/filesystem.hpp>
#include <boost/program_options.hpp>
+#include <boost/random/random_device.hpp>
#include <thrift/stdcxx.h>
#if _WIN32
#include <thrift/windows/TWinsockSingleton.h>
@@ -130,13 +131,16 @@ bool print_eq(T expected, T actual) {
return_code |= ERR_BASETYPES; \
}
+int binary_test(ThriftTestClient& testClient, string::size_type siz);
+
+BOOST_CONSTEXPR_OR_CONST int ERR_BASETYPES = 1;
+BOOST_CONSTEXPR_OR_CONST int ERR_STRUCTS = 2;
+BOOST_CONSTEXPR_OR_CONST int ERR_CONTAINERS = 4;
+BOOST_CONSTEXPR_OR_CONST int ERR_EXCEPTIONS = 8;
+BOOST_CONSTEXPR_OR_CONST int ERR_UNKNOWN = 64;
+
int main(int argc, char** argv) {
cout.precision(19);
- int ERR_BASETYPES = 1;
- int ERR_STRUCTS = 2;
- int ERR_CONTAINERS = 4;
- int ERR_EXCEPTIONS = 8;
- int ERR_UNKNOWN = 64;
string testDir = boost::filesystem::system_complete(argv[0]).parent_path().parent_path().parent_path().string();
string caPath = testDir + "/keys/CA.pem";
@@ -161,13 +165,13 @@ int main(int argc, char** argv) {
boost::program_options::options_description desc("Allowed options");
desc.add_options()
("help,h", "produce help message")
- ("host",
- boost::program_options::value<string>(&host)->default_value(host),
+ ("host",
+ boost::program_options::value<string>(&host)->default_value(host),
"Host to connect")
- ("port",
- boost::program_options::value<int>(&port)->default_value(port),
+ ("port",
+ boost::program_options::value<int>(&port)->default_value(port),
"Port number to connect")
- ("domain-socket",
+ ("domain-socket",
boost::program_options::value<string>(&domain_socket)->default_value(domain_socket),
"Domain Socket (e.g. /tmp/ThriftTest.thrift), instead of host and port")
("abstract-namespace",
@@ -179,7 +183,7 @@ int main(int argc, char** argv) {
("protocol",
boost::program_options::value<string>(&protocol_type)->default_value(protocol_type),
"Protocol: binary, compact, header, json, multi, multic, multih, multij")
- ("ssl",
+ ("ssl",
"Encrypted Transport using SSL")
("testloops,n",
boost::program_options::value<int>(&numTests)->default_value(numTests),
@@ -244,7 +248,7 @@ int main(int argc, char** argv) {
stdcxx::shared_ptr<TSocket> socket;
stdcxx::shared_ptr<TTransport> transport;
stdcxx::shared_ptr<TProtocol> protocol;
- stdcxx::shared_ptr<TProtocol> protocol2; // SecondService for multiplexed
+ stdcxx::shared_ptr<TProtocol> protocol2; // SecondService for multiplexed
if (ssl) {
cout << "Client Certificate File: " << certPath << endl;
@@ -295,9 +299,9 @@ int main(int argc, char** argv) {
}
if (boost::starts_with(protocol_type, "multi")) {
- protocol2 = stdcxx::make_shared<TMultiplexedProtocol>(protocol, "SecondService");
- // we don't need access to the original protocol any more, so...
- protocol = stdcxx::make_shared<TMultiplexedProtocol>(protocol, "ThriftTest");
+ protocol2 = stdcxx::make_shared<TMultiplexedProtocol>(protocol, "SecondService");
+ // we don't need access to the original protocol any more, so...
+ protocol = stdcxx::make_shared<TMultiplexedProtocol>(protocol, "ThriftTest");
}
// Connection info
@@ -387,18 +391,18 @@ int main(int argc, char** argv) {
// in the middle of the ThriftTest
//
if (boost::starts_with(protocol_type, "multi")) {
- SecondServiceClient ssc(protocol2);
- // transport is already open...
-
+ SecondServiceClient ssc(protocol2);
+ // transport is already open...
+
try {
cout << "secondService.secondTestString(\"foo\") => " << flush;
- std::string result;
- ssc.secondtestString(result, "foo");
- cout << "{" << result << "}" << endl;
- } catch (std::exception& e) {
- cout << " *** FAILED *** " << e.what() << endl;
- return_code |= ERR_EXCEPTIONS;
- }
+ std::string result;
+ ssc.secondtestString(result, "foo");
+ cout << "{" << result << "}" << endl;
+ } catch (std::exception& e) {
+ cout << " *** FAILED *** " << e.what() << endl;
+ return_code |= ERR_EXCEPTIONS;
+ }
}
try {
@@ -568,72 +572,9 @@ int main(int argc, char** argv) {
/**
* BINARY TEST
*/
- cout << "testBinary(empty)" << endl;
- try {
- string bin_result;
- testClient.testBinary(bin_result, string());
- if (!bin_result.empty()) {
- cout << endl << "*** FAILED ***" << endl;
- cout << "invalid length: " << bin_result.size() << endl;
- return_code |= ERR_BASETYPES;
- }
- } catch (TTransportException&) {
- throw;
- } catch (exception& ex) {
- cout << "*** FAILED ***" << endl << ex.what() << endl;
- return_code |= ERR_BASETYPES;
- }
- cout << "testBinary([-128..127]) = {" << flush;
- const signed char bin_data[256]
- = {-128, -127, -126, -125, -124, -123, -122, -121, -120, -119, -118, -117, -116, -115, -114,
- -113, -112, -111, -110, -109, -108, -107, -106, -105, -104, -103, -102, -101, -100, -99,
- -98, -97, -96, -95, -94, -93, -92, -91, -90, -89, -88, -87, -86, -85, -84,
- -83, -82, -81, -80, -79, -78, -77, -76, -75, -74, -73, -72, -71, -70, -69,
- -68, -67, -66, -65, -64, -63, -62, -61, -60, -59, -58, -57, -56, -55, -54,
- -53, -52, -51, -50, -49, -48, -47, -46, -45, -44, -43, -42, -41, -40, -39,
- -38, -37, -36, -35, -34, -33, -32, -31, -30, -29, -28, -27, -26, -25, -24,
- -23, -22, -21, -20, -19, -18, -17, -16, -15, -14, -13, -12, -11, -10, -9,
- -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6,
- 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
- 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
- 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
- 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
- 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
- 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
- 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
- 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
- 127};
- try {
- string bin_result;
- testClient.testBinary(bin_result, string(reinterpret_cast<const char *>(bin_data), 256));
- if (bin_result.size() != 256) {
- cout << endl << "*** FAILED ***" << endl;
- cout << "invalid length: " << bin_result.size() << endl;
- return_code |= ERR_BASETYPES;
- } else {
- bool first = true;
- bool failed = false;
- for (int i = 0; i < 256; ++i) {
- if (!first)
- cout << ",";
- else
- first = false;
- cout << static_cast<int>(bin_result[i]);
- if (!failed && bin_result[i] != i - 128) {
- failed = true;
- }
- }
- cout << "}" << endl;
- if (failed) {
- cout << "*** FAILED ***" << endl;
- return_code |= ERR_BASETYPES;
- }
- }
- } catch (TTransportException&) {
- throw;
- } catch (exception& ex) {
- cout << "*** FAILED ***" << endl << ex.what() << endl;
- return_code |= ERR_BASETYPES;
+ for (string::size_type i = 0; i < 131073 && !return_code; ) {
+ return_code |= binary_test(testClient, i);
+ if (i > 0) { i *= 2; } else { ++i; }
}
@@ -1137,7 +1078,7 @@ int main(int argc, char** argv) {
return_code |= ERR_BASETYPES;
cout << endl << "All tests done." << endl << flush;
-
+
uint64_t stop = now();
uint64_t tot = stop - start;
@@ -1164,3 +1105,66 @@ int main(int argc, char** argv) {
return return_code;
}
+
+void binary_fill(std::string& str, string::size_type siz)
+{
+ static const signed char bin_data[256]
+ = {-128, -127, -126, -125, -124, -123, -122, -121, -120, -119, -118, -117, -116, -115, -114,
+ -113, -112, -111, -110, -109, -108, -107, -106, -105, -104, -103, -102, -101, -100, -99,
+ -98, -97, -96, -95, -94, -93, -92, -91, -90, -89, -88, -87, -86, -85, -84,
+ -83, -82, -81, -80, -79, -78, -77, -76, -75, -74, -73, -72, -71, -70, -69,
+ -68, -67, -66, -65, -64, -63, -62, -61, -60, -59, -58, -57, -56, -55, -54,
+ -53, -52, -51, -50, -49, -48, -47, -46, -45, -44, -43, -42, -41, -40, -39,
+ -38, -37, -36, -35, -34, -33, -32, -31, -30, -29, -28, -27, -26, -25, -24,
+ -23, -22, -21, -20, -19, -18, -17, -16, -15, -14, -13, -12, -11, -10, -9,
+ -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6,
+ 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
+ 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
+ 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
+ 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
+ 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
+ 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
+ 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
+ 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
+ 127};
+
+ str.resize(siz);
+ char *ptr = &str[0];
+ string::size_type pos = 0;
+ for (string::size_type i = 0; i < siz; ++i)
+ {
+ if (pos == 255) { pos = 0; } else { ++pos; }
+ *ptr++ = bin_data[pos];
+ }
+}
+
+int binary_test(ThriftTestClient& testClient, string::size_type siz)
+{
+ string bin_request;
+ string bin_result;
+
+ cout << "testBinary(siz = " << siz << ")" << endl;
+ binary_fill(bin_request, siz);
+ try {
+ testClient.testBinary(bin_result, bin_request);
+
+ if (bin_request.size() != bin_result.size()) {
+ cout << "*** FAILED: request size " << bin_request.size() << "; result size " << bin_result.size() << endl;
+ return ERR_BASETYPES;
+ }
+
+ for (string::size_type i = 0; i < siz; ++i) {
+ if (bin_request.at(i) != bin_result.at(i)) {
+ cout << "*** FAILED: at position " << i << " request[i] is h" << hex << bin_request.at(i) << " result[i] is h" << hex << bin_result.at(i) << endl;
+ return ERR_BASETYPES;
+ }
+ }
+ } catch (TTransportException&) {
+ throw;
+ } catch (exception& ex) {
+ cout << "*** FAILED ***" << endl << ex.what() << endl;
+ return ERR_BASETYPES;
+ }
+
+ return 0;
+}
http://git-wip-us.apache.org/repos/asf/thrift/blob/39eaae66/test/cpp/src/TestServer.cpp
----------------------------------------------------------------------
diff --git a/test/cpp/src/TestServer.cpp b/test/cpp/src/TestServer.cpp
index 744a86c..78b0a74 100644
--- a/test/cpp/src/TestServer.cpp
+++ b/test/cpp/src/TestServer.cpp
@@ -113,7 +113,7 @@ public:
void testBinary(std::string& _return, const std::string& thing) {
std::ostringstream hexstr;
hexstr << std::hex << thing;
- printf("testBinary(%s)\n", hexstr.str().c_str());
+ printf("testBinary(%lu: %s)\n", thing.size(), hexstr.str().c_str());
_return = thing;
}
@@ -345,7 +345,7 @@ class SecondHandler : public SecondServiceIf
public:
void secondtestString(std::string& result, const std::string& thing)
{ result = "testString(\"" + thing + "\")"; }
-};
+};
class TestProcessorEventHandler : public TProcessorEventHandler {
virtual void* getContext(const char* fn_name, void* serverContext) {
@@ -606,10 +606,10 @@ int main(int argc, char** argv) {
} else if (protocol_type == "compact") {
} else if (protocol_type == "json") {
} else if (protocol_type == "header") {
- } else if (protocol_type == "multi") { // multiplexed binary
- } else if (protocol_type == "multic") { // multiplexed compact
- } else if (protocol_type == "multih") { // multiplexed header
- } else if (protocol_type == "multij") { // multiplexed json
+ } else if (protocol_type == "multi") { // multiplexed binary
+ } else if (protocol_type == "multic") { // multiplexed compact
+ } else if (protocol_type == "multih") { // multiplexed header
+ } else if (protocol_type == "multij") { // multiplexed json
} else {
throw invalid_argument("Unknown protocol type " + protocol_type);
}
http://git-wip-us.apache.org/repos/asf/thrift/blob/39eaae66/test/known_failures_Linux.json
----------------------------------------------------------------------
diff --git a/test/known_failures_Linux.json b/test/known_failures_Linux.json
index ea194a1..ae9b370 100644
--- a/test/known_failures_Linux.json
+++ b/test/known_failures_Linux.json
@@ -3,9 +3,9 @@
"c_glib-csharp_multi-binary_framed-ip",
"c_glib-csharp_multi_buffered-ip",
"c_glib-csharp_multi_framed-ip",
- "c_glib-csharp_multic_buffered-ip",
"c_glib-csharp_multic-compact_buffered-ip",
"c_glib-csharp_multic-compact_framed-ip",
+ "c_glib-csharp_multic_buffered-ip",
"c_glib-csharp_multic_framed-ip",
"c_glib-rs_multi_buffered-ip",
"c_glib-rs_multi_framed-ip",
@@ -195,6 +195,8 @@
"d-py_json_buffered-ip-ssl",
"d-py_json_framed-ip",
"d-py_json_framed-ip-ssl",
+ "erl-cpp_binary_buffered-ip",
+ "erl-cpp_compact_buffered-ip",
"erl-csharp_binary_buffered-ip",
"erl-csharp_compact_buffered-ip",
"erl-nodejs_binary_buffered-ip",
@@ -297,6 +299,20 @@
"nodejs-netcore_json_buffered-ip-ssl",
"nodejs-netcore_json_framed-ip",
"nodejs-netcore_json_framed-ip-ssl",
+ "rb-cpp_json_buffered-ip",
+ "rb-cpp_json_framed-ip",
+ "rs-cpp_binary_buffered-ip",
+ "rs-cpp_binary_framed-ip",
+ "rs-cpp_compact_buffered-ip",
+ "rs-cpp_compact_framed-ip",
+ "rs-cpp_multi-binary_buffered-ip",
+ "rs-cpp_multi-binary_framed-ip",
+ "rs-cpp_multi_buffered-ip",
+ "rs-cpp_multi_framed-ip",
+ "rs-cpp_multic-compact_buffered-ip",
+ "rs-cpp_multic-compact_framed-ip",
+ "rs-cpp_multic_buffered-ip",
+ "rs-cpp_multic_framed-ip",
"rs-csharp_binary_buffered-ip",
"rs-csharp_binary_framed-ip",
"rs-csharp_compact_buffered-ip",
http://git-wip-us.apache.org/repos/asf/thrift/blob/39eaae66/test/rs/src/bin/test_client.rs
----------------------------------------------------------------------
diff --git a/test/rs/src/bin/test_client.rs b/test/rs/src/bin/test_client.rs
index 7c11ad5..0df2f00 100644
--- a/test/rs/src/bin/test_client.rs
+++ b/test/rs/src/bin/test_client.rs
@@ -126,7 +126,7 @@ fn build_protocols(
};
let (i_prot, o_prot): (Box<TInputProtocol>, Box<TOutputProtocol>) = match protocol {
- "binary" | "multi:binary" => {
+ "binary" => {
(Box::new(TBinaryInputProtocol::new(i_tran, true)),
Box::new(TBinaryOutputProtocol::new(o_tran, true)))
}
@@ -139,7 +139,7 @@ fn build_protocols(
),
))
}
- "compact" | "multi:compact" => {
+ "compact" => {
(Box::new(TCompactInputProtocol::new(i_tran)),
Box::new(TCompactOutputProtocol::new(o_tran)))
}
[11/50] [abbrv] thrift git commit: THRIFT-4353: support php ext read
data after message begin Client: php
Posted by je...@apache.org.
THRIFT-4353: support php ext read data after message begin
Client: php
This closes #1383
Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/1df2d9b8
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/1df2d9b8
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/1df2d9b8
Branch: refs/heads/0.11.0
Commit: 1df2d9b801553a1addc1df112bedde09527dbfdd
Parents: a39ba7f
Author: 董菲 <fe...@anjuke.com>
Authored: Wed Nov 16 10:32:52 2016 +0800
Committer: James E. King, III <jk...@apache.org>
Committed: Wed Oct 25 08:56:40 2017 -0400
----------------------------------------------------------------------
.../ext/thrift_protocol/php_thrift_protocol.cpp | 58 ++++++++++++++++++++
.../ext/thrift_protocol/php_thrift_protocol.h | 1 +
.../thrift_protocol/php_thrift_protocol7.cpp | 31 +++++++++++
3 files changed, 90 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/thrift/blob/1df2d9b8/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp
----------------------------------------------------------------------
diff --git a/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp b/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp
index 4c9062e..5374286 100644
--- a/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp
+++ b/lib/php/src/ext/thrift_protocol/php_thrift_protocol.cpp
@@ -98,6 +98,7 @@ const int BAD_VERSION = 4;
static zend_function_entry thrift_protocol_functions[] = {
PHP_FE(thrift_protocol_write_binary, NULL)
PHP_FE(thrift_protocol_read_binary, NULL)
+ PHP_FE(thrift_protocol_read_binary_after_message_begin, NULL)
{NULL, NULL, NULL}
} ;
@@ -1123,4 +1124,61 @@ PHP_FUNCTION(thrift_protocol_read_binary) {
}
}
+
+// 4 params: $transport $response_Typename $strict_read $buffer_size
+PHP_FUNCTION(thrift_protocol_read_binary_after_message_begin) {
+ int argc = ZEND_NUM_ARGS();
+
+ if (argc < 3) {
+ WRONG_PARAM_COUNT;
+ }
+
+ zval ***args = (zval***) emalloc(argc * sizeof(zval**));
+ zend_get_parameters_array_ex(argc, args);
+
+ if (Z_TYPE_PP(args[0]) != IS_OBJECT) {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "1st parameter is not an object (transport)");
+ efree(args);
+ RETURN_NULL();
+ }
+
+ if (Z_TYPE_PP(args[1]) != IS_STRING) {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "2nd parameter is not a string (typename of expected response struct)");
+ efree(args);
+ RETURN_NULL();
+ }
+
+ if (argc == 4 && Z_TYPE_PP(args[3]) != IS_LONG) {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "4nd parameter is not an integer (typename of expected buffer size)");
+ efree(args);
+ RETURN_NULL();
+ }
+
+ try {
+ size_t buffer_size = 8192;
+ if (argc == 4) {
+ buffer_size = Z_LVAL_PP(args[3]);
+ }
+
+ PHPInputTransport transport(*args[0], buffer_size);
+ char* obj_typename = Z_STRVAL_PP(args[1]);
+ convert_to_boolean(*args[2]);
+ bool strict_read = Z_BVAL_PP(args[2]);
+ efree(args);
+ args = NULL;
+
+ createObject(obj_typename, return_value);
+ zval* spec = zend_read_static_property(zend_get_class_entry(return_value TSRMLS_CC), "_TSPEC", 6, false TSRMLS_CC);
+ binary_deserialize_spec(return_value, transport, Z_ARRVAL_P(spec));
+ } catch (const PHPExceptionWrapper& ex) {
+ zend_throw_exception_object(ex TSRMLS_CC);
+ RETURN_NULL();
+ } catch (const std::exception& ex) {
+ throw_zend_exception_from_std_exception(ex TSRMLS_CC);
+ RETURN_NULL();
+ }
+}
+
+
+
#endif /* PHP_VERSION_ID < 70000 && PHP_VERSION_ID > 50000 */
http://git-wip-us.apache.org/repos/asf/thrift/blob/1df2d9b8/lib/php/src/ext/thrift_protocol/php_thrift_protocol.h
----------------------------------------------------------------------
diff --git a/lib/php/src/ext/thrift_protocol/php_thrift_protocol.h b/lib/php/src/ext/thrift_protocol/php_thrift_protocol.h
index 44d03cc..0420997 100644
--- a/lib/php/src/ext/thrift_protocol/php_thrift_protocol.h
+++ b/lib/php/src/ext/thrift_protocol/php_thrift_protocol.h
@@ -21,6 +21,7 @@
PHP_FUNCTION(thrift_protocol_write_binary);
PHP_FUNCTION(thrift_protocol_read_binary);
+PHP_FUNCTION(thrift_protocol_read_binary_after_message_begin);
extern zend_module_entry thrift_protocol_module_entry;
#define phpext_thrift_protocol_ptr &thrift_protocol_module_entry
http://git-wip-us.apache.org/repos/asf/thrift/blob/1df2d9b8/lib/php/src/ext/thrift_protocol/php_thrift_protocol7.cpp
----------------------------------------------------------------------
diff --git a/lib/php/src/ext/thrift_protocol/php_thrift_protocol7.cpp b/lib/php/src/ext/thrift_protocol/php_thrift_protocol7.cpp
index 3c6c3db..dafc185 100644
--- a/lib/php/src/ext/thrift_protocol/php_thrift_protocol7.cpp
+++ b/lib/php/src/ext/thrift_protocol/php_thrift_protocol7.cpp
@@ -88,6 +88,7 @@ const int BAD_VERSION = 4;
static zend_function_entry thrift_protocol_functions[] = {
PHP_FE(thrift_protocol_write_binary, nullptr)
PHP_FE(thrift_protocol_read_binary, nullptr)
+ PHP_FE(thrift_protocol_read_binary_after_message_begin, nullptr)
{nullptr, nullptr, nullptr}
};
@@ -959,6 +960,10 @@ void binary_serialize_spec(zval* zthis, PHPOutputTransport& transport, HashTable
zval rv;
zval* prop = zend_read_property(Z_OBJCE_P(zthis), zthis, varname, strlen(varname), false, &rv);
+
+ if (Z_TYPE_P(prop) == IS_REFERENCE){
+ ZVAL_UNREF(prop);
+ }
if (Z_TYPE_P(prop) != IS_NULL) {
transport.writeI8(ttype);
transport.writeI16(fieldno);
@@ -1068,4 +1073,30 @@ PHP_FUNCTION(thrift_protocol_read_binary) {
}
}
+// 4 params: $transport $response_Typename $strict_read $buffer_size
+PHP_FUNCTION(thrift_protocol_read_binary_after_message_begin) {
+ zval *protocol;
+ zend_string *obj_typename;
+ zend_bool strict_read;
+ size_t buffer_size = 8192;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "oSb|l", &protocol, &obj_typename, &strict_read, &buffer_size) == FAILURE) {
+ return;
+ }
+
+ try {
+ PHPInputTransport transport(protocol, buffer_size);
+
+ createObject(ZSTR_VAL(obj_typename), return_value);
+ zval* spec = zend_read_static_property(Z_OBJCE_P(return_value), "_TSPEC", sizeof("_TSPEC")-1, false);
+ binary_deserialize_spec(return_value, transport, Z_ARRVAL_P(spec));
+ } catch (const PHPExceptionWrapper& ex) {
+ zend_throw_exception_object(ex);
+ RETURN_NULL();
+ } catch (const std::exception& ex) {
+ throw_zend_exception_from_std_exception(ex);
+ RETURN_NULL();
+ }
+}
+
#endif /* PHP_VERSION_ID >= 70000 */
[35/50] [abbrv] thrift git commit: THRIFT-2013: add multiplex server
and client test support to cpp language add multiplex client test support to
csharp and java languages fix a bug in the server-side header protocol
factory fix a bug in the cpp SSL serv
Posted by je...@apache.org.
THRIFT-2013: add multiplex server and client test support to cpp language
add multiplex client test support to csharp and java languages
fix a bug in the server-side header protocol factory
fix a bug in the cpp SSL server socket implementation
remove unnecessary sleep in cpp server testOneway
This closes #1414
Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/58402ff6
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/58402ff6
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/58402ff6
Branch: refs/heads/0.11.0
Commit: 58402ff6a71f00f9d61a9676bdabd3e5bbe9ea3f
Parents: 87ad2bc
Author: James E. King, III <jk...@apache.org>
Authored: Fri Nov 17 14:41:46 2017 -0500
Committer: James E. King, III <jk...@apache.org>
Committed: Sat Nov 18 21:10:40 2017 -0500
----------------------------------------------------------------------
README.md | 2 +-
.../thrift/processor/TMultiplexedProcessor.h | 111 +++++++++++--------
lib/cpp/src/thrift/protocol/THeaderProtocol.h | 2 +-
lib/cpp/src/thrift/transport/TSSLSocket.cpp | 51 +++++----
.../ThriftMVCTest/Controllers/HomeController.cs | 8 +-
.../test/ThriftMVCTest/SecondServiceImpl.cs | 14 +--
lib/erl/test/thrift_test_test.erl | 12 --
.../test/org/apache/thrift/test/TestClient.java | 34 +++++-
.../test/org/apache/thrift/test/TestServer.java | 4 -
lib/nodejs/test/client.js | 2 +-
lib/nodejs/test/server.js | 4 +-
test/ThriftTest.thrift | 3 +-
test/c_glib/src/thrift_second_service_handler.c | 13 ---
test/cpp/CMakeLists.txt | 5 +-
test/cpp/Makefile.am | 6 +-
test/cpp/src/TestClient.cpp | 108 ++++++++++++------
test/cpp/src/TestServer.cpp | 65 +++++++----
test/csharp/TestClient.cs | 41 +++++--
test/features/known_failures_Linux.json | 12 +-
test/known_failures_Linux.json | 90 ++++++++++++---
test/rs/src/bin/test_client.rs | 12 --
test/rs/src/bin/test_server.rs | 4 -
test/tests.json | 69 +++++++++---
23 files changed, 431 insertions(+), 241 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/thrift/blob/58402ff6/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 2ef9a5e..5435041 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
Apache Thrift
=============
-Last Modified: 2017--10
+Last Modified: 2017-11-10
License
=======
http://git-wip-us.apache.org/repos/asf/thrift/blob/58402ff6/lib/cpp/src/thrift/processor/TMultiplexedProcessor.h
----------------------------------------------------------------------
diff --git a/lib/cpp/src/thrift/processor/TMultiplexedProcessor.h b/lib/cpp/src/thrift/processor/TMultiplexedProcessor.h
index 13b09bb..aa3d49f 100644
--- a/lib/cpp/src/thrift/processor/TMultiplexedProcessor.h
+++ b/lib/cpp/src/thrift/processor/TMultiplexedProcessor.h
@@ -27,8 +27,6 @@
namespace apache {
namespace thrift {
-using stdcxx::shared_ptr;
-
namespace protocol {
/**
@@ -38,7 +36,7 @@ namespace protocol {
*/
class StoredMessageProtocol : public TProtocolDecorator {
public:
- StoredMessageProtocol(shared_ptr<protocol::TProtocol> _protocol,
+ StoredMessageProtocol(stdcxx::shared_ptr<protocol::TProtocol> _protocol,
const std::string& _name,
const TMessageType _type,
const int32_t _seqid)
@@ -67,19 +65,19 @@ public:
* processors with it, as shown in the following example:</p>
*
* <blockquote><code>
- * shared_ptr<TMultiplexedProcessor> processor(new TMultiplexedProcessor());
+ * stdcxx::shared_ptr<TMultiplexedProcessor> processor(new TMultiplexedProcessor());
*
* processor->registerProcessor(
* "Calculator",
- * shared_ptr<TProcessor>( new CalculatorProcessor(
- * shared_ptr<CalculatorHandler>( new CalculatorHandler()))));
+ * stdcxx::shared_ptr<TProcessor>( new CalculatorProcessor(
+ * stdcxx::shared_ptr<CalculatorHandler>( new CalculatorHandler()))));
*
* processor->registerProcessor(
* "WeatherReport",
- * shared_ptr<TProcessor>( new WeatherReportProcessor(
- * shared_ptr<WeatherReportHandler>( new WeatherReportHandler()))));
+ * stdcxx::shared_ptr<TProcessor>( new WeatherReportProcessor(
+ * stdcxx::shared_ptr<WeatherReportHandler>( new WeatherReportHandler()))));
*
- * shared_ptr<TServerTransport> transport(new TServerSocket(9090));
+ * stdcxx::shared_ptr<TServerTransport> transport(new TServerSocket(9090));
* TSimpleServer server(processor, transport);
*
* server.serve();
@@ -87,7 +85,7 @@ public:
*/
class TMultiplexedProcessor : public TProcessor {
public:
- typedef std::map<std::string, shared_ptr<TProcessor> > services_t;
+ typedef std::map<std::string, stdcxx::shared_ptr<TProcessor> > services_t;
/**
* 'Register' a service with this <code>TMultiplexedProcessor</code>. This
@@ -100,11 +98,41 @@ public:
* as "handlers", e.g. WeatherReportHandler,
* implementing WeatherReportIf interface.
*/
- void registerProcessor(const std::string& serviceName, shared_ptr<TProcessor> processor) {
+ void registerProcessor(const std::string& serviceName, stdcxx::shared_ptr<TProcessor> processor) {
services[serviceName] = processor;
}
/**
+ * Register a service to be called to process queries without service name
+ * \param [in] processor Implementation of a service.
+ */
+ void registerDefault(const stdcxx::shared_ptr<TProcessor>& processor) {
+ defaultProcessor = processor;
+ }
+
+ /**
+ * Chew up invalid input and return an exception to throw.
+ */
+ TException protocol_error(stdcxx::shared_ptr<protocol::TProtocol> in,
+ stdcxx::shared_ptr<protocol::TProtocol> out,
+ const std::string& name,
+ int32_t seqid,
+ const std::string& msg) const {
+ in->skip(::apache::thrift::protocol::T_STRUCT);
+ in->readMessageEnd();
+ in->getTransport()->readEnd();
+ ::apache::thrift::TApplicationException
+ x(::apache::thrift::TApplicationException::PROTOCOL_ERROR,
+ "TMultiplexedProcessor: " + msg);
+ out->writeMessageBegin(name, ::apache::thrift::protocol::T_EXCEPTION, seqid);
+ x.write(out.get());
+ out->writeMessageEnd();
+ out->getTransport()->writeEnd();
+ out->getTransport()->flush();
+ return TException(msg);
+}
+
+ /**
* This implementation of <code>process</code> performs the following steps:
*
* <ol>
@@ -119,8 +147,8 @@ public:
* the service name was not found in the message, or if the service
* name was not found in the service map.
*/
- bool process(shared_ptr<protocol::TProtocol> in,
- shared_ptr<protocol::TProtocol> out,
+ bool process(stdcxx::shared_ptr<protocol::TProtocol> in,
+ stdcxx::shared_ptr<protocol::TProtocol> out,
void* connectionContext) {
std::string name;
protocol::TMessageType type;
@@ -133,22 +161,10 @@ public:
if (type != protocol::T_CALL && type != protocol::T_ONEWAY) {
// Unexpected message type.
- in->skip(::apache::thrift::protocol::T_STRUCT);
- in->readMessageEnd();
- in->getTransport()->readEnd();
- const std::string msg("TMultiplexedProcessor: Unexpected message type");
- ::apache::thrift::TApplicationException
- x(::apache::thrift::TApplicationException::PROTOCOL_ERROR, msg);
- out->writeMessageBegin(name, ::apache::thrift::protocol::T_EXCEPTION, seqid);
- x.write(out.get());
- out->writeMessageEnd();
- out->getTransport()->writeEnd();
- out->getTransport()->flush();
- throw TException(msg);
+ throw protocol_error(in, out, name, seqid, "Unexpected message type");
}
// Extract the service name
-
boost::tokenizer<boost::char_separator<char> > tok(name, boost::char_separator<char>(":"));
std::vector<std::string> tokens;
@@ -161,39 +177,46 @@ public:
services_t::iterator it = services.find(tokens[0]);
if (it != services.end()) {
- shared_ptr<TProcessor> processor = it->second;
+ stdcxx::shared_ptr<TProcessor> processor = it->second;
// Let the processor registered for this service name
// process the message.
return processor
- ->process(shared_ptr<protocol::TProtocol>(
+ ->process(stdcxx::shared_ptr<protocol::TProtocol>(
new protocol::StoredMessageProtocol(in, tokens[1], type, seqid)),
out,
connectionContext);
} else {
// Unknown service.
- in->skip(::apache::thrift::protocol::T_STRUCT);
- in->readMessageEnd();
- in->getTransport()->readEnd();
-
- std::string msg("TMultiplexedProcessor: Unknown service: ");
- msg += tokens[0];
- ::apache::thrift::TApplicationException
- x(::apache::thrift::TApplicationException::PROTOCOL_ERROR, msg);
- out->writeMessageBegin(name, ::apache::thrift::protocol::T_EXCEPTION, seqid);
- x.write(out.get());
- out->writeMessageEnd();
- out->getTransport()->writeEnd();
- out->getTransport()->flush();
- msg += ". Did you forget to call registerProcessor()?";
- throw TException(msg);
+ throw protocol_error(in, out, name, seqid,
+ "Unknown service: " + tokens[0] +
+ ". Did you forget to call registerProcessor()?");
}
+ } else if (tokens.size() == 1) {
+ if (defaultProcessor) {
+ // non-multiplexed client forwards to default processor
+ return defaultProcessor
+ ->process(stdcxx::shared_ptr<protocol::TProtocol>(
+ new protocol::StoredMessageProtocol(in, tokens[0], type, seqid)),
+ out,
+ connectionContext);
+ } else {
+ throw protocol_error(in, out, name, seqid,
+ "Non-multiplexed client request dropped. "
+ "Did you forget to call defaultProcessor()?");
+ }
+ } else {
+ throw protocol_error(in, out, name, seqid,
+ "Wrong number of tokens.");
}
- return false;
}
private:
/** Map of service processor objects, indexed by service names. */
services_t services;
+
+ //! If a non-multi client requests something, it goes to the
+ //! default processor (if one is defined) for backwards compatibility.
+ stdcxx::shared_ptr<TProcessor> defaultProcessor;
};
}
}
http://git-wip-us.apache.org/repos/asf/thrift/blob/58402ff6/lib/cpp/src/thrift/protocol/THeaderProtocol.h
----------------------------------------------------------------------
diff --git a/lib/cpp/src/thrift/protocol/THeaderProtocol.h b/lib/cpp/src/thrift/protocol/THeaderProtocol.h
index 0b3997c..8cd5017 100644
--- a/lib/cpp/src/thrift/protocol/THeaderProtocol.h
+++ b/lib/cpp/src/thrift/protocol/THeaderProtocol.h
@@ -192,7 +192,7 @@ class THeaderProtocolFactory : public TProtocolFactory {
public:
virtual stdcxx::shared_ptr<TProtocol> getProtocol(stdcxx::shared_ptr<transport::TTransport> trans) {
THeaderProtocol* headerProtocol
- = new THeaderProtocol(trans, stdcxx::shared_ptr<transport::TTransport>(), T_BINARY_PROTOCOL);
+ = new THeaderProtocol(trans, trans, T_BINARY_PROTOCOL);
return stdcxx::shared_ptr<TProtocol>(headerProtocol);
}
http://git-wip-us.apache.org/repos/asf/thrift/blob/58402ff6/lib/cpp/src/thrift/transport/TSSLSocket.cpp
----------------------------------------------------------------------
diff --git a/lib/cpp/src/thrift/transport/TSSLSocket.cpp b/lib/cpp/src/thrift/transport/TSSLSocket.cpp
index ddefb34..3f0e28e 100644
--- a/lib/cpp/src/thrift/transport/TSSLSocket.cpp
+++ b/lib/cpp/src/thrift/transport/TSSLSocket.cpp
@@ -157,7 +157,7 @@ void cleanupOpenSSL() {
mutexes.reset();
}
-static void buildErrors(string& message, int error = 0);
+static void buildErrors(string& message, int errno_copy = 0, int sslerrno = 0);
static bool matchName(const char* host, const char* pattern, int size);
static char uppercase(char c);
@@ -301,7 +301,7 @@ bool TSSLSocket::peek() {
default:;// do nothing
}
string errors;
- buildErrors(errors, errno_copy);
+ buildErrors(errors, errno_copy, error);
throw TSSLException("SSL_peek: " + errors);
} else if (rc == 0) {
ERR_clear_error();
@@ -325,12 +325,14 @@ void TSSLSocket::close() {
if (ssl_ != NULL) {
try {
int rc;
+ int errno_copy = 0;
+ int error = 0;
do {
rc = SSL_shutdown(ssl_);
if (rc <= 0) {
- int errno_copy = THRIFT_GET_SOCKET_ERROR;
- int error = SSL_get_error(ssl_, rc);
+ errno_copy = THRIFT_GET_SOCKET_ERROR;
+ error = SSL_get_error(ssl_, rc);
switch (error) {
case SSL_ERROR_SYSCALL:
if ((errno_copy != THRIFT_EINTR)
@@ -348,9 +350,8 @@ void TSSLSocket::close() {
} while (rc == 2);
if (rc < 0) {
- int errno_copy = THRIFT_GET_SOCKET_ERROR;
string errors;
- buildErrors(errors, errno_copy);
+ buildErrors(errors, errno_copy, error);
GlobalOutput(("SSL_shutdown: " + errors).c_str());
}
} catch (TTransportException& te) {
@@ -380,17 +381,19 @@ uint32_t TSSLSocket::read(uint8_t* buf, uint32_t len) {
throw TTransportException(TTransportException::UNKNOWN, "retry again");
int32_t bytes = 0;
while (readRetryCount_ < maxRecvRetries_) {
- ERR_clear_error();
bytes = SSL_read(ssl_, buf, len);
+ int32_t errno_copy = THRIFT_GET_SOCKET_ERROR;
int32_t error = SSL_get_error(ssl_, bytes);
readRetryCount_++;
- if (bytes >= 0 && error == 0) {
+ if (error == SSL_ERROR_NONE) {
readRetryCount_ = 0;
break;
}
- int32_t errno_copy = THRIFT_GET_SOCKET_ERROR;
unsigned int waitEventReturn;
switch (error) {
+ case SSL_ERROR_ZERO_RETURN:
+ throw TTransportException(TTransportException::END_OF_FILE, "client disconnected");
+
case SSL_ERROR_SYSCALL:
if ((errno_copy != THRIFT_EINTR)
&& (errno_copy != THRIFT_EAGAIN)) {
@@ -422,9 +425,9 @@ uint32_t TSSLSocket::read(uint8_t* buf, uint32_t len) {
throw TTransportException(TTransportException::INTERNAL_ERROR, "too much recv retries");
}
else if (waitEventReturn == TSSL_DATA) {
- // in case of SSL and huge thrift packets, there may be a number of
- // socket operations, before any data becomes available by SSL_read().
- // Therefore the number of retries should not be increased and
+ // in case of SSL and huge thrift packets, there may be a number of
+ // socket operations, before any data becomes available by SSL_read().
+ // Therefore the number of retries should not be increased and
// the operation should be repeated.
readRetryCount_--;
continue;
@@ -433,7 +436,7 @@ uint32_t TSSLSocket::read(uint8_t* buf, uint32_t len) {
default:;// do nothing
}
string errors;
- buildErrors(errors, errno_copy);
+ buildErrors(errors, errno_copy, error);
throw TSSLException("SSL_read: " + errors);
}
return bytes;
@@ -470,7 +473,7 @@ void TSSLSocket::write(const uint8_t* buf, uint32_t len) {
default:;// do nothing
}
string errors;
- buildErrors(errors, errno_copy);
+ buildErrors(errors, errno_copy, error);
throw TSSLException("SSL_write: " + errors);
}
written += bytes;
@@ -514,7 +517,7 @@ uint32_t TSSLSocket::write_partial(const uint8_t* buf, uint32_t len) {
default:;// do nothing
}
string errors;
- buildErrors(errors, errno_copy);
+ buildErrors(errors, errno_copy, error);
throw TSSLException("SSL_write: " + errors);
}
written += bytes;
@@ -574,12 +577,14 @@ void TSSLSocket::initializeHandshake() {
}
int rc;
+ int errno_copy = 0;
+ int error = 0;
if (server()) {
do {
rc = SSL_accept(ssl_);
if (rc <= 0) {
- int errno_copy = THRIFT_GET_SOCKET_ERROR;
- int error = SSL_get_error(ssl_, rc);
+ errno_copy = THRIFT_GET_SOCKET_ERROR;
+ error = SSL_get_error(ssl_, rc);
switch (error) {
case SSL_ERROR_SYSCALL:
if ((errno_copy != THRIFT_EINTR)
@@ -610,8 +615,8 @@ void TSSLSocket::initializeHandshake() {
do {
rc = SSL_connect(ssl_);
if (rc <= 0) {
- int errno_copy = THRIFT_GET_SOCKET_ERROR;
- int error = SSL_get_error(ssl_, rc);
+ errno_copy = THRIFT_GET_SOCKET_ERROR;
+ error = SSL_get_error(ssl_, rc);
switch (error) {
case SSL_ERROR_SYSCALL:
if ((errno_copy != THRIFT_EINTR)
@@ -635,10 +640,9 @@ void TSSLSocket::initializeHandshake() {
} while (rc == 2);
}
if (rc <= 0) {
- int errno_copy = THRIFT_GET_SOCKET_ERROR;
string fname(server() ? "SSL_accept" : "SSL_connect");
string errors;
- buildErrors(errors, errno_copy);
+ buildErrors(errors, errno_copy, error);
throw TSSLException(fname + ": " + errors);
}
authorize();
@@ -975,7 +979,7 @@ int TSSLSocketFactory::passwordCallback(char* password, int size, int, void* dat
}
// extract error messages from error queue
-void buildErrors(string& errors, int errno_copy) {
+void buildErrors(string& errors, int errno_copy, int sslerrno) {
unsigned long errorCode;
char message[256];
@@ -999,6 +1003,9 @@ void buildErrors(string& errors, int errno_copy) {
if (errors.empty()) {
errors = "error code: " + to_string(errno_copy);
}
+ if (sslerrno) {
+ errors += " (SSL_error_code = " + to_string(sslerrno) + ")";
+ }
}
/**
http://git-wip-us.apache.org/repos/asf/thrift/blob/58402ff6/lib/csharp/test/ThriftMVCTest/Controllers/HomeController.cs
----------------------------------------------------------------------
diff --git a/lib/csharp/test/ThriftMVCTest/Controllers/HomeController.cs b/lib/csharp/test/ThriftMVCTest/Controllers/HomeController.cs
index ab9eada..c9a1ec4 100644
--- a/lib/csharp/test/ThriftMVCTest/Controllers/HomeController.cs
+++ b/lib/csharp/test/ThriftMVCTest/Controllers/HomeController.cs
@@ -41,9 +41,8 @@ namespace ThriftMVCTest.Controllers
SecondService.IAsync asyncService =
new SecondService.Client(new TBinaryProtocol(new THttpClient(new Uri(baseUri, "Async.thrift"))));
- await asyncService.blahBlahAsync();
var result = await asyncService.secondtestStringAsync("TestString");
- if (result != "TestString")
+ if (result != "testString(\"TestString\")")
{
throw new Exception("The wrong result was returned");
}
@@ -59,9 +58,8 @@ namespace ThriftMVCTest.Controllers
SecondService.ISync service =
new SecondService.Client(new TBinaryProtocol(new THttpClient(new Uri(baseUri, "Sync.thrift"))));
- service.blahBlah();
var result = service.secondtestString("TestString");
- if (result != "TestString")
+ if (result != "testString(\"TestString\")")
{
throw new Exception("The wrong result was returned");
}
@@ -69,4 +67,4 @@ namespace ThriftMVCTest.Controllers
return RedirectToAction("Index");
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/thrift/blob/58402ff6/lib/csharp/test/ThriftMVCTest/SecondServiceImpl.cs
----------------------------------------------------------------------
diff --git a/lib/csharp/test/ThriftMVCTest/SecondServiceImpl.cs b/lib/csharp/test/ThriftMVCTest/SecondServiceImpl.cs
index dce0148..fad301a 100644
--- a/lib/csharp/test/ThriftMVCTest/SecondServiceImpl.cs
+++ b/lib/csharp/test/ThriftMVCTest/SecondServiceImpl.cs
@@ -24,24 +24,14 @@ namespace ThriftMVCTest
{
public class SecondServiceImpl : SecondService.IAsync, SecondService.ISync
{
- public Task blahBlahAsync()
- {
- return Task.FromResult(0);
- }
-
public Task<string> secondtestStringAsync(string thing)
{
return Task.FromResult(thing);
}
- public void blahBlah()
- {
-
- }
-
public string secondtestString(string thing)
{
- return thing;
+ return "testString(\"" + thing + "\")";
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/thrift/blob/58402ff6/lib/erl/test/thrift_test_test.erl
----------------------------------------------------------------------
diff --git a/lib/erl/test/thrift_test_test.erl b/lib/erl/test/thrift_test_test.erl
index ae20f31..77df61d 100644
--- a/lib/erl/test/thrift_test_test.erl
+++ b/lib/erl/test/thrift_test_test.erl
@@ -628,18 +628,6 @@ service_info_test_() ->
{struct, []},
thrift_test_thrift:function_info(testOneway, exceptions)
)},
- {"blahBlah params", ?_assertEqual(
- {struct, []},
- second_service_thrift:function_info(blahBlah, params_type)
- )},
- {"blahBlah reply", ?_assertEqual(
- {struct, []},
- second_service_thrift:function_info(blahBlah, reply_type)
- )},
- {"blahBlah exceptions", ?_assertEqual(
- {struct, []},
- second_service_thrift:function_info(blahBlah, exceptions)
- )},
{"secondtestString params", ?_assertEqual(
{struct, [{1, string}]},
second_service_thrift:function_info(secondtestString, params_type)
http://git-wip-us.apache.org/repos/asf/thrift/blob/58402ff6/lib/java/test/org/apache/thrift/test/TestClient.java
----------------------------------------------------------------------
diff --git a/lib/java/test/org/apache/thrift/test/TestClient.java b/lib/java/test/org/apache/thrift/test/TestClient.java
index b2ce1e6..feaa972 100644
--- a/lib/java/test/org/apache/thrift/test/TestClient.java
+++ b/lib/java/test/org/apache/thrift/test/TestClient.java
@@ -33,6 +33,7 @@ import org.apache.thrift.TSerializer;
import org.apache.thrift.protocol.TBinaryProtocol;
import org.apache.thrift.protocol.TCompactProtocol;
import org.apache.thrift.protocol.TJSONProtocol;
+import org.apache.thrift.protocol.TMultiplexedProtocol;
import org.apache.thrift.protocol.TProtocol;
import org.apache.thrift.protocol.TSimpleJSONProtocol;
import org.apache.thrift.transport.TFastFramedTransport;
@@ -46,6 +47,7 @@ import org.apache.thrift.transport.TTransportException;
// Generated code
import thrift.test.Insanity;
import thrift.test.Numberz;
+import thrift.test.SecondService;
import thrift.test.ThriftTest;
import thrift.test.Xception;
import thrift.test.Xception2;
@@ -64,6 +66,7 @@ public class TestClient {
private static int ERR_STRUCTS = 2;
private static int ERR_CONTAINERS = 4;
private static int ERR_EXCEPTIONS = 8;
+ private static int ERR_PROTOCOLS = 16;
private static int ERR_UNKNOWN = 64;
public static void main(String [] args) {
@@ -102,7 +105,7 @@ public class TestClient {
System.out.println(" --host=arg (=" + host + ")\tHost to connect");
System.out.println(" --port=arg (=" + port + ")\tPort number to connect");
System.out.println(" --transport=arg (=" + transport_type + ")\n\t\t\t\tTransport: buffered, framed, fastframed, http");
- System.out.println(" --protocol=arg (=" + protocol_type + ")\tProtocol: binary, json, compact");
+ System.out.println(" --protocol=arg (=" + protocol_type + ")\tProtocol: binary, compact, json, multi, multic, multij");
System.out.println(" --ssl\t\t\tEncrypted Transport using SSL");
System.out.println(" --testloops[--n]=arg (=" + numTests + ")\tNumber of Tests");
System.exit(0);
@@ -117,6 +120,9 @@ public class TestClient {
if (protocol_type.equals("binary")) {
} else if (protocol_type.equals("compact")) {
} else if (protocol_type.equals("json")) {
+ } else if (protocol_type.equals("multi")) {
+ } else if (protocol_type.equals("multic")) {
+ } else if (protocol_type.equals("multij")) {
} else {
throw new Exception("Unknown protocol type! " + protocol_type);
}
@@ -163,16 +169,21 @@ public class TestClient {
}
TProtocol tProtocol = null;
- if (protocol_type.equals("json")) {
+ TProtocol tProtocol2 = null;
+ if (protocol_type.equals("json") || protocol_type.equals("multij")) {
tProtocol = new TJSONProtocol(transport);
- } else if (protocol_type.equals("compact")) {
+ } else if (protocol_type.equals("compact") || protocol_type.equals("multic")) {
tProtocol = new TCompactProtocol(transport);
} else {
tProtocol = new TBinaryProtocol(transport);
}
- ThriftTest.Client testClient =
- new ThriftTest.Client(tProtocol);
+ if (protocol_type.startsWith("multi")) {
+ tProtocol2 = new TMultiplexedProtocol(tProtocol, "SecondService");
+ tProtocol = new TMultiplexedProtocol(tProtocol, "ThriftTest");
+ }
+
+ ThriftTest.Client testClient = new ThriftTest.Client(tProtocol);
Insanity insane = new Insanity();
long timeMin = 0;
@@ -223,6 +234,19 @@ public class TestClient {
}
/**
+ * Multiplexed test
+ */
+ if (protocol_type.startsWith("multi")) {
+ SecondService.Client secondClient = new SecondService.Client(tProtocol2);
+ System.out.print("secondtestString(\"Test2\")");
+ s = secondClient.secondtestString("Test2");
+ System.out.print(" = \"" + s + "\"\n");
+ if (!s.equals("testString(\"Test2\")")) {
+ returnCode |= ERR_PROTOCOLS;
+ System.out.println("*** FAILURE ***\n");
+ }
+ }
+ /**
* BYTE TEST
*/
System.out.print("testByte(1)");
http://git-wip-us.apache.org/repos/asf/thrift/blob/58402ff6/lib/java/test/org/apache/thrift/test/TestServer.java
----------------------------------------------------------------------
diff --git a/lib/java/test/org/apache/thrift/test/TestServer.java b/lib/java/test/org/apache/thrift/test/TestServer.java
index 71b86c3..1f3e555 100644
--- a/lib/java/test/org/apache/thrift/test/TestServer.java
+++ b/lib/java/test/org/apache/thrift/test/TestServer.java
@@ -73,10 +73,6 @@ public class TestServer {
static class SecondHandler implements thrift.test.SecondService.Iface {
@Override
- public void blahBlah() throws org.apache.thrift.TException
- { throw new org.apache.thrift.TException("blahBlah"); }
-
- @Override
public java.lang.String secondtestString(java.lang.String thing) throws org.apache.thrift.TException
{ return "testString(\"" + thing + "\")"; }
http://git-wip-us.apache.org/repos/asf/thrift/blob/58402ff6/lib/nodejs/test/client.js
----------------------------------------------------------------------
diff --git a/lib/nodejs/test/client.js b/lib/nodejs/test/client.js
index 9609518..006fad2 100644
--- a/lib/nodejs/test/client.js
+++ b/lib/nodejs/test/client.js
@@ -108,7 +108,7 @@ if (type === 'tcp') {
connection.on('connect', function() {
secondclient.secondtestString("Test", function(err, response) {
assert(!err);
- assert.equal("Test", response);
+ assert.equal("testString(\"Test\")", response);
});
runTests();
http://git-wip-us.apache.org/repos/asf/thrift/blob/58402ff6/lib/nodejs/test/server.js
----------------------------------------------------------------------
diff --git a/lib/nodejs/test/server.js b/lib/nodejs/test/server.js
index bad3b17..8f2e06b 100644
--- a/lib/nodejs/test/server.js
+++ b/lib/nodejs/test/server.js
@@ -72,8 +72,8 @@ if (type === 'http' || type ==='websocket') {
if (type === 'multiplex') {
var SecondServiceHandler = {
secondtestString: function(thing, result) {
- console.log('testString(\'' + thing + '\')');
- result(null, thing);
+ console.log('testString("' + thing + '")');
+ result(null, 'testString("' + thing + '")');
}
};
http://git-wip-us.apache.org/repos/asf/thrift/blob/58402ff6/test/ThriftTest.thrift
----------------------------------------------------------------------
diff --git a/test/ThriftTest.thrift b/test/ThriftTest.thrift
index c56f571..24dcbb9 100644
--- a/test/ThriftTest.thrift
+++ b/test/ThriftTest.thrift
@@ -321,13 +321,12 @@ service ThriftTest
service SecondService
{
- void blahBlah()
/**
* Prints 'testString("%s")' with thing as '%s'
* @param string thing - the string to print
* @return string - returns the string 'thing'
*/
- string secondtestString(1: string thing),
+ string secondtestString(1: string thing)
}
struct VersioningTestV1 {
http://git-wip-us.apache.org/repos/asf/thrift/blob/58402ff6/test/c_glib/src/thrift_second_service_handler.c
----------------------------------------------------------------------
diff --git a/test/c_glib/src/thrift_second_service_handler.c b/test/c_glib/src/thrift_second_service_handler.c
index c464372..66ac7bc 100644
--- a/test/c_glib/src/thrift_second_service_handler.c
+++ b/test/c_glib/src/thrift_second_service_handler.c
@@ -50,17 +50,6 @@ second_service_handler_secondtest_string (TTestSecondServiceIf *iface,
return TRUE;
}
-gboolean
-second_service_handler_blah_blah (TTestSecondServiceIf *iface, GError **error)
-{
- THRIFT_UNUSED_VAR (iface);
- THRIFT_UNUSED_VAR (error);
-
- printf ("blahBlah()\n");
-
- return TRUE;
-}
-
static void
second_service_handler_init (SecondServiceHandler *self)
{
@@ -76,7 +65,5 @@ second_service_handler_class_init (SecondServiceHandlerClass *klass)
base_class->secondtest_string =
second_service_handler_secondtest_string;
- base_class->blah_blah =
- second_service_handler_blah_blah;
}
http://git-wip-us.apache.org/repos/asf/thrift/blob/58402ff6/test/cpp/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/test/cpp/CMakeLists.txt b/test/cpp/CMakeLists.txt
index 1facfa4..cdd63db 100755
--- a/test/cpp/CMakeLists.txt
+++ b/test/cpp/CMakeLists.txt
@@ -34,6 +34,7 @@ include_directories("${CMAKE_CURRENT_BINARY_DIR}/gen-cpp")
include_directories("${PROJECT_SOURCE_DIR}/lib/cpp/src")
set(crosstestgencpp_SOURCES
+ gen-cpp/SecondService.cpp
gen-cpp/ThriftTest.cpp
gen-cpp/ThriftTest_types.cpp
gen-cpp/ThriftTest_constants.cpp
@@ -44,7 +45,7 @@ LINK_AGAINST_THRIFT_LIBRARY(crosstestgencpp thrift)
set(crossstressgencpp_SOURCES
gen-cpp/Service.cpp
- #gen-cpp/StressTest_types.cpp #basically empty, so omitting
+ gen-cpp/StressTest_types.cpp
gen-cpp/StressTest_constants.cpp
)
add_library(crossstressgencpp STATIC ${crossstressgencpp_SOURCES})
@@ -79,7 +80,7 @@ add_test(NAME StressTestNonBlocking COMMAND StressTestNonBlocking)
# Common thrift code generation rules
#
-add_custom_command(OUTPUT gen-cpp/ThriftTest.cpp gen-cpp/ThriftTest_types.cpp gen-cpp/ThriftTest_constants.cpp
+add_custom_command(OUTPUT gen-cpp/SecondService.cpp gen-cpp/SecondService.h gen-cpp/ThriftTest.cpp gen-cpp/ThriftTest.h gen-cpp/ThriftTest_types.cpp gen-cpp/ThriftTest_constants.cpp
COMMAND ${THRIFT_COMPILER} --gen cpp:templates,cob_style -r ${PROJECT_SOURCE_DIR}/test/ThriftTest.thrift
)
http://git-wip-us.apache.org/repos/asf/thrift/blob/58402ff6/test/cpp/Makefile.am
----------------------------------------------------------------------
diff --git a/test/cpp/Makefile.am b/test/cpp/Makefile.am
index 359e7e6..e8be80a 100755
--- a/test/cpp/Makefile.am
+++ b/test/cpp/Makefile.am
@@ -21,12 +21,16 @@ AUTOMAKE_OPTIONS = subdir-objects serial-tests
BUILT_SOURCES = gen-cpp/ThriftTest.cpp \
gen-cpp/ThriftTest_types.cpp \
gen-cpp/ThriftTest_constants.cpp \
+ gen-cpp/SecondService.cpp \
gen-cpp/StressTest_types.cpp \
gen-cpp/StressTest_constants.cpp \
gen-cpp/Service.cpp
noinst_LTLIBRARIES = libtestgencpp.la libstresstestgencpp.la
nodist_libtestgencpp_la_SOURCES = \
+ gen-cpp/SecondService.cpp \
+ gen-cpp/SecondService.h \
+ gen-cpp/SecondService.tcc \
gen-cpp/ThriftTest_constants.cpp \
gen-cpp/ThriftTest_constants.h \
gen-cpp/ThriftTest_types.cpp \
@@ -98,7 +102,7 @@ StressTestNonBlocking_LDADD = \
#
# Common thrift code generation rules
#
-gen-cpp/ThriftTest.cpp gen-cpp/ThriftTest_types.cpp gen-cpp/ThriftTest_constants.cpp: $(top_srcdir)/test/ThriftTest.thrift $(THRIFT)
+gen-cpp/ThriftTest.cpp gen-cpp/ThriftTest_types.cpp gen-cpp/ThriftTest_constants.cpp gen-cpp/SecondService.cpp gen-cpp/SecondService.h gen-cpp/SecondService.tcc: $(top_srcdir)/test/ThriftTest.thrift $(THRIFT)
$(THRIFT) --gen cpp:templates,cob_style -r $<
gen-cpp/StressTest_types.cpp gen-cpp/StressTest_constants.cpp gen-cpp/Service.cpp: $(top_srcdir)/test/StressTest.thrift $(THRIFT)
http://git-wip-us.apache.org/repos/asf/thrift/blob/58402ff6/test/cpp/src/TestClient.cpp
----------------------------------------------------------------------
diff --git a/test/cpp/src/TestClient.cpp b/test/cpp/src/TestClient.cpp
index 6b2e731..6e7ff8e 100644
--- a/test/cpp/src/TestClient.cpp
+++ b/test/cpp/src/TestClient.cpp
@@ -26,6 +26,7 @@
#include <thrift/protocol/TCompactProtocol.h>
#include <thrift/protocol/THeaderProtocol.h>
#include <thrift/protocol/TJSONProtocol.h>
+#include <thrift/protocol/TMultiplexedProtocol.h>
#include <thrift/transport/THttpClient.h>
#include <thrift/transport/TTransportUtils.h>
#include <thrift/transport/TSocket.h>
@@ -40,13 +41,15 @@
#include <inttypes.h>
#endif
-#include <boost/program_options.hpp>
+#include <boost/algorithm/string.hpp>
#include <boost/filesystem.hpp>
+#include <boost/program_options.hpp>
#include <thrift/stdcxx.h>
#if _WIN32
#include <thrift/windows/TWinsockSingleton.h>
#endif
+#include "SecondService.h"
#include "ThriftTest.h"
using namespace std;
@@ -156,28 +159,33 @@ int main(int argc, char** argv) {
int return_code = 0;
boost::program_options::options_description desc("Allowed options");
- desc.add_options()("help,h",
- "produce help message")("host",
- boost::program_options::value<string>(&host)
- ->default_value(host),
- "Host to connect")("port",
- boost::program_options::value<int>(
- &port)->default_value(port),
- "Port number to connect")(
- "domain-socket",
- boost::program_options::value<string>(&domain_socket)->default_value(domain_socket),
- "Domain Socket (e.g. /tmp/ThriftTest.thrift), instead of host and port")(
- "abstract-namespace",
- "Look for the domain socket in the Abstract Namespace (no connection with filesystem pathnames)")(
- "transport",
- boost::program_options::value<string>(&transport_type)->default_value(transport_type),
- "Transport: buffered, framed, http, evhttp")(
- "protocol",
- boost::program_options::value<string>(&protocol_type)->default_value(protocol_type),
- "Protocol: binary, header, compact, json")("ssl", "Encrypted Transport using SSL")(
- "testloops,n",
- boost::program_options::value<int>(&numTests)->default_value(numTests),
- "Number of Tests")("noinsane", "Do not run insanity test");
+ desc.add_options()
+ ("help,h", "produce help message")
+ ("host",
+ boost::program_options::value<string>(&host)->default_value(host),
+ "Host to connect")
+ ("port",
+ boost::program_options::value<int>(&port)->default_value(port),
+ "Port number to connect")
+ ("domain-socket",
+ boost::program_options::value<string>(&domain_socket)->default_value(domain_socket),
+ "Domain Socket (e.g. /tmp/ThriftTest.thrift), instead of host and port")
+ ("abstract-namespace",
+ "Look for the domain socket in the Abstract Namespace"
+ " (no connection with filesystem pathnames)")
+ ("transport",
+ boost::program_options::value<string>(&transport_type)->default_value(transport_type),
+ "Transport: buffered, framed, http, evhttp")
+ ("protocol",
+ boost::program_options::value<string>(&protocol_type)->default_value(protocol_type),
+ "Protocol: binary, compact, header, json, multi, multic, multih, multij")
+ ("ssl",
+ "Encrypted Transport using SSL")
+ ("testloops,n",
+ boost::program_options::value<int>(&numTests)->default_value(numTests),
+ "Number of Tests")
+ ("noinsane",
+ "Do not run insanity test");
boost::program_options::variables_map vm;
boost::program_options::store(boost::program_options::parse_command_line(argc, argv, desc), vm);
@@ -194,6 +202,10 @@ int main(int argc, char** argv) {
} else if (protocol_type == "compact") {
} else if (protocol_type == "header") {
} else if (protocol_type == "json") {
+ } else if (protocol_type == "multi") {
+ } else if (protocol_type == "multic") {
+ } else if (protocol_type == "multih") {
+ } else if (protocol_type == "multij") {
} else {
throw invalid_argument("Unknown protocol type " + protocol_type);
}
@@ -232,6 +244,7 @@ int main(int argc, char** argv) {
stdcxx::shared_ptr<TSocket> socket;
stdcxx::shared_ptr<TTransport> transport;
stdcxx::shared_ptr<TProtocol> protocol;
+ stdcxx::shared_ptr<TProtocol> protocol2; // SecondService for multiplexed
if (ssl) {
cout << "Client Certificate File: " << certPath << endl;
@@ -271,18 +284,20 @@ int main(int argc, char** argv) {
transport = bufferedSocket;
}
- if (protocol_type.compare("json") == 0) {
- stdcxx::shared_ptr<TProtocol> jsonProtocol(new TJSONProtocol(transport));
- protocol = jsonProtocol;
- } else if (protocol_type.compare("compact") == 0) {
- stdcxx::shared_ptr<TProtocol> compactProtocol(new TCompactProtocol(transport));
- protocol = compactProtocol;
- } else if (protocol_type == "header") {
- stdcxx::shared_ptr<TProtocol> headerProtocol(new THeaderProtocol(transport));
- protocol = headerProtocol;
+ if (protocol_type == "json" || protocol_type == "multij") {
+ protocol = stdcxx::make_shared<TJSONProtocol>(transport);
+ } else if (protocol_type == "compact" || protocol_type == "multic") {
+ protocol = stdcxx::make_shared<TCompactProtocol>(transport);
+ } else if (protocol_type == "header" || protocol_type == "multih") {
+ protocol = stdcxx::make_shared<THeaderProtocol>(transport);
} else {
- stdcxx::shared_ptr<TBinaryProtocol> binaryProtocol(new TBinaryProtocol(transport));
- protocol = binaryProtocol;
+ protocol = stdcxx::make_shared<TBinaryProtocol>(transport);
+ }
+
+ if (boost::starts_with(protocol_type, "multi")) {
+ protocol2 = stdcxx::make_shared<TMultiplexedProtocol>(protocol, "SecondService");
+ // we don't need access to the original protocol any more, so...
+ protocol = stdcxx::make_shared<TMultiplexedProtocol>(protocol, "ThriftTest");
}
// Connection info
@@ -367,6 +382,25 @@ int main(int argc, char** argv) {
return_code |= ERR_BASETYPES;
}
+ //
+ // Multiplexed protocol - call another service method
+ // in the middle of the ThriftTest
+ //
+ if (boost::starts_with(protocol_type, "multi")) {
+ SecondServiceClient ssc(protocol2);
+ // transport is already open...
+
+ try {
+ cout << "secondService.secondTestString(\"foo\") => " << flush;
+ std::string result;
+ ssc.secondtestString(result, "foo");
+ cout << "{" << result << "}" << endl;
+ } catch (std::exception& e) {
+ cout << " *** FAILED *** " << e.what() << endl;
+ return_code |= ERR_EXCEPTIONS;
+ }
+ }
+
try {
#ifdef _MSC_VER
#pragma warning( push )
@@ -1096,12 +1130,14 @@ int main(int argc, char** argv) {
/**
* I32 TEST
*/
- cout << "re-test testI32(-1)";
+ cout << "re-test testI32(-1)" << flush;
int i32 = testClient.testI32(-1);
cout << " = " << i32 << endl;
if (i32 != -1)
return_code |= ERR_BASETYPES;
+ cout << endl << "All tests done." << endl << flush;
+
uint64_t stop = now();
uint64_t tot = stop - start;
@@ -1115,10 +1151,10 @@ int main(int argc, char** argv) {
time_max = tot;
}
+ cout << flush;
transport->close();
}
- cout << endl << "All tests done." << endl;
uint64_t time_avg = time_tot / numTests;
http://git-wip-us.apache.org/repos/asf/thrift/blob/58402ff6/test/cpp/src/TestServer.cpp
----------------------------------------------------------------------
diff --git a/test/cpp/src/TestServer.cpp b/test/cpp/src/TestServer.cpp
index 37d0eb6..744a86c 100644
--- a/test/cpp/src/TestServer.cpp
+++ b/test/cpp/src/TestServer.cpp
@@ -17,26 +17,29 @@
* under the License.
*/
-#include <thrift/concurrency/ThreadManager.h>
+#include <thrift/async/TAsyncBufferProcessor.h>
+#include <thrift/async/TAsyncProtocolProcessor.h>
+#include <thrift/async/TEvhttpServer.h>
#include <thrift/concurrency/PlatformThreadFactory.h>
+#include <thrift/concurrency/ThreadManager.h>
+#include <thrift/processor/TMultiplexedProcessor.h>
#include <thrift/protocol/TBinaryProtocol.h>
#include <thrift/protocol/TCompactProtocol.h>
#include <thrift/protocol/THeaderProtocol.h>
#include <thrift/protocol/TJSONProtocol.h>
+#include <thrift/server/TNonblockingServer.h>
#include <thrift/server/TSimpleServer.h>
-#include <thrift/server/TThreadedServer.h>
#include <thrift/server/TThreadPoolServer.h>
-#include <thrift/async/TEvhttpServer.h>
-#include <thrift/async/TAsyncBufferProcessor.h>
-#include <thrift/async/TAsyncProtocolProcessor.h>
-#include <thrift/server/TNonblockingServer.h>
-#include <thrift/transport/TServerSocket.h>
-#include <thrift/transport/TSSLServerSocket.h>
-#include <thrift/transport/TSSLSocket.h>
-#include <thrift/transport/TNonblockingServerSocket.h>
+#include <thrift/server/TThreadedServer.h>
#include <thrift/transport/THttpServer.h>
#include <thrift/transport/THttpTransport.h>
+#include <thrift/transport/TNonblockingServerSocket.h>
+#include <thrift/transport/TSSLServerSocket.h>
+#include <thrift/transport/TSSLSocket.h>
+#include <thrift/transport/TServerSocket.h>
#include <thrift/transport/TTransportUtils.h>
+
+#include "SecondService.h"
#include "ThriftTest.h"
#ifdef HAVE_STDINT_H
@@ -50,6 +53,7 @@
#include <stdexcept>
#include <sstream>
+#include <boost/algorithm/string.hpp>
#include <boost/program_options.hpp>
#include <boost/filesystem.hpp>
#include <thrift/stdcxx.h>
@@ -331,13 +335,18 @@ public:
}
}
- void testOneway(const int32_t sleepFor) {
- printf("testOneway(%d): Sleeping...\n", sleepFor);
- THRIFT_SLEEP_SEC(sleepFor);
- printf("testOneway(%d): done sleeping!\n", sleepFor);
+ void testOneway(const int32_t aNum) {
+ printf("testOneway(%d): call received\n", aNum);
}
};
+class SecondHandler : public SecondServiceIf
+{
+ public:
+ void secondtestString(std::string& result, const std::string& thing)
+ { result = "testString(\"" + thing + "\")"; }
+};
+
class TestProcessorEventHandler : public TProcessorEventHandler {
virtual void* getContext(const char* fn_name, void* serverContext) {
(void)serverContext;
@@ -565,7 +574,7 @@ int main(int argc, char** argv) {
("abstract-namespace", "Create the domain socket in the Abstract Namespace (no connection with filesystem pathnames)")
("server-type", po::value<string>(&server_type)->default_value(server_type), "type of server, \"simple\", \"thread-pool\", \"threaded\", or \"nonblocking\"")
("transport", po::value<string>(&transport_type)->default_value(transport_type), "transport: buffered, framed, http")
- ("protocol", po::value<string>(&protocol_type)->default_value(protocol_type), "protocol: binary, compact, header, json")
+ ("protocol", po::value<string>(&protocol_type)->default_value(protocol_type), "protocol: binary, compact, header, json, multi, multic, multih, multij")
("ssl", "Encrypted Transport using SSL")
("processor-events", "processor-events")
("workers,n", po::value<size_t>(&workers)->default_value(workers), "Number of thread pools workers. Only valid for thread-pool server type")
@@ -597,6 +606,10 @@ int main(int argc, char** argv) {
} else if (protocol_type == "compact") {
} else if (protocol_type == "json") {
} else if (protocol_type == "header") {
+ } else if (protocol_type == "multi") { // multiplexed binary
+ } else if (protocol_type == "multic") { // multiplexed compact
+ } else if (protocol_type == "multih") { // multiplexed header
+ } else if (protocol_type == "multij") { // multiplexed json
} else {
throw invalid_argument("Unknown protocol type " + protocol_type);
}
@@ -627,15 +640,15 @@ int main(int argc, char** argv) {
// Dispatcher
stdcxx::shared_ptr<TProtocolFactory> protocolFactory;
- if (protocol_type == "json") {
+ if (protocol_type == "json" || protocol_type == "multij") {
stdcxx::shared_ptr<TProtocolFactory> jsonProtocolFactory(new TJSONProtocolFactory());
protocolFactory = jsonProtocolFactory;
- } else if (protocol_type == "compact") {
+ } else if (protocol_type == "compact" || protocol_type == "multic") {
TCompactProtocolFactoryT<TBufferBase> *compactProtocolFactory = new TCompactProtocolFactoryT<TBufferBase>();
compactProtocolFactory->setContainerSizeLimit(container_limit);
compactProtocolFactory->setStringSizeLimit(string_limit);
protocolFactory.reset(compactProtocolFactory);
- } else if (protocol_type == "header") {
+ } else if (protocol_type == "header" || protocol_type == "multih") {
stdcxx::shared_ptr<TProtocolFactory> headerProtocolFactory(new THeaderProtocolFactory());
protocolFactory = headerProtocolFactory;
} else {
@@ -645,9 +658,9 @@ int main(int argc, char** argv) {
protocolFactory.reset(binaryProtocolFactory);
}
- // Processor
+ // Processors
stdcxx::shared_ptr<TestHandler> testHandler(new TestHandler());
- stdcxx::shared_ptr<ThriftTestProcessor> testProcessor(new ThriftTestProcessor(testHandler));
+ stdcxx::shared_ptr<TProcessor> testProcessor(new ThriftTestProcessor(testHandler));
if (vm.count("processor-events")) {
testProcessor->setEventHandler(
@@ -706,6 +719,18 @@ int main(int argc, char** argv) {
}
cout << endl;
+ // Multiplexed Processor if needed
+ if (boost::starts_with(protocol_type, "multi")) {
+ stdcxx::shared_ptr<SecondHandler> secondHandler(new SecondHandler());
+ stdcxx::shared_ptr<SecondServiceProcessor> secondProcessor(new SecondServiceProcessor(secondHandler));
+
+ stdcxx::shared_ptr<TMultiplexedProcessor> multiplexedProcessor(new TMultiplexedProcessor());
+ multiplexedProcessor->registerDefault(testProcessor); // non-multi clients go to the default processor (multi:binary, multic:compact, ...)
+ multiplexedProcessor->registerProcessor("ThriftTest", testProcessor);
+ multiplexedProcessor->registerProcessor("SecondService", secondProcessor);
+ testProcessor = stdcxx::dynamic_pointer_cast<TProcessor>(multiplexedProcessor);
+ }
+
// Server
stdcxx::shared_ptr<apache::thrift::server::TServer> server;
http://git-wip-us.apache.org/repos/asf/thrift/blob/58402ff6/test/csharp/TestClient.cs
----------------------------------------------------------------------
diff --git a/test/csharp/TestClient.cs b/test/csharp/TestClient.cs
index fad1057..17e5978 100644
--- a/test/csharp/TestClient.cs
+++ b/test/csharp/TestClient.cs
@@ -33,7 +33,7 @@ namespace Test
{
public class TestClient
{
- private class TestParams
+ public class TestParams
{
public int numIterations = 1;
public string host = "localhost";
@@ -44,6 +44,7 @@ namespace Test
public bool framed;
public string protocol;
public bool encrypted = false;
+ public bool multiplexed = false;
protected bool _isFirstTransport = true;
@@ -105,21 +106,30 @@ namespace Test
private const int ErrorStructs = 2;
private const int ErrorContainers = 4;
private const int ErrorExceptions = 8;
+ private const int ErrorProtocol = 16;
private const int ErrorUnknown = 64;
private class ClientTest
{
+ private readonly TestParams param;
private readonly TTransport transport;
+ private readonly SecondService.Client second;
private readonly ThriftTest.Client client;
private readonly int numIterations;
private bool done;
public int ReturnCode { get; set; }
- public ClientTest(TestParams param)
+ public ClientTest(TestParams paramin)
{
+ param = paramin;
transport = param.CreateTransport();
- client = new ThriftTest.Client(param.CreateProtocol(transport));
+ TProtocol protocol = param.CreateProtocol(transport);
+ if (param.multiplexed)
+ {
+ second = new SecondService.Client(new TMultiplexedProtocol(protocol, "SecondService"));
+ }
+ client = new ThriftTest.Client(protocol);
numIterations = param.numIterations;
}
public void Execute()
@@ -148,7 +158,7 @@ namespace Test
try
{
- ReturnCode |= ExecuteClientTest(client);
+ ReturnCode |= ExecuteClientTest(client, second, param);
}
catch (Exception ex)
{
@@ -215,12 +225,12 @@ namespace Test
{
numThreads = Convert.ToInt32(args[++i]);
}
- else if (args[i] == "--compact" || args[i] == "--protocol=compact")
+ else if (args[i] == "--compact" || args[i] == "--protocol=compact" || args[i] == "--protocol=multic")
{
param.protocol = "compact";
Console.WriteLine("Using compact protocol");
}
- else if (args[i] == "--json" || args[i] == "--protocol=json")
+ else if (args[i] == "--json" || args[i] == "--protocol=json" || args[i] == "--protocol=multij")
{
param.protocol = "json";
Console.WriteLine("Using JSON protocol");
@@ -230,6 +240,11 @@ namespace Test
param.encrypted = true;
Console.WriteLine("Using encrypted transport");
}
+
+ if (args[i].StartsWith("--protocol=multi"))
+ {
+ param.multiplexed = true;
+ }
}
}
catch (Exception ex)
@@ -296,7 +311,7 @@ namespace Test
return retval;
}
- public static int ExecuteClientTest(ThriftTest.Client client)
+ public static int ExecuteClientTest(ThriftTest.Client client, SecondService.Client second, TestParams param)
{
int returnCode = 0;
@@ -313,6 +328,18 @@ namespace Test
returnCode |= ErrorBaseTypes;
}
+ if (param.multiplexed)
+ {
+ Console.WriteLine("secondTestString(\"Test2\")");
+ s = second.secondtestString("Test2");
+ Console.WriteLine(" = \"" + s + "\"");
+ if ("testString(\"Test2\")" != s)
+ {
+ Console.WriteLine("*** FAILED ***");
+ returnCode |= ErrorProtocol;
+ }
+ }
+
Console.Write("testBool(true)");
bool t = client.testBool((bool)true);
Console.WriteLine(" = " + t);
http://git-wip-us.apache.org/repos/asf/thrift/blob/58402ff6/test/features/known_failures_Linux.json
----------------------------------------------------------------------
diff --git a/test/features/known_failures_Linux.json b/test/features/known_failures_Linux.json
index e3575f9..f96356d 100644
--- a/test/features/known_failures_Linux.json
+++ b/test/features/known_failures_Linux.json
@@ -1,6 +1,10 @@
[
"c_glib-limit_container_length_binary_buffered-ip",
"c_glib-limit_string_length_binary_buffered-ip",
+ "cpp-theader_framed_binary_multih-header_buffered-ip",
+ "cpp-theader_framed_compact_multih-header_buffered-ip",
+ "cpp-theader_unframed_binary_multih-header_buffered-ip",
+ "cpp-theader_unframed_compact_multih-header_buffered-ip",
"csharp-limit_container_length_binary_buffered-ip",
"csharp-limit_container_length_compact_buffered-ip",
"csharp-limit_string_length_binary_buffered-ip",
@@ -33,8 +37,10 @@
"rb-limit_string_length_accel-binary_buffered-ip",
"rb-limit_string_length_binary_buffered-ip",
"rb-limit_string_length_compact_buffered-ip",
+ "rs-limit_container_length_binary_buffered-ip",
+ "rs-limit_container_length_compact_buffered-ip",
+ "rs-limit_container_length_multic-compact_buffered-ip",
"rs-limit_string_length_binary_buffered-ip",
"rs-limit_string_length_compact_buffered-ip",
- "rs-limit_container_length_binary_buffered-ip",
- "rs-limit_container_length_compact_buffered-ip"
-]
+ "rs-limit_string_length_multic-compact_buffered-ip"
+]
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/thrift/blob/58402ff6/test/known_failures_Linux.json
----------------------------------------------------------------------
diff --git a/test/known_failures_Linux.json b/test/known_failures_Linux.json
index eda5df0..ea194a1 100644
--- a/test/known_failures_Linux.json
+++ b/test/known_failures_Linux.json
@@ -1,38 +1,90 @@
[
- "cpp-cpp_binary_buffered-ip-ssl",
- "cpp-cpp_binary_framed-ip-ssl",
+ "c_glib-csharp_multi-binary_buffered-ip",
+ "c_glib-csharp_multi-binary_framed-ip",
+ "c_glib-csharp_multi_buffered-ip",
+ "c_glib-csharp_multi_framed-ip",
+ "c_glib-csharp_multic_buffered-ip",
+ "c_glib-csharp_multic-compact_buffered-ip",
+ "c_glib-csharp_multic-compact_framed-ip",
+ "c_glib-csharp_multic_framed-ip",
+ "c_glib-rs_multi_buffered-ip",
+ "c_glib-rs_multi_framed-ip",
+ "c_glib-rs_multic_buffered-ip",
+ "c_glib-rs_multic_framed-ip",
"cpp-cpp_binary_http-domain",
- "cpp-cpp_binary_http-ip-ssl",
- "cpp-cpp_compact_buffered-ip-ssl",
- "cpp-cpp_compact_framed-ip-ssl",
- "cpp-cpp_compact_http-ip-ssl",
- "cpp-cpp_header_buffered-ip-ssl",
- "cpp-cpp_header_framed-ip-ssl",
- "cpp-cpp_header_http-ip-ssl",
- "cpp-cpp_json_buffered-ip-ssl",
- "cpp-cpp_json_framed-ip-ssl",
- "cpp-cpp_json_http-ip-ssl",
+ "cpp-cpp_compact_http-domain",
+ "cpp-cpp_compact_http-ip",
+ "cpp-cpp_header_http-domain",
+ "cpp-cpp_json_http-domain",
+ "cpp-cpp_json_http-ip",
+ "cpp-cpp_multi-binary_http-domain",
+ "cpp-cpp_multi-binary_http-ip",
+ "cpp-cpp_multi_http-domain",
+ "cpp-cpp_multi_http-ip",
+ "cpp-cpp_multic-compact_http-domain",
+ "cpp-cpp_multic-compact_http-ip",
+ "cpp-cpp_multic_http-domain",
+ "cpp-cpp_multic_http-ip",
+ "cpp-cpp_multih-header_http-domain",
+ "cpp-cpp_multih-header_http-ip",
+ "cpp-cpp_multih_http-domain",
+ "cpp-cpp_multih_http-ip",
+ "cpp-cpp_multij-json_http-domain",
+ "cpp-cpp_multij-json_http-ip",
+ "cpp-cpp_multij_http-domain",
+ "cpp-cpp_multij_http-ip",
"cpp-dart_binary_http-ip",
"cpp-dart_compact_http-ip",
"cpp-dart_json_http-ip",
+ "cpp-dart_multi-binary_http-ip",
+ "cpp-dart_multic-compact_http-ip",
+ "cpp-dart_multij-json_http-ip",
"cpp-go_binary_http-ip",
"cpp-go_binary_http-ip-ssl",
"cpp-go_compact_http-ip",
"cpp-go_compact_http-ip-ssl",
"cpp-go_json_http-ip",
"cpp-go_json_http-ip-ssl",
+ "cpp-go_multi-binary_http-ip",
+ "cpp-go_multi-binary_http-ip-ssl",
+ "cpp-go_multic-compact_http-ip",
+ "cpp-go_multic-compact_http-ip-ssl",
+ "cpp-go_multij-json_http-ip",
+ "cpp-go_multij-json_http-ip-ssl",
"cpp-java_binary_http-ip",
"cpp-java_binary_http-ip-ssl",
"cpp-java_compact_http-ip",
"cpp-java_compact_http-ip-ssl",
"cpp-java_json_http-ip",
"cpp-java_json_http-ip-ssl",
+ "cpp-java_multi-binary_http-ip",
+ "cpp-java_multi-binary_http-ip-ssl",
+ "cpp-java_multi_http-ip",
+ "cpp-java_multi_http-ip-ssl",
+ "cpp-java_multic-compact_http-ip",
+ "cpp-java_multic-compact_http-ip-ssl",
+ "cpp-java_multic_http-ip",
+ "cpp-java_multic_http-ip-ssl",
+ "cpp-java_multij-json_http-ip",
+ "cpp-java_multij-json_http-ip-ssl",
+ "cpp-java_multij_http-ip",
+ "cpp-java_multij_http-ip-ssl",
"cpp-nodejs_binary_http-ip",
"cpp-nodejs_binary_http-ip-ssl",
"cpp-nodejs_compact_http-ip",
"cpp-nodejs_compact_http-ip-ssl",
"cpp-nodejs_json_http-ip",
"cpp-nodejs_json_http-ip-ssl",
+ "cpp-nodejs_multi-binary_http-ip",
+ "cpp-nodejs_multi-binary_http-ip-ssl",
+ "cpp-nodejs_multic-compact_http-ip",
+ "cpp-nodejs_multic-compact_http-ip-ssl",
+ "cpp-nodejs_multij-json_http-ip",
+ "cpp-nodejs_multij-json_http-ip-ssl",
+ "cpp-rs_multi_buffered-ip",
+ "cpp-rs_multi_framed-ip",
+ "cpp-rs_multic_buffered-ip",
+ "cpp-rs_multic_framed-ip",
"csharp-d_binary_buffered-ip-ssl",
"csharp-d_binary_framed-ip-ssl",
"csharp-d_compact_buffered-ip-ssl",
@@ -246,9 +298,19 @@
"nodejs-netcore_json_framed-ip",
"nodejs-netcore_json_framed-ip-ssl",
"rs-csharp_binary_buffered-ip",
- "rs-csharp_compact_buffered-ip",
"rs-csharp_binary_framed-ip",
+ "rs-csharp_compact_buffered-ip",
"rs-csharp_compact_framed-ip",
+ "rs-csharp_multi-binary_buffered-ip",
+ "rs-csharp_multi-binary_framed-ip",
+ "rs-csharp_multi_buffered-ip",
+ "rs-csharp_multi_framed-ip",
+ "rs-csharp_multic-compact_buffered-ip",
+ "rs-csharp_multic-compact_framed-ip",
+ "rs-csharp_multic_buffered-ip",
+ "rs-csharp_multic_framed-ip",
"rs-dart_binary_framed-ip",
- "rs-dart_compact_framed-ip"
+ "rs-dart_compact_framed-ip",
+ "rs-dart_multi-binary_framed-ip",
+ "rs-dart_multic-compact_framed-ip"
]
http://git-wip-us.apache.org/repos/asf/thrift/blob/58402ff6/test/rs/src/bin/test_client.rs
----------------------------------------------------------------------
diff --git a/test/rs/src/bin/test_client.rs b/test/rs/src/bin/test_client.rs
index d720313..7c11ad5 100644
--- a/test/rs/src/bin/test_client.rs
+++ b/test/rs/src/bin/test_client.rs
@@ -287,18 +287,6 @@ fn make_thrift_calls(
// do the multiplexed calls while making the main ThriftTest calls
if let Some(ref mut client) = second_service_client.as_mut() {
- info!("SecondService blahBlah");
- {
- let r = client.blah_blah();
- match r {
- Err(thrift::Error::Application(ref e)) => {
- info!("received an {:?}", e);
- Ok(())
- }
- _ => Err(thrift::Error::User("did not get exception".into())),
- }?;
- }
-
info!("SecondService secondtestString");
{
verify_expected_result(
http://git-wip-us.apache.org/repos/asf/thrift/blob/58402ff6/test/rs/src/bin/test_server.rs
----------------------------------------------------------------------
diff --git a/test/rs/src/bin/test_server.rs b/test/rs/src/bin/test_server.rs
index a32e938..81a2ad8 100644
--- a/test/rs/src/bin/test_server.rs
+++ b/test/rs/src/bin/test_server.rs
@@ -390,10 +390,6 @@ impl ThriftTestSyncHandler for ThriftTestSyncHandlerImpl {
struct SecondServiceSyncHandlerImpl;
impl SecondServiceSyncHandler for SecondServiceSyncHandlerImpl {
- fn handle_blah_blah(&self) -> thrift::Result<()> {
- Err(thrift::new_application_error(thrift::ApplicationErrorKind::Unknown, "blahBlah"),)
- }
-
fn handle_secondtest_string(&self, thing: String) -> thrift::Result<String> {
info!("testString({})", &thing);
let ret = format!("testString(\"{}\")", &thing);
http://git-wip-us.apache.org/repos/asf/thrift/blob/58402ff6/test/tests.json
----------------------------------------------------------------------
diff --git a/test/tests.json b/test/tests.json
index c1c3155..bde9014 100644
--- a/test/tests.json
+++ b/test/tests.json
@@ -11,9 +11,7 @@
],
"protocols": [
"binary:multi",
- "compact:multic",
- "multi",
- "multic"
+ "compact:multic"
]
},
"client": {
@@ -22,8 +20,6 @@
"--lt-debug"
],
"protocols": [
- "multi",
- "multic",
"multi:binary",
"multic:compact"
],
@@ -40,7 +36,9 @@
],
"protocols": [
"binary",
- "compact"
+ "compact",
+ "multi",
+ "multic"
],
"workdir": "c_glib"
},
@@ -124,10 +122,7 @@
"protocols": [
"binary:multi",
"compact:multic",
- "json:multij",
- "multi",
- "multic",
- "multij"
+ "json:multij"
]
},
"client": {
@@ -135,6 +130,11 @@
"extra_args": ["run-testclient"],
"transports": [
"http"
+ ],
+ "protocols": [
+ "multi:binary",
+ "multic:compact",
+ "multij:json"
]
},
"transports": [
@@ -149,7 +149,10 @@
"protocols": [
"binary",
"compact",
- "json"
+ "json",
+ "multi",
+ "multic",
+ "multij"
],
"workdir": "../lib/java"
},
@@ -298,12 +301,24 @@
"server": {
"command": [
"TestServer"
+ ],
+ "protocols": [
+ "binary:multi",
+ "compact:multic",
+ "header:multih",
+ "json:multij"
]
},
"client": {
"timeout": 8,
"command": [
"TestClient"
+ ],
+ "protocols": [
+ "multi:binary",
+ "multic:compact",
+ "multih:header",
+ "multij:json"
]
},
"transports": [
@@ -320,7 +335,11 @@
"compact",
"binary",
"json",
- "header"
+ "header",
+ "multi",
+ "multic",
+ "multih",
+ "multij"
],
"workdir": "cpp"
},
@@ -385,6 +404,12 @@
"mono",
"TestClientServer.exe",
"client"
+ ],
+ "protocols": [
+ "multi",
+ "multic",
+ "multi:binary",
+ "multic:compact"
]
},
"workdir": "csharp"
@@ -408,9 +433,9 @@
"command": [
"dotnet",
"run",
- "--no-build",
- "--no-restore",
- "--",
+ "--no-build",
+ "--no-restore",
+ "--",
"server"
]
},
@@ -419,9 +444,9 @@
"command": [
"dotnet",
"run",
- "--no-build",
- "--no-restore",
- "--",
+ "--no-build",
+ "--no-restore",
+ "--",
"client"
]
},
@@ -622,12 +647,20 @@
"server": {
"command": [
"test_server"
+ ],
+ "protocols": [
+ "binary:multi",
+ "compact:multic"
]
},
"client": {
"timeout": 6,
"command": [
"test_client"
+ ],
+ "protocols": [
+ "multi:binary",
+ "multic:compact"
]
},
"sockets": [
[31/50] [abbrv] thrift git commit: update the CONTRIBUTING readme to
point to build instructions (again)
Posted by je...@apache.org.
update the CONTRIBUTING readme to point to build instructions (again)
Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/ad2ea3da
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/ad2ea3da
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/ad2ea3da
Branch: refs/heads/0.11.0
Commit: ad2ea3daa9907433251148a4b719f5a51a060213
Parents: 388738d
Author: James E. King, III <jk...@apache.org>
Authored: Sat Nov 11 09:49:13 2017 -0500
Committer: James E. King, III <jk...@apache.org>
Committed: Sat Nov 11 09:49:13 2017 -0500
----------------------------------------------------------------------
CONTRIBUTING.md | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/thrift/blob/ad2ea3da/CONTRIBUTING.md
----------------------------------------------------------------------
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index b552ddf..d8b0a4c 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -9,7 +9,9 @@ Thank you for your interest in contributing to the Apache Thrift project! Infor
## If you want to build the project locally ##
For Windows systems, see our detailed instructions on the [CMake README](build/cmake/README.md).
-For Windows Native C++ builds, see our detailed instructions on the [WinCPP
+
+For Windows Native C++ builds, see our detailed instructions on the [WinCPP README](build/wincpp/README.md).
+
For unix systems, see our detailed instructions on the [Docker README](build/docker/README.md).
## If you want to review open issues... ##
[47/50] [abbrv] thrift git commit: THRIFT-3686 Java processor should
report internal error on uncaught exception Client: java
Posted by je...@apache.org.
THRIFT-3686 Java processor should report internal error on uncaught exception
Client: java
This closes #904
This closes #1428
Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/026c9d03
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/026c9d03
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/026c9d03
Branch: refs/heads/0.11.0
Commit: 026c9d032c4a298ecb9edbcdfb52590facb442f3
Parents: 1541f0a
Author: Nobuaki Sukegawa <ns...@apache.org>
Authored: Sat Feb 27 16:27:05 2016 +0900
Committer: James E. King, III <jk...@apache.org>
Committed: Thu Nov 30 12:43:26 2017 -0500
----------------------------------------------------------------------
.../src/org/apache/thrift/ProcessFunction.java | 28 ++++++++++++--------
.../apache/thrift/server/ServerTestBase.java | 17 +++++++-----
2 files changed, 27 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/thrift/blob/026c9d03/lib/java/src/org/apache/thrift/ProcessFunction.java
----------------------------------------------------------------------
diff --git a/lib/java/src/org/apache/thrift/ProcessFunction.java b/lib/java/src/org/apache/thrift/ProcessFunction.java
index 5c039fe..340e301 100644
--- a/lib/java/src/org/apache/thrift/ProcessFunction.java
+++ b/lib/java/src/org/apache/thrift/ProcessFunction.java
@@ -4,6 +4,7 @@ import org.apache.thrift.protocol.TMessage;
import org.apache.thrift.protocol.TMessageType;
import org.apache.thrift.protocol.TProtocol;
import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.transport.TTransportException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -30,24 +31,29 @@ public abstract class ProcessFunction<I, T extends TBase> {
return;
}
iprot.readMessageEnd();
- TBase result = null;
+ TSerializable result = null;
+ byte msgType = TMessageType.REPLY;
try {
result = getResult(iface, args);
- } catch(TException tex) {
- LOGGER.error("Internal error processing " + getMethodName(), tex);
- handleException(seqid, oprot);
- return;
- } catch(RuntimeException rex) {
- LOGGER.error("Internal error processing " + getMethodName(), rex);
- if (handleRuntimeExceptions()) {
- handleException(seqid, oprot);
+ } catch (TTransportException ex) {
+ LOGGER.error("Transport error while processing " + getMethodName(), ex);
+ throw ex;
+ } catch (TApplicationException ex) {
+ LOGGER.error("Internal application error processing " + getMethodName(), ex);
+ result = ex;
+ msgType = TMessageType.EXCEPTION;
+ } catch (Exception ex) {
+ LOGGER.error("Internal error processing " + getMethodName(), ex);
+ if(!isOneway()) {
+ result = new TApplicationException(TApplicationException.INTERNAL_ERROR,
+ "Internal error processing " + getMethodName());
+ msgType = TMessageType.EXCEPTION;
}
- return;
}
if(!isOneway()) {
- oprot.writeMessageBegin(new TMessage(getMethodName(), TMessageType.REPLY, seqid));
+ oprot.writeMessageBegin(new TMessage(getMethodName(), msgType, seqid));
result.write(oprot);
oprot.writeMessageEnd();
oprot.getTransport().flush();
http://git-wip-us.apache.org/repos/asf/thrift/blob/026c9d03/lib/java/test/org/apache/thrift/server/ServerTestBase.java
----------------------------------------------------------------------
diff --git a/lib/java/test/org/apache/thrift/server/ServerTestBase.java b/lib/java/test/org/apache/thrift/server/ServerTestBase.java
index e3e4288..e245963 100644
--- a/lib/java/test/org/apache/thrift/server/ServerTestBase.java
+++ b/lib/java/test/org/apache/thrift/server/ServerTestBase.java
@@ -234,7 +234,8 @@ public abstract class ServerTestBase extends TestCase {
x.message = arg;
throw x;
} else if ("TException".equals(arg)) {
- throw new TException(arg);
+ // Unspecified exception should yield a TApplicationException on client side
+ throw new RuntimeException(arg);
} else {
Xtruct result = new Xtruct();
result.string_thing = arg;
@@ -681,13 +682,15 @@ public abstract class ServerTestBase extends TestCase {
x.errorCode = 1001;
x.message = arg;
// throw and onError yield the same result.
- // resultHandler.onError(x);
- // return;
- throw x;
- } else if ("TException".equals(arg)) {
- // throw new TException(arg);
- resultHandler.onError(new TException(arg));
+ // throw x;
+ resultHandler.onError(x);
return;
+ } else if ("TException".equals(arg)) {
+ // throw and onError yield the same result.
+ // resultHandler.onError(new TException(arg));
+ // return;
+ // Unspecified exception should yield a TApplicationException on client side
+ throw new RuntimeException(arg);
}
resultHandler.onComplete(null);
}
[26/50] [abbrv] thrift git commit: THRIFT-4377: more informative
error messages on tests THRIFT-4377: fix haxe-php integration Client: haxe
Posted by je...@apache.org.
THRIFT-4377: more informative error messages on tests
THRIFT-4377: fix haxe-php integration
Client: haxe
This closes #1407
Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/a533ea16
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/a533ea16
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/a533ea16
Branch: refs/heads/0.11.0
Commit: a533ea1615e9df935e77b99440cf264c6b417e3e
Parents: ac11cf8
Author: Oleksii Prudkyi <Ol...@gmail.com>
Authored: Sun Oct 29 20:17:42 2017 +0200
Committer: James E. King, III <jk...@apache.org>
Committed: Mon Oct 30 15:12:16 2017 -0400
----------------------------------------------------------------------
lib/haxe/src/org/apache/thrift/server/TSimpleServer.hx | 2 +-
test/haxe/src/TestClient.hx | 10 +++++++++-
2 files changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/thrift/blob/a533ea16/lib/haxe/src/org/apache/thrift/server/TSimpleServer.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/server/TSimpleServer.hx b/lib/haxe/src/org/apache/thrift/server/TSimpleServer.hx
index 655a629..0600744 100644
--- a/lib/haxe/src/org/apache/thrift/server/TSimpleServer.hx
+++ b/lib/haxe/src/org/apache/thrift/server/TSimpleServer.hx
@@ -121,7 +121,7 @@ class TSimpleServer extends TServer {
logDelegate(e); // Unexpected
}
- if(client != null)
+ if(client != null && !runOnce)
{
client.close();
}
http://git-wip-us.apache.org/repos/asf/thrift/blob/a533ea16/test/haxe/src/TestClient.hx
----------------------------------------------------------------------
diff --git a/test/haxe/src/TestClient.hx b/test/haxe/src/TestClient.hx
index 9f02499..853319e 100644
--- a/test/haxe/src/TestClient.hx
+++ b/test/haxe/src/TestClient.hx
@@ -444,6 +444,10 @@ class TestClient {
rslt.Expect( e.message == "Xception", 'testException("Xception") - e.message == "Xception"');
rslt.Expect( e.errorCode == 1001, 'testException("Xception") - e.errorCode == 1001');
}
+ catch (e : TException)
+ {
+ rslt.Expect( false, 'testException("Xception") - ${e} : ${e.errorMsg}');
+ }
catch (e : Dynamic)
{
rslt.Expect( false, 'testException("Xception") - $e');
@@ -457,7 +461,7 @@ class TestClient {
}
catch (e : TException)
{
- rslt.Expect( true, 'testException("TException") - $e');
+ rslt.Expect( true, 'testException("TException") - $e : ${e.errorMsg}');
}
catch (e : Dynamic)
{
@@ -475,6 +479,10 @@ class TestClient {
client.testException("bla");
rslt.Expect( true, 'testException("bla") should not throw');
}
+ catch (e : TException)
+ {
+ rslt.Expect( false, 'testException("bla") - ${e} : ${e.errorMsg}');
+ }
catch (e : Dynamic)
{
rslt.Expect( false, 'testException("bla") - $e');
[28/50] [abbrv] thrift git commit: THRIFT-4285 Move TX/RX methods
from gen. code to library
Posted by je...@apache.org.
THRIFT-4285 Move TX/RX methods from gen. code to library
This change removes a lot of duplication from generated code and allows
the caller to customize how they can read from / write to the
transport. Backwards compatible adapters make the change compatible
with existing code in use by consuming applications.
Client: Go
This closes #1382
Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/4f77ab8e
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/4f77ab8e
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/4f77ab8e
Branch: refs/heads/0.11.0
Commit: 4f77ab8e296d64c57e6ea1c6e3f0f152bc7d6a3a
Parents: 847ecf3
Author: D. Can Celasun <ca...@dcc.im>
Authored: Thu Sep 21 15:21:00 2017 +0200
Committer: James E. King, III <jk...@apache.org>
Committed: Fri Nov 3 18:21:40 2017 -0700
----------------------------------------------------------------------
.../cpp/src/thrift/generate/t_go_generator.cc | 252 ++++++-------------
lib/go/test/tests/client_error_test.go | 194 +++++++++++++-
lib/go/test/tests/multiplexed_protocol_test.go | 150 ++++++-----
lib/go/test/tests/one_way_test.go | 2 +-
lib/go/test/tests/protocol_mock.go | 1 +
lib/go/test/tests/protocols_test.go | 2 +-
lib/go/thrift/application_exception.go | 30 ++-
lib/go/thrift/client.go | 78 ++++++
lib/go/thrift/client_go17.go | 13 +
lib/go/thrift/client_pre_go17.go | 13 +
test/go/Makefile.am | 2 +
test/go/src/bin/testclient/main.go | 32 +--
test/go/src/common/client.go | 27 +-
test/go/src/common/clientserver_test.go | 33 ++-
tutorial/go/src/client.go | 7 +-
15 files changed, 545 insertions(+), 291 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/thrift/blob/4f77ab8e/compiler/cpp/src/thrift/generate/t_go_generator.cc
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/thrift/generate/t_go_generator.cc b/compiler/cpp/src/thrift/generate/t_go_generator.cc
index bac1c57..e869b00 100644
--- a/compiler/cpp/src/thrift/generate/t_go_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_go_generator.cc
@@ -1878,20 +1878,16 @@ void t_go_generator::generate_service_client(t_service* tservice) {
f_types_ << indent() << "type " << serviceName << "Client struct {" << endl;
indent_up();
+ f_types_ << indent() << "c thrift.TClient" << endl;
if (!extends_client.empty()) {
f_types_ << indent() << "*" << extends_client << endl;
- } else {
- f_types_ << indent() << "Transport thrift.TTransport" << endl;
- f_types_ << indent() << "ProtocolFactory thrift.TProtocolFactory" << endl;
- f_types_ << indent() << "InputProtocol thrift.TProtocol" << endl;
- f_types_ << indent() << "OutputProtocol thrift.TProtocol" << endl;
- f_types_ << indent() << "SeqId int32" << endl;
- /*f_types_ << indent() << "reqs map[int32]Deferred" << endl*/;
}
indent_down();
f_types_ << indent() << "}" << endl << endl;
- // Constructor function
+
+ // Legacy constructor function
+ f_types_ << indent() << "// Deprecated: Use New" << serviceName << " instead" << endl;
f_types_ << indent() << "func New" << serviceName
<< "ClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *" << serviceName
<< "Client {" << endl;
@@ -1902,19 +1898,16 @@ void t_go_generator::generate_service_client(t_service* tservice) {
f_types_ << "{" << extends_field << ": " << extends_client_new << "Factory(t, f)}";
} else {
indent_up();
- f_types_ << "{Transport: t," << endl;
- f_types_ << indent() << "ProtocolFactory: f," << endl;
- f_types_ << indent() << "InputProtocol: f.GetProtocol(t)," << endl;
- f_types_ << indent() << "OutputProtocol: f.GetProtocol(t)," << endl;
- f_types_ << indent() << "SeqId: 0," << endl;
- /*f_types_ << indent() << "Reqs: make(map[int32]Deferred)" << endl*/;
+ f_types_ << "{" << endl;
+ f_types_ << indent() << "c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t))," << endl;
indent_down();
f_types_ << indent() << "}" << endl;
}
indent_down();
f_types_ << indent() << "}" << endl << endl;
- // Constructor function
+ // Legacy constructor function with custom input & output protocols
+ f_types_ << indent() << "// Deprecated: Use New" << serviceName << " instead" << endl;
f_types_
<< indent() << "func New" << serviceName
<< "ClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *"
@@ -1927,18 +1920,32 @@ void t_go_generator::generate_service_client(t_service* tservice) {
<< endl;
} else {
indent_up();
- f_types_ << "{Transport: t," << endl;
- f_types_ << indent() << "ProtocolFactory: nil," << endl;
- f_types_ << indent() << "InputProtocol: iprot," << endl;
- f_types_ << indent() << "OutputProtocol: oprot," << endl;
- f_types_ << indent() << "SeqId: 0," << endl;
- /*f_types_ << indent() << "Reqs: make(map[int32]interface{})" << endl*/;
+ f_types_ << "{" << endl;
+ f_types_ << indent() << "c: thrift.NewTStandardClient(iprot, oprot)," << endl;
indent_down();
f_types_ << indent() << "}" << endl;
}
indent_down();
f_types_ << indent() << "}" << endl << endl;
+
+ // Constructor function
+ f_types_ << indent() << "func New" << serviceName
+ << "Client(c thrift.TClient) *" << serviceName << "Client {" << endl;
+ indent_up();
+ f_types_ << indent() << "return &" << serviceName << "Client{" << endl;
+
+ indent_up();
+ f_types_ << indent() << "c: c," << endl;
+ if (!extends.empty()) {
+ f_types_ << indent() << extends_field << ": " << extends_client_new << "(c)," << endl;
+ }
+ indent_down();
+ f_types_ << indent() << "}" << endl;
+
+ indent_down();
+ f_types_ << indent() << "}" << endl << endl;
+
// Generate client method implementations
vector<t_function*> functions = tservice->get_functions();
vector<t_function*>::const_iterator f_iter;
@@ -1953,177 +1960,75 @@ void t_go_generator::generate_service_client(t_service* tservice) {
f_types_ << indent() << "func (p *" << serviceName << "Client) "
<< function_signature_if(*f_iter, "", true) << " {" << endl;
indent_up();
- /*
- f_types_ <<
- indent() << "p.SeqId += 1" << endl;
- if (!(*f_iter)->is_oneway()) {
- f_types_ <<
- indent() << "d := defer.Deferred()" << endl <<
- indent() << "p.Reqs[p.SeqId] = d" << endl;
- }
- */
- f_types_ << indent() << "if err = p.send" << funname << "(";
- bool first = true;
-
- for (fld_iter = fields.begin(); fld_iter != fields.end(); ++fld_iter) {
- if (first) {
- first = false;
- } else {
- f_types_ << ", ";
- }
- f_types_ << variable_name_to_go_name((*fld_iter)->get_name());
- }
-
- f_types_ << "); err != nil { return }" << endl;
-
- if (!(*f_iter)->is_oneway()) {
- f_types_ << indent() << "return p.recv" << funname << "()" << endl;
- } else {
- f_types_ << indent() << "return" << endl;
- }
-
- indent_down();
- f_types_ << indent() << "}" << endl << endl;
- f_types_ << indent() << "func (p *" << serviceName << "Client) send"
- << function_signature(*f_iter) << "(err error) {" << endl;
- indent_up();
- std::string argsname = publicize((*f_iter)->get_name() + "_args", true);
- // Serialize the request header
- f_types_ << indent() << "oprot := p.OutputProtocol" << endl;
- f_types_ << indent() << "if oprot == nil {" << endl;
- f_types_ << indent() << " oprot = p.ProtocolFactory.GetProtocol(p.Transport)" << endl;
- f_types_ << indent() << " p.OutputProtocol = oprot" << endl;
- f_types_ << indent() << "}" << endl;
- f_types_ << indent() << "p.SeqId++" << endl;
- f_types_ << indent() << "if err = oprot.WriteMessageBegin(\"" << (*f_iter)->get_name()
- << "\", " << ((*f_iter)->is_oneway() ? "thrift.ONEWAY" : "thrift.CALL")
- << ", p.SeqId); err != nil {" << endl;
- indent_up();
- f_types_ << indent() << " return" << endl;
- indent_down();
- f_types_ << indent() << "}" << endl;
- f_types_ << indent() << "args := " << argsname << "{" << endl;
+ std::string method = (*f_iter)->get_name();
+ std::string argsType = publicize(method + "_args", true);
+ std::string argsName = tmp("_args");
+ f_types_ << indent() << "var " << argsName << " " << argsType << endl;
for (fld_iter = fields.begin(); fld_iter != fields.end(); ++fld_iter) {
- f_types_ << indent() << publicize((*fld_iter)->get_name()) << " : "
- << variable_name_to_go_name((*fld_iter)->get_name()) << "," << endl;
+ f_types_ << indent() << argsName << "." << publicize((*fld_iter)->get_name())
+ << " = " << variable_name_to_go_name((*fld_iter)->get_name()) << endl;
}
- f_types_ << indent() << "}" << endl;
-
- // Write to the stream
- f_types_ << indent() << "if err = args." << write_method_name_ << "(oprot); err != nil {" << endl;
- indent_up();
- f_types_ << indent() << " return" << endl;
- indent_down();
- f_types_ << indent() << "}" << endl;
- f_types_ << indent() << "if err = oprot.WriteMessageEnd(); err != nil {" << endl;
- indent_up();
- f_types_ << indent() << " return" << endl;
- indent_down();
- f_types_ << indent() << "}" << endl;
- f_types_ << indent() << "return oprot.Flush()" << endl;
- indent_down();
- f_types_ << indent() << "}" << endl << endl;
if (!(*f_iter)->is_oneway()) {
- std::string resultname = publicize((*f_iter)->get_name() + "_result", true);
- // Open function
- f_types_ << endl << indent() << "func (p *" << serviceName << "Client) recv"
- << publicize((*f_iter)->get_name()) << "() (";
+ std::string resultName = tmp("_result");
+ std::string resultType = publicize(method + "_result", true);
+ f_types_ << indent() << "var " << resultName << " " << resultType << endl;
+ f_types_ << indent() << "if err = p.c.Call(ctx, \""
+ << method << "\", &" << argsName << ", &" << resultName << "); err != nil {" << endl;
- if (!(*f_iter)->get_returntype()->is_void()) {
- f_types_ << "value " << type_to_go_type((*f_iter)->get_returntype()) << ", ";
- }
-
- f_types_ << "err error) {" << endl;
indent_up();
- // TODO(mcslee): Validate message reply here, seq ids etc.
- string error(tmp("error"));
- string error2(tmp("error"));
- f_types_ << indent() << "iprot := p.InputProtocol" << endl;
- f_types_ << indent() << "if iprot == nil {" << endl;
- f_types_ << indent() << " iprot = p.ProtocolFactory.GetProtocol(p.Transport)" << endl;
- f_types_ << indent() << " p.InputProtocol = iprot" << endl;
- f_types_ << indent() << "}" << endl;
- f_types_ << indent() << "method, mTypeId, seqId, err := iprot.ReadMessageBegin()" << endl;
- f_types_ << indent() << "if err != nil {" << endl;
- f_types_ << indent() << " return" << endl;
- f_types_ << indent() << "}" << endl;
- f_types_ << indent() << "if method != \"" << (*f_iter)->get_name() << "\" {" << endl;
- f_types_ << indent() << " err = thrift.NewTApplicationException("
- << "thrift.WRONG_METHOD_NAME, \"" << (*f_iter)->get_name()
- << " failed: wrong method name\")" << endl;
- f_types_ << indent() << " return" << endl;
- f_types_ << indent() << "}" << endl;
- f_types_ << indent() << "if p.SeqId != seqId {" << endl;
- f_types_ << indent() << " err = thrift.NewTApplicationException("
- << "thrift.BAD_SEQUENCE_ID, \"" << (*f_iter)->get_name()
- << " failed: out of sequence response\")" << endl;
- f_types_ << indent() << " return" << endl;
- f_types_ << indent() << "}" << endl;
- f_types_ << indent() << "if mTypeId == thrift.EXCEPTION {" << endl;
- f_types_ << indent() << " " << error
- << " := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "
- "\"Unknown Exception\")" << endl;
- f_types_ << indent() << " var " << error2 << " error" << endl;
- f_types_ << indent() << " " << error2 << ", err = " << error << ".Read(iprot)" << endl;
- f_types_ << indent() << " if err != nil {" << endl;
- f_types_ << indent() << " return" << endl;
- f_types_ << indent() << " }" << endl;
- f_types_ << indent() << " if err = iprot.ReadMessageEnd(); err != nil {" << endl;
- f_types_ << indent() << " return" << endl;
- f_types_ << indent() << " }" << endl;
- f_types_ << indent() << " err = " << error2 << endl;
- f_types_ << indent() << " return" << endl;
- f_types_ << indent() << "}" << endl;
- f_types_ << indent() << "if mTypeId != thrift.REPLY {" << endl;
- f_types_ << indent() << " err = thrift.NewTApplicationException("
- << "thrift.INVALID_MESSAGE_TYPE_EXCEPTION, \"" << (*f_iter)->get_name()
- << " failed: invalid message type\")" << endl;
- f_types_ << indent() << " return" << endl;
- f_types_ << indent() << "}" << endl;
- f_types_ << indent() << "result := " << resultname << "{}" << endl;
- f_types_ << indent() << "if err = result." << read_method_name_ << "(iprot); err != nil {" << endl;
- f_types_ << indent() << " return" << endl;
- f_types_ << indent() << "}" << endl;
- f_types_ << indent() << "if err = iprot.ReadMessageEnd(); err != nil {" << endl;
- f_types_ << indent() << " return" << endl;
+ f_types_ << indent() << "return" << endl;
+ indent_down();
f_types_ << indent() << "}" << endl;
t_struct* xs = (*f_iter)->get_xceptions();
const std::vector<t_field*>& xceptions = xs->get_members();
vector<t_field*>::const_iterator x_iter;
- for (x_iter = xceptions.begin(); x_iter != xceptions.end(); ++x_iter) {
- const std::string pubname = publicize((*x_iter)->get_name());
+ if (!xceptions.empty()) {
+ f_types_ << indent() << "switch {" << endl;
- f_types_ << indent() << "if result." << pubname << " != nil {" << endl;
- f_types_ << indent() << " err = result." << pubname << endl;
- f_types_ << indent() << " return " << endl;
- f_types_ << indent() << "}";
+ for (x_iter = xceptions.begin(); x_iter != xceptions.end(); ++x_iter) {
+ const std::string pubname = publicize((*x_iter)->get_name());
+ const std::string field = resultName + "." + pubname;
- if ((x_iter + 1) != xceptions.end()) {
- f_types_ << " else ";
- } else {
- f_types_ << endl;
+ f_types_ << indent() << "case " << field << "!= nil:" << endl;
+ indent_up();
+
+ if (!(*f_iter)->get_returntype()->is_void()) {
+ f_types_ << indent() << "return r, " << field << endl;
+ } else {
+ f_types_ << indent() << "return "<< field << endl;
+ }
+
+ indent_down();
}
+
+ f_types_ << indent() << "}" << endl << endl;
}
- // Careful, only return _result if not a void function
if (!(*f_iter)->get_returntype()->is_void()) {
- f_types_ << indent() << "value = result.GetSuccess()" << endl;
+ f_types_ << indent() << "return " << resultName << ".GetSuccess(), nil" << endl;
+ } else {
+ f_types_ << indent() << "return nil" << endl;
}
+ } else {
+ // TODO: would be nice to not to duplicate the call generation
+ f_types_ << indent() << "if err := p.c.Call(ctx, \""
+ << method << "\", &"<< argsName << ", nil); err != nil {" << endl;
- f_types_ << indent() << "return" << endl;
- // Close function
+ indent_up();
+ f_types_ << indent() << "return err" << endl;
indent_down();
- f_types_ << indent() << "}" << endl << endl;
+ f_types_ << indent() << "}" << endl;
+ f_types_ << indent() << "return nil" << endl;
}
- }
- // indent_down();
- f_types_ << endl;
+ indent_down();
+ f_types_ << "}" << endl << endl;
+ }
}
/**
@@ -2308,8 +2213,10 @@ void t_go_generator::generate_service_remote(t_service* tservice) {
f_remote << indent() << " Usage()" << endl;
f_remote << indent() << " os.Exit(1)" << endl;
f_remote << indent() << "}" << endl;
+ f_remote << indent() << "iprot := protocolFactory.GetProtocol(trans)" << endl;
+ f_remote << indent() << "oprot := protocolFactory.GetProtocol(trans)" << endl;
f_remote << indent() << "client := " << package_name_ << ".New" << publicize(service_name_)
- << "ClientFactory(trans, protocolFactory)" << endl;
+ << "Client(thrift.NewTStandardClient(iprot, oprot))" << endl;
f_remote << indent() << "if err := trans.Open(); err != nil {" << endl;
f_remote << indent() << " fmt.Fprintln(os.Stderr, \"Error opening socket to \", "
"host, \":\", port, \" \", err)" << endl;
@@ -3444,10 +3351,13 @@ string t_go_generator::function_signature(t_function* tfunction, string prefix)
* @return String of rendered function definition
*/
string t_go_generator::function_signature_if(t_function* tfunction, string prefix, bool addError) {
- // TODO(mcslee): Nitpicky, no ',' if argument_list is empty
string signature = publicize(prefix + tfunction->get_name()) + "(";
- signature += "ctx context.Context, ";
- signature += argument_list(tfunction->get_arglist()) + ") (";
+ signature += "ctx context.Context";
+ if (!tfunction->get_arglist()->get_members().empty()) {
+ signature += ", " + argument_list(tfunction->get_arglist());
+ }
+ signature += ") (";
+
t_type* ret = tfunction->get_returntype();
t_struct* exceptions = tfunction->get_xceptions();
string errs = argument_list(exceptions);
http://git-wip-us.apache.org/repos/asf/thrift/blob/4f77ab8e/lib/go/test/tests/client_error_test.go
----------------------------------------------------------------------
diff --git a/lib/go/test/tests/client_error_test.go b/lib/go/test/tests/client_error_test.go
index ad43447..4a8ef13 100644
--- a/lib/go/test/tests/client_error_test.go
+++ b/lib/go/test/tests/client_error_test.go
@@ -20,11 +20,12 @@
package tests
import (
- "github.com/golang/mock/gomock"
"errors"
"errortest"
"testing"
"thrift"
+
+ "github.com/golang/mock/gomock"
)
// TestCase: Comprehensive call and reply workflow in the client.
@@ -397,7 +398,6 @@ func prepareClientCallReply(protocol *MockTProtocol, failAt int, failWith error)
// Expecting TTransportError on fail.
func TestClientReportTTransportErrors(t *testing.T) {
mockCtrl := gomock.NewController(t)
- transport := thrift.NewTMemoryBuffer()
thing := errortest.NewTestStruct()
thing.M = make(map[string]string)
@@ -411,6 +411,38 @@ func TestClientReportTTransportErrors(t *testing.T) {
if !prepareClientCallReply(protocol, i, err) {
return
}
+ client := errortest.NewErrorTestClient(thrift.NewTStandardClient(protocol, protocol))
+ _, retErr := client.TestStruct(defaultCtx, thing)
+ mockCtrl.Finish()
+ err2, ok := retErr.(thrift.TTransportException)
+ if !ok {
+ t.Fatal("Expected a TTrasportException")
+ }
+
+ if err2.TypeId() != thrift.TIMED_OUT {
+ t.Fatal("Expected TIMED_OUT error")
+ }
+ }
+}
+
+// TestCase: Comprehensive call and reply workflow in the client.
+// Expecting TTransportError on fail.
+// Similar to TestClientReportTTransportErrors, but using legacy client constructor.
+func TestClientReportTTransportErrorsLegacy(t *testing.T) {
+ mockCtrl := gomock.NewController(t)
+ transport := thrift.NewTMemoryBuffer()
+ thing := errortest.NewTestStruct()
+ thing.M = make(map[string]string)
+ thing.L = make([]string, 0)
+ thing.S = make([]string, 0)
+ thing.I = 3
+
+ err := thrift.NewTTransportException(thrift.TIMED_OUT, "test")
+ for i := 0; ; i++ {
+ protocol := NewMockTProtocol(mockCtrl)
+ if !prepareClientCallReply(protocol, i, err) {
+ return
+ }
client := errortest.NewErrorTestClientProtocol(transport, protocol, protocol)
_, retErr := client.TestStruct(defaultCtx, thing)
mockCtrl.Finish()
@@ -429,7 +461,6 @@ func TestClientReportTTransportErrors(t *testing.T) {
// Expecting TTProtocolErrors on fail.
func TestClientReportTProtocolErrors(t *testing.T) {
mockCtrl := gomock.NewController(t)
- transport := thrift.NewTMemoryBuffer()
thing := errortest.NewTestStruct()
thing.M = make(map[string]string)
@@ -443,6 +474,37 @@ func TestClientReportTProtocolErrors(t *testing.T) {
if !prepareClientCallReply(protocol, i, err) {
return
}
+ client := errortest.NewErrorTestClient(thrift.NewTStandardClient(protocol, protocol))
+ _, retErr := client.TestStruct(defaultCtx, thing)
+ mockCtrl.Finish()
+ err2, ok := retErr.(thrift.TProtocolException)
+ if !ok {
+ t.Fatal("Expected a TProtocolException")
+ }
+ if err2.TypeId() != thrift.INVALID_DATA {
+ t.Fatal("Expected INVALID_DATA error")
+ }
+ }
+}
+
+// TestCase: Comprehensive call and reply workflow in the client.
+// Expecting TTProtocolErrors on fail.
+// Similar to TestClientReportTProtocolErrors, but using legacy client constructor.
+func TestClientReportTProtocolErrorsLegacy(t *testing.T) {
+ mockCtrl := gomock.NewController(t)
+ transport := thrift.NewTMemoryBuffer()
+ thing := errortest.NewTestStruct()
+ thing.M = make(map[string]string)
+ thing.L = make([]string, 0)
+ thing.S = make([]string, 0)
+ thing.I = 3
+
+ err := thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, errors.New("test"))
+ for i := 0; ; i++ {
+ protocol := NewMockTProtocol(mockCtrl)
+ if !prepareClientCallReply(protocol, i, err) {
+ return
+ }
client := errortest.NewErrorTestClientProtocol(transport, protocol, protocol)
_, retErr := client.TestStruct(defaultCtx, thing)
mockCtrl.Finish()
@@ -557,13 +619,47 @@ func prepareClientCallException(protocol *MockTProtocol, failAt int, failWith er
// TestCase: call and reply with exception workflow in the client.
func TestClientCallException(t *testing.T) {
mockCtrl := gomock.NewController(t)
- transport := thrift.NewTMemoryBuffer()
err := thrift.NewTTransportException(thrift.TIMED_OUT, "test")
for i := 0; ; i++ {
protocol := NewMockTProtocol(mockCtrl)
willComplete := !prepareClientCallException(protocol, i, err)
+ client := errortest.NewErrorTestClient(thrift.NewTStandardClient(protocol, protocol))
+ _, retErr := client.TestString(defaultCtx, "test")
+ mockCtrl.Finish()
+
+ if !willComplete {
+ err2, ok := retErr.(thrift.TTransportException)
+ if !ok {
+ t.Fatal("Expected a TTransportException")
+ }
+ if err2.TypeId() != thrift.TIMED_OUT {
+ t.Fatal("Expected TIMED_OUT error")
+ }
+ } else {
+ err2, ok := retErr.(thrift.TApplicationException)
+ if !ok {
+ t.Fatal("Expected a TApplicationException")
+ }
+ if err2.TypeId() != thrift.PROTOCOL_ERROR {
+ t.Fatal("Expected PROTOCOL_ERROR error")
+ }
+ break
+ }
+ }
+}
+
+// TestCase: call and reply with exception workflow in the client.
+// Similar to TestClientCallException, but using legacy client constructor.
+func TestClientCallExceptionLegacy(t *testing.T) {
+ mockCtrl := gomock.NewController(t)
+ transport := thrift.NewTMemoryBuffer()
+ err := thrift.NewTTransportException(thrift.TIMED_OUT, "test")
+ for i := 0; ; i++ {
+ protocol := NewMockTProtocol(mockCtrl)
+ willComplete := !prepareClientCallException(protocol, i, err)
+
client := errortest.NewErrorTestClientProtocol(transport, protocol, protocol)
_, retErr := client.TestString(defaultCtx, "test")
mockCtrl.Finish()
@@ -592,6 +688,36 @@ func TestClientCallException(t *testing.T) {
// TestCase: Mismatching sequence id has been received in the client.
func TestClientSeqIdMismatch(t *testing.T) {
mockCtrl := gomock.NewController(t)
+ protocol := NewMockTProtocol(mockCtrl)
+ gomock.InOrder(
+ protocol.EXPECT().WriteMessageBegin("testString", thrift.CALL, int32(1)),
+ protocol.EXPECT().WriteStructBegin("testString_args"),
+ protocol.EXPECT().WriteFieldBegin("s", thrift.TType(thrift.STRING), int16(1)),
+ protocol.EXPECT().WriteString("test"),
+ protocol.EXPECT().WriteFieldEnd(),
+ protocol.EXPECT().WriteFieldStop(),
+ protocol.EXPECT().WriteStructEnd(),
+ protocol.EXPECT().WriteMessageEnd(),
+ protocol.EXPECT().Flush(),
+ protocol.EXPECT().ReadMessageBegin().Return("testString", thrift.REPLY, int32(2), nil),
+ )
+
+ client := errortest.NewErrorTestClient(thrift.NewTStandardClient(protocol, protocol))
+ _, err := client.TestString(defaultCtx, "test")
+ mockCtrl.Finish()
+ appErr, ok := err.(thrift.TApplicationException)
+ if !ok {
+ t.Fatal("Expected TApplicationException")
+ }
+ if appErr.TypeId() != thrift.BAD_SEQUENCE_ID {
+ t.Fatal("Expected BAD_SEQUENCE_ID error")
+ }
+}
+
+// TestCase: Mismatching sequence id has been received in the client.
+// Similar to TestClientSeqIdMismatch, but using legacy client constructor.
+func TestClientSeqIdMismatchLegeacy(t *testing.T) {
+ mockCtrl := gomock.NewController(t)
transport := thrift.NewTMemoryBuffer()
protocol := NewMockTProtocol(mockCtrl)
gomock.InOrder(
@@ -622,6 +748,36 @@ func TestClientSeqIdMismatch(t *testing.T) {
// TestCase: Wrong method name has been received in the client.
func TestClientWrongMethodName(t *testing.T) {
mockCtrl := gomock.NewController(t)
+ protocol := NewMockTProtocol(mockCtrl)
+ gomock.InOrder(
+ protocol.EXPECT().WriteMessageBegin("testString", thrift.CALL, int32(1)),
+ protocol.EXPECT().WriteStructBegin("testString_args"),
+ protocol.EXPECT().WriteFieldBegin("s", thrift.TType(thrift.STRING), int16(1)),
+ protocol.EXPECT().WriteString("test"),
+ protocol.EXPECT().WriteFieldEnd(),
+ protocol.EXPECT().WriteFieldStop(),
+ protocol.EXPECT().WriteStructEnd(),
+ protocol.EXPECT().WriteMessageEnd(),
+ protocol.EXPECT().Flush(),
+ protocol.EXPECT().ReadMessageBegin().Return("unknown", thrift.REPLY, int32(1), nil),
+ )
+
+ client := errortest.NewErrorTestClient(thrift.NewTStandardClient(protocol, protocol))
+ _, err := client.TestString(defaultCtx, "test")
+ mockCtrl.Finish()
+ appErr, ok := err.(thrift.TApplicationException)
+ if !ok {
+ t.Fatal("Expected TApplicationException")
+ }
+ if appErr.TypeId() != thrift.WRONG_METHOD_NAME {
+ t.Fatal("Expected WRONG_METHOD_NAME error")
+ }
+}
+
+// TestCase: Wrong method name has been received in the client.
+// Similar to TestClientWrongMethodName, but using legacy client constructor.
+func TestClientWrongMethodNameLegacy(t *testing.T) {
+ mockCtrl := gomock.NewController(t)
transport := thrift.NewTMemoryBuffer()
protocol := NewMockTProtocol(mockCtrl)
gomock.InOrder(
@@ -652,6 +808,36 @@ func TestClientWrongMethodName(t *testing.T) {
// TestCase: Wrong message type has been received in the client.
func TestClientWrongMessageType(t *testing.T) {
mockCtrl := gomock.NewController(t)
+ protocol := NewMockTProtocol(mockCtrl)
+ gomock.InOrder(
+ protocol.EXPECT().WriteMessageBegin("testString", thrift.CALL, int32(1)),
+ protocol.EXPECT().WriteStructBegin("testString_args"),
+ protocol.EXPECT().WriteFieldBegin("s", thrift.TType(thrift.STRING), int16(1)),
+ protocol.EXPECT().WriteString("test"),
+ protocol.EXPECT().WriteFieldEnd(),
+ protocol.EXPECT().WriteFieldStop(),
+ protocol.EXPECT().WriteStructEnd(),
+ protocol.EXPECT().WriteMessageEnd(),
+ protocol.EXPECT().Flush(),
+ protocol.EXPECT().ReadMessageBegin().Return("testString", thrift.INVALID_TMESSAGE_TYPE, int32(1), nil),
+ )
+
+ client := errortest.NewErrorTestClient(thrift.NewTStandardClient(protocol, protocol))
+ _, err := client.TestString(defaultCtx, "test")
+ mockCtrl.Finish()
+ appErr, ok := err.(thrift.TApplicationException)
+ if !ok {
+ t.Fatal("Expected TApplicationException")
+ }
+ if appErr.TypeId() != thrift.INVALID_MESSAGE_TYPE_EXCEPTION {
+ t.Fatal("Expected INVALID_MESSAGE_TYPE_EXCEPTION error")
+ }
+}
+
+// TestCase: Wrong message type has been received in the client.
+// Similar to TestClientWrongMessageType, but using legacy client constructor.
+func TestClientWrongMessageTypeLegacy(t *testing.T) {
+ mockCtrl := gomock.NewController(t)
transport := thrift.NewTMemoryBuffer()
protocol := NewMockTProtocol(mockCtrl)
gomock.InOrder(
http://git-wip-us.apache.org/repos/asf/thrift/blob/4f77ab8e/lib/go/test/tests/multiplexed_protocol_test.go
----------------------------------------------------------------------
diff --git a/lib/go/test/tests/multiplexed_protocol_test.go b/lib/go/test/tests/multiplexed_protocol_test.go
index 27802e5..0b5896b 100644
--- a/lib/go/test/tests/multiplexed_protocol_test.go
+++ b/lib/go/test/tests/multiplexed_protocol_test.go
@@ -36,15 +36,22 @@ func FindAvailableTCPServerPort() net.Addr {
}
}
+func createTransport(addr net.Addr) (thrift.TTransport, error) {
+ socket := thrift.NewTSocketFromAddrTimeout(addr, TIMEOUT)
+ transport := thrift.NewTFramedTransport(socket)
+ err := transport.Open()
+ if err != nil {
+ return nil, err
+ }
+ return transport, nil
+}
-var processor = thrift.NewTMultiplexedProcessor()
-
-func TestInitTwoServers(t *testing.T) {
- var err error
+func TestMultiplexedProtocolFirst(t *testing.T) {
+ processor := thrift.NewTMultiplexedProcessor()
protocolFactory := thrift.NewTBinaryProtocolFactoryDefault()
transportFactory := thrift.NewTTransportFactory()
transportFactory = thrift.NewTFramedTransportFactory(transportFactory)
- addr = FindAvailableTCPServerPort()
+ addr := FindAvailableTCPServerPort()
serverTransport, err := thrift.NewTServerSocketTimeout(addr.String(), TIMEOUT)
if err != nil {
t.Fatal("Unable to create server socket", err)
@@ -57,82 +64,117 @@ func TestInitTwoServers(t *testing.T) {
secondProcessor := multiplexedprotocoltest.NewSecondProcessor(&SecondImpl{})
processor.RegisterProcessor("SecondService", secondProcessor)
+ defer server.Stop()
go server.Serve()
time.Sleep(10 * time.Millisecond)
-}
-
-var firstClient *multiplexedprotocoltest.FirstClient
-func TestInitClient1(t *testing.T) {
- socket := thrift.NewTSocketFromAddrTimeout(addr, TIMEOUT)
- transport := thrift.NewTFramedTransport(socket)
- var protocol thrift.TProtocol = thrift.NewTBinaryProtocolTransport(transport)
- protocol = thrift.NewTMultiplexedProtocol(protocol, "FirstService")
- firstClient = multiplexedprotocoltest.NewFirstClientProtocol(transport, protocol, protocol)
- err := transport.Open()
+ transport, err := createTransport(addr)
if err != nil {
- t.Fatal("Unable to open client socket", err)
+ t.Fatal(err)
}
-}
+ defer transport.Close()
+ protocol := thrift.NewTMultiplexedProtocol(thrift.NewTBinaryProtocolTransport(transport), "FirstService")
-var secondClient *multiplexedprotocoltest.SecondClient
+ client := multiplexedprotocoltest.NewFirstClient(thrift.NewTStandardClient(protocol, protocol))
-func TestInitClient2(t *testing.T) {
- socket := thrift.NewTSocketFromAddrTimeout(addr, TIMEOUT)
- transport := thrift.NewTFramedTransport(socket)
- var protocol thrift.TProtocol = thrift.NewTBinaryProtocolTransport(transport)
- protocol = thrift.NewTMultiplexedProtocol(protocol, "SecondService")
- secondClient = multiplexedprotocoltest.NewSecondClientProtocol(transport, protocol, protocol)
- err := transport.Open()
+ ret, err := client.ReturnOne(defaultCtx)
if err != nil {
- t.Fatal("Unable to open client socket", err)
+ t.Fatal("Unable to call first server:", err)
+ } else if ret != 1 {
+ t.Fatal("Unexpected result from server: ", ret)
}
}
-//create client without service prefix
-func createLegacyClient(t *testing.T) *multiplexedprotocoltest.SecondClient {
- socket := thrift.NewTSocketFromAddrTimeout(addr, TIMEOUT)
- transport := thrift.NewTFramedTransport(socket)
- var protocol thrift.TProtocol = thrift.NewTBinaryProtocolTransport(transport)
- legacyClient := multiplexedprotocoltest.NewSecondClientProtocol(transport, protocol, protocol)
- err := transport.Open()
+func TestMultiplexedProtocolSecond(t *testing.T) {
+ processor := thrift.NewTMultiplexedProcessor()
+ protocolFactory := thrift.NewTBinaryProtocolFactoryDefault()
+ transportFactory := thrift.NewTTransportFactory()
+ transportFactory = thrift.NewTFramedTransportFactory(transportFactory)
+ addr := FindAvailableTCPServerPort()
+ serverTransport, err := thrift.NewTServerSocketTimeout(addr.String(), TIMEOUT)
if err != nil {
- t.Fatal("Unable to open client socket", err)
+ t.Fatal("Unable to create server socket", err)
}
- return legacyClient
-}
+ server = thrift.NewTSimpleServer4(processor, serverTransport, transportFactory, protocolFactory)
-func TestCallFirst(t *testing.T) {
- ret, err := firstClient.ReturnOne(defaultCtx)
+ firstProcessor := multiplexedprotocoltest.NewFirstProcessor(&FirstImpl{})
+ processor.RegisterProcessor("FirstService", firstProcessor)
+
+ secondProcessor := multiplexedprotocoltest.NewSecondProcessor(&SecondImpl{})
+ processor.RegisterProcessor("SecondService", secondProcessor)
+
+ defer server.Stop()
+ go server.Serve()
+ time.Sleep(10 * time.Millisecond)
+
+ transport, err := createTransport(addr)
if err != nil {
- t.Fatal("Unable to call first server:", err)
+ t.Fatal(err)
}
- if ret != 1 {
+ defer transport.Close()
+ protocol := thrift.NewTMultiplexedProtocol(thrift.NewTBinaryProtocolTransport(transport), "SecondService")
+
+ client := multiplexedprotocoltest.NewSecondClient(thrift.NewTStandardClient(protocol, protocol))
+
+ ret, err := client.ReturnTwo(defaultCtx)
+ if err != nil {
+ t.Fatal("Unable to call second server:", err)
+ } else if ret != 2 {
t.Fatal("Unexpected result from server: ", ret)
}
}
-func TestCallSecond(t *testing.T) {
- ret, err := secondClient.ReturnTwo(defaultCtx)
+func TestMultiplexedProtocolLegacy(t *testing.T) {
+ processor := thrift.NewTMultiplexedProcessor()
+ protocolFactory := thrift.NewTBinaryProtocolFactoryDefault()
+ transportFactory := thrift.NewTTransportFactory()
+ transportFactory = thrift.NewTFramedTransportFactory(transportFactory)
+ addr := FindAvailableTCPServerPort()
+ serverTransport, err := thrift.NewTServerSocketTimeout(addr.String(), TIMEOUT)
if err != nil {
- t.Fatal("Unable to call second server:", err)
+ t.Fatal("Unable to create server socket", err)
}
- if ret != 2 {
- t.Fatal("Unexpected result from server: ", ret)
+ server = thrift.NewTSimpleServer4(processor, serverTransport, transportFactory, protocolFactory)
+
+ firstProcessor := multiplexedprotocoltest.NewFirstProcessor(&FirstImpl{})
+ processor.RegisterProcessor("FirstService", firstProcessor)
+
+ secondProcessor := multiplexedprotocoltest.NewSecondProcessor(&SecondImpl{})
+ processor.RegisterProcessor("SecondService", secondProcessor)
+
+ defer server.Stop()
+ go server.Serve()
+ time.Sleep(10 * time.Millisecond)
+
+ transport, err := createTransport(addr)
+ if err != nil {
+ t.Error(err)
+ return
}
-}
+ defer transport.Close()
-func TestCallLegacy(t *testing.T) {
- legacyClient := createLegacyClient(t)
- ret, err := legacyClient.ReturnTwo(defaultCtx)
+ protocol := thrift.NewTBinaryProtocolTransport(transport)
+ client := multiplexedprotocoltest.NewSecondClient(thrift.NewTStandardClient(protocol, protocol))
+
+ ret, err := client.ReturnTwo(defaultCtx)
//expect error since default processor is not registered
if err == nil {
t.Fatal("Expecting error")
}
+
//register default processor and call again
processor.RegisterDefault(multiplexedprotocoltest.NewSecondProcessor(&SecondImpl{}))
- legacyClient = createLegacyClient(t)
- ret, err = legacyClient.ReturnTwo(defaultCtx)
+ transport, err = createTransport(addr)
+ if err != nil {
+ t.Error(err)
+ return
+ }
+ defer transport.Close()
+
+ protocol = thrift.NewTBinaryProtocolTransport(transport)
+ client = multiplexedprotocoltest.NewSecondClient(thrift.NewTStandardClient(protocol, protocol))
+
+ ret, err = client.ReturnTwo(defaultCtx)
if err != nil {
t.Fatal("Unable to call legacy server:", err)
}
@@ -140,9 +182,3 @@ func TestCallLegacy(t *testing.T) {
t.Fatal("Unexpected result from server: ", ret)
}
}
-
-func TestShutdownServerAndClients(t *testing.T) {
- firstClient.Transport.Close()
- secondClient.Transport.Close()
- server.Stop()
-}
http://git-wip-us.apache.org/repos/asf/thrift/blob/4f77ab8e/lib/go/test/tests/one_way_test.go
----------------------------------------------------------------------
diff --git a/lib/go/test/tests/one_way_test.go b/lib/go/test/tests/one_way_test.go
index 32881e2..8abd671 100644
--- a/lib/go/test/tests/one_way_test.go
+++ b/lib/go/test/tests/one_way_test.go
@@ -59,7 +59,7 @@ func TestInitOneway(t *testing.T) {
func TestInitOnewayClient(t *testing.T) {
transport := thrift.NewTSocketFromAddrTimeout(addr, TIMEOUT)
protocol := thrift.NewTBinaryProtocolTransport(transport)
- client = onewaytest.NewOneWayClientProtocol(transport, protocol, protocol)
+ client = onewaytest.NewOneWayClient(thrift.NewTStandardClient(protocol, protocol))
err := transport.Open()
if err != nil {
t.Fatal("Unable to open client socket", err)
http://git-wip-us.apache.org/repos/asf/thrift/blob/4f77ab8e/lib/go/test/tests/protocol_mock.go
----------------------------------------------------------------------
diff --git a/lib/go/test/tests/protocol_mock.go b/lib/go/test/tests/protocol_mock.go
index 9197fed..8476c86 100644
--- a/lib/go/test/tests/protocol_mock.go
+++ b/lib/go/test/tests/protocol_mock.go
@@ -24,6 +24,7 @@ package tests
import (
thrift "thrift"
+
gomock "github.com/golang/mock/gomock"
)
http://git-wip-us.apache.org/repos/asf/thrift/blob/4f77ab8e/lib/go/test/tests/protocols_test.go
----------------------------------------------------------------------
diff --git a/lib/go/test/tests/protocols_test.go b/lib/go/test/tests/protocols_test.go
index 1580678..cffd9c3 100644
--- a/lib/go/test/tests/protocols_test.go
+++ b/lib/go/test/tests/protocols_test.go
@@ -47,7 +47,7 @@ func RunSocketTestSuite(t *testing.T, protocolFactory thrift.TProtocolFactory,
t.Fatal(err)
}
var protocol thrift.TProtocol = protocolFactory.GetProtocol(transport)
- thriftTestClient := thrifttest.NewThriftTestClientProtocol(transport, protocol, protocol)
+ thriftTestClient := thrifttest.NewThriftTestClient(thrift.NewTStandardClient(protocol, protocol))
err = transport.Open()
if err != nil {
t.Fatal("Unable to open client socket", err)
http://git-wip-us.apache.org/repos/asf/thrift/blob/4f77ab8e/lib/go/thrift/application_exception.go
----------------------------------------------------------------------
diff --git a/lib/go/thrift/application_exception.go b/lib/go/thrift/application_exception.go
index 525bce2..b9d7eed 100644
--- a/lib/go/thrift/application_exception.go
+++ b/lib/go/thrift/application_exception.go
@@ -45,7 +45,7 @@ var defaultApplicationExceptionMessage = map[int32]string{
type TApplicationException interface {
TException
TypeId() int32
- Read(iprot TProtocol) (TApplicationException, error)
+ Read(iprot TProtocol) error
Write(oprot TProtocol) error
}
@@ -69,10 +69,11 @@ func (p *tApplicationException) TypeId() int32 {
return p.type_
}
-func (p *tApplicationException) Read(iprot TProtocol) (TApplicationException, error) {
+func (p *tApplicationException) Read(iprot TProtocol) error {
+ // TODO: this should really be generated by the compiler
_, err := iprot.ReadStructBegin()
if err != nil {
- return nil, err
+ return err
}
message := ""
@@ -81,7 +82,7 @@ func (p *tApplicationException) Read(iprot TProtocol) (TApplicationException, er
for {
_, ttype, id, err := iprot.ReadFieldBegin()
if err != nil {
- return nil, err
+ return err
}
if ttype == STOP {
break
@@ -90,33 +91,40 @@ func (p *tApplicationException) Read(iprot TProtocol) (TApplicationException, er
case 1:
if ttype == STRING {
if message, err = iprot.ReadString(); err != nil {
- return nil, err
+ return err
}
} else {
if err = SkipDefaultDepth(iprot, ttype); err != nil {
- return nil, err
+ return err
}
}
case 2:
if ttype == I32 {
if type_, err = iprot.ReadI32(); err != nil {
- return nil, err
+ return err
}
} else {
if err = SkipDefaultDepth(iprot, ttype); err != nil {
- return nil, err
+ return err
}
}
default:
if err = SkipDefaultDepth(iprot, ttype); err != nil {
- return nil, err
+ return err
}
}
if err = iprot.ReadFieldEnd(); err != nil {
- return nil, err
+ return err
}
}
- return NewTApplicationException(type_, message), iprot.ReadStructEnd()
+ if err := iprot.ReadStructEnd(); err != nil {
+ return err
+ }
+
+ p.message = message
+ p.type_ = type_
+
+ return nil
}
func (p *tApplicationException) Write(oprot TProtocol) (err error) {
http://git-wip-us.apache.org/repos/asf/thrift/blob/4f77ab8e/lib/go/thrift/client.go
----------------------------------------------------------------------
diff --git a/lib/go/thrift/client.go b/lib/go/thrift/client.go
new file mode 100644
index 0000000..8bdb53d
--- /dev/null
+++ b/lib/go/thrift/client.go
@@ -0,0 +1,78 @@
+package thrift
+
+import "fmt"
+
+type TStandardClient struct {
+ seqId int32
+ iprot, oprot TProtocol
+}
+
+// TStandardClient implements TClient, and uses the standard message format for Thrift.
+// It is not safe for concurrent use.
+func NewTStandardClient(inputProtocol, outputProtocol TProtocol) *TStandardClient {
+ return &TStandardClient{
+ iprot: inputProtocol,
+ oprot: outputProtocol,
+ }
+}
+
+func (p *TStandardClient) Send(oprot TProtocol, seqId int32, method string, args TStruct) error {
+ if err := oprot.WriteMessageBegin(method, CALL, seqId); err != nil {
+ return err
+ }
+ if err := args.Write(oprot); err != nil {
+ return err
+ }
+ if err := oprot.WriteMessageEnd(); err != nil {
+ return err
+ }
+ return oprot.Flush()
+}
+
+func (p *TStandardClient) Recv(iprot TProtocol, seqId int32, method string, result TStruct) error {
+ rMethod, rTypeId, rSeqId, err := iprot.ReadMessageBegin()
+ if err != nil {
+ return err
+ }
+
+ if method != rMethod {
+ return NewTApplicationException(WRONG_METHOD_NAME, fmt.Sprintf("%s: wrong method name", method))
+ } else if seqId != rSeqId {
+ return NewTApplicationException(BAD_SEQUENCE_ID, fmt.Sprintf("%s: out of order sequence response", method))
+ } else if rTypeId == EXCEPTION {
+ var exception tApplicationException
+ if err := exception.Read(iprot); err != nil {
+ return err
+ }
+
+ if err := iprot.ReadMessageEnd(); err != nil {
+ return err
+ }
+
+ return &exception
+ } else if rTypeId != REPLY {
+ return NewTApplicationException(INVALID_MESSAGE_TYPE_EXCEPTION, fmt.Sprintf("%s: invalid message type", method))
+ }
+
+ if err := result.Read(iprot); err != nil {
+ return err
+ }
+
+ return iprot.ReadMessageEnd()
+}
+
+func (p *TStandardClient) call(method string, args, result TStruct) error {
+ p.seqId++
+ seqId := p.seqId
+
+ if err := p.Send(p.oprot, seqId, method, args); err != nil {
+ return err
+ }
+
+ // method is oneway
+ if result == nil {
+ return nil
+ }
+
+ return p.Recv(p.iprot, seqId, method, result)
+}
http://git-wip-us.apache.org/repos/asf/thrift/blob/4f77ab8e/lib/go/thrift/client_go17.go
----------------------------------------------------------------------
diff --git a/lib/go/thrift/client_go17.go b/lib/go/thrift/client_go17.go
new file mode 100644
index 0000000..15c1c52
--- /dev/null
+++ b/lib/go/thrift/client_go17.go
@@ -0,0 +1,13 @@
+// +build go1.7
+
+package thrift
+
+import "context"
+
+type TClient interface {
+ Call(ctx context.Context, method string, args, result TStruct) error
+}
+
+func (p *TStandardClient) Call(ctx context.Context, method string, args, result TStruct) error {
+ return p.call(method, args, result)
+}
http://git-wip-us.apache.org/repos/asf/thrift/blob/4f77ab8e/lib/go/thrift/client_pre_go17.go
----------------------------------------------------------------------
diff --git a/lib/go/thrift/client_pre_go17.go b/lib/go/thrift/client_pre_go17.go
new file mode 100644
index 0000000..d2e99ef
--- /dev/null
+++ b/lib/go/thrift/client_pre_go17.go
@@ -0,0 +1,13 @@
+// +build !go1.7
+
+package thrift
+
+import "golang.org/x/net/context"
+
+type TClient interface {
+ Call(ctx context.Context, method string, args, result TStruct) error
+}
+
+func (p *TStandardClient) Call(ctx context.Context, method string, args, result TStruct) error {
+ return p.call(method, args, result)
+}
http://git-wip-us.apache.org/repos/asf/thrift/blob/4f77ab8e/test/go/Makefile.am
----------------------------------------------------------------------
diff --git a/test/go/Makefile.am b/test/go/Makefile.am
index db27258..6bc97f5 100644
--- a/test/go/Makefile.am
+++ b/test/go/Makefile.am
@@ -30,6 +30,8 @@ precross: bin/testclient bin/testserver
ThriftTest.thrift: $(THRIFTTEST)
grep -v list.*map.*list.*map $(THRIFTTEST) > ThriftTest.thrift
+.PHONY: gopath
+
# Thrift for GO has problems with complex map keys: THRIFT-2063
gopath: $(THRIFT) ThriftTest.thrift
mkdir -p src/gen
http://git-wip-us.apache.org/repos/asf/thrift/blob/4f77ab8e/test/go/src/bin/testclient/main.go
----------------------------------------------------------------------
diff --git a/test/go/src/bin/testclient/main.go b/test/go/src/bin/testclient/main.go
index b34c539..ab24cbf 100644
--- a/test/go/src/bin/testclient/main.go
+++ b/test/go/src/bin/testclient/main.go
@@ -38,7 +38,7 @@ var testloops = flag.Int("testloops", 1, "Number of Tests")
func main() {
flag.Parse()
- client, err := common.StartClient(*host, *port, *domain_socket, *transport, *protocol, *ssl)
+ client, _, err := common.StartClient(*host, *port, *domain_socket, *transport, *protocol, *ssl)
if err != nil {
t.Fatalf("Unable to start client: ", err)
}
@@ -128,7 +128,7 @@ func callEverything(client *thrifttest.ThriftTestClient) {
}
bin, err := client.TestBinary(defaultCtx, binout)
for i := 0; i < 256; i++ {
- if (binout[i] != bin[i]) {
+ if binout[i] != bin[i] {
t.Fatalf("Unexpected TestBinary() result expected %d, got %d ", binout[i], bin[i])
}
}
@@ -224,21 +224,21 @@ func callEverything(client *thrifttest.ThriftTestClient) {
}
crazy := thrifttest.NewInsanity()
- crazy.UserMap = map[thrifttest.Numberz]thrifttest.UserId {
- thrifttest.Numberz_FIVE: 5,
+ crazy.UserMap = map[thrifttest.Numberz]thrifttest.UserId{
+ thrifttest.Numberz_FIVE: 5,
thrifttest.Numberz_EIGHT: 8,
}
truck1 := thrifttest.NewXtruct()
truck1.StringThing = "Goodbye4"
- truck1.ByteThing = 4;
- truck1.I32Thing = 4;
- truck1.I64Thing = 4;
+ truck1.ByteThing = 4
+ truck1.I32Thing = 4
+ truck1.I64Thing = 4
truck2 := thrifttest.NewXtruct()
truck2.StringThing = "Hello2"
- truck2.ByteThing = 2;
- truck2.I32Thing = 2;
- truck2.I64Thing = 2;
- crazy.Xtructs = []*thrifttest.Xtruct {
+ truck2.ByteThing = 2
+ truck2.I32Thing = 2
+ truck2.I64Thing = 2
+ crazy.Xtructs = []*thrifttest.Xtruct{
truck1,
truck2,
}
@@ -248,17 +248,17 @@ func callEverything(client *thrifttest.ThriftTestClient) {
}
if !reflect.DeepEqual(crazy, insanity[1][2]) {
t.Fatalf("Unexpected TestInsanity() first result expected %#v, got %#v ",
- crazy,
- insanity[1][2])
+ crazy,
+ insanity[1][2])
}
if !reflect.DeepEqual(crazy, insanity[1][3]) {
t.Fatalf("Unexpected TestInsanity() second result expected %#v, got %#v ",
- crazy,
- insanity[1][3])
+ crazy,
+ insanity[1][3])
}
if len(insanity[2][6].UserMap) > 0 || len(insanity[2][6].Xtructs) > 0 {
t.Fatalf("Unexpected TestInsanity() non-empty result got %#v ",
- insanity[2][6])
+ insanity[2][6])
}
xxsret, err := client.TestMulti(defaultCtx, 42, 4242, 424242, map[int16]string{1: "blah", 2: "thing"}, thrifttest.Numberz_EIGHT, thrifttest.UserId(24))
http://git-wip-us.apache.org/repos/asf/thrift/blob/4f77ab8e/test/go/src/common/client.go
----------------------------------------------------------------------
diff --git a/test/go/src/common/client.go b/test/go/src/common/client.go
index 4251d91..236ce43 100644
--- a/test/go/src/common/client.go
+++ b/test/go/src/common/client.go
@@ -41,7 +41,7 @@ func StartClient(
domain_socket string,
transport string,
protocol string,
- ssl bool) (client *thrifttest.ThriftTestClient, err error) {
+ ssl bool) (client *thrifttest.ThriftTestClient, trans thrift.TTransport, err error) {
hostPort := fmt.Sprintf("%s:%d", host, port)
@@ -56,12 +56,11 @@ func StartClient(
case "binary":
protocolFactory = thrift.NewTBinaryProtocolFactoryDefault()
default:
- return nil, fmt.Errorf("Invalid protocol specified %s", protocol)
+ return nil, nil, fmt.Errorf("Invalid protocol specified %s", protocol)
}
if debugClientProtocol {
protocolFactory = thrift.NewTDebugProtocolFactory(protocolFactory, "client:")
}
- var trans thrift.TTransport
if ssl {
trans, err = thrift.NewTSSLSocket(hostPort, &tls.Config{InsecureSkipVerify: true})
} else {
@@ -72,7 +71,7 @@ func StartClient(
}
}
if err != nil {
- return nil, err
+ return nil, nil, err
}
switch transport {
case "http":
@@ -86,29 +85,25 @@ func StartClient(
} else {
trans, err = thrift.NewTHttpPostClient(fmt.Sprintf("http://%s/", hostPort))
}
-
- if err != nil {
- return nil, err
- }
-
case "framed":
trans = thrift.NewTFramedTransport(trans)
case "buffered":
trans = thrift.NewTBufferedTransport(trans, 8192)
case "zlib":
trans, err = thrift.NewTZlibTransport(trans, zlib.BestCompression)
- if err != nil {
- return nil, err
- }
case "":
trans = trans
default:
- return nil, fmt.Errorf("Invalid transport specified %s", transport)
+ return nil, nil, fmt.Errorf("Invalid transport specified %s", transport)
+ }
+ if err != nil {
+ return nil, nil, err
}
-
if err = trans.Open(); err != nil {
- return nil, err
+ return nil, nil, err
}
- client = thrifttest.NewThriftTestClientFactory(trans, protocolFactory)
+ iprot := protocolFactory.GetProtocol(trans)
+ oprot := protocolFactory.GetProtocol(trans)
+ client = thrifttest.NewThriftTestClient(thrift.NewTStandardClient(iprot, oprot))
return
}
http://git-wip-us.apache.org/repos/asf/thrift/blob/4f77ab8e/test/go/src/common/clientserver_test.go
----------------------------------------------------------------------
diff --git a/test/go/src/common/clientserver_test.go b/test/go/src/common/clientserver_test.go
index ecd021f..c4cfd44 100644
--- a/test/go/src/common/clientserver_test.go
+++ b/test/go/src/common/clientserver_test.go
@@ -23,6 +23,7 @@ import (
"errors"
"gen/thrifttest"
"reflect"
+ "sync"
"testing"
"thrift"
@@ -47,10 +48,15 @@ var units = []test_unit{
func TestAllConnection(t *testing.T) {
certPath = "../../../keys"
+ wg := &sync.WaitGroup{}
+ wg.Add(len(units))
for _, unit := range units {
- t.Logf("%#v", unit)
- doUnit(t, &unit)
+ go func(u test_unit) {
+ defer wg.Done()
+ doUnit(t, &u)
+ }(unit)
}
+ wg.Wait()
}
func doUnit(t *testing.T, unit *test_unit) {
@@ -62,17 +68,17 @@ func doUnit(t *testing.T, unit *test_unit) {
server := thrift.NewTSimpleServer4(processor, serverTransport, transportFactory, protocolFactory)
if err = server.Listen(); err != nil {
- t.Errorf("Unable to start server", err)
- t.FailNow()
+ t.Errorf("Unable to start server: %v", err)
+ return
}
go server.AcceptLoop()
defer server.Stop()
- client, err := StartClient(unit.host, unit.port, unit.domain_socket, unit.transport, unit.protocol, unit.ssl)
+ client, trans, err := StartClient(unit.host, unit.port, unit.domain_socket, unit.transport, unit.protocol, unit.ssl)
if err != nil {
- t.Errorf("Unable to start client", err)
- t.FailNow()
+ t.Errorf("Unable to start client: %v", err)
+ return
}
- defer client.Transport.Close()
+ defer trans.Close()
callEverythingWithMock(t, client, handler)
}
@@ -273,7 +279,7 @@ func callEverythingWithMock(t *testing.T, client *thrifttest.ThriftTestClient, h
xxsret, err := client.TestMulti(defaultCtx, 42, 4242, 424242, map[int16]string{1: "blah", 2: "thing"}, thrifttest.Numberz_EIGHT, thrifttest.UserId(24))
if err != nil {
- t.Errorf("Unexpected error in TestMulti() call: ", err)
+ t.Errorf("Unexpected error in TestMulti() call: %v", err)
}
if !reflect.DeepEqual(xxs, xxsret) {
t.Errorf("Unexpected TestMulti() result expected %#v, got %#v ", xxs, xxsret)
@@ -289,9 +295,12 @@ func callEverythingWithMock(t *testing.T, client *thrifttest.ThriftTestClient, h
// TODO: connection is being closed on this
err = client.TestException(defaultCtx, "TException")
- tex, ok := err.(thrift.TApplicationException)
- if err == nil || !ok || tex.TypeId() != thrift.INTERNAL_ERROR {
- t.Errorf("Unexpected TestException() result expected ApplicationError, got %#v ", err)
+ if err == nil {
+ t.Error("expected exception got nil")
+ } else if tex, ok := err.(thrift.TApplicationException); !ok {
+ t.Errorf("Unexpected TestException() result expected ApplicationError, got %T ", err)
+ } else if tex.TypeId() != thrift.INTERNAL_ERROR {
+ t.Errorf("expected internal_error got %v", tex.TypeId())
}
ign, err := client.TestMultiException(defaultCtx, "Xception", "ignoreme")
http://git-wip-us.apache.org/repos/asf/thrift/blob/4f77ab8e/tutorial/go/src/client.go
----------------------------------------------------------------------
diff --git a/tutorial/go/src/client.go b/tutorial/go/src/client.go
index 65027ea..25616bf 100644
--- a/tutorial/go/src/client.go
+++ b/tutorial/go/src/client.go
@@ -22,8 +22,9 @@ package main
import (
"crypto/tls"
"fmt"
- "git.apache.org/thrift.git/lib/go/thrift"
"tutorial"
+
+ "git.apache.org/thrift.git/lib/go/thrift"
)
func handleClient(client *tutorial.CalculatorClient) (err error) {
@@ -98,5 +99,7 @@ func runClient(transportFactory thrift.TTransportFactory, protocolFactory thrift
if err := transport.Open(); err != nil {
return err
}
- return handleClient(tutorial.NewCalculatorClientFactory(transport, protocolFactory))
+ iprot := protocolFactory.GetProtocol(transport)
+ oprot := protocolFactory.GetProtocol(transport)
+ return handleClient(tutorial.NewCalculatorClient(thrift.NewTStandardClient(iprot, oprot)))
}
[41/50] [abbrv] thrift git commit: THRIFT-4392 reorder structs in
plugin.thrift
Posted by je...@apache.org.
THRIFT-4392 reorder structs in plugin.thrift
This fixes #1417
This closes #1413
Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/35f987d4
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/35f987d4
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/35f987d4
Branch: refs/heads/0.11.0
Commit: 35f987d45b2d4e03f3047a923f40fbb54c9e67eb
Parents: 44426c9
Author: Chet Murthy <ch...@gmail.com>
Authored: Thu Nov 23 18:03:01 2017 -0800
Committer: James E. King, III <jk...@apache.org>
Committed: Wed Nov 29 21:37:18 2017 -0500
----------------------------------------------------------------------
compiler/cpp/src/thrift/plugin/plugin.thrift | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/thrift/blob/35f987d4/compiler/cpp/src/thrift/plugin/plugin.thrift
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/thrift/plugin/plugin.thrift b/compiler/cpp/src/thrift/plugin/plugin.thrift
index a93873d..1e51310 100644
--- a/compiler/cpp/src/thrift/plugin/plugin.thrift
+++ b/compiler/cpp/src/thrift/plugin/plugin.thrift
@@ -120,12 +120,6 @@ struct t_const {
3: required t_const_value value
100: optional string doc
}
-struct t_struct {
- 1: required TypeMetadata metadata
- 2: required list<t_field> members
- 3: required bool is_union
- 4: required bool is_xception
-}
struct t_field {
1: required string name
2: required t_type_id type
@@ -136,6 +130,12 @@ struct t_field {
99: optional map<string, string> annotations
100: optional string doc
}
+struct t_struct {
+ 1: required TypeMetadata metadata
+ 2: required list<t_field> members
+ 3: required bool is_union
+ 4: required bool is_xception
+}
struct t_function {
1: required string name
2: required t_type_id returntype
[42/50] [abbrv] thrift git commit: THRIFT-2913: fix random CI build
failures in lib/rb test 'Thrift::ThreadPoolServer should serve inside a
thread' Client: rb
Posted by je...@apache.org.
THRIFT-2913: fix random CI build failures in lib/rb test
'Thrift::ThreadPoolServer should serve inside a thread'
Client: rb
This closes #1429
Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/1ce7a5b4
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/1ce7a5b4
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/1ce7a5b4
Branch: refs/heads/0.11.0
Commit: 1ce7a5b459c47d6c960850a8a97eacc53a851452
Parents: 35f987d
Author: James E. King, III <jk...@apache.org>
Authored: Thu Nov 30 08:39:17 2017 -0500
Committer: James E. King, III <jk...@apache.org>
Committed: Thu Nov 30 12:32:17 2017 -0500
----------------------------------------------------------------------
lib/rb/spec/server_spec.rb | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/thrift/blob/1ce7a5b4/lib/rb/spec/server_spec.rb
----------------------------------------------------------------------
diff --git a/lib/rb/spec/server_spec.rb b/lib/rb/spec/server_spec.rb
index eaecbda..93b9195 100644
--- a/lib/rb/spec/server_spec.rb
+++ b/lib/rb/spec/server_spec.rb
@@ -97,6 +97,7 @@ describe 'Server' do
@prot = mock("BaseProtocol")
@client = mock("Client")
@server = described_class.new(@processor, @server_trans, @trans, @prot)
+ sleep(0.1)
end
it "should serve inside a thread" do
[07/50] [abbrv] thrift git commit: THRIFT-4351: change DOCKER_ env
vars for travis integration to work better, ready for enabling job on PRs
Posted by je...@apache.org.
THRIFT-4351: change DOCKER_ env vars for travis integration to work better,
ready for enabling job on PRs
This closes #1397
Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/cd5be7be
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/cd5be7be
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/cd5be7be
Branch: refs/heads/0.11.0
Commit: cd5be7be702bac300a658184fa0b496debdfee72
Parents: 54ce558
Author: James E. King, III <jk...@apache.org>
Authored: Sat Oct 21 10:16:19 2017 -0400
Committer: James E. King, III <jk...@apache.org>
Committed: Mon Oct 23 14:13:46 2017 -0400
----------------------------------------------------------------------
.travis.yml | 25 +++++--------------------
build/docker/README.md | 37 ++++++++++++++++++++++++-------------
build/docker/refresh.sh | 11 ++++++++---
build/docker/run.sh | 2 +-
build/docker/vars.sh | 23 -----------------------
5 files changed, 38 insertions(+), 60 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/thrift/blob/cd5be7be/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index 0f9500c..9a94e36 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -21,25 +21,8 @@
#
# Docker Integration
+# see: build/docker/README.md
#
-# DOCKER_REPO
-# [required] The repository name (within your account).
-# DOCKER_PASS
-# [optional, secure] Your docker account password.
-# If you do not set this, each build job in the "test"
-# stage might rebuild the docker image and extend build
-# time by about 10 minutes per job. If you do set this
-# then each build job in the "docker" stage" will build
-# the docker image if Dockerfile has changed, and then
-# push the new tag up to your docker hub account.
-# DOCKER_USER
-# [required] Your docker hub account name.
-#
-# The resulting tag is:
-# $DOCKER_USER/$DOCKER_REPO:$DISTRO
-# example (and the default):
-# apache/thrift:ubuntu-xenial
-#
sudo: required
dist: trusty
@@ -64,8 +47,10 @@ env:
- DISTRO=ubuntu-xenial
- BUILD_LIBS="CPP C_GLIB HASKELL JAVA PYTHON TESTING TUTORIALS" # only meaningful for CMake builds
- TRAVIS_BUILD_STAGE=test
- - DEFAULT_DOCKER_USER="apache"
- - DEFAULT_DOCKER_REPO="thrift"
+ # DOCKER_REPO (this works for all builds as a source for docker images - you can override for fork builds in your Travis settings)
+ - DOCKER_REPO="thrift/thrift-build"
+ # DOCKER_USER (provide in your Travis settings if you want to build and update docker images once, instead of on every job)
+ # DOCKER_PASS (same)
jobs:
include:
http://git-wip-us.apache.org/repos/asf/thrift/blob/cd5be7be/build/docker/README.md
----------------------------------------------------------------------
diff --git a/build/docker/README.md b/build/docker/README.md
index 81a4935..32fad92 100644
--- a/build/docker/README.md
+++ b/build/docker/README.md
@@ -11,13 +11,15 @@ The Travis CI scripts use the following environment variables and logic to deter
| Variable | Default | Usage |
| -------- | ----- | ------- |
| `DISTRO` | `ubuntu-xenial` | Set by various build jobs in `.travis.yml` to run builds in different containers. Not intended to be set externally.|
-| `DOCKER_REPO` | `thrift` | The name of the Docker Hub repository to obtain and store docker images. |
-| `DOCKER_USER` | `apache` | The Docker Hub account name containing the repository. |
+| `DOCKER_REPO` | `thrift/thrift-build` | The name of the Docker Hub repository to obtain and store docker images. |
+| `DOCKER_USER` | `<none>` | The Docker Hub account name containing the repository. |
| `DOCKER_PASS` | `<none>` | The Docker Hub account password to use when pushing new tags. |
-For example, the default docker image that is used in builds if no overrides are specified would be: `apache/thrift:ubuntu-xenial`
+For example, the default docker image that is used in builds if no overrides are specified would be: `thrift/thrift-build:ubuntu-xenial`
-If you have forked the Apache Thrift repository and you would like to use your own Docker Hub account to store thrift build images, you can use the Travis CI web interface to set the `DOCKER_USER`, `DOCKER_PASS`, and `DOCKER_REPO` variables in a secure manner.
+### Forks ###
+
+If you have forked the Apache Thrift repository and you would like to use your own Docker Hub account to store thrift build images, you can use the Travis CI web interface to set the `DOCKER_USER`, `DOCKER_PASS`, and `DOCKER_REPO` variables in a secure manner. Your fork builds will then pull, push, and tag the docker images in your account.
### Logic ###
@@ -27,36 +29,42 @@ The Travis CI build runs in two phases - first the docker images are rebuilt for
The Travis CI (continuous integration) builds use the Ubuntu Trusty, Xenial, and Artful images to maximize language level coverage.
-### Ubuntu
+### Ubuntu ###
+
* trusty (legacy)
* xenial (stable)
* artful (latest)
-## Unsupported Containers
+## Unsupported Containers ##
These containers may be in various states, and may not build everything.
-### CentOS
+### CentOS ###
* 7.3
* make check in lib/py may hang in test_sslsocket - root cause unknown
-### Debian
+### Debian ###
+
* jessie
* stretch
* make check in lib/cpp fails due to https://svn.boost.org/trac10/ticket/12507
-## Usage
+## Building Locally ##
+
From the Apache Thrift code base root:
-* Build
+* Build the image
docker build -t thrift build/docker/ubuntu-xenial
-* Run
+* Open a command prompt in the image
docker run -v $(pwd):/thrift/src -it thrift /bin/bash
-## Core Tool Versions per Dockerfile
+## Core Tool Versions per Dockerfile ##
+
+Last updated: October 1, 2017
+
| Tool | ubuntu-trusty | ubuntu-xenial | ubuntu-artful | Notes |
| :-------- | :------------ | :------------ | :------------ | :---- |
| ant | 1.9.3 | 1.9.6 | 1.9.9 | |
@@ -74,7 +82,10 @@ From the Apache Thrift code base root:
| openssl | 1.0.1f | 1.0.2g | 1.0.2g | |
| qt5 | 5.2.1 | 5.5.1 | 5.9.1 | |
-## Compiler/Language Versions per Dockerfile
+## Compiler/Language Versions per Dockerfile ##
+
+Last updated: October 1, 2017
+
| Language | ubuntu-trusty | ubuntu-xenial | ubuntu-artful | Notes |
| :-------- | :------------ | :------------ | :------------ | :---- |
| as3 | | | | Not in CI |
http://git-wip-us.apache.org/repos/asf/thrift/blob/cd5be7be/build/docker/refresh.sh
----------------------------------------------------------------------
diff --git a/build/docker/refresh.sh b/build/docker/refresh.sh
index 20a443b..08cbc91 100755
--- a/build/docker/refresh.sh
+++ b/build/docker/refresh.sh
@@ -31,7 +31,7 @@
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
-. $SCRIPT_DIR/vars.sh
+DOCKER_TAG=$DOCKER_REPO:$DISTRO
function dockerfile_changed {
# image may not exist yet, so we have to let it fail silently:
@@ -63,15 +63,20 @@ fi
popd
#
-# Dockerfile has changed
+# Dockerfile has changed - rebuild it for the current build job.
+# If it is a "docker" stage build then we want to push it back
+# to the DOCKER_REPO. If it is a "test" stage build then we do
+# not. If nobody defined a DOCKER_PASS then it doesn't matter.
#
echo Rebuilding docker image $DISTRO
docker build --tag $DOCKER_TAG build/docker/$DISTRO
-if [[ ! -z "$DOCKER_PASS" ]]; then
+if [[ "$TRAVIS_BUILD_STAGE" == "docker" ]] && [[ ! -z "$DOCKER_USER" ]] && [[ ! -z "$DOCKER_PASS" ]]; then
echo Pushing docker image $DOCKER_TAG
docker login -u $DOCKER_USER -p $DOCKER_PASS
docker push $DOCKER_TAG
+else
+ echo Not pushing docker image: either not a docker stage build job, or one of DOCKER_USER or DOCKER_PASS is undefined.
fi
http://git-wip-us.apache.org/repos/asf/thrift/blob/cd5be7be/build/docker/run.sh
----------------------------------------------------------------------
diff --git a/build/docker/run.sh b/build/docker/run.sh
index b54924b..1fe19d5 100755
--- a/build/docker/run.sh
+++ b/build/docker/run.sh
@@ -21,7 +21,7 @@
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
-. $SCRIPT_DIR/vars.sh
+DOCKER_TAG=$DOCKER_REPO:$DISTRO
printenv | sort
http://git-wip-us.apache.org/repos/asf/thrift/blob/cd5be7be/build/docker/vars.sh
----------------------------------------------------------------------
diff --git a/build/docker/vars.sh b/build/docker/vars.sh
deleted file mode 100755
index 752e282..0000000
--- a/build/docker/vars.sh
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-[[ ! -z "$DOCKER_USER" ]] || export DOCKER_USER=$DEFAULT_DOCKER_USER
-[[ ! -z "$DOCKER_REPO" ]] || export DOCKER_REPO=$DEFAULT_DOCKER_REPO
-[[ ! -z "$DOCKER_TAG" ]] || export DOCKER_TAG=$DOCKER_USER/$DOCKER_REPO:$DISTRO