auth_digest.c | auth_digest.c | |||
---|---|---|---|---|
skipping to change at line 361 | skipping to change at line 361 | |||
conn->proxy_authn_baton = apr_pcalloc(pool, sizeof(digest_authn_inf o_t)); | conn->proxy_authn_baton = apr_pcalloc(pool, sizeof(digest_authn_inf o_t)); | |||
} | } | |||
/* Make serf send the initial requests one by one */ | /* Make serf send the initial requests one by one */ | |||
serf_connection_set_max_outstanding_requests(conn, 1); | serf_connection_set_max_outstanding_requests(conn, 1); | |||
return APR_SUCCESS; | return APR_SUCCESS; | |||
} | } | |||
apr_status_t | apr_status_t | |||
serf__setup_request_digest_auth(int code, | serf__setup_request_digest_auth(peer_t peer, | |||
int code, | ||||
serf_connection_t *conn, | serf_connection_t *conn, | |||
const char *method, | const char *method, | |||
const char *uri, | const char *uri, | |||
serf_bucket_t *hdrs_bkt) | serf_bucket_t *hdrs_bkt) | |||
{ | { | |||
digest_authn_info_t *digest_info = (code == 401) ? conn->authn_baton : | digest_authn_info_t *digest_info = (peer == HOST) ? conn->authn_baton : | |||
conn->proxy_authn_baton; | conn->proxy_authn_baton; | |||
apr_status_t status = APR_SUCCESS; | apr_status_t status = APR_SUCCESS; | |||
if (digest_info && digest_info->realm) { | if (digest_info && digest_info->realm) { | |||
const char *value; | const char *value; | |||
apr_uri_t parsed_uri; | apr_uri_t parsed_uri; | |||
/* extract path from uri */ | /* extract path from uri */ | |||
status = apr_uri_parse(conn->pool, uri, &parsed_uri); | status = apr_uri_parse(conn->pool, uri, &parsed_uri); | |||
/* Build a new Authorization header. */ | /* Build a new Authorization header. */ | |||
digest_info->header = (code == 401) ? "Authorization" : | digest_info->header = (peer == HOST) ? "Authorization" : | |||
"Proxy-Authorization"; | "Proxy-Authorization"; | |||
value = build_auth_header(digest_info, parsed_uri.path, method, | value = build_auth_header(digest_info, parsed_uri.path, method, | |||
conn->pool); | conn->pool); | |||
serf_bucket_headers_setn(hdrs_bkt, digest_info->header, | serf_bucket_headers_setn(hdrs_bkt, digest_info->header, | |||
value); | value); | |||
digest_info->digest_nc++; | digest_info->digest_nc++; | |||
} | } | |||
return status; | return status; | |||
} | } | |||
apr_status_t | apr_status_t | |||
serf__validate_response_digest_auth(int code, | serf__validate_response_digest_auth(peer_t peer, | |||
int code, | ||||
serf_connection_t *conn, | serf_connection_t *conn, | |||
serf_request_t *request, | serf_request_t *request, | |||
serf_bucket_t *response, | serf_bucket_t *response, | |||
apr_pool_t *pool) | apr_pool_t *pool) | |||
{ | { | |||
const char *key; | const char *key; | |||
char *auth_attr; | char *auth_attr; | |||
char *nextkv; | char *nextkv; | |||
const char *rspauth = NULL; | const char *rspauth = NULL; | |||
const char *qop = NULL; | const char *qop = NULL; | |||
const char *nc_str = NULL; | const char *nc_str = NULL; | |||
serf_bucket_t *hdrs; | serf_bucket_t *hdrs; | |||
digest_authn_info_t *digest_info = (code == 401) ? conn->authn_baton : | digest_authn_info_t *digest_info = (peer == HOST) ? conn->authn_baton : | |||
conn->proxy_authn_baton; | conn->proxy_authn_baton; | |||
hdrs = serf_bucket_response_get_headers(response); | hdrs = serf_bucket_response_get_headers(response); | |||
/* Need a copy cuz we're going to write NUL characters into the string. */ | /* Need a copy cuz we're going to write NUL characters into the string. */ | |||
if (code == 401) | if (peer == HOST) | |||
auth_attr = apr_pstrdup(pool, | auth_attr = apr_pstrdup(pool, | |||
serf_bucket_headers_get(hdrs, "Authentication-Info")); | serf_bucket_headers_get(hdrs, "Authentication-Info")); | |||
else | else | |||
auth_attr = apr_pstrdup(pool, | auth_attr = apr_pstrdup(pool, | |||
serf_bucket_headers_get(hdrs, "Proxy-Authentication-Info")); | serf_bucket_headers_get(hdrs, "Proxy-Authentication-Info")); | |||
/* If there's no Authentication-Info header there's nothing to validate . */ | /* If there's no Authentication-Info header there's nothing to validate . */ | |||
if (! auth_attr) | if (! auth_attr) | |||
return APR_SUCCESS; | return APR_SUCCESS; | |||
End of changes. 6 change blocks. | ||||
6 lines changed or deleted | 8 lines changed or added | |||
This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |