summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Winship <danw@gnome.org>2010-04-06 12:08:59 -0400
committerDan Winship <danw@gnome.org>2010-04-09 19:51:33 -0400
commitc28b30ad8dcc6ef96b4ddc680107cbd058873dec (patch)
treef4f2504ea98d17d32355265a5b9c179a7b4d325e
parent7dfc7855fc9e41fd542c0cef7a229fe2c2e959ca (diff)
downloadlibsoup-c28b30ad8dcc6ef96b4ddc680107cbd058873dec.tar.gz
soup-multipart: don't quote the boundary string if it doesn't need it
RFC 2616 warns that some HTTP implementations misparse quoted boundary parameters in multipart Content-Type headers. (Sigh.) Since our boundary strings are tokens, they don't need to be quoted anyway (although if we parse and then later reserialize a multipart generated by someone else, we may still need to quote it). https://bugzilla.gnome.org/show_bug.cgi?id=614176
-rw-r--r--libsoup/soup-multipart.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/libsoup/soup-multipart.c b/libsoup/soup-multipart.c
index dd0287ca..f825a9da 100644
--- a/libsoup/soup-multipart.c
+++ b/libsoup/soup-multipart.c
@@ -423,15 +423,15 @@ soup_multipart_to_message (SoupMultipart *multipart,
SoupMessageHeadersIter iter;
const char *name, *value;
GString *str;
- char *content_type;
+ GHashTable *params;
int i;
- content_type = g_strdup_printf ("%s; boundary=\"%s\"",
- multipart->mime_type,
- multipart->boundary);
- soup_message_headers_replace (dest_headers, "Content-Type",
- content_type);
- g_free (content_type);
+ params = g_hash_table_new (g_str_hash, g_str_equal);
+ g_hash_table_insert (params, "boundary", multipart->boundary);
+ soup_message_headers_set_content_type (dest_headers,
+ multipart->mime_type,
+ params);
+ g_hash_table_destroy (params);
for (i = 0; i < multipart->bodies->len; i++) {
part_headers = multipart->headers->pdata[i];