|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
Patch ssh2_scp_send_fix_send_large_file_bug_for_0.11.3 for ssh2 Bug #62807Patch version 2012-08-13 12:49 UTC Return to Bug #62807 | Download this patchThis patch renders other patches obsolete Obsolete patches:
Developer: chopins.xiao@gmail.com
1007a1008,1013
> ssize_t write_size;
> int nfds = 1;
> struct timeval timeout;
> int select_number;
> fd_set writefd;
> int ssh_fd;
1015d1020
<
1042d1046
< libssh2_channel_set_blocking(remote_file, 1);
1043a1048,1052
> libssh2_channel_set_blocking(remote_file, 1);
> int send_none = 1;
> char buffer[8192];
> size_t toread;
> size_t bytesread;
1045,1048c1054,1057
< char buffer[8192];
< size_t toread = MIN(8192, ssb.sb.st_size);
< size_t bytesread = php_stream_read(local_file, buffer, toread);
<
---
> if(send_none == 1) {
> toread = MIN(8192, ssb.sb.st_size);
> bytesread = php_stream_read(local_file, buffer, toread);
> }
1055,1056c1064,1092
<
< if (bytesread != libssh2_channel_write(remote_file, buffer, bytesread)) {
---
> write_size = libssh2_channel_write(remote_file, buffer, bytesread);
> if(write_size < 0) {
> switch(write_size) {
> case LIBSSH2_ERROR_EAGAIN:
> php_error_docref(NULL TSRMLS_CC, E_WARNING,"System tcpsendspace is full");
> break;
> case LIBSSH2_ERROR_ALLOC:
> php_error_docref(NULL TSRMLS_CC,E_WARNING,"An internal memory allocation call failed");
> break;
> case LIBSSH2_ERROR_SOCKET_SEND:
> php_error_docref(NULL TSRMLS_CC,E_WARNING,"Unable to send data on socket");
> break;
> case LIBSSH2_ERROR_CHANNEL_CLOSED:
> php_error_docref(NULL TSRMLS_CC,E_WARNING,"The channel has been closed");
> break;
> case LIBSSH2_ERROR_CHANNEL_EOF_SENT:
> php_error_docref(NULL TSRMLS_CC,E_WARNING,"The channel has been requested to be closed");
> break;
> break;
> }
> RETURN_FALSE;
> }
> if(LIBSSH2_ERROR_NONE == write_size || LIBSSH2_ERROR_EAGAIN == write_size) {
> send_none = 0;
> continue;
> } else {
> send_none = 1;
> }
> if (write_size != bytesread) {
|
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Tue Sep 15 20:00:02 2026 UTC |