]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.11] gh-81403: Fix for CacheFTPHandler in urllib (GH-13951) (#103705)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sun, 23 Apr 2023 12:20:34 +0000 (05:20 -0700)
committerGitHub <noreply@github.com>
Sun, 23 Apr 2023 12:20:34 +0000 (05:20 -0700)
commit6e25228b2e8bd9556b879c629ee20876271bf7da
tree720cee2ae75ecc84a8c8668a6fad1ed99e224721
parenta43dbe13e2827464afe06e4b73f461003de28d79
[3.11] gh-81403: Fix for CacheFTPHandler in urllib (GH-13951) (#103705)

* gh-81403: Fix for CacheFTPHandler in urllib (GH-13951)

bpo-37222: Fix for CacheFTPHandler in urllib

A call to FTP.ntransfercmd must be followed by FTP.voidresp to clear
the "end transfer" message. Without this, the client and server get
out of sync, which will result in an error if the FTP instance is
reused to open a second URL. This scenario occurs for even the most
basic usage of CacheFTPHandler.

Reverts the patch merged as a resolution to bpo-16270 and adds a test
case for the CacheFTPHandler in test_urllib2net.py.

(cherry picked from commit e38bebb9ee805df6848f42845e71c8da8a821ad3)

Co-authored-by: Dan Hemberger <846186+hemberger@users.noreply.github.com>
Co-authored-by: Senthil Kumaran <senthil@python.org>
* Added NEWS entry.

---------

Co-authored-by: Dan Hemberger <846186+hemberger@users.noreply.github.com>
Co-authored-by: Senthil Kumaran <senthil@python.org>
Lib/test/test_urllib2net.py
Lib/urllib/request.py
Misc/NEWS.d/next/Library/2023-04-22-22-14-09.gh-issue-81403.zVz9Td.rst [new file with mode: 0644]