Bug 47549

Summary: Chunked encoding error when writing zero buffer
Product: [Mono] Class Libraries Reporter: Alexander Udovichenko <udovichenko48>
Component: SystemAssignee: Marek Safar <masafa>
Severity: normal CC: masafa, mfrydl, mono-bugs+mono
Priority: ---    
Version: unspecified   
Target Milestone: Untriaged   
Hardware: PC   
OS: All   
Tags: Is this bug a regression?: ---
Last known good build:
Attachments: reproduce code
pcap dump

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. ***