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 (show other bugs)
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)

See Also:
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

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

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