php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #56387 libssh automatically decrease a window frame, but pecl module does not
Submitted: 2005-05-03 11:24 UTC Modified: 2005-05-04 14:59 UTC
From: deadem at mail dot ru Assigned: pollita (profile)
Status: Closed Package: ssh2 (PECL)
PHP Version: 5.0.3 OS: linux
Private report: No CVE-ID: None
 [2005-05-03 11:24 UTC] deadem at mail dot ru
Description:
------------
patch:
diff ssh2_fopen_wrappers.c.orig ssh2_fopen_wrappers.c 
976c976,985
<               if (bytesread != libssh2_channel_write(remote_file, buffer, bytesread)) {
---
>         size_t realwrite = 0;
>         size_t stepwrite = 0;
>         while ((stepwrite = libssh2_channel_write(remote_file, buffer + realwrite, bytesread - realwrite)) > 0) {
>             realwrite += stepwrite;
>             if (bytesread <= realwrite) {
>                 break;
>             }
>         }
> 
>               if (bytesread != realwrite) {


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-05-03 15:26 UTC] pollita@php.net
libssh2 automatically handles this sort of partial write chunking when the channel is set to blocking.
 [2005-05-03 16:31 UTC] deadem at mail dot ru
no. see in libssh2-0.8/src/channel.c
LIBSSH2_API int libssh2_channel_write_ex(LIBSSH2_CHANNEL *channel, int stream_id, const char *buf, size_t buflen)

this function only wait for first window frame and send data of it's size, instead of buflen.

    if (buflen > channel->local.window_size) {
        buflen = channel->local.window_size;
    }
    if (buflen > channel->local.packet_size) {
        buflen = channel->local.packet_size;
    }
 [2005-05-04 14:59 UTC] pollita@php.net
Ah, I see what you're talking about now.

I'm actually going to fix this in libssh2_channel_write so that blocking write really does mean blocking write.

Thanks for your persistence.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sat Nov 16 21:01:32 2019 UTC