This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Sohaib Ahmad
Recipients Sohaib Ahmad, gson, orsenthil, r.david.murray
Date 2016-09-15.10:44:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1473936250.24.0.619456161592.issue27973@psf.upfronthosting.co.za>
In-reply-to
Content
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 there is where the control got stuck and issue26960 was reported.

This is the end of debug log with the file mentioned in issue26960, after which the control got stuck:

*cmd* 'TYPE I'
*put* 'TYPE I\r\n'
*get* '200 Type set to I\r\n'
*resp* '200 Type set to I'
*cmd* 'PASV'
*put* 'PASV\r\n'
*get* '227 Entering Passive Mode (130,133,3,130,207,26).\r\n'
*resp* '227 Entering Passive Mode (130,133,3,130,207,26).'
*cmd* 'RETR ratings.list.gz'
*put* 'RETR ratings.list.gz\r\n'
*get* '150 Opening BINARY mode data connection for ratings.list.gz (12643237 bytes)\r\n'
*resp* '150 Opening BINARY mode data connection for ratings.list.gz (12643237 bytes)'

And this is the end of debug log of a very small file transfer over FTP:

*cmd* 'PASV'
*put* 'PASV\r\n'
*get* '227 Entering Passive Mode (130,239,18,165,234,243).\r\n'
*resp* '227 Entering Passive Mode (130,239,18,165,234,243).'
*cmd* 'RETR Contents-udeb-ppc64el.gz'
*put* 'RETR Contents-udeb-ppc64el.gz\r\n'
*get* '150 Opening BINARY mode data connection for Contents-udeb-ppc64el.gz (26555 bytes).\r\n'
*resp* '150 Opening BINARY mode data connection for Contents-udeb-ppc64el.gz (26555 bytes).'
*get* '226 Transfer complete.\r\n'
*resp* '226 Transfer complete.'

The control returned successfully once FTP returned 2xx.

Please correct me if I am wrong but from the RETR command it looks like it is trying the retrieve the whole file in both cases. Is urlopen() supposed to retrieve files when called or just get the headers/information etc.?
History
Date User Action Args
2016-09-15 10:44:10Sohaib Ahmadsetrecipients: + Sohaib Ahmad, orsenthil, r.david.murray, gson
2016-09-15 10:44:10Sohaib Ahmadsetmessageid: <1473936250.24.0.619456161592.issue27973@psf.upfronthosting.co.za>
2016-09-15 10:44:10Sohaib Ahmadlinkissue27973 messages
2016-09-15 10:44:09Sohaib Ahmadcreate
Morty Proxy This is a proxified and sanitized view of the page, visit original site.