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

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


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


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

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.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

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