Fixes bug #669059. We now extract the Content-Type better and more accurate.
This commit is contained in:
Родитель
f81d027f60
Коммит
169b2eeb94
|
@ -567,22 +567,29 @@ CURLcode Curl_readwrite(struct connectdata *conn,
|
||||||
*start && isspace((int)*start);
|
*start && isspace((int)*start);
|
||||||
start++);
|
start++);
|
||||||
|
|
||||||
/* count all non-space letters following */
|
end = strchr(start, '\r');
|
||||||
for(end=start, len=0;
|
if(!end)
|
||||||
*end && !isspace((int)*end);
|
end = strchr(start, '\n');
|
||||||
end++, len++);
|
|
||||||
|
|
||||||
/* allocate memory of a cloned copy */
|
if(end) {
|
||||||
if(data->info.contenttype)
|
/* skip all trailing space letters */
|
||||||
free(data->info.contenttype);
|
for(; isspace(*end) && (end > start); end--);
|
||||||
|
|
||||||
data->info.contenttype = malloc(len + 1);
|
/* get length of the type */
|
||||||
if (NULL == data->info.contenttype)
|
len = end-start+1;
|
||||||
return CURLE_OUT_OF_MEMORY;
|
|
||||||
|
|
||||||
/* copy the content-type string */
|
/* allocate memory of a cloned copy */
|
||||||
memcpy(data->info.contenttype, start, len);
|
if(data->info.contenttype)
|
||||||
data->info.contenttype[len] = 0; /* zero terminate */
|
free(data->info.contenttype);
|
||||||
|
|
||||||
|
data->info.contenttype = malloc(len + 1);
|
||||||
|
if (NULL == data->info.contenttype)
|
||||||
|
return CURLE_OUT_OF_MEMORY;
|
||||||
|
|
||||||
|
/* copy the content-type string */
|
||||||
|
memcpy(data->info.contenttype, start, len);
|
||||||
|
data->info.contenttype[len] = 0; /* zero terminate */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if((k->httpversion == 10) &&
|
else if((k->httpversion == 10) &&
|
||||||
conn->bits.httpproxy &&
|
conn->bits.httpproxy &&
|
||||||
|
|
Загрузка…
Ссылка в новой задаче