aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2001-02-07 09:31:03 +0000
committerDaniel Stenberg <daniel@haxx.se>2001-02-07 09:31:03 +0000
commitabb14de7e05505d4159e6ffbb75f6135d21b3f6e (patch)
treecc1a6f02b6abeeda8c25d37c7cffd8384cfcaf2e /lib
parentccd57e58f6bc700338b7feee3260b68772a29260 (diff)
GetLine() didn't properly act on -1 lengths returned from Curl_read()
Diffstat (limited to 'lib')
-rw-r--r--lib/http.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/http.c b/lib/http.c
index 9fe056c5f..54623ec6b 100644
--- a/lib/http.c
+++ b/lib/http.c
@@ -226,17 +226,18 @@ int GetLine(int sockfd, char *buf, struct connectdata *conn)
(nread<BUFSIZE) && read_rc;
nread++, ptr++) {
if((CURLE_OK != Curl_read(conn, sockfd, ptr, 1, &nread)) ||
+ (nread <= 0) ||
(*ptr == '\n'))
break;
}
*ptr=0; /* zero terminate */
-
+
if(data->bits.verbose) {
fputs("< ", data->err);
fwrite(buf, 1, nread, data->err);
fputs("\n", data->err);
}
- return nread;
+ return nread>0?nread:0;
}