aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-mime-utils.c
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2001-05-12 04:57:26 +0800
committerDan Winship <danw@src.gnome.org>2001-05-12 04:57:26 +0800
commitba099582f365aa886cf426c4b7c422244ccec2e4 (patch)
tree048f51bf50cc32bba92dad2ca6ef2fe0ede0af86 /camel/camel-mime-utils.c
parent96dab8cb1934bfd4d0240d1aa9c2ca0e45a9edbb (diff)
downloadgsoc2013-evolution-ba099582f365aa886cf426c4b7c422244ccec2e4.tar.gz
gsoc2013-evolution-ba099582f365aa886cf426c4b7c422244ccec2e4.tar.zst
gsoc2013-evolution-ba099582f365aa886cf426c4b7c422244ccec2e4.zip
Decode Content-Location, either correctly or Netscape-generated-brokenly.
* camel-mime-utils.c (header_location_decode): Decode Content-Location, either correctly or Netscape-generated-brokenly. * camel-mime-part.c (camel_mime_part_set_content_location, camel_mime_part_get_content_location, etc): Deal with Content-Location header. svn path=/trunk/; revision=9772
Diffstat (limited to 'camel/camel-mime-utils.c')
-rw-r--r--camel/camel-mime-utils.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/camel/camel-mime-utils.c b/camel/camel-mime-utils.c
index 7e486689ef..fbfbb3e5be 100644
--- a/camel/camel-mime-utils.c
+++ b/camel/camel-mime-utils.c
@@ -2842,6 +2842,32 @@ header_decode_date(const char *in, int *saveoffset)
return t;
}
+char *
+header_location_decode(const char *in)
+{
+ const char *p;
+
+ /* Sigh. RFC2557 says:
+ * content-location = "Content-Location:" [CFWS] URI [CFWS]
+ * where URI is restricted to the syntax for URLs as
+ * defined in Uniform Resource Locators [URL] until
+ * IETF specifies other kinds of URIs.
+ *
+ * But Netscape puts quotes around the URI when sending web
+ * pages.
+ */
+
+ header_decode_lwsp(&in);
+ if (*in == '"')
+ return header_decode_quoted_string(&in);
+ else {
+ for (p = in; *p && !is_lwsp(*p); p++)
+ ;
+ return g_strndup(in, p - in);
+ }
+}
+
+
/* extra rfc checks */
#define CHECKS