dump malformed header line draft
authorISHIKAWA, Chiaki <ishikawa@yk.rim.or.jp>
Mon, 23 May 2022 03:03:50 +0900
changeset 116800 007fee4c8ee98909334307dbae7dc3ca0a0c0634
parent 116733 be1c2780ec012a2e3c3721c92b7283584667172f
child 116801 1b8dff0a0f76f7b046e61558f90535650b3dc8f7
push id15955
push userishikawa@yk.rim.or.jp
push dateSun, 22 May 2022 18:04:18 +0000
treeherdertry-comm-central@beaacca97fbd [default view] [failures only]
dump malformed header line
mailnews/base/src/HeaderReader.h
--- a/mailnews/base/src/HeaderReader.h
+++ b/mailnews/base/src/HeaderReader.h
@@ -276,16 +276,32 @@ bool HeaderReader::HandleLine(mozilla::S
     mHdr = Hdr();
   }
 
   auto colon = std::find(line.cbegin(), line.cend(), ':');
   if (colon == line.cend()) {
     // UHOH. We were expecting a "name: value" line, but didn't find one.
     // Just ignore this line.
     NS_WARNING("Malformed header (expected 'name: value')");
+#ifdef DEBUG
+    {
+      auto start = line.cbegin();
+      fflush(stdout);
+      printf("{debug} line-> '");
+
+      // I am lazy to find out more about std span data type and its
+      // associated operation.
+      long unsigned i = 1;
+      for (; i <= line.Length() && start < line.cend() && *start != '\0'; start++, i++)  {
+        printf("%c", *start);
+      }
+      printf("'\n");
+    }
+#endif
+
     mPos += line.Length();
     return keepGoing;
   }
   auto val = colon + 1;
   if (*val == ' ' || *val == '\t') {
     // Skip single leading whitespace.
     ++val;
   }