[New-bugs-announce] [issue42077] Some Absolute domain name not work in urllib

Zheng SHAO report at bugs.python.org
Sun Oct 18 22:18:56 EDT 2020


New submission from Zheng SHAO <axot at msn.com>:

```
import ssl
import urllib.request

url_string = "https://kubernetes.default.svc.cluster.local./api/"

ctx = ssl._create_unverified_context()

with urllib.request.urlopen(url_string, context=ctx) as f:
    f.read()
```

In running this sample code will got a following handshake error,

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.8/urllib/request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python3.8/urllib/request.py", line 525, in open
    response = self._open(req, data)
  File "/usr/lib/python3.8/urllib/request.py", line 542, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
  File "/usr/lib/python3.8/urllib/request.py", line 502, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.8/urllib/request.py", line 1393, in https_open
    return self.do_open(http.client.HTTPSConnection, req,
  File "/usr/lib/python3.8/urllib/request.py", line 1353, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: SSLV3_ALERT_UNEXPECTED_MESSAGE] sslv3 alert unexpected message (_ssl.c:1123)>

Instead using absolute domain name, using `https://kubernetes.default.svc.cluster.local/api/` then the issue solved. I also tried other domains like `google.com.`, but in this case the handshake process had no errors.

----------
components: Library (Lib)
messages: 378919
nosy: axot
priority: normal
severity: normal
status: open
title: Some Absolute domain name not work in urllib
versions: Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42077>
_______________________________________


More information about the New-bugs-announce mailing list