Skip to content

Commit f066c50

Browse files
committed
no need to rename path
it's actually "path and query and fragment" but "path" is a bit easier to read
1 parent eecbc57 commit f066c50

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/server/decode.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ where
131131
}
132132

133133
fn url_from_httparse_req(req: &httparse::Request<'_, '_>) -> http_types::Result<Url> {
134-
let path_and_query = req.path.ok_or_else(|| format_err!("No uri found"))?;
134+
let path = req.path.ok_or_else(|| format_err!("No uri found"))?;
135135

136136
let host = req
137137
.headers
@@ -142,12 +142,12 @@ fn url_from_httparse_req(req: &httparse::Request<'_, '_>) -> http_types::Result<
142142

143143
let host = std::str::from_utf8(host)?;
144144

145-
if path_and_query.starts_with("http://") || path_and_query.starts_with("https://") {
146-
Ok(Url::parse(path_and_query)?)
147-
} else if path_and_query.starts_with('/') {
148-
Ok(Url::parse(&format!("http://{}{}", host, path_and_query))?)
145+
if path.starts_with("http://") || path.starts_with("https://") {
146+
Ok(Url::parse(path)?)
147+
} else if path.starts_with('/') {
148+
Ok(Url::parse(&format!("http://{}{}", host, path))?)
149149
} else if req.method.unwrap().eq_ignore_ascii_case("connect") {
150-
Ok(Url::parse(&format!("http://{}/", path_and_query))?)
150+
Ok(Url::parse(&format!("http://{}/", path))?)
151151
} else {
152152
Err(format_err!("unexpected uri format"))
153153
}

0 commit comments

Comments
 (0)