fix proxy uri (add query)

This commit is contained in:
pfyy
2022-09-27 19:36:39 +08:00
parent 2cda891f02
commit aa32782179

View File

@@ -52,12 +52,13 @@ impl HttpHandler for ProxyHandler {
mut request: Request<Body>, mut request: Request<Body>,
) -> RequestOrResponse { ) -> RequestOrResponse {
let uri = request.uri().to_string(); let uri = request.uri().to_string();
let uri_path = request.uri().path(); let uri_path_and_query = request.uri().path_and_query().unwrap().as_str();
if uri.contains("hoyoverse.com") || uri.contains("mihoyo.com") || uri.contains("yuanshen.com") { if uri.contains("hoyoverse.com") || uri.contains("mihoyo.com") || uri.contains("yuanshen.com") {
// Create new URI. // Create new URI.
let new_uri = let new_uri =
Uri::from_str(format!("{}{}", SERVER.lock().unwrap(), uri_path).as_str()).unwrap(); Uri::from_str(format!("{}{}", SERVER.lock().unwrap(), uri_path_and_query).as_str())
.unwrap();
// Set request URI to the new one. // Set request URI to the new one.
*request.uri_mut() = new_uri; *request.uri_mut() = new_uri;
} }