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

shinrich pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new 9414172  Handle MIME hdr parsing edge case
9414172 is described below

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

    Handle MIME hdr parsing edge case
---
 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 18de0f6..8dfc155 100644
--- a/proxy/hdrs/MIME.cc
+++ b/proxy/hdrs/MIME.cc
@@ -2485,9 +2485,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
shinr...@apache.org.

Reply via email to