summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2020-07-29 12:11:56 +0300
committerSergey Poznyakoff <gray@gnu.org>2020-07-29 12:11:56 +0300
commitbae847821ac56157d4e0104a9bb274673cfa059f (patch)
tree61d27864b9c1e5b795422f7b8f628b7712634e22 /include
parent90cf55bc239b7665280714fbdba1e54e78ddaa3a (diff)
downloadmailutils-bae847821ac56157d4e0104a9bb274673cfa059f.tar.gz
mailutils-bae847821ac56157d4e0104a9bb274673cfa059f.tar.bz2
Relax syntax rules for parsing Content-Type headers.
* decodemail/decodemail.c (qstring_format): Account for s==NULL (message_decode): Use MU_CONTENT_TYPE_RELAXED when parsing content types. * doc/texinfo/programs/decodemail.texi: Document handling of partial content types. * include/mailutils/util.h (MU_CONTENT_TYPE_STRICT) (MU_CONTENT_TYPE_RELAXED) (MU_CONTENT_TYPE_PARAM): New constants. (mu_content_type_parse_ext): New function. * lib/mdecode.c (text_mime_cmp): Implement comparison of partial content types (missing subtype). (message_body_stream): Use MU_CONTENT_TYPE_RELAXED. * libmailutils/base/ctparse.c (content_type_parse): Take additional argument (flags). Modify parsing algorithm depending on its value. (mu_content_type_parse_ext): New function. (mu_content_type_parse): Rewrite as a wrapper over mu_content_type_parse_ext. (mu_content_type_destroy): Account for subtype==NULL.
Diffstat (limited to 'include')
-rw-r--r--include/mailutils/util.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/include/mailutils/util.h b/include/mailutils/util.h
index 4ff036002..3261d3bb8 100644
--- a/include/mailutils/util.h
+++ b/include/mailutils/util.h
@@ -135,9 +135,16 @@ struct mu_content_type
};
typedef struct mu_content_type *mu_content_type_t;
-
+
+#define MU_CONTENT_TYPE_STRICT 0x00
+#define MU_CONTENT_TYPE_RELAXED 0x01
+#define MU_CONTENT_TYPE_PARAM 0x02
+
int mu_content_type_parse (const char *input, const char *charset,
mu_content_type_t *retct);
+int mu_content_type_parse_ext (const char *input, const char *charset,
+ int flags,
+ mu_content_type_t *retct);
void mu_content_type_destroy (mu_content_type_t *pptr);
int mu_content_type_format (mu_content_type_t ct, char **return_ptr);

Return to:

Send suggestions and report system problems to the System administrator.