Bug 47549 - Chunked encoding error when writing zero buffer
Summary: Chunked encoding error when writing zero buffer
Alias: None
Product: Class Libraries
Classification: Mono
Component: System (show other bugs)
Version: unspecified
Hardware: PC All
: --- normal
Target Milestone: Untriaged
Assignee: Marek Safar
: 54332 (view as bug list)
Depends on:
Reported: 2016-11-20 13:20 UTC by Alexander Udovichenko
Modified: 2017-12-11 21:54 UTC (History)
3 users (show)

See Also:
Is this bug a regression?: ---
Last known good build:

reproduce code (561 bytes, text/plain)
2016-11-20 13:20 UTC, Alexander Udovichenko
pcap dump (4.12 KB, application/octet-stream)
2016-11-20 13:24 UTC, Alexander Udovichenko

Description Alexander Udovichenko 2016-11-20 13:20:38 UTC
Created attachment 18554 [details]
reproduce code

When using chunked encoding in response, then writing zero buffer to output Stream will result
writing Chunk End Mark to client ("0\r\n"). This happens because count argument of ResponseStream class in Write method (https://github.com/mono/mono/blob/master/mcs/class/System/System.Net/ResponseStream.cs) is tested for zero after chunk prefix is writed to lower stream. 
I tested this case in MS.NET, it worked well.
I attach code sample to reproduce this and also I have a pcap dump of wrong respose.
Comment 1 Alexander Udovichenko 2016-11-20 13:24:40 UTC
Created attachment 18555 [details]
pcap dump
Comment 2 Marek Safar 2016-11-23 16:44:18 UTC
Fixed in master
Comment 3 Martin Baulig 2017-12-11 21:54:58 UTC
*** Bug 54332 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.