summaryrefslogtreecommitdiff
path: root/python/qpid/util.py
diff options
context:
space:
mode:
authorKim van der Riet <kpvdr@apache.org>2013-02-28 16:14:30 +0000
committerKim van der Riet <kpvdr@apache.org>2013-02-28 16:14:30 +0000
commit9c73ef7a5ac10acd6a50d5d52bd721fc2faa5919 (patch)
tree2a890e1df09e5b896a9b4168a7b22648f559a1f2 /python/qpid/util.py
parent172d9b2a16cfb817bbe632d050acba7e31401cd2 (diff)
downloadqpid-python-asyncstore.tar.gz
Update from trunk r1375509 through r1450773asyncstore
git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/asyncstore@1451244 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'python/qpid/util.py')
-rw-r--r--python/qpid/util.py26
1 files changed, 24 insertions, 2 deletions
diff --git a/python/qpid/util.py b/python/qpid/util.py
index 39ad1d830e..8da17ce0c6 100644
--- a/python/qpid/util.py
+++ b/python/qpid/util.py
@@ -17,15 +17,19 @@
# under the License.
#
-import os, socket, time, textwrap, re
+import os, socket, time, textwrap, re, sys
try:
from ssl import wrap_socket as ssl
except ImportError:
from socket import ssl as wrap_socket
class ssl:
-
def __init__(self, sock, keyfile=None, certfile=None, trustfile=None):
+ # Bug (QPID-4337): this is the "old" version of python SSL.
+ # The private key is required. If a certificate is given, but no
+ # keyfile, assume the key is contained in the certificate
+ if certfile and not keyfile:
+ keyfile = certfile
self.sock = sock
self.ssl = wrap_socket(sock, keyfile=keyfile, certfile=certfile)
@@ -38,6 +42,24 @@ except ImportError:
def close(self):
self.sock.close()
+def get_client_properties_with_defaults(provided_client_properties={}):
+ ppid = 0
+ try:
+ ppid = os.getppid()
+ except:
+ pass
+
+ client_properties = {"product": "qpid python client",
+ "version": "development",
+ "platform": os.name,
+ "qpid.client_process": os.path.basename(sys.argv[0]),
+ "qpid.client_pid": os.getpid(),
+ "qpid.client_ppid": ppid}
+
+ if provided_client_properties:
+ client_properties.update(provided_client_properties)
+ return client_properties
+
def connect(host, port):
for res in socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM):
af, socktype, proto, canonname, sa = res