Bug 38849 - [mono-fastcgi] impossible to start fastcgi on
Summary: [mono-fastcgi] impossible to start fastcgi on
Alias: None
Product: Tools
Classification: Mono
Component: other ()
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Alexander Köplinger [MSFT]
Depends on:
Reported: 2016-02-17 13:28 UTC by Artem
Modified: 2016-02-26 13:53 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 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 Artem 2016-02-17 13:28:26 UTC
According to https://github.com/mono/xsp/blob/master/src/Mono.WebServer.FastCgi/Sockets/TcpSocket.cs#L38

public TcpSocket (System.Net.IPAddress address, int port)
			: this (new System.Net.IPEndPoint (Equals(address, System.Net.IPAddress.Any) ?
				System.Net.IPAddress.Loopback : address, port))

there is no possibility to start fastcgi on IPAddress.Any (, because of forced conversion to IPAddress.Loopback ( 

Is any reason to do this? Fastcgi on listen only internal host tcp traffic. It works in case nginx and fastcgi are running on the one host, otherwise (different hosts) we have to add firewall rules to allow remote traffic from nginx get to fastcgi.

I think the conversion => is meaningless and we should remove the one.

According to git history before Jun 3 2013 there has been mistake, which was fixed by this commit https://github.com/mono/xsp/commit/0f0cee3a3cc4658e2f3b29a3eb77cb4b878d4542
Before this commit there was reference equals, which was always false, instead of IPEndPoint.Equals. So this converting really worked only after this commit. 

IPAddress doesn't override operator ==, only Equals (https://github.com/mono/mono/blob/master/mcs/class/System/System.Net/IPAddress.cs#L479)
so on Apache mod also can work on only because of mistake with ==
Comment 1 Alexander Köplinger [MSFT] 2016-02-22 18:33:20 UTC
Yeah, you're correct this looks pretty pointless. I think we can remove it.

The == comparison in the Apache mod has been that way since the beginning [1] and the FastCgi one started out the same way in [2] but was later changed as you said.

[1] https://github.com/mono/xsp/commit/27668ce4a89862c4ea8d4814a7fafb13ee73601d#diff-b3f046f8216096c242f36b2a223daafd
[2] https://github.com/shana/mono-soc-2007/commit/15cdbea0c9bc3e46c248ef40b4e9782911d027d9#diff-03fdd3e764b2b9d6788decf396baf4cc
Comment 2 Alexander Köplinger [MSFT] 2016-02-26 13:53:52 UTC
Fixed by https://github.com/mono/xsp/pull/73