pub fn handle_path(&self, path: &str, host: &str, auth: &str) -> (String, String, Option<String>) {
		let mut host = trim_port(host);
		let hostn = host.to_owned();

		// Prevent the client from accessing data they aren't supposed to access, at the risk of breaking some (very badly designed) clients. A more elegant solution is possible, but it isn't worth implementing, as no popular clients are anywhere near this broken.
		let fp = &[host, path].concat();
		match path {
			_ if path.ends_with("/index.html") => return ("./".to_owned(), "redir".to_owned(), None),
			_ if path.contains("..") => return ("..".to_owned(), "redir".to_owned(), None),
			_ => (),
		}

		/* Check if the path is protected by HTTP authentication. If checking path authentication fails (due to either a badly formatted config or a bad Config object), act as if the endpoint doesn't have authentication.
		If it is protected, check if the auth input matches the correct login, and return if it is incorrect. */
		if self.authx.is_match(fp) {
			if let Some(regx) = self.authx.matches(fp).iter().next() {
				if let Some(eauth) = self.authmap.get(&["r#", &self.authx.patterns()[regx]].concat()) {
					let authx = trim_prefix("Basic ", auth);
					if authx != eauth {
						return ("unauth".to_owned(), "redir".to_owned(), None)
					}
				}
			}
		}

		// Check if a path has redirects set, and then return the redirects if they are present. If a regex redirect is set, trim matching content from the path, and then add the non-matching content to the redirect destination. 
		if self.redirx.is_match(fp) {
			if let Some(regx) = self.redirx.matches(fp).iter().next() {
				if let Some(link) = self.redirmap.get(&["r#", &self.redirx.patterns()[regx]].concat()) {
					return ([link.to_owned(), trim_regex(&self.redirx.patterns()[regx], fp)].concat(), "redir".to_owned(), None)
				}
			}
		}
		if self.lredir.binary_search(fp).is_ok() {
			if let Some(link) = self.redirmap.get(fp) {
				return (link.to_owned(), "redir".to_owned(), None)
			}
		}

		// Check if a reverse proxy is set, and return the proxy URL if it is present.
		if self.proxyx.is_match(fp) {
			if let Some(regx) = self.proxyx.matches(fp).iter().next() {
				if let Some(link) = self.proxymap.get(&["r#", &self.proxyx.patterns()[regx]].concat()) {
					return ([link.to_owned(), trim_regex(&self.proxyx.patterns()[regx], fp)].concat(), "proxy".to_owned(), None)
				}
			}
		}
		if self.lproxy.binary_search(&hostn).is_ok() {
			if let Some(link) = self.proxymap.get(host) {
				return ([link, path].concat(), "proxy".to_owned(), None)
			}
		}

		// If the host doesn't exist or is a location the client isn't allowed to access, use the default host instead.
		if self.hidden.binary_search(&hostn).is_ok() || self.hiddenx.is_match(&hostn) || host.is_empty() || &host[..1] == "." || host.contains('/') || host.contains('\\') || !Path::new(&hostn).exists() {
			host = "html"
		}

		// If we're serving a folder, return the index file from that folder.
		let pathn;
		if path.ends_with('/') {
			pathn = [path, "index.html"].concat()
		} else {
			pathn = path.to_owned()
		}

		// Return an optional "full path" variant of the path, for use with file requests.
		let full_path = [host, &*pathn].concat();
		(pathn, host.to_owned(), Some(full_path))
	}
/* Generate the correct host and path, from raw data and a Config object. 
	Special cases:
	- If HTTP authentication fails, "unauth" will be returned as the path, and "redir" will be returned as the host.
	- If a redirect is set, "redir" will be returned as the host, and the location to redirect to will be returned as the path.
	- If a reverse proxy is set, "proxy" will be returned as the host, and the URL to proxy will be returned as the path.
	- If a normal file is being served, an optional full path (host+path) will be returned, along with the path and host.*/
