feat: handle subset of urlendcoded
This commit is contained in:
parent
d7421324dc
commit
5f2109787f
1 changed files with 17 additions and 6 deletions
|
@ -26,7 +26,14 @@ impl URL {
|
|||
Some(key) => key.to_string(),
|
||||
None => continue,
|
||||
};
|
||||
let value = key_value.next().unwrap_or("").to_string();
|
||||
let value = key_value
|
||||
.next()
|
||||
.unwrap_or("")
|
||||
.to_string()
|
||||
.replace("+", " ")
|
||||
.replace("%20", " ")
|
||||
.replace("%23", "#")
|
||||
.replace("%2C", ",");
|
||||
query.insert(key, value);
|
||||
}
|
||||
|
||||
|
@ -41,13 +48,13 @@ impl URL {
|
|||
}
|
||||
|
||||
/// Utility function to get a path segment by index
|
||||
///
|
||||
///
|
||||
/// This is a very simple function, and its implementation is fairly naïve
|
||||
///
|
||||
///
|
||||
/// index: Index of the path segment to get
|
||||
///
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
///
|
||||
/// ```
|
||||
/// let url = URL::new("/path/to/resource").unwrap();
|
||||
/// assert_eq!(url.get_path_segment(1), Some("to"));
|
||||
|
@ -94,7 +101,11 @@ impl Request {
|
|||
None => return RequestStatus::MalformedHTTP(stream),
|
||||
};
|
||||
|
||||
RequestStatus::Ok(Request { stream, method, url })
|
||||
RequestStatus::Ok(Request {
|
||||
stream,
|
||||
method,
|
||||
url,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn mut_stream(self) -> TcpStream {
|
||||
|
|
Loading…
Reference in a new issue