Commit 4ec09b21 authored by Carlos Garcia Campos's avatar Carlos Garcia Campos Committed by Carlos Garcia Campos

soup-message: make soup_message_disables_feature_by_type() public

Renamed as soup_message_is_feature_disabled(). We need this in WebKit to
check if cookies are available in an existing SoupMessage.
parent c5813ff0
Pipeline #194832 passed with stage
in 1 minute and 1 second
......@@ -35,6 +35,7 @@ SoupChunkAllocator
soup_message_set_chunk_allocator
<SUBSECTION>
soup_message_disable_feature
soup_message_is_feature_disabled
soup_message_get_soup_request
<SUBSECTION>
SoupMessagePriority
......
......@@ -143,8 +143,6 @@ GInputStream *soup_message_io_get_response_istream (SoupMessage *msg,
gboolean soup_message_disables_feature (SoupMessage *msg,
gpointer feature);
gboolean soup_message_disables_feature_by_type (SoupMessage *msg,
GType feature_type);
GList *soup_message_get_disabled_features (SoupMessage *msg);
......
......@@ -1927,8 +1927,21 @@ soup_message_disables_feature (SoupMessage *msg, gpointer feature)
return FALSE;
}
/**
* soup_message_is_feature_disabled:
* @msg: a #SoupMessage
* @feature_type: the #GType of a #SoupSessionFeature
*
* Get whether #SoupSessionFeature<!-- -->s of the given @feature_type
* (or a subclass of that type) are disabled on @msg.
* See soup_message_disable_feature().
*
* Returns: %TRUE if feature is disabled, or %FALSE otherwise.
*
* Since: 2.72
*/
gboolean
soup_message_disables_feature_by_type (SoupMessage *msg, GType feature_type)
soup_message_is_feature_disabled (SoupMessage *msg, GType feature_type)
{
SoupMessagePrivate *priv;
GHashTableIter iter;
......
......@@ -217,6 +217,10 @@ SOUP_AVAILABLE_IN_2_28
void soup_message_disable_feature (SoupMessage *msg,
GType feature_type);
SOUP_AVAILABLE_IN_2_72
gboolean soup_message_is_feature_disabled (SoupMessage *msg,
GType feature_type);
SOUP_AVAILABLE_IN_2_42
SoupRequest *soup_message_get_soup_request (SoupMessage *msg);
......
......@@ -69,6 +69,7 @@ G_BEGIN_DECLS
#define SOUP_VERSION_2_66 (G_ENCODE_VERSION (2, 66))
#define SOUP_VERSION_2_68 (G_ENCODE_VERSION (2, 68))
#define SOUP_VERSION_2_70 (G_ENCODE_VERSION (2, 70))
#define SOUP_VERSION_2_72 (G_ENCODE_VERSION (2, 72))
/* evaluates to the current stable version; for development cycles,
* this means the next stable target
......@@ -410,6 +411,13 @@ G_BEGIN_DECLS
#else
# define SOUP_AVAILABLE_IN_2_70 _SOUP_EXTERN
#endif
#if SOUP_VERSION_MAX_ALLOWED < SOUP_VERSION_2_72
# define SOUP_AVAILABLE_IN_2_72 G_UNAVAILABLE(2, 72) _SOUP_EXTERN
#else
# define SOUP_AVAILABLE_IN_2_72 _SOUP_EXTERN
#endif
SOUP_AVAILABLE_IN_2_42
guint soup_get_major_version (void);
......
......@@ -337,7 +337,7 @@ soup_websocket_client_prepare_handshake_with_extensions (SoupMessage *msg,
for (i = 0; i < supported_extensions->len; i++) {
SoupWebsocketExtensionClass *extension_class = (SoupWebsocketExtensionClass *)supported_extensions->pdata[i];
if (soup_message_disables_feature_by_type (msg, G_TYPE_FROM_CLASS (extension_class)))
if (soup_message_is_feature_disabled (msg, G_TYPE_FROM_CLASS (extension_class)))
continue;
if (i != 0)
......
......@@ -403,7 +403,9 @@ test_disabled (gconstpointer data)
uri = soup_uri_new_with_base (base_uri, path);
msg = soup_message_new_from_uri ("GET", uri);
g_assert_false (soup_message_is_feature_disabled (msg, SOUP_TYPE_CONTENT_SNIFFER));
soup_message_disable_feature (msg, SOUP_TYPE_CONTENT_SNIFFER);
g_assert_true (soup_message_is_feature_disabled (msg, SOUP_TYPE_CONTENT_SNIFFER));
g_signal_connect (msg, "content-sniffed",
G_CALLBACK (sniffing_content_sniffed), &sniffed_type);
......@@ -415,7 +417,9 @@ test_disabled (gconstpointer data)
req = soup_session_request_uri (session, uri, NULL);
msg = soup_request_http_get_message (SOUP_REQUEST_HTTP (req));
g_assert_false (soup_message_is_feature_disabled (msg, SOUP_TYPE_CONTENT_SNIFFER));
soup_message_disable_feature (msg, SOUP_TYPE_CONTENT_SNIFFER);
g_assert_true (soup_message_is_feature_disabled (msg, SOUP_TYPE_CONTENT_SNIFFER));
g_object_unref (msg);
stream = soup_test_request_send (req, NULL, 0, &error);
if (stream) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment