diff options
| author | Gordon Sim <gsim@apache.org> | 2013-05-27 16:31:33 +0000 |
|---|---|---|
| committer | Gordon Sim <gsim@apache.org> | 2013-05-27 16:31:33 +0000 |
| commit | 322b2650808bb2489baadc35dcbb68bc3d8e7dad (patch) | |
| tree | ae05dcabdbf8672d2c33c55bb48229eb313fc27f /qpid/cpp/src | |
| parent | edc69cb984c456a5a5b0b03e2d5414876841a084 (diff) | |
| download | qpid-python-322b2650808bb2489baadc35dcbb68bc3d8e7dad.tar.gz | |
QPID-4887: retrieve username and password from url if specified
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1486657 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src')
| -rw-r--r-- | qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp b/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp index c9623f568c..869d0caebc 100644 --- a/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp +++ b/qpid/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp @@ -44,10 +44,9 @@ namespace qpid { namespace messaging { namespace amqp { - ConnectionContext::ConnectionContext(const std::string& u, const qpid::types::Variant::Map& o) : qpid::messaging::ConnectionOptions(o), - url(u), + url(u, protocol.empty() ? qpid::Address::TCP : protocol), engine(pn_transport()), connection(pn_connection()), //note: disabled read/write of header as now handled by engine @@ -85,6 +84,8 @@ void ConnectionContext::open() qpid::sys::ScopedLock<qpid::sys::Monitor> l(lock); if (state != DISCONNECTED) throw qpid::messaging::ConnectionError("Connection was already opened!"); if (!driver) driver = DriverImpl::getDefault(); + if (url.getUser().size()) username = url.getUser(); + if (url.getPass().size()) password = url.getPass(); for (Url::const_iterator i = url.begin(); state != CONNECTED && i != url.end(); ++i) { transport = driver->getTransport(i->protocol, *this); |
