diff options
author | Raphael Kubo da Costa <kubo@profusion.mobi> | 2012-01-17 12:30:48 -0200 |
---|---|---|
committer | Dan Winship <danw@gnome.org> | 2012-01-18 09:37:08 -0500 |
commit | 5c20e8186fa241f31e4c0d07ec94aa40337b4db3 (patch) | |
tree | 89b23d37bbd96595ff820fa79d6a2708de13b600 /tests | |
parent | 5eddf1a9d2e041de95012ece3cf97fbc2236306d (diff) | |
download | libsoup-5c20e8186fa241f31e4c0d07ec94aa40337b4db3.tar.gz libsoup-5c20e8186fa241f31e4c0d07ec94aa40337b4db3.tar.bz2 libsoup-5c20e8186fa241f31e4c0d07ec94aa40337b4db3.zip |
SoupSession: Do not actually send a request if it was cancelled before.
soup_session_cancel_message() may have been called in a REQUEST_STARTED
callback, so it is safer to make sure that
soup_connection_send_request() is called only if that is not the case.
https://bugzilla.gnome.org/show_bug.cgi?id=668098
Diffstat (limited to 'tests')
-rw-r--r-- | tests/misc-test.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/misc-test.c b/tests/misc-test.c index a8ddc214..358031d9 100644 --- a/tests/misc-test.c +++ b/tests/misc-test.c @@ -591,6 +591,12 @@ ea_connection_created (SoupSession *session, GObject *conn, gpointer user_data) } static void +ea_request_started (SoupSession *session, SoupMessage *msg, SoupSocket *socket, gpointer user_data) +{ + soup_session_cancel_message (session, msg, SOUP_STATUS_CANCELLED); +} + +static void do_early_abort_test (void) { SoupSession *session; @@ -633,6 +639,26 @@ do_early_abort_test (void) g_main_context_iteration (context, FALSE); soup_test_session_abort_unref (session); + + session = soup_test_session_new (SOUP_TYPE_SESSION_ASYNC, NULL); + msg = soup_message_new_from_uri ("GET", base_uri); + + g_signal_connect (session, "request-started", + G_CALLBACK (ea_request_started), NULL); + soup_session_send_message (session, msg); + debug_printf (2, " Message 3 completed\n"); + + if (msg->status_code != SOUP_STATUS_CANCELLED) { + debug_printf (1, " Unexpected response: %d %s\n", + msg->status_code, msg->reason_phrase); + errors++; + } + g_object_unref (msg); + + while (g_main_context_pending (context)) + g_main_context_iteration (context, FALSE); + + soup_test_session_abort_unref (session); } static void |