mirror of
https://github.com/TeamPiped/piped-proxy.git
synced 2024-08-14 23:50:45 +00:00
Send 206 response in UMP response content.
This commit is contained in:
parent
b9c8dc8f58
commit
a9bc07e98d
1 changed files with 7 additions and 1 deletions
|
@ -1,4 +1,4 @@
|
||||||
use actix_web::http::Method;
|
use actix_web::http::{Method, StatusCode};
|
||||||
use actix_web::{web, App, HttpRequest, HttpResponse, HttpResponseBuilder, HttpServer};
|
use actix_web::{web, App, HttpRequest, HttpResponse, HttpResponseBuilder, HttpServer};
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
use qstring::QString;
|
use qstring::QString;
|
||||||
|
@ -120,6 +120,7 @@ fn is_header_allowed(header: &str) -> bool {
|
||||||
| "report-to"
|
| "report-to"
|
||||||
| "strict-transport-security"
|
| "strict-transport-security"
|
||||||
| "user-agent"
|
| "user-agent"
|
||||||
|
| "range"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,6 +245,8 @@ async fn index(req: HttpRequest) -> Result<HttpResponse, Box<dyn Error>> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let has_range = query.has("range");
|
||||||
|
|
||||||
let qs = {
|
let qs = {
|
||||||
let collected = query
|
let collected = query
|
||||||
.into_pairs()
|
.into_pairs()
|
||||||
|
@ -427,6 +430,9 @@ async fn index(req: HttpRequest) -> Result<HttpResponse, Box<dyn Error>> {
|
||||||
if let Some(mime_type) = mime_type {
|
if let Some(mime_type) = mime_type {
|
||||||
response.content_type(mime_type);
|
response.content_type(mime_type);
|
||||||
}
|
}
|
||||||
|
if has_range {
|
||||||
|
response.status(StatusCode::PARTIAL_CONTENT);
|
||||||
|
}
|
||||||
let transformed_stream = UmpTransformStream::new(resp);
|
let transformed_stream = UmpTransformStream::new(resp);
|
||||||
return Ok(response.streaming(transformed_stream));
|
return Ok(response.streaming(transformed_stream));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue