diff options
author | Ilia Alshanetsky <iliaa@php.net> | 2006-01-18 14:05:28 +0000 |
---|---|---|
committer | Ilia Alshanetsky <iliaa@php.net> | 2006-01-18 14:05:28 +0000 |
commit | f0b0e2cd19c67466d91eb51888dbd062cd7a6416 (patch) | |
tree | 43e8c5d5575254805d5932a62bd83d70eec4ecb2 | |
parent | 9e03537d905f9af6b3fda4f6ff14d6aa77b2d406 (diff) | |
download | php-git-f0b0e2cd19c67466d91eb51888dbd062cd7a6416.tar.gz |
MFB51: Make get_headers() use the default context.
-rw-r--r-- | ext/standard/url.c | 4 |
1 files changed, 3 insertions, 1 deletions
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; |