Bug 29819 - HttpListener Pipelined inbound requests are ignored
Summary: HttpListener Pipelined inbound requests are ignored
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: System ()
Version: 4.0.0
Hardware: Macintosh Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2015-05-06 18:10 UTC by Jon
Modified: 2015-05-07 15:03 UTC (History)
2 users (show)

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

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 for Bug 29819 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description Jon 2015-05-06 18:10:26 UTC
If I create a web server using C# I noticed that the second request of inbound pipelined requests are always ignored. I've tried on both 3.12.1 and 4.0.0 on Linux.

Here's my netcat command to test pipelining:
nc -v localhost 5000 < httppipe.txt 

Here's the contents of httppipe.txt:
GET /heartbeat HTTP/1.1
Host: localhost

GET /heartbeat HTTP/1.1
Host: localhost

I'm pretty confident my netcat approach works because I tested it on a Java server successfully. (Meaning I saw 2 responses)

In my C# server, I've tried both GetResult and GetResultAsync. The code with GetResultAsync is basically pulled right from the MSDN example. It looks like this:
using System;
using System.Net;
using System.Threading;

namespace WebServerTest {
    public class WebServer {

        private HttpListener listener;
        public volatile bool Active = false;

        private Thread listenThread;

        public WebServer() {
            listener = new HttpListener();
            //IAsyncResult result = 
            //this.Listener.BeginGetContext(new AsyncCallback(ListenerCallback),null);
            listener.BeginGetContext(new AsyncCallback(ListenerCallback), listener);

            this.listenThread = new Thread(new ParameterizedThreadStart(Startlistener));

        private void Startlistener(object s)
            while (true){              

        private void ProcessRequest()
            var result = listener.BeginGetContext(ListenerCallback, listener);

        public static void ListenerCallback(IAsyncResult result)
            HttpListener listener = (HttpListener) result.AsyncState;
            // Call EndGetContext to complete the asynchronous operation.
            HttpListenerContext context = listener.EndGetContext(result);
            listener.BeginGetContext(new AsyncCallback(ListenerCallback), listener);
            HttpListenerRequest request = context.Request;
            // Obtain a response object.
            HttpListenerResponse response = context.Response;
            // Construct a response. 
            string responseString = "<HTML><BODY> Hello world!</BODY></HTML>";
            byte[] buffer = System.Text.Encoding.UTF8.GetBytes(responseString);
            // Get a response stream and write the response to it.
            response.ContentLength64 = buffer.Length;
            System.IO.Stream output = response.OutputStream;
            // You must close the output stream.