aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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