Bug 54332 - HttpListener sends zero length chunk when zero length buffer is written
Summary: HttpListener sends zero length chunk when zero length buffer is written
Status: RESOLVED DUPLICATE of bug 47549
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.Net.Http (show other bugs)
Version: 4.8.0 (C9)
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-03-31 12:55 UTC by Martin Frydl
Modified: 2017-12-11 21:54 UTC (History)
3 users (show)

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


Attachments
Test case (936 bytes, text/x-csharp)
2017-03-31 12:55 UTC, Martin Frydl
Details
Client script (77 bytes, text/plain)
2017-03-31 12:56 UTC, Martin Frydl
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 DUPLICATE of bug 47549

Description Martin Frydl 2017-03-31 12:55:27 UTC
Created attachment 21101 [details]
Test case

When HttpListener uses chunked transfer encoding and Write() with zero length is invoked on response stream, the zero-length chunk is sent over the network. This confuses the client as the zero length chunk means end of response. The attached example shows the problem. Just run the test in Mono and then run the shell script to make client call (uses Netcat). The respose is:

HTTP/1.1 200 OK
Server: Mono-HTTPAPI/1.0
Date: Fri, 31 Mar 2017 12:04:28 GMT
Transfer-Encoding: chunked
Keep-Alive: timeout=15,max=100

0

4
test
0

On Windows/.NET, it is correct:

HTTP/1.1 200 OK
Transfer-Encoding: chunked
Server: Microsoft-HTTPAPI/2.0
Date: Fri, 31 Mar 2017 12:16:19 GMT

4
test
0
Comment 1 Martin Frydl 2017-03-31 12:56:28 UTC
Created attachment 21102 [details]
Client script
Comment 2 Alexander Udovichenko 2017-08-11 10:08:16 UTC
Dublicate of this https://bugzilla.xamarin.com/show_bug.cgi?id=47549
Already fixed in newer versions
Comment 3 Martin Baulig 2017-12-11 21:54:58 UTC

*** This bug has been marked as a duplicate of bug 47549 ***