Bug 31209 - HttpConnection locks up if first line of request is empty
Summary: HttpConnection locks up if first line of request is empty
Alias: None
Product: Class Libraries
Classification: Mono
Component: System ()
Version: 4.0.0
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2015-06-17 20:01 UTC by Brett Ernst
Modified: 2015-11-06 15:49 UTC (History)
3 users (show)

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

Potential fix. MIT license. (1.70 KB, patch)
2015-06-17 20:01 UTC, Brett Ernst

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:

Description Brett Ernst 2015-06-17 20:01:16 UTC
Created attachment 11657 [details]
Potential fix. MIT license.

When hosting an HTTP server (for example, a Nancy self-hosted process) an empty line in the request can cause the worker thread to spin forever, pegging the CPU. This occurs on line 347 of mcs/class/System/System.Net/HttpConnection.cs. The problem seems to be present in master.

The issue is consistently reproducible by telnetting to a hosting process and simply hitting enter.

I've attached the patch I'm using to work around the problem, provided under the MIT license.
Comment 1 Brett Ernst 2015-06-17 20:57:00 UTC
Apologies - the line number referenced above should be 323, not 347.
Comment 2 Martin Baulig 2015-11-06 15:49:24 UTC