|
|
@ -6,6 +6,7 @@ using System.Web; |
|
|
|
using System.Text.RegularExpressions; |
|
|
|
using System.Text.RegularExpressions; |
|
|
|
using System.IO; |
|
|
|
using System.IO; |
|
|
|
using FLocal.Core; |
|
|
|
using FLocal.Core; |
|
|
|
|
|
|
|
using FLocal.Common; |
|
|
|
|
|
|
|
|
|
|
|
namespace FLocal.IISHandler.handlers.response { |
|
|
|
namespace FLocal.IISHandler.handlers.response { |
|
|
|
class RobotsHandler : AbstractGetHandler<FLocal.Common.URL.Robots> { |
|
|
|
class RobotsHandler : AbstractGetHandler<FLocal.Common.URL.Robots> { |
|
|
@ -18,10 +19,12 @@ namespace FLocal.IISHandler.handlers.response { |
|
|
|
|
|
|
|
|
|
|
|
protected override IEnumerable<System.Xml.Linq.XElement> getSpecificData(WebContext context) { |
|
|
|
protected override IEnumerable<System.Xml.Linq.XElement> getSpecificData(WebContext context) { |
|
|
|
context.httpresponse.ContentType = "text/plain"; |
|
|
|
context.httpresponse.ContentType = "text/plain"; |
|
|
|
context.httpresponse.WriteLine("User-agent: *"); |
|
|
|
if(Config.instance.IsIndexingDisabled) { |
|
|
|
context.httpresponse.WriteLine("Disallow: /"); |
|
|
|
context.httpresponse.WriteLine("User-agent: *"); |
|
|
|
foreach(var subnet in context.remoteHost.matchingSubnets) { |
|
|
|
context.httpresponse.WriteLine("Disallow: /"); |
|
|
|
context.httpresponse.WriteLine(subnet.ToString()); |
|
|
|
foreach(var subnet in context.remoteHost.matchingSubnets) { |
|
|
|
|
|
|
|
context.httpresponse.WriteLine(subnet.ToString()); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
throw new SkipXsltTransformException(); |
|
|
|
throw new SkipXsltTransformException(); |
|
|
|
} |
|
|
|
} |
|
|
|