curl-library
SFTP and files larger than 16384 revisited
Date: Tue, 7 Apr 2009 14:50:25 -0500
It looks like this has been discussed a time or two before, but I didn't
see where any conclusion was reached. I thought I would pass along what
I found out.
Using cURL 7.19.3, libssh2-1.0, and openssl 0.9.8j I was running into a
problem where SFTP uploads would work fine for smaller files, but would
get stuck in an infinite loop for larger files (> 16384 bytes). From
what I could tell, the problem is centered in libssh's
libssh2_channel_write_ex function. When the size of the data to be sent
exceeds window_size, it tries to break the data up into smaller pieces.
if (channel->write_bufwrite > channel->local.window_size) {
_libssh2_debug(session, LIBSSH2_DBG_CONN,
"Splitting write block due to %lu byte "
"window_size on %lu/%lu/%d",
channel->local.window_size,
channel->local.id,
channel->remote.id, stream_id);
channel->write_bufwrite = channel->local.window_size;
}
I couldn't quite put my finger on where that was going wrong at, but
managed to work around it by adjusting cURL's CURL_MAX_WRITE_SIZE down
such that the data + SSL overhead wouldn't exceed 16384.
I'm not claiming this is a cURL bug. I just wanted to share what I
found.
Thanks to all that have contributed,
RHamilton
Received on 2009-04-07