Be compliant with rfc7233 for sending a 206 response.

This commit is contained in:
Kavin 2023-12-08 10:47:48 +00:00
parent 118c005d4d
commit c3b78def59
No known key found for this signature in database
GPG Key ID: 6E4598CA5C92C41F
1 changed files with 1 additions and 3 deletions

View File

@ -245,8 +245,6 @@ async fn index(req: HttpRequest) -> Result<HttpResponse, Box<dyn Error>> {
}
}
let has_range = query.has("range");
let qs = {
let collected = query
.into_pairs()
@ -430,7 +428,7 @@ async fn index(req: HttpRequest) -> Result<HttpResponse, Box<dyn Error>> {
if let Some(mime_type) = mime_type {
response.content_type(mime_type);
}
if has_range {
if req.headers().contains_key("range") {
response.status(StatusCode::PARTIAL_CONTENT);
}
let transformed_stream = UmpTransformStream::new(resp);