[MacPorts] #55150: Pymol gives error on fetching from any https site
MacPorts
noreply at macports.org
Mon Oct 23 16:54:29 UTC 2017
#55150: Pymol gives error on fetching from any https site
----------------------------+-----------------------------------
Reporter: carlosfamilia | Owner: howarth.at.macports@…
Type: defect | Status: assigned
Priority: Normal | Milestone:
Component: ports | Version: 2.4.2
Resolution: | Keywords:
Port: pymol |
----------------------------+-----------------------------------
Comment (by carlosfamilia):
Noted! Thanks.
I have been looking around in the pymol code and made some changes.
This rolls back for the previous behaviour, however it does not check the
certificates, I am not sure if you want to implement it like this or a
more safe approach. Nevertheless the code needing changes is here
identified:
{{{
*** internal.py Mon Oct 23 17:28:36 2017
--- internal.py.old Thu Mar 9 00:40:30 2017
***************
*** 3,9 ****
import os
import sys
- import ssl
cmd = sys.modules["pymol.cmd"]
from pymol import _cmd
import threading
--- 3,8 ----
***************
*** 317,326 ****
if not is_string(finfo):
handle = finfo
elif '://' in finfo:
- context = ssl._create_unverified_context()
req = urllib2.Request(finfo,
headers={'User-Agent': 'PyMOL/' +
_self.get_version()[0]})
! handle = urllib2.urlopen(req, context=context)
else:
handle = open(finfo, 'rb')
contents = handle.read()
--- 316,324 ----
if not is_string(finfo):
handle = finfo
elif '://' in finfo:
req = urllib2.Request(finfo,
headers={'User-Agent': 'PyMOL/' +
_self.get_version()[0]})
! handle = urllib2.urlopen(req)
else:
handle = open(finfo, 'rb')
contents = handle.read()
}}}
{{{
*** plugins/repository.py Mon Oct 23 17:32:35 2017
--- plugins/repository.py.old Wed Apr 26 14:08:45 2017
***************
*** 11,17 ****
from __future__ import print_function
import sys
- import ssl
if sys.version_info[0] > 2:
import urllib.request as urllib2
from urllib.parse import urlparse
--- 11,16 ----
***************
*** 32,40 ****
not change that.
'''
from . import pref_get
! context = ssl._create_unverified_context()
timeout = pref_get('network_timeout', 10.0)
! return urllib2.urlopen(url, timeout=timeout, context=context)
def urlreadstr(url, encoding='iso-8859-1'):
--- 31,39 ----
not change that.
'''
from . import pref_get
!
timeout = pref_get('network_timeout', 10.0)
! return urllib2.urlopen(url, timeout=timeout)
def urlreadstr(url, encoding='iso-8859-1'):
}}}
--
Ticket URL: <https://trac.macports.org/ticket/55150#comment:4>
MacPorts <https://www.macports.org/>
Ports system for macOS
More information about the macports-tickets
mailing list