diff --git a/src/satellite/src/storage/certification/impls.rs b/src/satellite/src/storage/certification/impls.rs index 4971b9646..87d94270f 100644 --- a/src/satellite/src/storage/certification/impls.rs +++ b/src/satellite/src/storage/certification/impls.rs @@ -10,7 +10,7 @@ use crate::storage::constants::{ ENCODING_CERTIFICATION_ORDER, RESPONSE_STATUS_CODE_200, RESPONSE_STATUS_CODE_404, ROOT_404_HTML, ROOT_INDEX_HTML, ROOT_PATH, }; -use crate::storage::http::headers::{build_asset_headers, build_redirect_headers}; +use crate::storage::http::headers::{build_headers, build_redirect_headers}; use crate::storage::http::types::{HeaderField, StatusCode}; use crate::storage::types::state::FullPath; use crate::storage::types::store::Asset; @@ -93,7 +93,7 @@ impl CertifiedAssetHashes { self.insert_v1(&full_path, encoding.sha256); self.insert_v2( &full_path, - &build_asset_headers(asset, encoding, &encoding_type.to_string()), + &build_headers(asset, encoding, &encoding_type.to_string()), RESPONSE_STATUS_CODE_200, encoding.sha256, ); @@ -211,7 +211,7 @@ impl CertifiedAssetHashes { if let Some(encoding) = asset.encodings.get(*encoding_type) { self.insert_rewrite_into_tree_v2( full_path, - &build_asset_headers(asset, encoding, &encoding_type.to_string()), + &build_headers(asset, encoding, &encoding_type.to_string()), encoding.sha256, RESPONSE_STATUS_CODE_200, ); diff --git a/src/satellite/src/storage/http/headers.rs b/src/satellite/src/storage/http/headers.rs index b522036f9..0059258d0 100644 --- a/src/satellite/src/storage/http/headers.rs +++ b/src/satellite/src/storage/http/headers.rs @@ -5,7 +5,7 @@ use crate::storage::types::store::{Asset, AssetEncoding, EncodingType}; use crate::storage::url::matching_urls; use hex::encode; -pub fn build_asset_headers( +pub fn build_headers( asset: &Asset, encoding: &AssetEncoding, encoding_type: &EncodingType, @@ -72,7 +72,8 @@ pub fn build_config_headers( .. }: &StorageConfig, ) -> Vec { - matching_urls(requested_path, config_headers).iter() + matching_urls(requested_path, config_headers) + .iter() .flat_map(|(_, headers)| headers.clone()) .collect() } diff --git a/src/satellite/src/storage/http/response.rs b/src/satellite/src/storage/http/response.rs index 86169267f..154144638 100644 --- a/src/satellite/src/storage/http/response.rs +++ b/src/satellite/src/storage/http/response.rs @@ -4,7 +4,7 @@ use crate::storage::constants::{ }; use crate::storage::http::types::{HeaderField, HttpResponse, StatusCode}; use crate::storage::http::utils::{ - build_encodings, build_headers, build_redirect_headers_response, streaming_strategy, + build_encodings, build_response_headers, build_response_redirect_headers, streaming_strategy, }; use crate::storage::types::store::Asset; @@ -25,7 +25,7 @@ pub fn build_asset_response( for encoding_type in encodings.iter() { if let Some(encoding) = asset.encodings.get(encoding_type) { - let headers = build_headers( + let headers = build_response_headers( &requested_url, &asset, encoding, @@ -99,7 +99,7 @@ pub fn build_redirect_response( redirect: &StorageConfigRedirect, ) -> HttpResponse { let headers = - build_redirect_headers_response(&requested_url, &redirect.location, &certificate_version) + build_response_redirect_headers(&requested_url, &redirect.location, &certificate_version) .unwrap(); HttpResponse { diff --git a/src/satellite/src/storage/http/utils.rs b/src/satellite/src/storage/http/utils.rs index ac2d5dedc..169ccb78f 100644 --- a/src/satellite/src/storage/http/utils.rs +++ b/src/satellite/src/storage/http/utils.rs @@ -4,7 +4,7 @@ use crate::storage::certification::cert::{ build_asset_certificate_header, build_certified_expression, }; use crate::storage::constants::ASSET_ENCODING_NO_COMPRESSION; -use crate::storage::http::headers::{build_asset_headers, build_redirect_headers}; +use crate::storage::http::headers::{build_headers, build_redirect_headers}; use crate::storage::http::types::{ CallbackFunc, HeaderField, StreamingCallbackToken, StreamingStrategy, }; @@ -52,7 +52,7 @@ pub fn create_token( }) } -pub fn build_headers( +pub fn build_response_headers( url: &str, asset: &Asset, encoding: &AssetEncoding, @@ -60,12 +60,12 @@ pub fn build_headers( certificate_version: &Option, rewrite_source: &Option, ) -> Result, &'static str> { - let asset_headers = build_asset_headers(asset, encoding, encoding_type); + let asset_headers = build_headers(asset, encoding, encoding_type); extend_headers_with_certification(asset_headers, url, certificate_version, rewrite_source) } -pub fn build_redirect_headers_response( +pub fn build_response_redirect_headers( url: &str, location: &str, certificate_version: &Option,