[libsoup] Verify that soup_auth_is_for_proxy() is returning the right thing
- From: Dan Winship <danw src gnome org>
- To: svn-commits-list gnome org
- Subject: [libsoup] Verify that soup_auth_is_for_proxy() is returning the right thing
- Date: Tue, 28 Apr 2009 10:38:11 -0400 (EDT)
commit 3ea8be6e4e1040bd5e3f7b54100f9342b21138a5
Author: Dan Winship <danw gnome org>
Date: Tue Apr 28 10:37:01 2009 -0400
Verify that soup_auth_is_for_proxy() is returning the right thing
---
tests/proxy-test.c | 22 +++++++++++++++++++---
1 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/tests/proxy-test.c b/tests/proxy-test.c
index e512e86..ebdd2cc 100644
--- a/tests/proxy-test.c
+++ b/tests/proxy-test.c
@@ -48,6 +48,22 @@ static void
authenticate (SoupSession *session, SoupMessage *msg,
SoupAuth *auth, gboolean retrying, gpointer data)
{
+ if (msg->status_code == SOUP_STATUS_UNAUTHORIZED) {
+ if (soup_auth_is_for_proxy (auth)) {
+ debug_printf (1, " got proxy auth object for 401!\n");
+ errors++;
+ }
+ } else if (msg->status_code == SOUP_STATUS_PROXY_UNAUTHORIZED) {
+ if (!soup_auth_is_for_proxy (auth)) {
+ debug_printf (1, " got regular auth object for 407!\n");
+ errors++;
+ }
+ } else {
+ debug_printf (1, " got authenticate signal with status %d\n",
+ msg->status_code);
+ errors++;
+ }
+
if (!retrying)
soup_auth_authenticate (auth, "user1", "realm1");
}
@@ -67,9 +83,9 @@ test_url (const char *url, int proxy, guint expected, gboolean sync)
* connections/auth aren't cached between tests.
*/
proxy_uri = soup_uri_new (proxies[proxy]);
- session = g_object_new (sync ? SOUP_TYPE_SESSION_SYNC : SOUP_TYPE_SESSION_ASYNC,
- SOUP_SESSION_PROXY_URI, proxy_uri,
- NULL);
+ session = soup_test_session_new (sync ? SOUP_TYPE_SESSION_SYNC : SOUP_TYPE_SESSION_ASYNC,
+ SOUP_SESSION_PROXY_URI, proxy_uri,
+ NULL);
soup_uri_free (proxy_uri);
g_signal_connect (session, "authenticate",
G_CALLBACK (authenticate), NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]