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
Depends on:
Reported: 2017-03-31 12:55 UTC by Martin Frydl
Modified: 2017-12-11 21:54 UTC (History)
3 users (show)

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

Test case (936 bytes, text/x-csharp)
2017-03-31 12:55 UTC, Martin Frydl
Client script (77 bytes, text/plain)
2017-03-31 12:56 UTC, Martin Frydl

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



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

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

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