https://github.com/python/cpython/blob/ee51327a2329eb9c2bfbb6ea673cfab4299450b0/Lib/urllib/request.py#L900