soup_session_pause_message() can be called only on async messages
The soup_session_pause_message()
can be called only on async messages, but that breaks gnome-calendar test, the one trying incorrect credentials. The libsoup calls soup_session_pause_message()
only on a single place.
When I remove the assertion in the soup_session_pause_message()
then the test passes with no problem, without any visible side effects (and valgrind doesn't claim any definitely-leaked memory).
Backtrace for the assertion:
# GcalSimpleServer-DEBUG: Listening on http://127.0.0.1:41151/
# DEBUG: Authenticating with wrong username...
# GcalSimpleServer-DEBUG: Authorizing username: 'thyartismurder', password: 'popmusic'
# DEBUG: Authenticating with wrong username...
Bail out! libsoup-FATAL-CRITICAL: soup_session_pause_message: assertion 'item->async' failed
at g_logv() at gmessages.c:1335
by g_log() at gmessages.c:1494
by soup_session_pause_message() at soup-session.c:1879
by authenticate_auth() at soup-auth-manager.c:588
by auth_got_headers() at soup-auth-manager.c:687
by status_handler_metamarshal() at soup-message.c:1352
by g_closure_invoke() at gclosure.c:298
by signal_emit_unlocked_R() at gsignal.c:3238
by g_signal_emit_valist() at gsignal.c:3497
by g_signal_emit() at gsignal.c:3555
by soup_message_got_headers() at soup-message.c:1217
by io_read() at soup-client-message-io-http1.c:619
by io_run_until() at soup-client-message-io-http1.c:733
by soup_client_message_io_http1_run_until_read() at soup-client-message-io-http1.c:880
by soup_client_message_io_run_until_read() at soup-client-message-io.c:79
by soup_message_io_run_until_read() at soup-message.c:2780
by soup_session_send() at soup-session.c:3172
by server_request_auth_wrong() at test-server.c:259
by g_test_run_suite_internal() at gtestutils.c:2901
by g_test_run_suite_internal() at gtestutils.c:3008
by g_test_run_suite_internal() at gtestutils.c:3008
by g_test_run_suite() at gtestutils.c:3082
by g_test_run() at gtestutils.c:2200
by main() at test-server.c:283
by __libc_start_call_main()
by __libc_start_main@@GLIBC_2.34()
by _start()
The related parts of the gnome-calendar test
static gboolean
wrong_authenticate_cb (SoupMessage *message,
SoupAuth *auth,
gboolean retrying,
gpointer user_data)
{
g_debug ("Authenticating with wrong username...");
if (!retrying)
soup_auth_authenticate (auth, "thyartismurder", "popmusic");
return TRUE;
}
static void
server_request_auth_wrong (void)
{
g_autoptr (GcalSimpleServer) server = NULL;
g_autoptr (SoupMessage) message = NULL;
g_autoptr (SoupSession) session = NULL;
g_autoptr (GInputStream) input_stream = NULL;
g_autoptr (GUri) uri = NULL;
g_autoptr (GError) error = NULL;
server = init_server ();
uri = gcal_simple_server_get_uri (server);
e_util_change_uri_component (&uri, SOUP_URI_PATH, "/secret-area");
session = soup_session_new ();
message = soup_message_new_from_uri ("GET", uri);
g_signal_connect (message, "authenticate", G_CALLBACK (wrong_authenticate_cb), server);
input_stream = soup_session_send (session, message, NULL, &error);
g_assert_no_error (error);
g_assert_nonnull (input_stream);
g_assert_cmpuint (soup_message_get_status (message), ==, SOUP_STATUS_UNAUTHORIZED);
}