summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2006-01-18 14:05:14 +0000
committerIlia Alshanetsky <iliaa@php.net>2006-01-18 14:05:14 +0000
commitfb7608a006adf057ade2f2697eb5f62d71aa0258 (patch)
treeed8f723c32f13d11d6b359426a462e531c9c413b
parent1d72f55e7d4ba046b675913551a7700e18d3584a (diff)
downloadphp-git-fb7608a006adf057ade2f2697eb5f62d71aa0258.tar.gz
Make get_headers() use the default context.
-rw-r--r--NEWS1
-rw-r--r--ext/standard/url.c4
2 files changed, 4 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 60d5b82d2d..44739b9277 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,7 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? 2006, PHP 5.1.3
+- Make get_headers() use the default context. (Ilia)
- Added a check for special characters in the session name. (Ilia)
- Added "consumed" stream filter. (Marcus)
- Added new mysqli constants for BIT and NEW_DECIMAL field types:
diff --git a/ext/standard/url.c b/ext/standard/url.c
index f63509c5d8..43c47b38d9 100644
--- a/ext/standard/url.c
+++ b/ext/standard/url.c
@@ -25,6 +25,7 @@
#include "php.h"
#include "url.h"
+#include "file.h"
#ifdef _OSD_POSIX
#ifndef APACHE
#error On this EBCDIC platform, PHP is only supported as an Apache module.
@@ -658,7 +659,7 @@ PHP_FUNCTION(get_headers)
{
char *url;
int url_len;
- php_stream_context *context = NULL;
+ php_stream_context *context;
php_stream *stream;
zval **prev_val, **hdr = NULL;
HashPosition pos;
@@ -667,6 +668,7 @@ PHP_FUNCTION(get_headers)
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &url, &url_len, &format) == FAILURE) {
return;
}
+ context = FG(default_context) ? FG(default_context) : (FG(default_context) = php_stream_context_alloc());
if (!(stream = php_stream_open_wrapper_ex(url, "r", REPORT_ERRORS | STREAM_USE_URL | STREAM_ONLY_GET_HEADERS, NULL, context))) {
RETURN_FALSE;