phpseclib - endless downloading

痴心易碎 提交于 2019-12-11 21:37:19

问题


I'm using phpseclib 0.3.1 for working with remote SFTP server. I have a script which downloads cover images from the SFTP, save them on my server and make updates in database.

I run this script for 7000 images and after nearly 10-12 minutes, it looks like script has stopped (but eventually I have found out that script entered an endless loop)

After some investigation, I have found the following details:

  1. function get($remote_file, $local_file = false) from SFTP.php is called for downloading image file

  2. In this function _get_sftp_packet() is called in while(true) loop.

  3. In _get_sftp_packet() there is a call of _get_channel_packet(NET_SFTP_CHANNEL);

  4. And in _get_channel_packet() there is a call of $response = $this->_get_binary_packet();

My problem that this $response is empty string. In function _get_sftp_packet() length of this response is used as a decrement and if function returns empty string (or length 0) - I will never get out of the loop in _get_sftp_packet()

Did anyone face this problem? What empty response means for _get_binary_packet() function?

I will appreciate any help.


回答1:


It's probably an issue with the window size handling. An issue that has been fixed for a while now.

You're running 0.3.1? The latest version is 0.3.10. You're like 5 versions behind.



来源:https://stackoverflow.com/questions/28639927/phpseclib-endless-downloading

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!