[issue47150] HTTPRedirectHandler fails on POST for 307 and 308
New submission from Jairo Llopis : urllib.request.HTTPRedirectHandler fails if there is a 307 HTTP return code in a POST request. In https://github.com/python/cpython/commit/c379bc5ec9012cf66424ef3d80612cf13ec51006 the same behaviour was implemented for 308. According to https://datatracker.ietf.org/doc/html/rfc7538#section-3 IMHO this implementation is wrong for 308: > Note: This status code is similar to 301 (Moved Permanently) > ([RFC7231], Section 6.4.2), except that it does not allow changing > the request method from POST to GET. A similar note exists in https://datatracker.ietf.org/doc/html/rfc7231#section-6.4.7 regarding code 307. So, as long as the original redirection is in POST and it gets redirected to another POST, it should not be an error. FWIW, in https://github.com/traefik/traefik/issues/7829#issuecomment-770210080 you can see that Traefik proxy uses 307 and 308 codes by default when redirecting non-GET requests. Thus, urllib.request.HTTPRedirectHandler will fail to process any POST requests proxied by Traefik. -- components: Library (Lib) messages: 416249 nosy: Jairo Llopis priority: normal severity: normal status: open title: HTTPRedirectHandler fails on POST for 307 and 308 type: behavior versions: Python 3.10, Python 3.11, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue47150> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue38615] imaplib has no timeout setting
New submission from Jairo Llopis : No way to pass a timeout to imaplib.IMAP4 or imaplib.IMAP4_SSL. When opening the connection, the only way is to use socket.settimeout(), which affects the global execution environment. It's interesting that poplib includes the needed timeout parameter instead... weird. I think it was forgotten for imaplib. -- components: Library (Lib) messages: 355542 nosy: Jairo Llopis priority: normal severity: normal status: open title: imaplib has no timeout setting type: enhancement versions: Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue38615> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue43095] Windows does not raise IsADirectoryError
New submission from Jairo Llopis : Trying to read a directory on Linux raises the expected exception: Python 3.9.1 (default, Jan 20 2021, 00:00:00) [GCC 10.2.1 20201125 (Red Hat 10.2.1-9)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import pathlib >>> pathlib.Path(".venv").read_text() Traceback (most recent call last): File "", line 1, in File "/usr/lib64/python3.9/pathlib.py", line 1255, in read_text with self.open(mode='r', encoding=encoding, errors=errors) as f: File "/usr/lib64/python3.9/pathlib.py", line 1241, in open return io.open(self, mode, buffering, encoding, errors, newline, IsADirectoryError: [Errno 21] Is a directory: '.venv' Doing the same on Windows raises a misleading permission error instead: >>> import pathlib >>> pathlib.Path(".venv").read_text() Traceback (most recent call last): File "", line 1, in File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.496.0_x64__qbz5n2kfra8p0\lib\pathlib.py", line 1255, in read_text with self.open(mode='r', encoding=encoding, errors=errors) as f: File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.496.0_x64__qbz5n2kfra8p0\lib\pathlib.py", line 1241, in open return io.open(self, mode, buffering, encoding, errors, newline, File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.496.0_x64__qbz5n2kfra8p0\lib\pathlib.py", line 1109, in _opener return self._accessor.open(self, flags, mode) PermissionError: [Errno 13] Permission denied: '.venv' -- components: Windows messages: 386103 nosy: Jairo Llopis, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: Windows does not raise IsADirectoryError versions: Python 3.9 ___ Python tracker <https://bugs.python.org/issue43095> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com