From 03fa576833643c67579ae216c4e7350fa9b5f2fe Mon Sep 17 00:00:00 2001 From: Marc Hoersken Date: Tue, 24 Feb 2015 23:59:06 +0100 Subject: telnet.c: fix handling of 0 being returned from custom read function According to [1]: "Returning 0 will signal end-of-file to the library and cause it to stop the current transfer." This change makes the Windows telnet code handle this case accordingly. [1] http://curl.haxx.se/libcurl/c/CURLOPT_READFUNCTION.html --- lib/telnet.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/telnet.c b/lib/telnet.c index be3e904bf..236e59286 100644 --- a/lib/telnet.c +++ b/lib/telnet.c @@ -1439,8 +1439,10 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done) if(result == CURL_READFUNC_PAUSE) break; - if(result == 0) /* no bytes */ + if(result == 0) { /* no bytes, means end-of-file */ + keepon = FALSE; break; + } readfile_read = result; /* fall thru with number of bytes read */ } -- cgit v1.2.3