diff options
-rw-r--r-- | libsoup/soup-message.c | 10 | ||||
-rw-r--r-- | libsoup/soup-session.c | 8 | ||||
-rw-r--r-- | tests/ssl-test.c | 4 |
3 files changed, 14 insertions, 8 deletions
diff --git a/libsoup/soup-message.c b/libsoup/soup-message.c index 67b6e6f5..750b9925 100644 --- a/libsoup/soup-message.c +++ b/libsoup/soup-message.c @@ -1826,11 +1826,13 @@ soup_message_set_https_status (SoupMessage *msg, SoupConnection *conn) * @certificate: (out) (transfer none): @msg's TLS certificate * @errors: (out): the verification status of @certificate * - * If @msg is using https, this retrieves the #GTlsCertificate - * associated with its connection, and the #GTlsCertificateFlags showing - * what problems, if any, have been found with that certificate. + * If @msg is using https (or attempted to use https but got + * %SOUP_STATUS_SSL_FAILED), this retrieves the #GTlsCertificate + * associated with its connection, and the #GTlsCertificateFlags + * showing what problems, if any, have been found with that + * certificate. * - * Return value: %TRUE if @msg uses https, %FALSE if not + * Return value: %TRUE if @msg used/attempted https, %FALSE if not * * Since: 2.34 */ diff --git a/libsoup/soup-session.c b/libsoup/soup-session.c index e37a71d5..3b23846c 100644 --- a/libsoup/soup-session.c +++ b/libsoup/soup-session.c @@ -1509,8 +1509,7 @@ tunnel_complete (SoupConnection *conn, guint status, gpointer user_data) if (item->msg->status_code) item->state = SOUP_MESSAGE_FINISHING; - else - soup_message_set_https_status (item->msg, item->conn); + soup_message_set_https_status (item->msg, item->conn); if (!SOUP_STATUS_IS_SUCCESSFUL (status)) { soup_connection_disconnect (conn); @@ -1597,6 +1596,8 @@ got_connection (SoupConnection *conn, guint status, gpointer user_data) SoupMessageQueueItem *item = user_data; SoupSession *session = item->session; + soup_message_set_https_status (item->msg, item->conn); + if (status != SOUP_STATUS_OK) { soup_connection_disconnect (conn); if (item->state == SOUP_MESSAGE_CONNECTING) { @@ -1751,10 +1752,10 @@ get_connection (SoupMessageQueueItem *item, gboolean *should_cleanup) } soup_session_set_item_connection (session, item, conn); - soup_message_set_https_status (item->msg, item->conn); if (soup_connection_get_state (item->conn) != SOUP_CONNECTION_NEW) { item->state = SOUP_MESSAGE_READY; + soup_message_set_https_status (item->msg, item->conn); return TRUE; } @@ -1801,7 +1802,6 @@ soup_session_process_queue_item (SoupSession *session, break; case SOUP_MESSAGE_READY: - soup_message_set_https_status (item->msg, item->conn); if (item->msg->status_code) { if (item->msg->status_code == SOUP_STATUS_TRY_AGAIN) { soup_message_cleanup_response (item->msg); diff --git a/tests/ssl-test.c b/tests/ssl-test.c index 6d96bc79..7716f302 100644 --- a/tests/ssl-test.c +++ b/tests/ssl-test.c @@ -109,6 +109,10 @@ do_one_strict_test (SoupSession *session, char *uri, errors++; } } + if (!soup_message_get_https_status (msg, NULL, NULL)) { + debug_printf (1, " get_https_status returns FALSE?\n"); + errors++; + } g_object_unref (msg); } |