Path: csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-1.proxad.net!hq-usenetpeers.eweka.nl!hq-usenetpeers.eweka.nl!xlned.com!feeder7.xlned.com!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'received:169.254.1': 0.05; 'attribute': 0.07; 'pypi': 0.07; 'socket': 0.07; '__init__': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'ah,': 0.16; 'httplib': 0.16; 'ioerror:': 0.16; 'libraries.': 0.16; 'self.sock': 0.16; 'simplest': 0.16; 'skip:" 70': 0.16; 'subject:SSL': 0.16; 'underlying': 0.16; 'urllib': 0.16; 'extensions': 0.16; 'wrote:': 0.18; 'discussion': 0.18; 'obviously': 0.18; 'trying': 0.19; 'help.': 0.21; 'machine': 0.22; 'import': 0.22; 'reset': 0.22; 'cc:addr:python.org': 0.22; 'install': 0.23; 'ssl': 0.24; 'subject:problem': 0.24; 'fine': 0.24; 'cc:2**0': 0.24; 'supported': 0.26; 'header:In-Reply-To:1': 0.27; 'idea': 0.28; 'correct': 0.29; 'url:bugs': 0.29; '(which': 0.31; 'requests': 0.31; '"",': 0.31; 'sep': 0.31; 'you\x92re': 0.31; 'anyone': 0.31; 'file': 0.32; 'received:169.254': 0.32; 'option': 0.32; 'open': 0.33; 'url:python': 0.33; '(most': 0.33; 'problem': 0.35; 'connection': 0.35; 'problem.': 0.35; 'skip:s 30': 0.35; 'doing': 0.36; 'url:org': 0.36; 'should': 0.36; 'received:169': 0.37; 'url:microsoft': 0.37; 'being': 0.38; 'server': 0.38; 'skip:- 10': 0.38; 'recent': 0.39; 'skip:u 10': 0.60; 'more': 0.64; 'charset:windows-1252': 0.65; 'believe': 0.68; 'received:130': 0.73; 'article': 0.77; 'client-side': 0.84; 'curl': 0.84; 'it\x92s': 0.84; 'absolutely': 0.87 X-IronPort-AV: E=Sophos;i="5.04,630,1406584800"; d="scan'208";a="41286692" X-IPAS-Result: ApsoAHi5K1SC7wH2/2dsb2JhbABgEwEBg0xZoW6oUodLAoEiAQF6hAMBAQEBAgF5BQsCAQgOCi4yJQEBBA4FiDYIBQi+bQEXjhOBYDMHgy6BHQWFFI1fgzaIb41EhkqDZTsvAYJJAQEB From: Roland Hedberg To: Ned Deily Date: Wed, 1 Oct 2014 10:22:54 +0200 Subject: Re: Weird SSL problem Thread-Topic: Weird SSL problem Thread-Index: Ac/dUOYm8elM+gDCQcSUbf17mxQx7w== References: In-Reply-To: Accept-Language: en-US, sv-SE Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US, sv-SE Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Cc: "python-list@python.org" X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 101 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1412151831 news.xs4all.nl 2933 [2001:888:2000:d::a6]:55027 X-Complaints-To: abuse@xs4all.nl X-Received-Bytes: 6909 X-Received-Body-CRC: 4073936103 Xref: csiph.com comp.lang.python:78527 30 sep 2014 kl. 00:55 skrev Ned Deily : > In article , > Roland Hedberg wrote: >=20 >> Hi! >>=20 >> I=B9m trying to access=20 >> https://stsadweb.one.microsoft.com/adfs/.well-known/openid-configuration >>=20 >> Doing it the simplest way I get the following: >>=20 >>>>> import urllib >>>>> f =3D=20 >>>>> urllib.urlopen("https://stsadweb.one.microsoft.com/adfs/.well-known/o= penid >>>>> -configuration") >> Traceback (most recent call last): >> File "", line 1, in >> File=20 >> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib= .py", >> line 87, in urlopen >> return opener.open(url) >> File=20 >> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib= .py", >> line 208, in open >> return getattr(self, name)(url) >> File=20 >> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib= .py", >> line 437, in open_https >> h.endheaders(data) >> File=20 >> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httpli= b.py" >> , line 969, in endheaders >> self._send_output(message_body) >> File=20 >> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httpli= b.py" >> , line 829, in _send_output >> self.send(msg) >> File=20 >> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httpli= b.py" >> , line 791, in send >> self.connect() >> File=20 >> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httpli= b.py" >> , line 1176, in connect >> self.sock =3D ssl.wrap_socket(sock, self.key_file, self.cert_file) >> File=20 >> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py= ",=20 >> line 387, in wrap_socket >> ciphers=3Dciphers) >> File=20 >> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py= ",=20 >> line 143, in __init__ >> self.do_handshake() >> File=20 >> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py= ",=20 >> line 305, in do_handshake >> self._sslobj.do_handshake() >> IOError: [Errno socket error] [Errno 54] Connection reset by peer >>>>> import ssl >>>>> ssl.OPENSSL_VERSION >> =B9OpenSSL 0.9.8za 5 Jun 2014' >>=20 >> Now, using Safari, or curl for that matter, from the same machine works= =20 >> without a hitch. >>=20 >> The URL above is also the only URL I=B9ve encountered this problem with. >>=20 >> Anyone got an idea ? >=20 > I believe the problem is that the connection is protected by a=20 > multi-hostname server certificate and Python 2's urllib (and underlying=20 > httplib and ssl modules) do not support SNI extensions to TLS. The=20 > request above works fine with Python 3 (which has supported client-side=20 > SNI since Python 3.2). See http://bugs.python.org/issue5639 for more=20 > discussion of the matter. If Python 3 is not an option for you, the=20 > requests package available via PyPI should help. You=92re absolutely correct in that it=92s a SNI problem. Python 3 is not an option and I was already using requests obviously missin= g something. Ah, had to install some extra libraries. =97 Roland =94Being able to think like a child is an important attribute of being an a= dult=94 - Eddie Izzard