diff options
author | Carlos Garcia Campos <cgarcia@igalia.com> | 2020-10-08 14:00:17 +0200 |
---|---|---|
committer | Carlos Garcia Campos <cgarcia@igalia.com> | 2020-10-08 15:18:53 +0200 |
commit | 0d7e672e29fa3318d9631206bee2fc5a7733f355 (patch) | |
tree | b765ef82197d7a960dbf6b4089370434916349d0 /libsoup/soup-form.c | |
parent | e7e602c879249e9d94535e1203c6fb8e9016e142 (diff) | |
download | libsoup-0d7e672e29fa3318d9631206bee2fc5a7733f355.tar.gz |
forms: Use GBytes instead of SoupMessageBody
Use the body stream always for requests in client side.
Diffstat (limited to 'libsoup/soup-form.c')
-rw-r--r-- | libsoup/soup-form.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/libsoup/soup-form.c b/libsoup/soup-form.c index 84acf486..32e7de3c 100644 --- a/libsoup/soup-form.c +++ b/libsoup/soup-form.c @@ -153,14 +153,16 @@ soup_form_decode_multipart (SoupMessage *msg, const char *file_control_name, SoupMultipart *multipart; GHashTable *form_data_set, *params; SoupMessageHeaders *part_headers; + GBytes *body; GBytes *part_body; char *disposition, *name; int i; g_return_val_if_fail (SOUP_IS_MESSAGE (msg), NULL); - multipart = soup_multipart_new_from_message (msg->request_headers, - msg->request_body); + body = soup_message_body_flatten (msg->request_body); + multipart = soup_multipart_new_from_message (msg->request_headers, body); + g_bytes_unref (body); if (!multipart) return NULL; @@ -483,9 +485,14 @@ soup_form_request_new_from_multipart (const char *uri, SoupMultipart *multipart) { SoupMessage *msg; + GBytes *body = NULL; msg = soup_message_new ("POST", uri); - soup_multipart_to_message (multipart, msg->request_headers, - msg->request_body); + soup_multipart_to_message (multipart, msg->request_headers, &body); + soup_message_set_request_body_from_bytes (msg, + soup_message_headers_get_content_type (msg->request_headers, NULL), + body); + g_bytes_unref (body); + return msg; } |