[issue1067702] urllib fails with multiple ftp transfers

2016-09-06 Thread Sohaib Ahmad
Sohaib Ahmad added the comment: The problem is reproducible on latest python 2.7 package (2.7.12). I tried the same scenario on 2.7.10 and it worked fine. I am not sure if this issue can be reopened or should I create a new one? In my case first transfer succeeds but second ftp transfer fails

[issue27973] urllib.urlretrieve() fails on second ftp transfer

2016-09-06 Thread Sohaib Ahmad
New submission from Sohaib Ahmad: urllib.urlretrieve() fails on ftp: - start and complete a transfer - immediately start another transfer The second transfer will fail with the following error: [Errno ftp error] 200 Type set to I I am using urllib.urlretrieve(url, filename) to retrieve two

[issue27973] urllib.urlretrieve() fails on second ftp transfer

2016-09-07 Thread Sohaib Ahmad
Sohaib Ahmad added the comment: I am not much familiar with mercurial. I will try to setup the development environment. Traceback is: [Errno ftp error] 200 Switching to Binary mode. Traceback (most recent call last): File "multiple_ftp_download.py", line 49, in main

[issue27973] urllib.urlretrieve() fails on second ftp transfer

2016-09-14 Thread Sohaib Ahmad
Sohaib Ahmad added the comment: Thank you for pointing me towards hg bisect. I got some time to look into it and was able to find the commit that broke this functionality. A fix from Python 3 was backported in issue "urllib hangs when closing connection" which removed a call to ft

[issue27973] urllib.urlretrieve() fails on second ftp transfer

2016-09-15 Thread Sohaib Ahmad
Sohaib Ahmad added the comment: I didn't know that urllib.urlopen() retrieves complete object in case of FTP. When getresp() is called for big files (the one in issue26960), RETR command is initiated and server returns code 150 which means "standby for another reply" and the

[issue27973] urllib.urlretrieve() fails on second ftp transfer

2016-09-15 Thread Sohaib Ahmad
Sohaib Ahmad added the comment: I manually reverted the issue26960 patch which fixed my issue of consecutive downloads but it also caused regression of issue26960. I am looking into what could be causing this hang when voidresp() is called using the demo available in issue26960 and it looks

[issue27973] urllib.urlretrieve() fails on second ftp transfer

2016-09-16 Thread Sohaib Ahmad
Sohaib Ahmad added the comment: The attached patch fixes the problem with multiple ftp downloads while keeping the fix for issue1067702 intact. The fix basically uses a new parameter ftp_retrieve to change the behavior of ftpwrapper.retrfile() if it is being called by urlretrieve(). I am not

[issue27973] urllib.urlretrieve() fails on second ftp transfer

2016-09-16 Thread Sohaib Ahmad
Sohaib Ahmad added the comment: Hi Senthil, Thanks for the review. Now that I look at it, even with a default value, an ftp specific parameter sure does break the open() API abstraction. -- ___ Python tracker <http://bugs.python.org/issue27

[issue27973] urllib.urlretrieve() fails on second ftp transfer

2016-09-17 Thread Sohaib Ahmad
Changes by Sohaib Ahmad : Removed file: http://bugs.python.org/file44692/urllib.patch ___ Python tracker <http://bugs.python.org/issue27973> ___ ___ Python-bugs-list m

[issue27973] urllib.urlretrieve() fails on second ftp transfer

2016-09-17 Thread Sohaib Ahmad
Sohaib Ahmad added the comment: I finally found the actual problem causing the failure of second download. urlretrieve() works with FTP in PASV mode, and in PASV mode after sending the file to client, the FTP server sends an ACK that the file has been transferred. After the fix of

[issue27973] urllib.urlretrieve() fails on second ftp transfer

2016-11-04 Thread Sohaib Ahmad
Sohaib Ahmad added the comment: Can someone please review this patch so that it would be in 2.7.13 when it comes out? -- ___ Python tracker <http://bugs.python.org/issue27

[issue27973] urllib.urlretrieve() fails on second ftp transfer

2016-11-10 Thread Sohaib Ahmad
Sohaib Ahmad added the comment: @Senthil, thanks for looking into this. Looking forward to your commit. Regards. -- ___ Python tracker <http://bugs.python.org/issue27