[libsoup/carlosgc/message-flags: 3/5] message: remove SOUP_MESSAGE_CERTIFICATE_TRUSTED flag




commit b5673035c78a427d8c00914e610a070769df83be
Author: Carlos Garcia Campos <cgarcia igalia com>
Date:   Fri Nov 6 14:06:01 2020 +0100

    message: remove SOUP_MESSAGE_CERTIFICATE_TRUSTED flag
    
    Flags are expected to be set by the user to modify the behavior of a
    message, not by libsoup to notify the user. It's still possible to
    check if certificate was trusted by checking the tls errors

 libsoup/soup-message.c | 7 -------
 libsoup/soup-message.h | 9 ++++-----
 tests/no-ssl-test.c    | 2 +-
 tests/ssl-test.c       | 4 ++--
 4 files changed, 7 insertions(+), 15 deletions(-)
---
diff --git a/libsoup/soup-message.c b/libsoup/soup-message.c
index 04424fda..f969fe2d 100644
--- a/libsoup/soup-message.c
+++ b/libsoup/soup-message.c
@@ -1272,10 +1272,6 @@ re_emit_tls_certificate_changed (SoupMessage    *msg,
        g_clear_object (&priv->tls_certificate);
        priv->tls_certificate = tls_certificate ? g_object_ref (tls_certificate) : NULL;
        priv->tls_certificate_errors = tls_errors;
-       if (priv->tls_certificate_errors)
-               priv->msg_flags &= ~SOUP_MESSAGE_CERTIFICATE_TRUSTED;
-       else if (priv->tls_certificate)
-               priv->msg_flags |= SOUP_MESSAGE_CERTIFICATE_TRUSTED;
        g_object_notify (G_OBJECT (msg), "tls-certificate");
        g_object_notify (G_OBJECT (msg), "tls-certificate-errors");
 }
@@ -1349,9 +1345,6 @@ soup_message_cleanup_response (SoupMessage *msg)
  *   indicate that it has removed the Content-Encoding on a message (and
  *   so headers such as Content-Length may no longer accurately describe
  *   the body).
- * @SOUP_MESSAGE_CERTIFICATE_TRUSTED: if set after an https response
- *   has been received, indicates that the server's SSL certificate is
- *   trusted according to the session's CA.
  * @SOUP_MESSAGE_NEW_CONNECTION: Requests that the message should be
  *   sent on a newly-created connection, not reusing an existing
  *   persistent connection. Note that messages with non-idempotent
diff --git a/libsoup/soup-message.h b/libsoup/soup-message.h
index 4b12478d..0e2abc1a 100644
--- a/libsoup/soup-message.h
+++ b/libsoup/soup-message.h
@@ -76,11 +76,10 @@ gboolean         soup_message_get_is_top_level_navigation (SoupMessage      *msg
 typedef enum {
        SOUP_MESSAGE_NO_REDIRECT              = (1 << 1),
        SOUP_MESSAGE_CONTENT_DECODED          = (1 << 2),
-       SOUP_MESSAGE_CERTIFICATE_TRUSTED      = (1 << 3),
-       SOUP_MESSAGE_NEW_CONNECTION           = (1 << 4),
-       SOUP_MESSAGE_IDEMPOTENT               = (1 << 5),
-       SOUP_MESSAGE_IGNORE_CONNECTION_LIMITS = (1 << 6),
-       SOUP_MESSAGE_DO_NOT_USE_AUTH_CACHE    = (1 << 7)
+       SOUP_MESSAGE_NEW_CONNECTION           = (1 << 3),
+       SOUP_MESSAGE_IDEMPOTENT               = (1 << 4),
+       SOUP_MESSAGE_IGNORE_CONNECTION_LIMITS = (1 << 5),
+       SOUP_MESSAGE_DO_NOT_USE_AUTH_CACHE    = (1 << 6)
 } SoupMessageFlags;
 
 SOUP_AVAILABLE_IN_2_4
diff --git a/tests/no-ssl-test.c b/tests/no-ssl-test.c
index 43c7a9bb..c985d88b 100644
--- a/tests/no-ssl-test.c
+++ b/tests/no-ssl-test.c
@@ -12,7 +12,7 @@ do_ssl_test_for_session (SoupSession *session, SoupURI *uri)
        soup_test_assert_message_status (msg, SOUP_STATUS_SSL_FAILED);
 
        g_assert_null (soup_message_get_tls_certificate (msg));
-       g_assert_false (soup_message_get_flags (msg) & SOUP_MESSAGE_CERTIFICATE_TRUSTED);
+       g_assert_cmpuint (soup_message_get_tls_certificate_errors (msg), ==, 0);
 
        g_object_unref (msg);
 }
diff --git a/tests/ssl-test.c b/tests/ssl-test.c
index 764d0433..abc633c8 100644
--- a/tests/ssl-test.c
+++ b/tests/ssl-test.c
@@ -62,9 +62,9 @@ do_strictness_test (gconstpointer data)
 
        g_test_bug ("665182");
        if (test->with_ca_list && SOUP_STATUS_IS_SUCCESSFUL (soup_message_get_status (msg)))
-               g_assert_true (soup_message_get_flags (msg) & SOUP_MESSAGE_CERTIFICATE_TRUSTED);
+               g_assert_cmpuint (flags, ==, 0);
        else
-               g_assert_false (soup_message_get_flags (msg) & SOUP_MESSAGE_CERTIFICATE_TRUSTED);
+               g_assert_cmpuint (flags, !=, 0);
 
        if (soup_message_get_status (msg) == SOUP_STATUS_SSL_FAILED &&
            test->expected_status != SOUP_STATUS_SSL_FAILED)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]