Skip to content

Commit

Permalink
Add range header handling for ump streams.
Browse files Browse the repository at this point in the history
  • Loading branch information
FireMasterK committed Nov 30, 2023
1 parent 75f7c4e commit 2295ad3
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
{
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 2295ad3

Please sign in to comment.