You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by bc...@apache.org on 2021/10/27 20:53:32 UTC

[trafficserver] 03/04: Fix output '\n' HTTP field line endings (#8455)

This is an automated email from the ASF dual-hosted git repository.

bcall pushed a commit to branch 9.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit 1a3ec881d5ed358fb52bc53e882c213c0dd4e3ac
Author: Brian Neradt <br...@verizonmedia.com>
AuthorDate: Wed Oct 27 13:35:41 2021 -0500

    Fix output '\n' HTTP field line endings (#8455)
    
    This is another attempt to fix what was initially addressed in #8096 but
    got backed out via #8305. That more extensive patch was considered too
    invasive and potentially risky.  This more targeted patch will fix
    clients that only send the \n endings but it will force the \r\n line
    ending on output.
    
    This was mostly in place except for header lines that get
    m_n_v_raw_printable set, which seems to be most header lines. The
    addition checks to see if the header line ends in \r\n. If it does not
    the m_n_v_raw_printable flag gets cleared and the logic that explicitly
    adds the line endings while be invoked on output.
    
    (cherry picked from commit 64f25678bfbbd1433cce703e3c43bcc49a53de56)
---
 proxy/hdrs/MIME.cc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/proxy/hdrs/MIME.cc b/proxy/hdrs/MIME.cc
index b88c5d5..3bf69fb 100644
--- a/proxy/hdrs/MIME.cc
+++ b/proxy/hdrs/MIME.cc
@@ -2580,6 +2580,8 @@ mime_parser_parse(MIMEParser *parser, HdrHeap *heap, MIMEHdrImpl *mh, const char
       }
       field_name.rtrim_if(&ParseRules::is_ws);
       raw_print_field = false;
+    } else if (parsed.suffix(2) != "\r\n") {
+      raw_print_field = false;
     }
 
     // find value first