Skip to content

Commit 92cce37

Browse files
On the SERF-195-branch: sync with trunk @ 1930562
git-svn-id: https://svn.apache.org/repos/asf/serf/branches/SERF-195@1930563 13f79535-47bb-0310-9956-ffa450edef68
2 parents f86ec09 + f8f87ae commit 92cce37

File tree

6 files changed

+188
-345
lines changed

6 files changed

+188
-345
lines changed

auth/auth_basic.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ serf__handle_basic_auth(const serf__authn_scheme_t *scheme,
4545
const char *auth_attr,
4646
apr_pool_t *pool)
4747
{
48-
const char *tmp;
49-
apr_size_t tmp_len;
5048
serf_connection_t *conn = request->conn;
5149
serf_context_t *ctx = conn->ctx;
5250
serf__authn_info_t *authn_info;
@@ -55,6 +53,7 @@ serf__handle_basic_auth(const serf__authn_scheme_t *scheme,
5553
apr_pool_t *scratch_pool;
5654
apr_hash_t *attr_dict;
5755
char *username, *password;
56+
const char *basic_creds;
5857
const char *realm_name, *realm = NULL;
5958

6059
/* Can't do Basic authentication if there's no callback to get
@@ -93,14 +92,11 @@ serf__handle_basic_auth(const serf__authn_scheme_t *scheme,
9392
return status;
9493
}
9594

96-
tmp = apr_pstrcat(conn->pool, username, ":", password, NULL);
97-
tmp_len = strlen(tmp);
98-
apr_pool_destroy(scratch_pool);
99-
100-
serf__encode_auth_header(&basic_info->value,
101-
scheme->name,
102-
tmp, tmp_len, pool);
95+
basic_creds = apr_pstrcat(scratch_pool, username, ":", password, NULL);
96+
serf__encode_auth_header(&basic_info->value, scheme->name,
97+
basic_creds, strlen(basic_creds), pool);
10398
basic_info->header = SERF__HEADER_FROM_CODE(code);
99+
apr_pool_destroy(scratch_pool);
104100

105101
return APR_SUCCESS;
106102
}

0 commit comments

Comments
 (0)