aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2002-09-16 14:02:08 +0000
committerDaniel Stenberg <daniel@haxx.se>2002-09-16 14:02:08 +0000
commitfb5d267bd053442b25b1f84833a469bc832b58b7 (patch)
treeb315dae0b03dc6fa8ea03a39332dc0135c54bec1
parentc19844a0a3d7f7d1c7351de65605d13d422f2600 (diff)
a follow-up fix to the previous fix for HTTP servers that don't reply *any*
headers at all
-rw-r--r--lib/transfer.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/lib/transfer.c b/lib/transfer.c
index 22fffa6a1..3f5025c3e 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -268,18 +268,13 @@ CURLcode Curl_readwrite(struct connectdata *conn,
k->end_ptr = strchr (k->str_start, '\n');
if (!k->end_ptr) {
- /* no more complete header lines within buffer */
- /* copy what is remaining into headerbuff */
- int str_length = (int)strlen(k->str);
+ /* Not a complete header line within buffer, append the data to
+ the end of the headerbuff. */
- /*
- * We enlarge the header buffer if it seems to be too
- * smallish
- */
- if (k->hbuflen + (int)str_length >=
- data->state.headersize) {
+ if (k->hbuflen + nread >= data->state.headersize) {
+ /* We enlarge the header buffer as it is too small */
char *newbuff;
- long newsize=MAX((k->hbuflen+str_length)*3/2,
+ long newsize=MAX((k->hbuflen+nread)*3/2,
data->state.headersize*2);
hbufp_index = k->hbufp - data->state.headerbuff;
newbuff = (char *)realloc(data->state.headerbuff, newsize);
@@ -291,9 +286,9 @@ CURLcode Curl_readwrite(struct connectdata *conn,
data->state.headerbuff = newbuff;
k->hbufp = data->state.headerbuff + hbufp_index;
}
- strcpy (k->hbufp, k->str);
- k->hbufp += str_length;
- k->hbuflen += str_length;
+ memcpy(k->hbufp, k->str, nread);
+ k->hbufp += nread;
+ k->hbuflen += nread;
if (!k->headerline && (k->hbuflen>5)) {
/* make a first check that this looks like a HTTP header */
if(!strnequal(data->state.headerbuff, "HTTP/", 5)) {