aboutsummaryrefslogtreecommitdiffstats
path: root/camel
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
parent96d2e72031fb69345988bb0bf97bf2493c15a358 (diff)
downloadgsoc2013-evolution-8197e16f5d03e912bd9c65d45a76288e9462b45e.tar
gsoc2013-evolution-8197e16f5d03e912bd9c65d45a76288e9462b45e.tar.gz
gsoc2013-evolution-8197e16f5d03e912bd9c65d45a76288e9462b45e.tar.bz2
gsoc2013-evolution-8197e16f5d03e912bd9c65d45a76288e9462b45e.tar.lz
gsoc2013-evolution-8197e16f5d03e912bd9c65d45a76288e9462b45e.tar.xz
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')
-rw-r--r--camel/ChangeLog6
-rw-r--r--camel/camel-mime-utils.c33
2 files changed, 31 insertions, 8 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 0bfa49490a..0d284bc912 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,9 @@
+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.
+
2004-03-12 Jeffrey Stedfast <fejj@ximian.com>
* providers/smtp/camel-smtp-transport.c (smtp_set_exception): Now
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