[gupnp/gupnp-0.18: 13/20] Revert "Properly quote charset in SOAP requests"



commit 926e5c960a824907d63d052b57813058e41c2b82
Author: Jens Georg <mail jensge org>
Date:   Mon Dec 26 15:59:16 2011 +0100

    Revert "Properly quote charset in SOAP requests"
    
    This reverts commit de2d1e3b97308a6c0941b271043bfab3b885299d.

 libgupnp/gupnp-service.c |   12 +++---------
 libgupnp/http-headers.c  |   14 ++++----------
 2 files changed, 7 insertions(+), 19 deletions(-)
---
diff --git a/libgupnp/gupnp-service.c b/libgupnp/gupnp-service.c
index c9a8ec6..60e5687 100644
--- a/libgupnp/gupnp-service.c
+++ b/libgupnp/gupnp-service.c
@@ -259,10 +259,6 @@ static void
 finalize_action (GUPnPServiceAction *action)
 {
         SoupServer *server;
-        GHashTable *params;
-
-        params = g_hash_table_new (g_str_hash, g_str_equal);
-        g_hash_table_insert (params, "charset", "utf-8");
 
         /* Embed action->response_str in a SOAP document */
         g_string_prepend (action->response_str,
@@ -283,9 +279,9 @@ finalize_action (GUPnPServiceAction *action)
                          "</s:Body>"
                          "</s:Envelope>");
 
-        soup_message_headers_set_content_type (action->msg->response_headers,
-                                               "text/xml",
-                                               params);
+        soup_message_headers_replace (action->msg->response_headers,
+                                      "Content-Type",
+                                      "text/xml; charset=\"utf-8\"");
 
         if (action->accept_gzip && action->response_str->len > 1024) {
                 http_response_set_body_gzip (action->msg,
@@ -315,8 +311,6 @@ finalize_action (GUPnPServiceAction *action)
 
         /* Cleanup */
         gupnp_service_action_unref (action);
-
-        g_hash_table_destroy (params);
 }
 
 /**
diff --git a/libgupnp/http-headers.c b/libgupnp/http-headers.c
index 3705381..abff749 100644
--- a/libgupnp/http-headers.c
+++ b/libgupnp/http-headers.c
@@ -310,7 +310,6 @@ http_response_set_content_type (SoupMessage  *msg,
                                 gsize         data_size)
 {
         char *content_type, *mime;
-        GHashTable *params = NULL;
 
         content_type = g_content_type_guess
                                 (path,
@@ -322,17 +321,12 @@ http_response_set_content_type (SoupMessage  *msg,
                 mime = g_strdup ("application/octet-stream");
         else if (strcmp (mime, "application/xml") == 0) {
                 g_free (mime);
-                mime = g_strdup ("text/xml");
-                params = g_hash_table_new (g_str_hash, g_str_equal);
-                g_hash_table_insert (params, "charset", "utf-8");
+                mime = g_strdup ("text/xml; charset=\"utf-8\"");
         }
 
-        soup_message_headers_set_content_type (msg->response_headers,
-                                               mime,
-                                               params);
-
-        if (params)
-                g_hash_table_destroy (params);
+        soup_message_headers_append (msg->response_headers,
+                                     "Content-Type",
+                                     mime);
 
         g_free (mime);
         g_free (content_type);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]