summaryrefslogtreecommitdiff
path: root/ext/standard/http_fopen_wrapper.c
diff options
context:
space:
mode:
authorXinchen Hui <laruence@gmail.com>2014-02-24 18:48:22 +0800
committerXinchen Hui <laruence@gmail.com>2014-02-24 18:48:22 +0800
commit93428dc6b902f23e56bf01e87c63ea0d6d6c03a4 (patch)
treeb90898523b92e51deab4cf0339d09fe2c65c264a /ext/standard/http_fopen_wrapper.c
parent1e5a4f281d21abab8101301ea155f9c0394ab02f (diff)
downloadphp-git-93428dc6b902f23e56bf01e87c63ea0d6d6c03a4.tar.gz
Refactor base64 to returning zend_string
Diffstat (limited to 'ext/standard/http_fopen_wrapper.c')
-rw-r--r--ext/standard/http_fopen_wrapper.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c
index db87e6907c..55a1d12cc7 100644
--- a/ext/standard/http_fopen_wrapper.c
+++ b/ext/standard/http_fopen_wrapper.c
@@ -526,6 +526,7 @@ finish:
/* auth header if it was specified */
if (((have_header & HTTP_HEADER_AUTH) == 0) && resource->user) {
+ zend_string *stmp;
/* decode the strings first */
php_url_decode(resource->user, strlen(resource->user));
@@ -539,15 +540,14 @@ finish:
strcat(scratch, resource->pass);
}
- tmp = (char*)php_base64_encode((unsigned char*)scratch, strlen(scratch), NULL);
+ stmp = php_base64_encode((unsigned char*)scratch, strlen(scratch));
- if (snprintf(scratch, scratch_len, "Authorization: Basic %s\r\n", tmp) > 0) {
+ if (snprintf(scratch, scratch_len, "Authorization: Basic %s\r\n", stmp->val) > 0) {
php_stream_write(stream, scratch, strlen(scratch));
php_stream_notify_info(context, PHP_STREAM_NOTIFY_AUTH_REQUIRED, NULL, 0);
}
- efree(tmp);
- tmp = NULL;
+ STR_FREE(stmp);
}
/* if the user has configured who they are, send a From: line */