Commit 587e43cf authored by Carlos Garcia Campos's avatar Carlos Garcia Campos

session: add public getters and setters for the SoupSession properties

Also make max-conns and max-conns-per-host construct only and ensure all
setters emit the GObject::notify signal when the value changes.
parent bd6de903
Pipeline #260110 passed with stages
in 1 minute and 28 seconds
......@@ -364,6 +364,26 @@ SoupSessionError
soup_session_new
soup_session_new_with_options
<SUBSECTION>
soup_session_get_local_address
soup_session_get_max_conns
soup_session_get_max_conns_per_host
soup_session_set_proxy_resolver
soup_session_get_proxy_resolver
soup_session_set_tls_database
soup_session_get_tls_database
soup_session_set_tls_interaction
soup_session_get_tls_interaction
soup_session_set_timeout
soup_session_get_timeout
soup_session_set_idle_timeout
soup_session_get_idle_timeout
soup_session_set_user_agent
soup_session_get_user_agent
soup_session_set_accept_language
soup_session_get_accept_language
soup_session_set_accept_language_auto
soup_session_get_accept_language_auto
<SUBSECTION>
soup_session_send
soup_session_send_async
soup_session_send_finish
......
......@@ -265,7 +265,7 @@ main (int argc, char **argv)
exit (1);
}
g_object_set (session, "tls-database", tls_db, NULL);
soup_session_set_tls_database (session, tls_db);
g_object_unref (tls_db);
}
......@@ -285,7 +285,8 @@ main (int argc, char **argv)
exit (1);
}
interaction = _get_tls_cert_interaction_new (client_cert);
g_object_set (session, "tls-interaction", interaction, NULL);
soup_session_set_tls_interaction (session, G_TLS_INTERACTION (interaction));
g_object_unref (interaction);
}
if (debug) {
......@@ -306,9 +307,7 @@ main (int argc, char **argv)
}
resolver = g_simple_proxy_resolver_new (proxy, NULL);
g_object_set (G_OBJECT (session),
"proxy-resolver", resolver,
NULL);
soup_session_set_proxy_resolver (session, resolver);
g_uri_unref (proxy_uri);
g_object_unref (resolver);
}
......
This diff is collapsed.
......@@ -31,11 +31,76 @@ typedef enum {
} SoupSessionError;
SOUP_AVAILABLE_IN_ALL
SoupSession *soup_session_new (void);
SoupSession *soup_session_new (void);
SOUP_AVAILABLE_IN_ALL
SoupSession *soup_session_new_with_options (const char *optname1,
...) G_GNUC_NULL_TERMINATED;
SoupSession *soup_session_new_with_options (const char *optname1,
...) G_GNUC_NULL_TERMINATED;
SOUP_AVAILABLE_IN_ALL
GInetSocketAddress *soup_session_get_local_address (SoupSession *session);
SOUP_AVAILABLE_IN_ALL
guint soup_session_get_max_conns (SoupSession *session);
SOUP_AVAILABLE_IN_ALL
guint soup_session_get_max_conns_per_host (SoupSession *session);
SOUP_AVAILABLE_IN_ALL
void soup_session_set_proxy_resolver (SoupSession *session,
GProxyResolver *proxy_resolver);
SOUP_AVAILABLE_IN_ALL
GProxyResolver *soup_session_get_proxy_resolver (SoupSession *session);
SOUP_AVAILABLE_IN_ALL
void soup_session_set_tls_database (SoupSession *session,
GTlsDatabase *tls_database);
SOUP_AVAILABLE_IN_ALL
GTlsDatabase *soup_session_get_tls_database (SoupSession *session);
SOUP_AVAILABLE_IN_ALL
void soup_session_set_tls_interaction (SoupSession *session,
GTlsInteraction *tls_interaction);
SOUP_AVAILABLE_IN_ALL
GTlsInteraction *soup_session_get_tls_interaction (SoupSession *session);
SOUP_AVAILABLE_IN_ALL
void soup_session_set_timeout (SoupSession *session,
guint timeout);
SOUP_AVAILABLE_IN_ALL
guint soup_session_get_timeout (SoupSession *session);
SOUP_AVAILABLE_IN_ALL
void soup_session_set_idle_timeout (SoupSession *session,
guint timeout);
SOUP_AVAILABLE_IN_ALL
guint soup_session_get_idle_timeout (SoupSession *session);
SOUP_AVAILABLE_IN_ALL
void soup_session_set_user_agent (SoupSession *session,
const char *user_agent);
SOUP_AVAILABLE_IN_ALL
const char *soup_session_get_user_agent (SoupSession *session);
SOUP_AVAILABLE_IN_ALL
void soup_session_set_accept_language (SoupSession *session,
const char *accept_language);
SOUP_AVAILABLE_IN_ALL
const char *soup_session_get_accept_language (SoupSession *session);
SOUP_AVAILABLE_IN_ALL
void soup_session_set_accept_language_auto (SoupSession *session,
gboolean accept_language_auto);
SOUP_AVAILABLE_IN_ALL
gboolean soup_session_get_accept_language_auto (SoupSession *session);
SOUP_AVAILABLE_IN_ALL
void soup_session_abort (SoupSession *session);
......
......@@ -753,9 +753,7 @@ do_connection_state_test_for_session (SoupSession *session)
debug_printf (1, " https -- SKIPPING\n");
resolver = g_simple_proxy_resolver_new (HTTP_PROXY, NULL);
g_object_set (G_OBJECT (session),
"proxy-resolver", resolver,
NULL);
soup_session_set_proxy_resolver (session, resolver);
g_object_unref (resolver);
debug_printf (1, " http with proxy\n");
......@@ -892,9 +890,7 @@ do_connection_event_test_for_session (SoupSession *session)
debug_printf (1, " https -- SKIPPING\n");
resolver = g_simple_proxy_resolver_new (HTTP_PROXY, NULL);
g_object_set (G_OBJECT (session),
"proxy-resolver", resolver,
NULL);
soup_session_set_proxy_resolver (session, resolver);
g_object_unref (resolver);
debug_printf (1, " http with proxy\n");
......
......@@ -199,8 +199,7 @@ do_priority_tests (void)
g_test_bug ("696277");
session = soup_test_session_new (NULL);
g_object_set (session, "max-conns", 1, NULL);
session = soup_test_session_new ("max-conns", 1, NULL);
expected_priorities[0] = SOUP_MESSAGE_PRIORITY_HIGH;
expected_priorities[1] = SOUP_MESSAGE_PRIORITY_NORMAL;
......@@ -236,13 +235,8 @@ test_session_properties (const char *name,
GProxyResolver *expected_proxy_resolver,
GTlsDatabase *expected_tls_database)
{
GProxyResolver *proxy_resolver = NULL;
GTlsDatabase *tlsdb = NULL;
g_object_get (G_OBJECT (session),
"proxy-resolver", &proxy_resolver,
"tls-database", &tlsdb,
NULL);
GProxyResolver *proxy_resolver = soup_session_get_proxy_resolver (session);
GTlsDatabase *tlsdb = soup_session_get_tls_database (session);
soup_test_assert (proxy_resolver == expected_proxy_resolver,
"%s has %s proxy resolver",
......@@ -250,9 +244,6 @@ test_session_properties (const char *name,
soup_test_assert (tlsdb == expected_tls_database,
"%s has %s TLS database",
name, tlsdb ? (expected_tls_database ? "wrong" : "a") : "no");
g_clear_object (&proxy_resolver);
g_clear_object (&tlsdb);
}
static void
......
......@@ -48,9 +48,7 @@ do_strictness_test (gconstpointer data)
GTlsDatabase *tlsdb;
tlsdb = g_tls_backend_get_default_database (g_tls_backend_get_default ());
g_object_set (G_OBJECT (session),
"tls-database", tlsdb,
NULL);
soup_session_set_tls_database (session, tlsdb);
g_object_unref (tlsdb);
}
......@@ -163,7 +161,7 @@ do_tls_interaction_test (gconstpointer data)
SOUP_TEST_SKIP_IF_NO_TLS;
session = soup_test_session_new (NULL);
g_object_get (session, "tls-database", &tls_db, NULL);
tls_db = soup_session_get_tls_database (session);
g_signal_connect (server, "request-started",
G_CALLBACK (server_request_started),
......@@ -184,7 +182,7 @@ do_tls_interaction_test (gconstpointer data)
"certificate",
g_object_ref (certificate),
g_object_unref);
g_object_set (session, "tls-interaction", interaction, NULL);
soup_session_set_tls_interaction (session, interaction);
g_object_unref (interaction);
/* With a GTlsInteraction */
......@@ -199,7 +197,6 @@ do_tls_interaction_test (gconstpointer data)
g_signal_handlers_disconnect_by_data (server, tls_db);
soup_test_session_abort_unref (session);
g_object_unref (tls_db);
g_object_unref (certificate);
}
......
......@@ -281,9 +281,7 @@ soup_test_session_new (const char *propname, ...)
g_assert_no_error (error);
}
g_object_set (G_OBJECT (session),
"tls-database", tlsdb,
NULL);
soup_session_set_tls_database (session, tlsdb);
g_clear_object (&tlsdb);
}
......
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