Generate the correct host and path, from raw data and a Config object.
Special cases:
If HTTP authentication fails, "unauth" will be returned as the path, and "redir" will be returned as the host.
If a redirect is set, "redir" will be returned as the host, and the location to redirect to will be returned as the path.
If a reverse proxy is set, "proxy" will be returned as the host, and the URL to proxy will be returned as the path.
If a normal file is being served, an optional full path (host+path) will be returned, along with the path and host.
Generate the correct host and path from raw data and a Config object . Special cases : If HTTP authentication fails " unauth " will be returned as the path and " redir " will be returned as the host . If a redirect is set " redir " will be returned as the host and the location to redirect to will be returned as the path . If a reverse proxy is set " proxy " will be returned as the host and the URL to proxy will be returned as the path . If a normal file is being served an optional full path ( host + path ) will be returned along with the path and host .
pub fn handle_path(&self, path: &str, host: &str, auth: &str) -> (String, String, Option<String>) {
		let mut host = trim_port(host);
		let hostn = host.to_owned();
		// Prevent the client from accessing data they aren't supposed to access, at the risk of breaking some (very badly designed) clients. A more elegant solution is possible, but it isn't worth implementing, as no popular clients are anywhere near this broken.
		let fp = &[host, path].concat();
		match path {
			_ if path.ends_with("/index.html") => return ("./".to_owned(), "redir".to_owned(), None),
			_ if path.contains("..") => return ("..".to_owned(), "redir".to_owned(), None),
			_ => (),
		}
		/* Check if the path is protected by HTTP authentication. If checking path authentication fails (due to either a badly formatted config or a bad Config object), act as if the endpoint doesn't have authentication.
		If it is protected, check if the auth input matches the correct login, and return if it is incorrect. */
		if self.authx.is_match(fp) {
			if let Some(regx) = self.authx.matches(fp).iter().next() {
				if let Some(eauth) = self.authmap.get(&["r#", &self.authx.patterns()[regx]].concat()) {
					let authx = trim_prefix("Basic ", auth);
					if authx != eauth {
						return ("unauth".to_owned(), "redir".to_owned(), None)
					}
				}
			}
		}
		// Check if a path has redirects set, and then return the redirects if they are present. If a regex redirect is set, trim matching content from the path, and then add the non-matching content to the redirect destination. 
		if self.redirx.is_match(fp) {
			if let Some(regx) = self.redirx.matches(fp).iter().next() {
				if let Some(link) = self.redirmap.get(&["r#", &self.redirx.patterns()[regx]].concat()) {
					return ([link.to_owned(), trim_regex(&self.redirx.patterns()[regx], fp)].concat(), "redir".to_owned(), None)
				}
			}
		}
		if self.lredir.binary_search(fp).is_ok() {
			if let Some(link) = self.redirmap.get(fp) {
				return (link.to_owned(), "redir".to_owned(), None)
			}
		}
		// Check if a reverse proxy is set, and return the proxy URL if it is present.
		if self.proxyx.is_match(fp) {
			if let Some(regx) = self.proxyx.matches(fp).iter().next() {
				if let Some(link) = self.proxymap.get(&["r#", &self.proxyx.patterns()[regx]].concat()) {
					return ([link.to_owned(), trim_regex(&self.proxyx.patterns()[regx], fp)].concat(), "proxy".to_owned(), None)
				}
			}
		}
		if self.lproxy.binary_search(&hostn).is_ok() {
			if let Some(link) = self.proxymap.get(host) {
				return ([link, path].concat(), "proxy".to_owned(), None)
			}
		}
		// If the host doesn't exist or is a location the client isn't allowed to access, use the default host instead.
		if self.hidden.binary_search(&hostn).is_ok() || self.hiddenx.is_match(&hostn) || host.is_empty() || &host[..1] == "." || host.contains('/') || host.contains('\\') || !Path::new(&hostn).exists() {
			host = "html"
		}
		// If we're serving a folder, return the index file from that folder.
		let pathn;
		if path.ends_with('/') {
			pathn = [path, "index.html"].concat()
		} else {
			pathn = path.to_owned()
		}
		// Return an optional "full path" variant of the path, for use with file requests.
		let full_path = [host, &*pathn].concat();
		(pathn, host.to_owned(), Some(full_path))
	}
