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

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


The following commit(s) were added to refs/heads/7.1.x by this push:
     new 194a37d  Handle MIME hdr parsing edge case
194a37d is described below

commit 194a37d137d2cfbc1fc65708cce916cf75f145b5
Author: Alan Wang <xf6w...@gmail.com>
AuthorDate: Mon Feb 12 11:36:05 2018 -0800

    Handle MIME hdr parsing edge case
    
    (cherry picked from commit 9414172435c05a41dcdf7a7163fb07a418d88bb7)
---
 proxy/hdrs/MIME.cc | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/proxy/hdrs/MIME.cc b/proxy/hdrs/MIME.cc
index e2b0c1b..1e0e567 100644
--- a/proxy/hdrs/MIME.cc
+++ b/proxy/hdrs/MIME.cc
@@ -2479,9 +2479,15 @@ mime_scanner_get(MIMEScanner *S, const char 
**raw_input_s, const char *raw_input
         zret = PARSE_RESULT_ERROR; // Unterminated field.
       }
     } else if (data_size) {
-      // Inside a field but more data is expected. Save what we've got.
-      mime_scanner_append(S, *raw_input_s, data_size);
-      data_size = 0; // Don't append again.
+      if (MIME_PARSE_INSIDE == S->m_state) {
+        // Inside a field but more data is expected. Save what we've got.
+        mime_scanner_append(S, *raw_input_s, data_size);
+        data_size = 0; // Don't append again.
+      } else if (MIME_PARSE_AFTER == S->m_state) {
+        // After a field but we still have data. Need to parse it too.
+        S->m_state = MIME_PARSE_BEFORE;
+        zret       = PARSE_RESULT_OK;
+      }
     }
   }
 

-- 
To stop receiving notification emails like this one, please contact
zw...@apache.org.

Reply via email to