Revision: 1868
Author: chemodax
Date: Tue May 21 03:16:59 2013
Log: On 1.2.x branch.
Merge r1819 from trunk:
SPNego authentication optimization.
Justification:
Avoid lookup through response headers on every read.
http://code.google.com/p/serf/source/detail?r=1868
Modified:
/branches/1.2.x
/branches/1.2.x/auth/auth_kerb.c
=======================================
--- /branches/1.2.x/auth/auth_kerb.c Tue Apr 23 09:11:11 2013
+++ /branches/1.2.x/auth/auth_kerb.c Tue May 21 03:16:59 2013
@@ -495,8 +495,7 @@
apr_pool_t *pool)
{
gss_authn_info_t *gss_info;
- serf_bucket_t *hdrs;
- const char *auth_hdr;
+ const char *auth_hdr_name;
/* TODO: currently this function is only called when a response
includes
an Authenticate header. This header is optional. If the server does
@@ -506,21 +505,23 @@
serf__log_skt(AUTH_VERBOSE, __FILE__, conn->skt,
"Validate Negotiate response header.\n");
- hdrs = serf_bucket_response_get_headers(response);
if (peer == HOST) {
gss_info = conn->authn_baton;
- auth_hdr = serf_bucket_headers_get(hdrs, "WWW-Authenticate");
+ auth_hdr_name = "WWW-Authenticate";
} else {
gss_info = conn->proxy_authn_baton;
- auth_hdr = serf_bucket_headers_get(hdrs, "Proxy-Authenticate");
+ auth_hdr_name = "Proxy-Authenticate";
}
+
if (gss_info->state != gss_api_auth_completed) {
- apr_status_t status = do_auth(peer,
- code,
- gss_info,
- conn,
- auth_hdr,
- pool);
+ serf_bucket_t *hdrs;
+ const char *auth_hdr_val;
+ apr_status_t status;
+
+ hdrs = serf_bucket_response_get_headers(response);
+ auth_hdr_val = serf_bucket_headers_get(hdrs, auth_hdr_name);
+
+ status = do_auth(peer, code, gss_info, conn, auth_hdr_val, pool);
if (status)
return status;
}