summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDan Winship <danw@gnome.org>2013-01-01 11:46:18 -0500
committerDan Winship <danw@gnome.org>2013-01-02 15:34:12 -0500
commitb99acd6fcc30ea537d8a758ff8ce5e2f84848781 (patch)
tree1a318e43a3f8062a2e43b4d25656d5c661afa190 /tests
parent2a6100c60c0cde68cbb37ff11075525df222b5da (diff)
downloadlibsoup-b99acd6fcc30ea537d8a758ff8ce5e2f84848781.tar.gz
libsoup-b99acd6fcc30ea537d8a758ff8ce5e2f84848781.tar.bz2
libsoup-b99acd6fcc30ea537d8a758ff8ce5e2f84848781.zip
soup-auth-manager: add soup_auth_manager_use_auth()
Add soup_auth_manager_use_auth(), for "preloading" authentication, and make the old automatically-request-NTLM behavior happen only for the legacy SoupSession subclasses.
Diffstat (limited to 'tests')
-rw-r--r--tests/ntlm-test.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/tests/ntlm-test.c b/tests/ntlm-test.c
index 3184ffcf..fa31280e 100644
--- a/tests/ntlm-test.c
+++ b/tests/ntlm-test.c
@@ -333,9 +333,7 @@ do_ntlm_round (SoupURI *base_uri, gboolean use_ntlm,
gboolean bob_via_ntlm = use_ntlm && bob;
gboolean alice_via_basic = !use_ntlm && alice;
- session = soup_test_session_new (SOUP_TYPE_SESSION_ASYNC, NULL);
- if (use_ntlm)
- soup_session_add_feature_by_type (session, SOUP_TYPE_AUTH_NTLM);
+ session = soup_test_session_new (SOUP_TYPE_SESSION, NULL);
if (user) {
g_signal_connect (session, "authenticate",
@@ -343,6 +341,16 @@ do_ntlm_round (SoupURI *base_uri, gboolean use_ntlm,
if (use_ntlm && !use_builtin_ntlm)
g_setenv ("NTLMUSER", user, TRUE);
}
+ if (use_ntlm) {
+ SoupAuthManager *auth_manager;
+ SoupAuth *ntlm;
+
+ soup_session_add_feature_by_type (session, SOUP_TYPE_AUTH_NTLM);
+ auth_manager = SOUP_AUTH_MANAGER (soup_session_get_feature (session, SOUP_TYPE_AUTH_MANAGER));
+ ntlm = g_object_new (SOUP_TYPE_AUTH_NTLM, NULL);
+ soup_auth_manager_use_auth (auth_manager, base_uri, ntlm);
+ g_object_unref (ntlm);
+ }
/* 1. Server doesn't request auth, so both get_ntlm_prompt and
* get_basic_prompt are both FALSE, and likewise do_basic. But
@@ -464,7 +472,7 @@ main (int argc, char **argv)
test_init (argc, argv, NULL);
- server = soup_test_server_new (FALSE);
+ server = soup_test_server_new (TRUE);
connections = g_hash_table_new (NULL, NULL);
soup_server_add_handler (server, NULL,
server_callback, connections, NULL);