From d64aa287aa5613476524c209635a3626e4fa7ee3 Mon Sep 17 00:00:00 2001 From: Uthman Yahaya Baba Date: Fri, 23 May 2025 23:33:20 +0100 Subject: [PATCH] Resolved merge conflict Signed-off-by: Uthman Yahaya Baba --- components/net/fetch/methods.rs | 5 +++-- components/shared/net/lib.rs | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/components/net/fetch/methods.rs b/components/net/fetch/methods.rs index a6377c03879..c3b843e2fa3 100644 --- a/components/net/fetch/methods.rs +++ b/components/net/fetch/methods.rs @@ -47,7 +47,6 @@ use crate::protocols::{ProtocolRegistry, is_url_potentially_trustworthy}; use crate::request_interceptor::RequestInterceptor; use crate::subresource_integrity::is_response_integrity_valid; -#[allow(dead_code)] const PARTIAL_RESPONSE_TO_NON_RANGE_REQUEST_ERROR: &str = "Refusing to provide partial response\ from earlier ranged request to API that did not make a range request"; @@ -576,7 +575,9 @@ pub async fn main_fetch( !request.headers.contains_key(RANGE) { // Defer rebinding result - blocked_error_response = Response::network_error(NetworkError::CacheError); + blocked_error_response = Response::network_error(NetworkError::Internal( + PARTIAL_RESPONSE_TO_NON_RANGE_REQUEST_ERROR.to_string(), + )); &blocked_error_response } else { internal_response diff --git a/components/shared/net/lib.rs b/components/shared/net/lib.rs index 446ab57f8fc..bf6249599c3 100644 --- a/components/shared/net/lib.rs +++ b/components/shared/net/lib.rs @@ -942,6 +942,7 @@ pub enum NetworkError { CorsHeaders, ConnectionFailure, RedirectError, + TooManyRedirects, InvalidMethod, ResourceError, ContentSecurityPolicy, @@ -968,7 +969,8 @@ impl fmt::Debug for NetworkError { NetworkError::CorsAuthorization => write!(f, "CORS authorization check failed"), NetworkError::CorsHeaders => write!(f, "CORS headers check failed"), NetworkError::ConnectionFailure => write!(f, "Request failed"), - NetworkError::RedirectError => write!(f, "Too many redirects"), + NetworkError::RedirectError => write!(f, "Redirect failed"), + NetworkError::TooManyRedirects => write!(f, "Too many redirects"), NetworkError::InvalidMethod => write!(f, "Unexpected method"), NetworkError::ResourceError => write!(f, "Resource access failed"), NetworkError::ContentSecurityPolicy => write!(f, "Blocked by Content-Security-Policy"), @@ -978,7 +980,7 @@ impl fmt::Debug for NetworkError { write!(f, "Subresource integrity validation failed") }, NetworkError::MixedContent => write!(f, "Blocked as mixed content"), - NetworkError::CacheError => write!(f, "Cache error"), + NetworkError::CacheError => write!(f, "Couldn't find response in cache"), NetworkError::InvalidPort => write!(f, "Request attempted on bad port"), NetworkError::LocalDirectoryError => write!(f, "Local directory access failed"), NetworkError::LoadCancelled => write!(f, "Load cancelled"),