Bug 35998 - HttpListener easily cause deadloop
Summary: HttpListener easily cause deadloop
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.Net.Http ()
Version: 4.0.0
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-11-18 08:50 UTC by firebank
Modified: 2015-11-19 16:28 UTC (History)
2 users (show)

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


Attachments
Test Server Program (1.21 KB, text/plain)
2015-11-18 08:50 UTC, firebank
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 FIXED

Description firebank 2015-11-18 08:50:34 UTC
Created attachment 13863 [details]
Test Server Program

Mono Version : 4.0.2
OS           : CentOS6.6 64bit / CentOS7.0 64bit

\mcs\class\System\System.Net\HttpConnection.cs

bool ProcessInput (MemoryStream ms)
{
	......

	do {
		if (line == null)
			break;
		if (line == "") {
			if (input_state == InputState.RequestLine)
				continue;
			current_line = null;
			ms = null;
			return true;
		}

		......

	} while( line != null);

	if (used == len) {
		ms.SetLength (0);
		position = 0;
	}
	return false;
}


ProcessInput function will deadloop after the client send a empty line.

e.g :
1) telnet IP PORT
2) Type a Enter
3) Type 123
4) Type a Enter


The same operation used on Windows .Net will return a 400 Bad Request.
Comment 1 firebank 2015-11-18 21:59:28 UTC
Step:

1) telnet IP PORT
2) Type Enter
3) Type 123
4) Type Enter
Comment 2 Martin Baulig 2015-11-19 16:28:09 UTC
We fixed that last week.