Serving robots.txt from bin Idea of solution for http://opensimulator.org/mantis/view.php?id=7392

Signed-off-by: Mandarinka Tasty <mandarinka.tasty@gmail.com>
Signed-off-by: Melanie Thielker <melanie@t-data.com>
melanie
Mandarinka Tasty 2016-12-29 23:20:33 +01:00 committed by Melanie Thielker
parent e0b5135010
commit aee3f273f0
2 changed files with 21 additions and 0 deletions

View File

@ -206,6 +206,7 @@ namespace OpenSim
MainServer.Instance.AddStreamHandler(new OpenSim.XSimStatusHandler(this));
if (userStatsURI != String.Empty)
MainServer.Instance.AddStreamHandler(new OpenSim.UXSimStatusHandler(this));
MainServer.Instance.AddStreamHandler(new OpenSim.SimRobotsHandler());
if (managedStatsURI != String.Empty)
{

View File

@ -876,6 +876,26 @@ namespace OpenSim
}
}
/// <summary>
/// handler to supply serving http://domainname:port/robots.txt
/// </summary>
public class SimRobotsHandler : BaseStreamHandler
{
public SimRobotsHandler() : base("GET", "/robots.txt", "SimRobots.txt", "Simulator Robots.txt") {}
protected override byte[] ProcessRequest(string path, Stream request,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
string robots = "# go away\nUser-agent: *\nDisallow: /\n";
return Util.UTF8.GetBytes(robots);
}
public override string ContentType
{
get { return "text/plain"; }
}
}
#endregion
/// <summary>