[libsoup/gnome-3-6] soup_message_get_https_status: provide info for failed attempts too
- From: Dan Winship <danw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsoup/gnome-3-6] soup_message_get_https_status: provide info for failed attempts too
- Date: Thu, 10 Jan 2013 14:39:24 +0000 (UTC)
commit 0022aed5e4e1fa22cba8749efe0f275f392b762f
Author: Dan Winship <danw gnome org>
Date: Mon Jan 7 16:30:55 2013 -0500
soup_message_get_https_status: provide info for failed attempts too
SoupMessage:tls-certificate and SoupMessage:tls-errors were only
getting set for successful https connections. It is useful to have
them be set on failed ones as well. Fix that, and make ssl-test test
it.
https://bugzilla.gnome.org/show_bug.cgi?id=690176
libsoup/soup-message.c | 10 ++++++----
libsoup/soup-session-async.c | 5 ++++-
libsoup/soup-session-sync.c | 2 +-
tests/ssl-test.c | 4 ++++
4 files changed, 15 insertions(+), 6 deletions(-)
---
diff --git a/libsoup/soup-message.c b/libsoup/soup-message.c
index 31ab10d..60cc1a8 100644
--- a/libsoup/soup-message.c
+++ b/libsoup/soup-message.c
@@ -1923,11 +1923,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-async.c b/libsoup/soup-session-async.c
index 398cc0f..01eee2a 100644
--- a/libsoup/soup-session-async.c
+++ b/libsoup/soup-session-async.c
@@ -126,6 +126,8 @@ ssl_tunnel_completed (SoupConnection *conn, guint status, gpointer user_data)
soup_message_finished (tunnel_item->msg);
soup_message_queue_item_unref (tunnel_item);
+ soup_message_set_https_status (item->msg, item->conn);
+
if (!SOUP_STATUS_IS_SUCCESSFUL (status)) {
soup_connection_disconnect (item->conn);
soup_message_queue_item_set_connection (item, NULL);
@@ -174,6 +176,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 (item->state != SOUP_MESSAGE_CONNECTING) {
soup_connection_disconnect (conn);
} else if (status != SOUP_STATUS_OK) {
@@ -236,7 +240,6 @@ process_queue_item (SoupMessageQueueItem *item,
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/libsoup/soup-session-sync.c b/libsoup/soup-session-sync.c
index d753f57..ff8bf0a 100644
--- a/libsoup/soup-session-sync.c
+++ b/libsoup/soup-session-sync.c
@@ -137,9 +137,9 @@ tunnel_connect (SoupSession *session, SoupMessageQueueItem *related)
if (SOUP_STATUS_IS_SUCCESSFUL (status)) {
if (!soup_connection_start_ssl_sync (conn, related->cancellable))
status = SOUP_STATUS_SSL_FAILED;
- soup_message_set_https_status (related->msg, conn);
}
+ soup_message_set_https_status (related->msg, conn);
if (!SOUP_STATUS_IS_SUCCESSFUL (status))
soup_connection_disconnect (conn);
diff --git a/tests/ssl-test.c b/tests/ssl-test.c
index 6d96bc7..7716f30 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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]