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

Notice (2018-05-21): bugzilla.xamarin.com will be switching to read-only mode on Thursday, 2018-05-25 22:00 UTC.

Please join us on Visual Studio Developer Community and GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs and copy them to the new locations as needed for follow-up. The See Also field on each Bugzilla bug will be updated with a link to its new location when applicable.

After Bugzilla is read-only, if you have new information to add for a bug that does not yet have a matching issue on Developer Community or GitHub, you can create a follow-up issue in the new location. Copy and paste the title and description from this bug, and then add your new details. You can get a pre-formatted version of the title and description here:

In special cases you might also want the comments:

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

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