/// <summary> /// Remove a Website /// </summary> /// <param name="website"></param> public void RemoveWebsite(HttpWebsite website) { if (!sites.Contains(website)) { sites.Remove(website); } }
/// <summary> /// Add a Website /// </summary> /// <param name="website"></param> public void AddWebsite(HttpWebsite website) { if (!sites.Contains(website)) { sites.Insert(0, website); } }
internal HttpClient(Socket handle, HttpWebServer server) { this.handle = handle; this.server = server; this.website = HttpWebsite.InternalWebsite; this.buffer = new byte[buffersize]; this.request = new HttpRequest(this); this.response = new HttpResponse(); handle.ReceiveTimeout = 30 * 1000; }
public ActivePageModule(HttpWebsite website) { this.website = website; }
public ErrorModule(HttpWebsite website) { this.website = website; this.ErrorPagePath = website.Config!=null?website.Config.ErrorPagePath:""; }
private void Process() { try { this.website = server.GetWebSite(request.headers[eHttpRequestHeader.Host]); if (this.website == HttpWebsite.InternalWebsite) { request.ErrorCode = 403; return; } else { request.client = this; IModule module = null; foreach (var x in website.modules) { if (x.CanProcess(request)) { module = x; break; } } if (module != null) { response = module.Process(request); if (!response.IsError) { response.Cookies.Add(new HttpCookie { name = "SessionID", content = request.Session.ID, Expires = DateTime.Now.AddHours(1) }); } Response(); } else { request.ErrorCode = 501; SendErrorAndDisconnect(); } } } catch (Exception e) { Log.Log.Default.Warn(e); request.ErrorCode = 500; SendErrorAndDisconnect(); //throw; } }