[libsoup] soup-multipart: don't quote the boundary string if it doesn't need it
- From: Dan Winship <danw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsoup] soup-multipart: don't quote the boundary string if it doesn't need it
- Date: Fri, 9 Apr 2010 23:53:03 +0000 (UTC)
commit c28b30ad8dcc6ef96b4ddc680107cbd058873dec
Author: Dan Winship <danw gnome org>
Date: Tue Apr 6 12:08:59 2010 -0400
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
libsoup/soup-multipart.c | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/libsoup/soup-multipart.c b/libsoup/soup-multipart.c
index dd0287c..f825a9d 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];
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]