public override bool Apply(Request request) { if (request.Flags ["pass"] == true) return false; request.ReplaceHeader ("Accept", "*/*"); request.ReplaceHeader ("Accept-Charset", "utf-8"); request.ReplaceHeader ("Accept-Encoding", "gzip, deflate"); return true; }
public override bool Apply(Request request) { int headers = request.Count; string connection = request.GetHeader ("Proxy-Connection"); request.RemoveHeader ("Proxy-Connection"); if (connection == null) request.ReplaceHeader ("Connection", "close"); else request.ReplaceHeader ("Connection", connection); if (headers != request.Count) return true; else return false; }
public override bool Apply(Request request) { if (request.Response != null) { request.Response.Add ("X-PP-User-Agent: " + request.GetHeader ("User-Agent")); return false; } try { listLock.EnterReadLock (); if (staticAgent.ContainsKey (request.Uri.Host)) { UserAgentRule r = staticAgent[request.Uri.Host]; if (r.UserAgent == "") { request.RemoveHeader ("User-Agent"); } else if (r.UserAgent.ToLowerInvariant () == "random") { request.ReplaceHeader ("User-Agent", RandomUserAgent ()); } else if (r.UserAgent.ToLowerInvariant () != "pass") { request.ReplaceHeader ("User-Agent", r.UserAgent); } if (r.Lang == "") { request.RemoveHeader ("Accept-Language"); } else if (r.Lang.ToLowerInvariant () == "random") { request.ReplaceHeader ("Accept-Language", GetRandom (lang)); } else if (r.Lang.ToLowerInvariant () != "pass") { request.ReplaceHeader ("Accept-Language", r.Lang); } } else { //Default request.ReplaceHeader ("User-Agent", RandomUserAgent ()); request.RemoveHeader ("Accept-Language"); } } finally { listLock.TryExitReadLock (); } return true; }