[libsoup/wip/tpopela/negotiate: 12/16] Avoid the unnecessary auth header splitting



commit 7b2854914991805aa86a5c38c9100cc8db76fed9
Author: Tomas Popela <tpopela redhat com>
Date:   Mon Oct 5 16:11:14 2015 +0200

    Avoid the unnecessary auth header splitting

 libsoup/soup-auth-negotiate.c |   12 ++----------
 1 files changed, 2 insertions(+), 10 deletions(-)
---
diff --git a/libsoup/soup-auth-negotiate.c b/libsoup/soup-auth-negotiate.c
index 258af83..a791eb7 100644
--- a/libsoup/soup-auth-negotiate.c
+++ b/libsoup/soup-auth-negotiate.c
@@ -162,7 +162,6 @@ soup_auth_negotiate_is_ready (SoupAuth *auth,
 static void
 check_server_response(SoupMessage *msg, gpointer state)
 {
-       gchar **parts, *p;
        gint ret;
        const char *auth_headers;
        SoupNegotiateConnectionState *conn = state;
@@ -174,19 +173,13 @@ check_server_response(SoupMessage *msg, gpointer state)
        /* FIXME: need to check for proxy-auth too */
        auth_headers = soup_message_headers_get_one (msg->response_headers,
                                                     "WWW-Authenticate");
-       parts = g_strsplit (auth_headers, " ", 0);
-       if (g_strv_length (parts) != 2) {
+       if (!auth_headers || g_ascii_strncasecmp (auth_headers, "Negotiate ", 10) != 0) {
                g_warning ("Failed to parse auth header %s", auth_headers);
                conn->state = SOUP_NEGOTIATE_FAILED;
                goto out;
        }
-       if (g_ascii_strcasecmp (parts[0], "Negotiate")) {
-               g_warning ("Failed to parse auth header %s", auth_headers);
-               conn->state = SOUP_NEGOTIATE_FAILED;
-       }
 
-       p = parts[1];
-       ret = soup_gssapi_syms.client_step (conn, p, &err);
+       ret = soup_gssapi_syms.client_step (conn, auth_headers + 10, &err);
 
        if (ret != AUTH_GSS_COMPLETE) {
                g_warning ("%s", err->message);
@@ -194,7 +187,6 @@ check_server_response(SoupMessage *msg, gpointer state)
        }
  out:
        g_clear_error (&err);
-       g_strfreev (parts);
 }
 
 static void


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