changeset 875262d7934c in tryton:default
details: https://hg.tryton.org/tryton?cmd=changeset&node=875262d7934c
description:
Keep origin host when making connection
Following https://bugs.python.org/issue6267
issue10308
review332611002
diffstat:
tryton/jsonrpc.py | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diffs (47 lines):
diff -r de087a40f176 -r 875262d7934c tryton/jsonrpc.py
--- a/tryton/jsonrpc.py Thu Apr 22 23:47:17 2021 +0200
+++ b/tryton/jsonrpc.py Thu Apr 22 23:48:54 2021 +0200
@@ -181,12 +181,12 @@
def make_connection(self, host):
if self._connection and host == self._connection[0]:
return self._connection[1]
- host, self._extra_headers, x509 = self.get_host_info(host)
+ chost, self._extra_headers, x509 = self.get_host_info(host)
ssl_ctx = ssl.create_default_context(cafile=self.__ca_certs)
def http_connection():
- self._connection = host, http.client.HTTPConnection(host,
+ self._connection = host, http.client.HTTPConnection(chost,
timeout=CONNECT_TIMEOUT)
self._connection[1].connect()
sock = self._connection[1].sock
@@ -194,7 +194,7 @@
sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
def https_connection(allow_http=False):
- self._connection = host, http.client.HTTPSConnection(host,
+ self._connection = host, http.client.HTTPSConnection(chost,
timeout=CONNECT_TIMEOUT, context=ssl_ctx)
try:
self._connection[1].connect()
@@ -219,8 +219,8 @@
fingerprint = ''
if (self.__fingerprints is not None
- and self.__fingerprints.exists(host)):
- if self.__fingerprints.get(host):
+ and self.__fingerprints.exists(chost)):
+ if self.__fingerprints.get(chost):
fingerprint = https_connection()
else:
http_connection()
@@ -228,7 +228,7 @@
fingerprint = https_connection(allow_http=True)
if self.__fingerprints is not None:
- self.__fingerprints.set(host, fingerprint)
+ self.__fingerprints.set(chost, fingerprint)
self._connection[1].timeout = DEFAULT_TIMEOUT
self._connection[1].sock.settimeout(DEFAULT_TIMEOUT)
return self._connection[1]