]> granicus.if.org Git - php/commitdiff
- only try to fetch stream context options if context is set
authorMichael Wallner <mike@php.net>
Tue, 6 Jun 2006 21:38:03 +0000 (21:38 +0000)
committerMichael Wallner <mike@php.net>
Tue, 6 Jun 2006 21:38:03 +0000 (21:38 +0000)
ext/curl/streams.c

index d8889c1135147ddacf0a3a5a26c5d2a2db4eba41..2941edf85546b4c876562f3528fd76ac05fbe6fb 100644 (file)
@@ -300,7 +300,7 @@ php_stream *php_curl_stream_opener(php_stream_wrapper *wrapper, char *filename,
        curl_easy_setopt(curlstream->curl, CURLOPT_USERAGENT, FG(user_agent) ? FG(user_agent) : "PHP/" PHP_VERSION);
        
        /* TODO: read cookies and options from context */
-       if (!strncasecmp(filename, "http", sizeof("http")-1)) {
+       if (context && !strncasecmp(filename, "http", sizeof("http")-1)) {
                /* HTTP(S) */
                if (SUCCESS == php_stream_context_get_option(context, "http", "user_agent", &ctx_opt) && Z_TYPE_PP(ctx_opt) == IS_STRING) {
                        curl_easy_setopt(curlstream->curl, CURLOPT_USERAGENT, Z_STRVAL_PP(ctx_opt));