Add range header handling for ump streams.

See https://github.com/TeamPiped/Piped/issues/3196
This commit is contained in:
Kavin 2023-11-30 02:10:50 +00:00
parent 75f7c4e8cd
commit 2295ad3d94
No known key found for this signature in database
GPG key ID: 6E4598CA5C92C41F

View file

@ -142,7 +142,7 @@ async fn index(req: HttpRequest) -> Result<HttpResponse, Box<dyn Error>> {
}
// parse query string
let query = QString::from(req.query_string());
let mut query = QString::from(req.query_string());
#[cfg(feature = "qhash")]
{
@ -236,6 +236,14 @@ async fn index(req: HttpRequest) -> Result<HttpResponse, Box<dyn Error>> {
let mime_type = query.get("mime").map(|s| s.to_string());
if is_ump && !query.has("range") {
if let Some(range) = req.headers().get("range") {
let range = range.to_str().unwrap();
let range = range.replace("bytes=", "");
query.add_pair(("range", range));
}
}
let qs = {
let collected = query
.into_pairs()