aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-mime-utils.c
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2004-03-15 12:38:08 +0800
committerMichael Zucci <zucchi@src.gnome.org>2004-03-15 12:38:08 +0800
commit8197e16f5d03e912bd9c65d45a76288e9462b45e (patch)
treedeb65df549336034d2c84ee6e47059167b7aec6c /camel/camel-mime-utils.c
parent96d2e72031fb69345988bb0bf97bf2493c15a358 (diff)
downloadgsoc2013-evolution-8197e16f5d03e912bd9c65d45a76288e9462b45e.tar.gz
gsoc2013-evolution-8197e16f5d03e912bd9c65d45a76288e9462b45e.tar.zst
gsoc2013-evolution-8197e16f5d03e912bd9c65d45a76288e9462b45e.zip
drop embedded whitespace characters, and don't do unquoting, etc. See
2004-03-15 Not Zed <NotZed@Ximian.com> * camel-mime-utils.c (camel_header_location_decode): drop embedded whitespace characters, and don't do unquoting, etc. See rfc2557 4.4.2 and rfc2017 3.1. svn path=/trunk/; revision=25058
Diffstat (limited to 'camel/camel-mime-utils.c')
-rw-r--r--camel/camel-mime-utils.c33
1 files changed, 25 insertions, 8 deletions
diff --git a/camel/camel-mime-utils.c b/camel/camel-mime-utils.c
index 9ebc21c755..56a9c4bfe2 100644
--- a/camel/camel-mime-utils.c
+++ b/camel/camel-mime-utils.c
@@ -3608,7 +3608,9 @@ camel_header_decode_date(const char *in, int *saveoffset)
char *
camel_header_location_decode(const char *in)
{
- const char *p;
+ int quote = 0;
+ GString *out = g_string_new("");
+ char c, *res;
/* Sigh. RFC2557 says:
* content-location = "Content-Location:" [CFWS] URI [CFWS]
@@ -3618,18 +3620,33 @@ camel_header_location_decode(const char *in)
*
* But Netscape puts quotes around the URI when sending web
* pages.
+ *
+ * Which is required as defined in rfc2017 [3.1]. Although
+ * outlook doesn't do this.
+ *
+ * Since we get headers already unfolded, we need just drop
+ * all whitespace. URL's cannot contain whitespace or quoted
+ * characters, even when included in quotes.
*/
header_decode_lwsp(&in);
- if (*in == '"')
- return header_decode_quoted_string(&in);
- else {
- for (p = in; *p && !camel_mime_is_lwsp(*p); p++)
- ;
- return g_strndup(in, p - in);
+ if (*in == '"') {
+ in++;
+ quote = 1;
}
-}
+ while ( (c = *in++) ) {
+ if (quote && c=='"')
+ break;
+ if (!camel_mime_is_lwsp(c))
+ g_string_append_c(out, c);
+ }
+
+ res = g_strdup(out->str);
+ g_string_free(out, TRUE);
+
+ return res;
+}
/* extra rfc checks */
#define CHECKS