Skip to content

Commit

Permalink
We still need that getattr check in 2.7
Browse files Browse the repository at this point in the history
  • Loading branch information
truthbk committed Nov 4, 2015
1 parent b99588a commit dfd7c19
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions checks.d/http_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,22 @@ def connect(self):
resolved_ssl_version = ssl_.resolve_ssl_version(self.ssl_version)

hostname = self.host

self.sock = conn
# Calls self._set_hostport(), so self.host is
# self._tunnel_host below.
self._tunnel()
# Mark this connection as not reusable
self.auto_open = 0

# Override the host with the one we're requesting data from.
hostname = self._tunnel_host
if getattr(self, '_tunnel_host', None):
# _tunnel_host was added in Python 2.6.3
# (See:
# http://hg.python.org/cpython/rev/0f57b30a152f)
#
# However this check is still necessary in 2.7.x

self.sock = conn
# Calls self._set_hostport(), so self.host is
# self._tunnel_host below.
self._tunnel()
# Mark this connection as not reusable
self.auto_open = 0

# Override the host with the one we're requesting data from.
hostname = self._tunnel_host

# Wrap socket using verification with the root certs in trusted_root_certs
self.sock = ssl_.ssl_wrap_socket(conn, self.key_file, self.cert_file,
Expand Down

0 comments on commit dfd7c19

Please sign in to comment.