summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergio Villar Senin <svillar@igalia.com>2011-01-31 13:29:22 +0100
committerSergio Villar Senin <svillar@igalia.com>2011-01-31 20:34:18 +0100
commitea5b7457064727ae96b97ca5ad93d23cee1ba12e (patch)
tree735d5aaee1db11d5dceaacdece2fa4ec0bbd06df
parentd88ee37535aa80635c5be4f9089e43b7c15ea8c9 (diff)
downloadlibsoup-ea5b7457064727ae96b97ca5ad93d23cee1ba12e.tar.gz
soup-request-data: return decoded contents for non-base64 data URLs
SoupRequestData was not returning the decoded version of data URLs when they were not encoded in base64 https://bugzilla.gnome.org/show_bug.cgi?id=641022
-rw-r--r--libsoup/soup-request-data.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/libsoup/soup-request-data.c b/libsoup/soup-request-data.c
index a385763e..8c97bf88 100644
--- a/libsoup/soup-request-data.c
+++ b/libsoup/soup-request-data.c
@@ -91,9 +91,14 @@ soup_request_data_send (SoupRequest *request,
end = comma;
if (end != start) {
- data->priv->content_type = g_strndup (start, end - start);
- if (!base64)
- soup_uri_decode (data->priv->content_type);
+ char *encoded_content_type = g_strndup (start, end - start);
+
+ if (base64)
+ data->priv->content_type = encoded_content_type;
+ else {
+ data->priv->content_type = soup_uri_decode (encoded_content_type);
+ g_free (encoded_content_type);
+ }
}
}
@@ -119,9 +124,8 @@ soup_request_data_send (SoupRequest *request,
goto fail;
}
} else {
- soup_uri_decode (start);
- data->priv->content_length = strlen (start);
- buf = g_memdup (start, data->priv->content_length);
+ buf = (guchar *) soup_uri_decode (start);
+ data->priv->content_length = strlen ((const char *) buf);
}
g_memory_input_stream_add_data (G_MEMORY_INPUT_STREAM (memstream),