private void AddPorn() { log.Info("Try to find the page including: " + FullRequestUri); lock (SyncObject) { foreach (Tuple <String, HashSet <String> > tset in ImageSrcSetList) { if (tset.Item2.Contains(FullRequestUri.ToLower())) { string domainName = GetDomain.GetDomainFromUrl(tset.Item1); PornDatabase.DomainType dt = PornDB.GetDomainType(domainName); //hit log.Info("Hit: " + FullRequestUri + " => " + tset.Item1); //add to database PornDB.InsertPornPage(domainName, tset.Item1, FullRequestUri, dt == PornDatabase.DomainType.Black); } } } }
protected override void OnReceiveRequest() { //store complete request uri first, it will parsed and the host will be removed later FullRequestUri = RequestLine.URI; DomainName = GetDomain.GetDomainFromUrl(RequestLine.URI); DomainType = PornDB.GetDomainType(DomainName); _autoDomainStatus = PornDB.GetAutoDomainStatus(DomainName); log.Debug(GetDomain.GetDomainFromUrl(RequestLine.URI)); //DomainType == PornDatabase.DomainType.Black || if (DomainType != PornDatabase.DomainType.White && _autoDomainStatus == PornDatabase.ForbiddenItemStatus.Normal && Properties.Settings.Default.IsPornWebsiteProtectionTurnOn) { PornDB.InsertBlockedPage(FullRequestUri); //SocketBP.Send403(); //SocketBP.SendMasaHttpForbidden("I Love You!"); SocketBP.SendMasaHttpForbidden(Properties.Settings.Default.forbiddenRedirectUrl, "<h1>该网页包含不良信息,已被" + Properties.Resources.ProductionName + "屏蔽!</h1>"); //SocketBP.SendHttpError(); State.NextStep = AbortRequest; log.Info("Block request in tmp black list: " + RequestLine.URI); } }