diff options
author | Carlos Garcia Campos <cgarcia@igalia.com> | 2021-03-04 11:14:09 +0100 |
---|---|---|
committer | Carlos Garcia Campos <cgarcia@igalia.com> | 2021-03-04 11:14:09 +0100 |
commit | 78456405a24af9811571bfe39643e662f0a7b1bf (patch) | |
tree | 6f9e479de3cae30c639f6bd635503295bd2f8127 /tests/multipart-test.c | |
parent | 7033879bcff9a7b1c31c086ed020fc8fa03fcd81 (diff) | |
download | libsoup-78456405a24af9811571bfe39643e662f0a7b1bf.tar.gz |
session: add soup_session_get_async_result_messagecarlosgc/async-result-message
This is useful to get the SoupMessage of an async operation from the
ready callback.
Diffstat (limited to 'tests/multipart-test.c')
-rw-r--r-- | tests/multipart-test.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/tests/multipart-test.c b/tests/multipart-test.c index c6c3b0e5..28a02e2f 100644 --- a/tests/multipart-test.c +++ b/tests/multipart-test.c @@ -335,7 +335,7 @@ multipart_next_part_cb (GObject *source, GAsyncResult *res, gpointer data) static void multipart_handling_cb (GObject *source, GAsyncResult *res, gpointer data) { - SoupMessage *message = (SoupMessage*)data; + SoupMessage *message; SoupSession *session = SOUP_SESSION (source); GError *error = NULL; GInputStream *in; @@ -347,6 +347,7 @@ multipart_handling_cb (GObject *source, GAsyncResult *res, gpointer data) return; } + message = soup_session_get_async_result_message (session, res); multipart = soup_multipart_input_stream_new (message, in); g_object_unref (in); @@ -360,7 +361,7 @@ multipart_handling_cb (GObject *source, GAsyncResult *res, gpointer data) static void sync_multipart_handling_cb (GObject *source, GAsyncResult *res, gpointer data) { - SoupMessage *message = (SoupMessage*)data; + SoupMessage *message; SoupSession *session = SOUP_SESSION (source); GError *error = NULL; GInputStream *in; @@ -374,6 +375,7 @@ sync_multipart_handling_cb (GObject *source, GAsyncResult *res, gpointer data) return; } + message = soup_session_get_async_result_message (session, res); multipart = soup_multipart_input_stream_new (message, in); g_object_unref (in); @@ -440,12 +442,12 @@ test_multipart (gconstpointer data) loop = g_main_loop_new (NULL, TRUE); if (multipart_mode == ASYNC_MULTIPART) - soup_session_send_async (session, msg, 0, NULL, multipart_handling_cb, msg); + soup_session_send_async (session, msg, 0, NULL, multipart_handling_cb, NULL); else if (multipart_mode == ASYNC_MULTIPART_SMALL_READS) { g_object_set_data (G_OBJECT (msg), "multipart-small-reads", GINT_TO_POINTER(1)); - soup_session_send_async (session, msg, 0, NULL, multipart_handling_cb, msg); + soup_session_send_async (session, msg, 0, NULL, multipart_handling_cb, NULL); } else if (multipart_mode == SYNC_MULTIPART) - soup_session_send_async (session, msg, 0, NULL, sync_multipart_handling_cb, msg); + soup_session_send_async (session, msg, 0, NULL, sync_multipart_handling_cb, NULL); else soup_session_send_async (session, msg, 0, NULL, no_multipart_handling_cb, NULL); |