Skip to content

Commit

Permalink
fix: fallback for
Browse files Browse the repository at this point in the history
  • Loading branch information
lostb1t committed Jul 26, 2024
1 parent 51dcbc5 commit 10d7919
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
11 changes: 6 additions & 5 deletions src/plex_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ impl PlexClient {
);
let mut headers = self.default_headers.clone();
for (key, value) in req.headers().iter() {
if key != ACCEPT {
if key != ACCEPT && key != http::header::HOST {
headers.insert(key, value.clone());
}
}
Expand Down Expand Up @@ -123,8 +123,8 @@ impl PlexClient {
//dbg!(&url);
//dbg!(&req.uri().clone().query().unwrap().to_string());
let mut headers = req.headers().clone();
//headers.remove(ACCEPT); // remove accept as we always do json request

headers.remove(ACCEPT); // remove accept as we always do json request
headers.remove(http::header::HOST);
let res = self
.http_client
.request(req.method().clone(), url)
Expand Down Expand Up @@ -448,8 +448,9 @@ impl PlexClient {
("X-Plex-Client-Capabilities", context.client_capabilities.clone()),
("X-Forwarded-For", context.forwarded_for.clone()),
("X-Real-Ip", context.real_ip.clone()),
("ACCEPT", Some("application/json".to_string())),
("ACCEPT_LANGUAGE", Some("en-US".to_string())),
(&ACCEPT.as_str(), Some("application/json".to_string())),
(&ACCEPT_LANGUAGE.as_str(), Some("en-US".to_string())),
(http::header::HOST.as_str(), Some(config.host.clone().unwrap())),
]);

for (key, val) in headers_map {
Expand Down
6 changes: 3 additions & 3 deletions src/routes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -992,10 +992,10 @@ async fn get_transcoding_for_request(
let mut depot = &mut Depot::new();
let mut ctrl = &mut FlowCtrl::new(vec![]);
proxy_for_transform.handle(req, depot, res, ctrl).await;
//dbg!(&res_upstream);
dbg!(&res);

//let res = plex_client.proxy_request(&req).await?;
//dbg!(&res);
let ress = plex_client.proxy_request(&req).await?;
dbg!(&ress);
//dbg!(&req);

let transcode: MediaContainerWrapper<MediaContainer> =
Expand Down

0 comments on commit 10d7919

Please sign in to comment.