summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2013-01-16 13:03:45 +0100
committerBenoit Foucher <benoit@zeroc.com>2013-01-16 13:03:45 +0100
commit3a7e1fda55a94937c8b9504b116a8b9bc29239ca (patch)
treec93d574855c871d95b5806bdc817a3ba5c58541b /cpp/src
parentFixed ICE-5131 - parsing of -p <version> for proxies, tweaked UDP endpoint de... (diff)
downloadice-3a7e1fda55a94937c8b9504b116a8b9bc29239ca.tar.bz2
ice-3a7e1fda55a94937c8b9504b116a8b9bc29239ca.tar.xz
ice-3a7e1fda55a94937c8b9504b116a8b9bc29239ca.zip
Fixed ICE-5143 and ICE-5140: stringified proxy and default raw encoding for opaque endpoints
Diffstat (limited to 'cpp/src')
-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
4 files changed, 19 insertions, 14 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();