Create HttpStatus to safely deal with HTTP responses status. (#33581)

Signed-off-by: webbeef <me@webbeef.org>
This commit is contained in:
webbeef 2024-09-29 11:23:48 -07:00 committed by GitHub
parent 013473f1d5
commit 58f34ad7a3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
30 changed files with 344 additions and 403 deletions

View file

@ -6,9 +6,10 @@ use std::future::{ready, Future};
use std::pin::Pin;
use headers::{HeaderMapExt, Range};
use http::{Method, StatusCode};
use http::Method;
use log::debug;
use net_traits::blob_url_store::{parse_blob_url, BlobURLStoreError};
use net_traits::http_status::HttpStatus;
use net_traits::request::Request;
use net_traits::response::{Response, ResponseBody};
use net_traits::{NetworkError, ResourceFetchTiming};
@ -55,8 +56,7 @@ impl ProtocolHandler for BlobProtocolHander {
};
let mut response = Response::new(url, ResourceFetchTiming::new(request.timing_type()));
response.status = Some((StatusCode::OK, "OK".to_string()));
response.raw_status = Some((StatusCode::OK.as_u16(), b"OK".to_vec()));
response.status = HttpStatus::default();
if is_range_request {
partial_content(&mut response);