From c565583e6c7df782994636e34a3e8c96e24fc2ea Mon Sep 17 00:00:00 2001
From: rfm
Date: Fri, 6 Mar 2009 09:01:17 +0000
Subject: [PATCH] Add some comments on handling faulty mime documents.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@28045 72102866-910b-0410-8b05-ffd578937521
---
Source/Additions/GSMime.m | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/Source/Additions/GSMime.m b/Source/Additions/GSMime.m
index 29e80b461..2b83292f8 100644
--- a/Source/Additions/GSMime.m
+++ b/Source/Additions/GSMime.m
@@ -662,6 +662,11 @@ wordData(NSString *word)
* [GSMimeParser-mimeDocument] method returns the
* resulting parsed document.
*
+ * If you need to parse faulty documents (eg where a faulty mail client
+ * has produced an email which does not conform to the MIME standards), you
+ * should look at the -setBuggyQotes: and -setDefaultCharset: methods, which
+ * are designed to cope with the most common faults.
+ *
*/
@implementation GSMimeParser
@@ -2212,10 +2217,15 @@ NSDebugMLLog(@"GSMime", @"Header parsed - %@", info);
}
}
-/**
- * Method to inform the parser that body parts with no content-type
+/** This is a method to inform the parser that body parts with no content-type
* header (which are treated as text/plain) should use the specified
- * characterset rather than the default (us-ascii)
+ * characterset rather than the default (us-ascii).
+ * This also controls the parsing of headers ... in a legal MIME document
+ * these must consst solely of us-ascii characters, but setting a different
+ * default characterset (such as latin1) will permit many illegal header
+ * lines (produced by faulty mail clients) to be parsed.
+ * HTTP requests use headers in the latin1 characterset, so this is the
+ * header line characterset used most commonly by faulty clients.
*/
- (void) setDefaultCharset: (NSString*)aName
{