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

@ -26,12 +26,14 @@ use servo_rand::RngCore;
use servo_url::{ImmutableOrigin, ServoUrl};
use crate::filemanager_thread::FileManagerThreadMsg;
use crate::http_status::HttpStatus;
use crate::request::{Request, RequestBuilder};
use crate::response::{HttpsState, Response, ResponseInit};
use crate::storage_thread::StorageThreadMsg;
pub mod blob_url_store;
pub mod filemanager_thread;
pub mod http_status;
pub mod image_cache;
pub mod pub_domains;
pub mod quality;
@ -658,7 +660,7 @@ pub struct Metadata {
pub headers: Option<Serde<HeaderMap>>,
/// HTTP Status
pub status: Option<(u16, Vec<u8>)>,
pub status: HttpStatus,
/// Is successful HTTPS connection
pub https_state: HttpsState,
@ -683,8 +685,7 @@ impl Metadata {
content_type: None,
charset: None,
headers: None,
// https://fetch.spec.whatwg.org/#concept-response-status-message
status: Some((200, b"".to_vec())),
status: HttpStatus::default(),
https_state: HttpsState::None,
referrer: None,
referrer_policy: None,