pub fn handle_path ( & self , path : & str , host : & str , auth : & str ) -> ( String , String , Option < String > ) { let mut host = trim_port ( host ) ; let hostn = host . to_owned ( ) ; // Prevent the client from accessing data they aren't supposed to access, at the risk of breaking some (very badly designed) clients. A more elegant solution is possible, but it isn't worth implementing, as no popular clients are anywhere near this broken. let fp = & [ host , path ] . concat ( ) ; match path { _ if path . ends_with ( " " ) => return ( " " . to_owned ( ) , " " . to_owned ( ) , None ) , _ if path . contains ( " " ) => return ( " " . to_owned ( ) , " " . to_owned ( ) , None ) , _ => ( ) , } /* Check if the path is protected by HTTP authentication. If checking path authentication fails (due to either a badly formatted config or a bad Config object), act as if the endpoint doesn't have authentication.
		If it is protected, check if the auth input matches the correct login, and return if it is incorrect. */ if self . authx . is_match ( fp ) { if let Some ( regx ) = self . authx . matches ( fp ) . iter ( ) . next ( ) { if let Some ( eauth ) = self . authmap . get ( & [ " " , & self . authx . patterns ( ) [ regx ] ] . concat ( ) ) { let authx = trim_prefix ( " " , auth ) ; if authx != eauth { return ( " " . to_owned ( ) , " " . to_owned ( ) , None ) } } } } // Check if a path has redirects set, and then return the redirects if they are present. If a regex redirect is set, trim matching content from the path, and then add the non-matching content to the redirect destination.  if self . redirx . is_match ( fp ) { if let Some ( regx ) = self . redirx . matches ( fp ) . iter ( ) . next ( ) { if let Some ( link ) = self . redirmap . get ( & [ " " , & self . redirx . patterns ( ) [ regx ] ] . concat ( ) ) { return ( [ link . to_owned ( ) , trim_regex ( & self . redirx . patterns ( ) [ regx ] , fp ) ] . concat ( ) , " " . to_owned ( ) , None ) } } } if self . lredir . binary_search ( fp ) . is_ok ( ) { if let Some ( link ) = self . redirmap . get ( fp ) { return ( link . to_owned ( ) , " " . to_owned ( ) , None ) } } // Check if a reverse proxy is set, and return the proxy URL if it is present. if self . proxyx . is_match ( fp ) { if let Some ( regx ) = self . proxyx . matches ( fp ) . iter ( ) . next ( ) { if let Some ( link ) = self . proxymap . get ( & [ " " , & self . proxyx . patterns ( ) [ regx ] ] . concat ( ) ) { return ( [ link . to_owned ( ) , trim_regex ( & self . proxyx . patterns ( ) [ regx ] , fp ) ] . concat ( ) , " " . to_owned ( ) , None ) } } } if self . lproxy . binary_search ( & hostn ) . is_ok ( ) { if let Some ( link ) = self . proxymap . get ( host ) { return ( [ link , path ] . concat ( ) , " " . to_owned ( ) , None ) } } // If the host doesn't exist or is a location the client isn't allowed to access, use the default host instead. if self . hidden . binary_search ( & hostn ) . is_ok ( ) || self . hiddenx . is_match ( & hostn ) || host . is_empty ( ) || & host [ .. 1 ] == " " || host . contains ( '/' ) || host . contains ( '\\' ) || ! Path :: new ( & hostn ) . exists ( ) { host = " " } // If we're serving a folder, return the index file from that folder. let pathn ; if path . ends_with ( '/' ) { pathn = [ path , " " ] . concat ( ) } else { pathn = path . to_owned ( ) } // Return an optional "full path" variant of the path, for use with file requests. let full_path = [ host , & * pathn ] . concat ( ) ; ( pathn , host . to_owned ( ) , Some ( full_path ) ) }
Generate the correct host and path, from raw data and a Config object.
Generate the correct host and path from raw data and a Config object .
&self
path
&str
host
&str
auth
&str
&self
path
&str
host
&str
auth
&str