Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2026-10-22
17:19 • Ticket [3610253fff] CopyChunk does not drain decompressor(s) status still Cl... artifact: 7b31b885c8 user: serhiy.storchaka
2026-10-15
11:29 • Closed ticket [3610253fff]. artifact: eda924bf35 user: serhiy.storchaka
2022-09-11
16:36 • Pending ticket [3610253fff]. artifact: a1a2d829e3 user: kjnash
16:32
Fix bug [3610253] - apply the patch supplied with the ticket, and add a test. REVIEW REQUESTED! Al... check-in: 3cee774ebf user: kjnash tags: http-bugfixes-2022H2
2013-04-09
17:24 • Ticket [3610253fff] CopyChunk does not drain decompressor(s) status still Op... artifact: 53ad754801 user: kaitzschu
2013-04-08
14:58 • Ticket [3610253fff]: 4 changes artifact: 41e2ef2997 user: dkf
12:01 • Ticket [3610253fff]: 4 changes artifact: 783894084b user: kaitzschu
03:42 • Ticket [3610253fff]: 4 changes artifact: 397a899807 user: kaitzschu
03:42 • Add attachment http.CopyChunk.not.draining.everything.diff to ticket [3... artifact: 5ff93bead0 user: kaitzschu
2013-04-07
20:42 • New ticket [3610253fff] CopyChunk does not drain decompressor(s). artifact: ff32f673f3 user: kaitzschu

CopyChunk does not drain decompressor(s)

Closed / Fixed3610253fffffffffffffffffffffffffffffffffCreated 14 years agoUpdated 41 days ago
Descriptionplain2013-04-07 20:42:10
When retrieving a file from chunked+gzip enabled server (SourceForge project web) I got constantly truncated result. File size was always an exact multiple of 64k bytes and was missing the tail. It seems that http::CopyChunk trusts there can't be more data left on decompression buffer than one /stream get/ can return and does only one round of gets (using /add -finalize/). Attached patch (agains core.tcl.tk version of file) fixed the problem for me, but I'm not quite sure if the encoder chaining (the reason to foreach streams?) has been taken into account correctly.

As a side note, MAX_BUFFER_SIZE has been declared as 65536 but is being referred as "65k" elsewhere in the file http.tcl.
kaitzschuplain2013-04-08 03:42:16
File Added - 462391: http.CopyChunk.not.draining.everything.diff
kaitzschuplain2013-04-08 12:01:12
A comment to my side note: "65k" appears in file tclZlib.c, not in http.tcl.
dkfplain2013-04-08 14:58:58
I wonder if this is related to 3603553 (which is/will be fixed in 8.6.1)
kaitzschuplain2013-04-09 17:24:06
Either unrelated or fix does not apply, version 106daecfcabb5f8314f1196ab9e6cb2e25be1b53 (with date 2013-04-08 20:29:44) from core.tcl.tk has the same problem, downloaded file is still missing tail without patching http::CopyChunk.
kjnashwiki2022-09-11 16:36:35

I could not find a suitable URL that uses chunked encoding and gzip.

However, the test http11-2.1 does exactly what we need, and it was a matter of finding a file size that triggered the bug - this is now test http11-2.1.1.

The patch provided by kaitzschu fixes the bug. This patch is now applied in commit [3cee774ebf] of branch http-bugfixes-2022H2. However, I have no expertise in the use of channels, and I would appreciate a review of this code.

The ticket reports "File size was always an exact multiple of 64k bytes and was missing the tail." I have changed the size of the chunks sent by the server tests/httpd11.tcl from 512 bytes to 671 bytes, in the hope that making the size not equal to a power of 2 would improve the tests. No other test failures were found.

serhiy.storchakawiki2026-10-15 11:29:07

Closing: fixed, see above.

serhiy.storchaka Ticket [3610253fff]: 3 changes [History diff]2026-10-22 17:19:26
Log in (anonymous is fine) to add a comment.

Attachments: