From 19f0a78a7a97cc671de629852f9a5b7fe58d556b Mon Sep 17 00:00:00 2001 From: Tobias Wolter Date: Wed, 27 Jul 2022 15:20:13 +0200 Subject: [PATCH 1/3] Adds an option to toggle the `Received` headers for HTTP connections in Compose. --- config/conf.xml | 5 +++++ lib/Compose.php | 10 ++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/config/conf.xml b/config/conf.xml index 5573e1f81..c1d0a1815 100644 --- a/config/conf.xml +++ b/config/conf.xml @@ -60,6 +60,11 @@ 30000 + + Add Received header + true diff --git a/lib/Compose.php b/lib/Compose.php index 92279a058..551b1b4e7 100644 --- a/lib/Compose.php +++ b/lib/Compose.php @@ -745,7 +745,7 @@ public function buildAndSendMessage( $body, $header, IMP_Prefs_Identity $identity, array $opts = array() ) { - global $injector, $prefs, $registry, $session; + global $injector, $prefs, $registry, $session, $conf; /* Set up defaults. */ $opts = array_merge(array( @@ -798,9 +798,11 @@ public function buildAndSendMessage( $headers = $this->_prepareHeaders($header, $opts); /* Add a Received header for the hop from browser to server. */ - $headers->addHeaderOb( - Horde_Core_Mime_Headers_Received::createHordeHop() - ); + if ($conf['compose']['add_received_header']) { + $headers->addHeaderOb( + Horde_Core_Mime_Headers_Received::createHordeHop() + ); + } /* Add the 'User-Agent' header. */ $headers->addHeaderOb(new Horde_Mime_Headers_UserAgent( From 056786411bf3c7ddb7df0e54efc8090275de572f Mon Sep 17 00:00:00 2001 From: Ralf Lang Date: Tue, 16 Aug 2022 13:15:49 +0200 Subject: [PATCH 2/3] Guard against missing config value / upgrade case --- lib/Compose.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Compose.php b/lib/Compose.php index 551b1b4e7..df006169b 100644 --- a/lib/Compose.php +++ b/lib/Compose.php @@ -798,7 +798,7 @@ public function buildAndSendMessage( $headers = $this->_prepareHeaders($header, $opts); /* Add a Received header for the hop from browser to server. */ - if ($conf['compose']['add_received_header']) { + if (!isset($conf['compose']['add_received_header']) || ($conf['compose']['add_received_header'] === true)) { $headers->addHeaderOb( Horde_Core_Mime_Headers_Received::createHordeHop() ); From bd7e1aa23cc085cd88704390ea7bcb551a8c2ec4 Mon Sep 17 00:00:00 2001 From: Ralf Lang Date: Tue, 16 Aug 2022 13:22:03 +0200 Subject: [PATCH 3/3] Apply suggestions from code review ws --- config/conf.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/config/conf.xml b/config/conf.xml index c1d0a1815..4bcef2471 100644 --- a/config/conf.xml +++ b/config/conf.xml @@ -60,7 +60,6 @@ 30000 - Add Received header