summaryrefslogtreecommitdiff
path: root/lib/telnet.c
diff options
context:
space:
mode:
authorRichy Kim <richy@fb.com>2016-12-20 05:48:15 -0500
committerDaniel Stenberg <daniel@haxx.se>2017-01-19 23:38:04 +0100
commit6b7616690e5370c21e3a760321af6bf4edbabfb6 (patch)
tree15ff13a118a311f3a604686103b6d0eaaee6ced4 /lib/telnet.c
parent81cb255cb355ca35453e7297af9cbc8ff7798416 (diff)
downloadcurl-6b7616690e5370c21e3a760321af6bf4edbabfb6.tar.gz
CURLOPT_BUFFERSIZE: support enlarging receive buffer
Replace use of fixed macro BUFSIZE to define the size of the receive buffer. Reappropriate CURLOPT_BUFFERSIZE to include enlarging receive buffer size. Upon setting, resize buffer if larger than the current default size up to a MAX_BUFSIZE (512KB). This can benefit protocols like SFTP. Closes #1222
Diffstat (limited to 'lib/telnet.c')
-rw-r--r--lib/telnet.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/telnet.c b/lib/telnet.c
index 551af60f2..8ee7efa4c 100644
--- a/lib/telnet.c
+++ b/lib/telnet.c
@@ -1416,6 +1416,7 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done)
/* Keep on listening and act on events */
while(keepon) {
+ const size_t buf_size = CURL_BUFSIZE(data->set.buffer_size);
waitret = WaitForMultipleObjects(obj_count, objs, FALSE, wait_timeout);
switch(waitret) {
case WAIT_TIMEOUT:
@@ -1451,7 +1452,7 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done)
if(!readfile_read)
break;
- if(!ReadFile(stdin_handle, buf, sizeof(data->state.buffer),
+ if(!ReadFile(stdin_handle, buf, buf_size,
&readfile_read, NULL)) {
keepon = FALSE;
result = CURLE_READ_ERROR;
@@ -1470,7 +1471,7 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done)
case WAIT_OBJECT_0 + 1:
{
- if(!ReadFile(stdin_handle, buf, sizeof(data->state.buffer),
+ if(!ReadFile(stdin_handle, buf, buf_size,
&readfile_read, NULL)) {
keepon = FALSE;
result = CURLE_READ_ERROR;