public TryPagesDirective(IReadOnlyList <string> pages, HttpLocationManager httpLocationManager) { _httpLocationManager = httpLocationManager; _pages = new List <string>(); for (var i = 1; i < pages.Count; i++) { _pages.Add(pages[i]); } }
public HttpServerInfo(IReadOnlyCollection <string> endPoints, IReadOnlyCollection <string> domains, string rootPath, bool useSSL, HttpLocationManager locationManager, ErrorMessageManager errorMessageManager) { Endpoints = endPoints; Domains = domains; RootPath = rootPath; UseSsl = useSSL; LocationManager = locationManager; ErrorMessageManager = errorMessageManager; }
public HttpServerConfig(List <string> endPoints, List <string> domains, string rootPath, bool useSSL, string certificate, string certificatePassword, HttpLocationManager locationManager, ErrorMessageManager errorMessageManager) { Endpoints = endPoints; Domains = domains; RootPath = rootPath; UseSsl = useSSL; Certificate = certificate; CertificatePassword = certificatePassword; LocationManager = locationManager; ErrorMessageManager = errorMessageManager; HttpServerInfo = new HttpServerInfo(Endpoints.AsReadOnly(), Domains.AsReadOnly(), RootPath, UseSsl, LocationManager, ErrorMessageManager); }
public HttpServerInfo(IEnumerable <string> hosts, IEnumerable <string> domains, string root, bool useSsl, string certificate, string password, HttpLocationManager httpLocationManager, ErrorMessagesManager errorMessageManager) { var tempHosts = (from host in hosts select host.Split(":") into rawSplit let address = IPAddress.Parse(rawSplit[0]) let port = int.Parse(rawSplit[1]) select new IPEndPoint(address, port)).ToList(); Hosts = tempHosts.AsReadOnly(); Domains = domains.ToList().AsReadOnly(); Root = root; UseSsl = useSsl; Certificate = certificate; Password = password; LocationManager = httpLocationManager; ErrorMessageManager = errorMessageManager; }
public LocationConfig(string key, JArray configItems, HttpLocationManager httpLocationManager, bool isDefault = false) { _httpLocationManager = httpLocationManager; _isDefault = isDefault; if (!isDefault) { var keyData = key.Split(" "); if (keyData[0].Equals("location", StringComparison.CurrentCultureIgnoreCase)) { if (keyData.Length == 2) { if (keyData[1][0].Equals('@')) { Key = keyData[1]; } _modifier = 0; _matchRegex = new Regex(keyData[1]); } else if (keyData.Length == 3) { switch (keyData[1]) { case "=": _modifier = 1; _matchRegex = new Regex(keyData[2]); break; case "~": _modifier = 2; _matchRegex = new Regex(keyData[2]); break; case "~*": _modifier = 3; _matchRegex = new Regex(keyData[2], RegexOptions.IgnoreCase); break; case "^~": _modifier = 4; _matchRegex = new Regex(keyData[2]); break; default: _modifier = 0; _matchRegex = new Regex(keyData[2]); break; } } } } _directives = new List <IDirective>(); foreach (var i in configItems) { var dataSplit = i.ToObject <string>().Split(" "); switch (dataSplit[0]) { case "index": _directives.Add(new IndexDirective(dataSplit)); break; case "try_files": _directives.Add(new TryFilesDirective(dataSplit, _httpLocationManager)); break; case "rewrite": _directives.Add(new ReWriteDirective(dataSplit)); break; case "try_pages": _directives.Add(new TryPagesDirective(dataSplit, _httpLocationManager)); break; case "return": _directives.Add(new ReturnDirective(dataSplit)); break; case "autoindex": //_directives.Add(new LocationDirective(i)); break; case "add_header": _directives.Add(new AddHeaderDirective(dataSplit)); break; } } }