strip continuation of received headers

This commit is contained in:
Charlie Smurthwaite
2017-08-10 02:06:32 +01:00
parent 2a9702ba47
commit a63c62ba62
+5 -3
View File
@@ -355,13 +355,15 @@ module Postal
if @header_key && @headers[@header_key.downcase] && @headers[@header_key.downcase].last if @header_key && @headers[@header_key.downcase] && @headers[@header_key.downcase].last
@headers[@header_key.downcase].last << data.to_s @headers[@header_key.downcase].last << data.to_s
end end
# If received headers are configured to be stripped and we're currently receiving one
# skip the append methods at the bottom of this loop.
next if Postal.config.smtp_server.strip_received_headers? && @header_key && @header_key.downcase == "received"
else else
@header_key, value = data.split(/\:\s*/, 2) @header_key, value = data.split(/\:\s*/, 2)
@headers[@header_key.downcase] ||= [] @headers[@header_key.downcase] ||= []
@headers[@header_key.downcase] << value @headers[@header_key.downcase] << value
if Postal.config.smtp_server.strip_received_headers? && @header_key.downcase == "received" # As above
next next if Postal.config.smtp_server.strip_received_headers? && @header_key && @header_key.downcase == "received"
end
end end
end end
@data << data @data << data