summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp')
-rw-r--r--cpp/src/Ice/EndpointFactoryManager.cpp2
-rw-r--r--cpp/src/Ice/OpaqueEndpointI.cpp12
-rw-r--r--cpp/src/Ice/OpaqueEndpointI.h3
-rw-r--r--cpp/src/Ice/Reference.cpp16
-rw-r--r--cpp/test/Ice/proxy/AllTests.cpp16
5 files changed, 27 insertions, 22 deletions
diff --git a/cpp/src/Ice/EndpointFactoryManager.cpp b/cpp/src/Ice/EndpointFactoryManager.cpp
index 8ce75b7f108..6cfe7757c82 100644
--- a/cpp/src/Ice/EndpointFactoryManager.cpp
+++ b/cpp/src/Ice/EndpointFactoryManager.cpp
@@ -131,7 +131,7 @@ IceInternal::EndpointFactoryManager::create(const string& str, bool oaEndpoint)
//
if(protocol == "opaque")
{
- EndpointIPtr ue = new OpaqueEndpointI(str.substr(end));
+ EndpointIPtr ue = new OpaqueEndpointI(str.substr(end), _instance);
factory = get(ue->type());
if(factory)
{
diff --git a/cpp/src/Ice/OpaqueEndpointI.cpp b/cpp/src/Ice/OpaqueEndpointI.cpp
index 10b16984b56..cfad09c13e8 100644
--- a/cpp/src/Ice/OpaqueEndpointI.cpp
+++ b/cpp/src/Ice/OpaqueEndpointI.cpp
@@ -11,6 +11,7 @@
#include <Ice/BasicStream.h>
#include <Ice/Exception.h>
#include <Ice/Instance.h>
+#include <Ice/DefaultsAndOverrides.h>
#include <Ice/Base64.h>
#include <Ice/HashUtil.h>
@@ -18,16 +19,11 @@ using namespace std;
using namespace Ice;
using namespace IceInternal;
-namespace
+IceInternal::OpaqueEndpointI::OpaqueEndpointI(const string& str, const InstancePtr& instance) :
+ EndpointI("")
{
-const Ice::ProtocolVersion Protocol_0_0 = { 0, 0 };
-const Ice::EncodingVersion Encoding_0_0 = { 0, 0 };
-}
+ _rawEncoding = instance->defaultsAndOverrides()->defaultEncoding;
-IceInternal::OpaqueEndpointI::OpaqueEndpointI(const string& str) :
- EndpointI(""),
- _rawEncoding(Ice::currentEncoding)
-{
const string delim = " \t\n\r";
string::size_type beg;
diff --git a/cpp/src/Ice/OpaqueEndpointI.h b/cpp/src/Ice/OpaqueEndpointI.h
index 303537ac7a2..53041b42058 100644
--- a/cpp/src/Ice/OpaqueEndpointI.h
+++ b/cpp/src/Ice/OpaqueEndpointI.h
@@ -12,6 +12,7 @@
#include <Ice/EndpointI.h>
#include <Ice/EndpointFactory.h>
+#include <Ice/InstanceF.h>
namespace IceInternal
{
@@ -20,7 +21,7 @@ class OpaqueEndpointI : public EndpointI
{
public:
- OpaqueEndpointI(const ::std::string&);
+ OpaqueEndpointI(const ::std::string&, const InstancePtr&);
OpaqueEndpointI(Ice::Short, BasicStream*);
virtual void streamWrite(BasicStream*) const;
diff --git a/cpp/src/Ice/Reference.cpp b/cpp/src/Ice/Reference.cpp
index 4983ac40157..ae84b89ffc9 100644
--- a/cpp/src/Ice/Reference.cpp
+++ b/cpp/src/Ice/Reference.cpp
@@ -290,13 +290,21 @@ IceInternal::Reference::toString() const
if(_protocol != Ice::Protocol_1_0)
{
+ //
+ // We only print the protocol if it's not 1.0. It's fine as
+ // long as we don't add Ice.Default.ProtocolVersion, a
+ // stringified proxy will convert back to the same proxy with
+ // stringToProxy.
+ //
s << " -p " << _protocol;
}
- if(_encoding != Ice::Encoding_1_0)
- {
- s << " -e " << _encoding;
- }
+ //
+ // Always print the encoding version to ensure a stringified proxy
+ // will convert back to a proxy with the same encoding with
+ // stringToProxy (and won't use Ice.Default.EncodingVersion).
+ //
+ s << " -e " << _encoding;
return s.str();
diff --git a/cpp/test/Ice/proxy/AllTests.cpp b/cpp/test/Ice/proxy/AllTests.cpp
index e9eba2918d4..1e6a3b7ebd1 100644
--- a/cpp/test/Ice/proxy/AllTests.cpp
+++ b/cpp/test/Ice/proxy/AllTests.cpp
@@ -221,10 +221,10 @@ allTests(const Ice::CommunicatorPtr& communicator)
test(b1->ice_getEncodingVersion().major == 6 && b1->ice_getEncodingVersion().minor == 5);
b1 = communicator->stringToProxy("test -p 1.0 -e 1.0");
- test(b1->ice_toString() == "test -t");
+ test(b1->ice_toString() == "test -t -e 1.0");
b1 = communicator->stringToProxy("test -p 6.5 -e 1.0");
- test(b1->ice_toString() == "test -t -p 6.5");
+ test(b1->ice_toString() == "test -t -p 6.5 -e 1.0");
try
{
@@ -373,7 +373,7 @@ allTests(const Ice::CommunicatorPtr& communicator)
Ice::PropertyDict proxyProps = communicator->proxyToProperty(b1, "Test");
test(proxyProps.size() == 18);
- test(proxyProps["Test"] == "test -t");
+ test(proxyProps["Test"] == "test -t -e 1.0");
test(proxyProps["Test.CollocationOptimized"] == "1");
test(proxyProps["Test.ConnectionCached"] == "1");
test(proxyProps["Test.PreferSecure"] == "0");
@@ -875,7 +875,7 @@ allTests(const Ice::CommunicatorPtr& communicator)
// Two legal TCP endpoints expressed as opaque endpoints
p1 = communicator->stringToProxy("test -e 1.0:opaque -e 1.0 -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAA==:opaque -e 1.0 -t 1 -v CTEyNy4wLjAuMusuAAAQJwAAAA==");
pstr = communicator->proxyToString(p1);
- test(pstr == "test -t:tcp -h 127.0.0.1 -p 12010 -t 10000:tcp -h 127.0.0.2 -p 12011 -t 10000");
+ test(pstr == "test -t -e 1.0:tcp -h 127.0.0.1 -p 12010 -t 10000:tcp -h 127.0.0.2 -p 12011 -t 10000");
//
// Test that an SSL endpoint and a nonsense endpoint get written
@@ -885,11 +885,11 @@ allTests(const Ice::CommunicatorPtr& communicator)
pstr = communicator->proxyToString(p1);
if(!ssl)
{
- test(pstr == "test -t:opaque -t 2 -e 1.0 -v CTEyNy4wLjAuMREnAAD/////AA==:opaque -t 99 -e 1.0 -v abch");
+ test(pstr == "test -t -e 1.0:opaque -t 2 -e 1.0 -v CTEyNy4wLjAuMREnAAD/////AA==:opaque -t 99 -e 1.0 -v abch");
}
else
{
- test(pstr == "test -t:ssl -h 127.0.0.1 -p 10001:opaque -t 99 -e 1.0 -v abch");
+ test(pstr == "test -t -e 1.0:ssl -h 127.0.0.1 -p 10001:opaque -t 99 -e 1.0 -v abch");
}
//
@@ -921,11 +921,11 @@ allTests(const Ice::CommunicatorPtr& communicator)
pstr = communicator->proxyToString(p2);
if(!ssl)
{
- test(pstr == "test -t:opaque -t 2 -e 1.0 -v CTEyNy4wLjAuMREnAAD/////AA==:opaque -t 99 -e 1.0 -v abch");
+ test(pstr == "test -t -e 1.0:opaque -t 2 -e 1.0 -v CTEyNy4wLjAuMREnAAD/////AA==:opaque -t 99 -e 1.0 -v abch");
}
else
{
- test(pstr == "test -t:ssl -h 127.0.0.1 -p 10001:opaque -t 99 -e 1.0 -v abch");
+ test(pstr == "test -t -e 1.0:ssl -h 127.0.0.1 -p 10001:opaque -t 99 -e 1.0 -v abch");
}
}