You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@slider.apache.org by go...@apache.org on 2016/07/06 00:52:13 UTC
incubator-slider git commit: SLIDER-942 Slider agent fails with SSL
validation errors with python 2.7.9
Repository: incubator-slider
Updated Branches:
refs/heads/develop c0f4e9220 -> 833c744a5
SLIDER-942 Slider agent fails with SSL validation errors with python 2.7.9
Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/833c744a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/833c744a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/833c744a
Branch: refs/heads/develop
Commit: 833c744a58afb3e421af3802f7ec2cd1dd5148b0
Parents: c0f4e92
Author: Gour Saha <go...@apache.org>
Authored: Tue Jul 5 17:52:02 2016 -0700
Committer: Gour Saha <go...@apache.org>
Committed: Tue Jul 5 17:52:02 2016 -0700
----------------------------------------------------------------------
slider-agent/src/main/python/agent/NetUtil.py | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/833c744a/slider-agent/src/main/python/agent/NetUtil.py
----------------------------------------------------------------------
diff --git a/slider-agent/src/main/python/agent/NetUtil.py b/slider-agent/src/main/python/agent/NetUtil.py
index eb658f7..88c129a 100644
--- a/slider-agent/src/main/python/agent/NetUtil.py
+++ b/slider-agent/src/main/python/agent/NetUtil.py
@@ -18,6 +18,7 @@ from urlparse import urlparse
import time
import logging
import httplib
+import sys
from ssl import SSLError
logger = logging.getLogger()
@@ -36,9 +37,16 @@ class NetUtil:
(like unreachable server or wrong HTTP code) result will be False
"""
logger.info("Connecting to the following url " + url);
+
try:
parsedurl = urlparse(url)
- ca_connection = httplib.HTTPSConnection(parsedurl[1])
+
+ if sys.version_info >= (2,7,9):
+ import ssl
+ ca_connection = httplib.HTTPSConnection(parsedurl[1], context=ssl._create_unverified_context())
+ else:
+ ca_connection = httplib.HTTPSConnection(parsedurl[1])
+
ca_connection.request("GET", parsedurl[2])
response = ca_connection.getresponse()
status = response.status