summaryrefslogtreecommitdiffstats
path: root/pykolab/wap_client/__init__.py
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2013-11-16 22:52:33 +0100
committerThomas Bruederli <bruederli@kolabsys.com>2013-11-16 22:52:33 +0100
commite85be5eb4b9e6e18bf1addf198b40e87779d1e9b (patch)
tree8808b04b609c1a831fbc9a2b334bf2bcac2daaad /pykolab/wap_client/__init__.py
parenta866247cb929f8c883ffb7805302f4e2f8114fa6 (diff)
downloadpykolab-e85be5eb4b9e6e18bf1addf198b40e87779d1e9b.tar.gz
Support https:// urls for WAP backend (#2545); remove unused code
Diffstat (limited to 'pykolab/wap_client/__init__.py')
-rw-r--r--pykolab/wap_client/__init__.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/pykolab/wap_client/__init__.py b/pykolab/wap_client/__init__.py
index 1dd6aab..674673c 100644
--- a/pykolab/wap_client/__init__.py
+++ b/pykolab/wap_client/__init__.py
@@ -19,6 +19,7 @@ if not hasattr(conf, 'defaults'):
API_HOSTNAME = "localhost"
API_SCHEME = "http"
API_PORT = 80
+API_SSL = False
API_BASE = "/kolab-webadmin/api/"
kolab_wap_url = conf.get('kolab_wap', 'api_url')
@@ -28,6 +29,10 @@ if not kolab_wap_url == None:
else:
result = None
+if hasattr(result, 'scheme') and result.scheme == 'https':
+ API_SSL = True
+ API_PORT = 443
+
if hasattr(result, 'hostname'):
API_HOSTNAME = result.hostname
@@ -41,8 +46,6 @@ session_id = None
conn = None
-from connect import connect
-
def authenticate(username=None, password=None, domain=None):
global session_id
@@ -71,7 +74,10 @@ def connect():
global conn
if conn == None:
- conn = httplib.HTTPConnection(API_HOSTNAME, API_PORT)
+ if API_SSL:
+ conn = httplib.HTTPSConnection(API_HOSTNAME, API_PORT)
+ else:
+ conn = httplib.HTTPConnection(API_HOSTNAME, API_PORT)
conn.connect()
return conn