mirror of
https://github.com/curl/curl.git
synced 2025-09-16 09:02:40 +03:00
content_encoding: do not reset stage counter for each header
Test 418 verifies Closes #10492
This commit is contained in:
parent
4858e7af1c
commit
119fb18719
|
@ -1047,7 +1047,6 @@ CURLcode Curl_build_unencoding_stack(struct Curl_easy *data,
|
||||||
const char *enclist, int is_transfer)
|
const char *enclist, int is_transfer)
|
||||||
{
|
{
|
||||||
struct SingleRequest *k = &data->req;
|
struct SingleRequest *k = &data->req;
|
||||||
int counter = 0;
|
|
||||||
unsigned int order = is_transfer? 2: 1;
|
unsigned int order = is_transfer? 2: 1;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
@ -1084,9 +1083,9 @@ CURLcode Curl_build_unencoding_stack(struct Curl_easy *data,
|
||||||
if(!encoding)
|
if(!encoding)
|
||||||
encoding = &error_encoding; /* Defer error at stack use. */
|
encoding = &error_encoding; /* Defer error at stack use. */
|
||||||
|
|
||||||
if(++counter >= MAX_ENCODE_STACK) {
|
if(k->writer_stack_depth++ >= MAX_ENCODE_STACK) {
|
||||||
failf(data, "Reject response due to %u content encodings",
|
failf(data, "Reject response due to more than %u content encodings",
|
||||||
counter);
|
MAX_ENCODE_STACK);
|
||||||
return CURLE_BAD_CONTENT_ENCODING;
|
return CURLE_BAD_CONTENT_ENCODING;
|
||||||
}
|
}
|
||||||
/* Stack the unencoding stage. */
|
/* Stack the unencoding stage. */
|
||||||
|
|
|
@ -689,6 +689,7 @@ struct SingleRequest {
|
||||||
struct dohdata *doh; /* DoH specific data for this request */
|
struct dohdata *doh; /* DoH specific data for this request */
|
||||||
#endif
|
#endif
|
||||||
unsigned char setcookies;
|
unsigned char setcookies;
|
||||||
|
unsigned char writer_stack_depth; /* Unencoding stack depth. */
|
||||||
BIT(header); /* incoming data has HTTP header */
|
BIT(header); /* incoming data has HTTP header */
|
||||||
BIT(content_range); /* set TRUE if Content-Range: was found */
|
BIT(content_range); /* set TRUE if Content-Range: was found */
|
||||||
BIT(upload_done); /* set to TRUE when doing chunked transfer-encoding
|
BIT(upload_done); /* set to TRUE when doing chunked transfer-encoding
|
||||||
|
|
|
@ -68,7 +68,7 @@ test380 test381 test383 test384 test385 test386 test387 test388 test389 \
|
||||||
test390 test391 test392 test393 test394 test395 test396 test397 test398 \
|
test390 test391 test392 test393 test394 test395 test396 test397 test398 \
|
||||||
test399 test400 test401 test402 test403 test404 test405 test406 test407 \
|
test399 test400 test401 test402 test403 test404 test405 test406 test407 \
|
||||||
test408 test409 test410 test411 test412 test413 test414 test415 test416 \
|
test408 test409 test410 test411 test412 test413 test414 test415 test416 \
|
||||||
test417 \
|
test417 test418 \
|
||||||
\
|
\
|
||||||
test430 test431 test432 test433 test434 test435 test436 \
|
test430 test431 test432 test433 test434 test435 test436 \
|
||||||
\
|
\
|
||||||
|
|
|
@ -47,7 +47,7 @@ Accept: */*
|
||||||
61
|
61
|
||||||
</errorcode>
|
</errorcode>
|
||||||
<stderr mode="text">
|
<stderr mode="text">
|
||||||
curl: (61) Reject response due to 5 content encodings
|
curl: (61) Reject response due to more than 5 content encodings
|
||||||
</stderr>
|
</stderr>
|
||||||
</verify>
|
</verify>
|
||||||
</testcase>
|
</testcase>
|
||||||
|
|
152
tests/data/test418
Normal file
152
tests/data/test418
Normal file
|
@ -0,0 +1,152 @@
|
||||||
|
<testcase>
|
||||||
|
<info>
|
||||||
|
<keywords>
|
||||||
|
HTTP
|
||||||
|
gzip
|
||||||
|
</keywords>
|
||||||
|
</info>
|
||||||
|
|
||||||
|
#
|
||||||
|
# Server-side
|
||||||
|
<reply>
|
||||||
|
<data nocheck="yes">
|
||||||
|
HTTP/1.1 200 OK
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
Transfer-Encoding: gzip
|
||||||
|
|
||||||
|
-foo-
|
||||||
|
</data>
|
||||||
|
</reply>
|
||||||
|
|
||||||
|
#
|
||||||
|
# Client-side
|
||||||
|
<client>
|
||||||
|
<server>
|
||||||
|
http
|
||||||
|
</server>
|
||||||
|
<name>
|
||||||
|
Response with multiple Transfer-Encoding headers
|
||||||
|
</name>
|
||||||
|
<command>
|
||||||
|
http://%HOSTIP:%HTTPPORT/%TESTNUMBER -sS
|
||||||
|
</command>
|
||||||
|
</client>
|
||||||
|
|
||||||
|
#
|
||||||
|
# Verify data after the test has been "shot"
|
||||||
|
<verify>
|
||||||
|
<protocol crlf="yes">
|
||||||
|
GET /%TESTNUMBER HTTP/1.1
|
||||||
|
Host: %HOSTIP:%HTTPPORT
|
||||||
|
User-Agent: curl/%VERSION
|
||||||
|
Accept: */*
|
||||||
|
|
||||||
|
</protocol>
|
||||||
|
|
||||||
|
# CURLE_BAD_CONTENT_ENCODING is 61
|
||||||
|
<errorcode>
|
||||||
|
61
|
||||||
|
</errorcode>
|
||||||
|
<stderr mode="text">
|
||||||
|
curl: (61) Reject response due to more than 5 content encodings
|
||||||
|
</stderr>
|
||||||
|
</verify>
|
||||||
|
</testcase>
|
Loading…
Reference in New Issue
Block a user