From 7c139633a1f4ebc83c3991330aefe15da1652d4d Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Sun, 30 Aug 2009 23:52:11 +0200 Subject: [PATCH] _libssh2_channel_write() only sends the 32K first bytes In theory we could split larger buffers into several smaller packets to pass to transport_write(), but for now we instead only deal with the first 32K in this call and assume the app will call this function again with the rest! The 32K size is a conservative limit based on the text in RFC4253 section 6.1. --- src/channel.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/channel.c b/src/channel.c index 006a64b..71583a0 100644 --- a/src/channel.c +++ b/src/channel.c @@ -1948,6 +1948,14 @@ _libssh2_channel_write(LIBSSH2_CHANNEL *channel, int stream_id, int rc; ssize_t wrote = 0; /* counter for this specific this call */ + /* In theory we could split larger buffers into several smaller packets, + * but for now we instead only deal with the first 32K in this call and + * assume the app will call it again with the rest! The 32K is a + * conservative limit based on the text in RFC4253 section 6.1. + */ + if(buflen > 32768) + buflen = 32768; + if (channel->write_state == libssh2_NB_state_idle) { channel->write_bufwrote = 0;