]> granicus.if.org Git - curl/commitdiff
telnet.c: fix handling of 0 being returned from custom read function
authorMarc Hoersken <info@marc-hoersken.de>
Tue, 24 Feb 2015 22:59:06 +0000 (23:59 +0100)
committerMarc Hoersken <info@marc-hoersken.de>
Tue, 24 Feb 2015 22:59:06 +0000 (23:59 +0100)
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

index be3e904bf234e330ce553e40a5ba3b16437b48ee..236e592860b19d703d990870149f406c53d7cc39 100644 (file)
@@ -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 */
         }