bool connect_only)
{
size_t bad = 0;
+ unsigned int max = MAX_HTTP_RESP_HEADER_SIZE;
if(delta < MAX_HTTP_RESP_HEADER_SIZE) {
+ data->info.header_size += (unsigned int)delta;
+ data->req.allheadercount += (unsigned int)delta;
if(!connect_only)
data->req.headerbytecount += (unsigned int)delta;
- data->info.header_size += (unsigned int)delta;
- if(data->info.header_size > MAX_HTTP_RESP_HEADER_SIZE)
+ if(data->req.allheadercount > max)
+ bad = data->req.allheadercount;
+ else if(data->info.header_size > (max * 20)) {
bad = data->info.header_size;
+ max *= 20;
+ }
}
else
- bad = data->info.header_size + delta;
+ bad = data->req.allheadercount + delta;
if(bad) {
- failf(data, "Too large response headers: %zu > %u",
- bad, MAX_HTTP_RESP_HEADER_SIZE);
+ failf(data, "Too large response headers: %zu > %u", bad, max);
return CURLE_RECV_ERROR;
}
return CURLE_OK;
curl_off_t pendingheader; /* this many bytes left to send is actually
header and not body */
struct curltime start; /* transfer started at this time */
- unsigned int headerbytecount; /* only count received headers */
+ unsigned int headerbytecount; /* received server headers (not CONNECT
+ headers) */
+ unsigned int allheadercount; /* all received headers (server + CONNECT) */
unsigned int deductheadercount; /* this amount of bytes doesn't count when
we check if anything has been transferred
at the end of a connection. We use this