pub struct Request {
pub selector: String,
pub query: String,
pub root: String,
pub host: String,
pub port: u16,
}
Expand description
This struct represents a single gopher request.
Fields§
§selector: String
Gopher selector requested
query: String
Search query string, if any.
root: String
Root directory of the server. Can’t serve outside of this.
host: String
Host of the currently running server.
port: u16
Port of the currently running server.
Implementations§
source§impl Request
impl Request
sourcepub fn from(host: &str, port: u16, root: &str) -> Result<Request>
pub fn from(host: &str, port: u16, root: &str) -> Result<Request>
Try to create a new request state object.
sourcepub fn relative_file_path(&self) -> String
pub fn relative_file_path(&self) -> String
Path to the target file relative to the server root.
sourcepub fn parse_request(&mut self, line: &str)
pub fn parse_request(&mut self, line: &str)
Set selector + query based on what the client sent.