Change http_content to Rc in HttpWrapper (#1391)

This commit is contained in:
007gzs
2024-10-21 09:44:01 +08:00
committed by GitHub
parent 32e5a59ae0
commit d96994767c
11 changed files with 446 additions and 304 deletions

View File

@@ -41,7 +41,7 @@ struct RquestBlockRoot {
struct RquestBlock {
log: Log,
config: Option<RquestBlockConfig>,
config: Option<Rc<RquestBlockConfig>>,
cache_request: bool,
}
@@ -141,9 +141,9 @@ impl RootContextWrapper<RquestBlockConfig> for RquestBlockRoot {
impl Context for RquestBlock {}
impl HttpContext for RquestBlock {}
impl HttpContextWrapper<RquestBlockConfig> for RquestBlock {
fn on_config(&mut self, _config: &RquestBlockConfig) {
self.config = Some(_config.clone());
self.cache_request = !_config.block_bodies.is_empty();
fn on_config(&mut self, config: Rc<RquestBlockConfig>) {
self.cache_request = !config.block_bodies.is_empty();
self.config = Some(config.clone());
}
fn cache_request_body(&self) -> bool {
self.cache_request