aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2002-10-09 13:03:51 +0000
committerDaniel Stenberg <daniel@haxx.se>2002-10-09 13:03:51 +0000
commitc3cc616264e6a424306edb7ff2acd035b31c90ef (patch)
tree04feccef412417ac25d22a73c552625a893d622f
parent91b84b89e4d057d7c1a022dc1b6ce44e3738dcf0 (diff)
Junk data could get inserted when saving/getting HTTP headers, as discovered
by Craig Davison. Now we deal with the 'nread' variable correctly between each header line.
-rw-r--r--lib/transfer.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/lib/transfer.c b/lib/transfer.c
index d33838ee8..1de4fccef 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -302,6 +302,9 @@ CURLcode Curl_readwrite(struct connectdata *conn,
break; /* read more and try again */
}
+ /* decrease the size of the remaining buffer */
+ nread -= (k->end_ptr - k->str)+1;
+
k->str = k->end_ptr + 1; /* move past new line */
/*
@@ -696,13 +699,6 @@ CURLcode Curl_readwrite(struct connectdata *conn,
there might be a non-header part left in the end of the read
buffer. */
- if (!k->header) {
- /* starting here, this is not part of the header! */
-
- /* we subtract the remaining header size from the buffer */
- nread -= (k->str - k->buf);
- }
-
} /* end if header mode */
/* This is not an 'else if' since it may be a rest from the header